[SSSD] [PATCH] sudo: print message if old protocol is used

Pavel Březina pbrezina at redhat.com
Thu Nov 15 16:54:26 UTC 2012


On 11/15/2012 02:30 PM, Simo Sorce wrote:
> On Thu, 2012-11-15 at 12:13 +0100, Pavel Březina wrote:
>> @@ -185,9 +186,14 @@ static int sudosrv_cmd(enum sss_sudo_type type,
>> struct cli_ctx *cli_ctx)
>>       }
>>
>>       /* if protocol is invalid return */
>> -    if (cli_ctx->cli_protocol_version->version !=
>> SSS_SUDO_PROTOCOL_VERSION) {
>> -        DEBUG(SSSDBG_FATAL_FAILURE, ("Invalid protocol! [%d]\n",
>> -              cli_ctx->cli_protocol_version->version));
>> +    if (protocol == 0) {
>> +        DEBUG(SSSDBG_FATAL_FAILURE, ("Protocol [%d] is not secure. "
>> +              "SSSD does not allow to use this protocol.\n",
>> protocol));
>> +        ret = EFAULT;
>> +        goto done;
>> +    } else if (protocol != SSS_SUDO_PROTOCOL_VERSION) {
>> +        DEBUG(SSSDBG_FATAL_FAILURE, ("Invalid protocol version [%d]!
>> \n",
>> +                                     protocol));
>>           ret = EFAULT;
>>           goto done;
>>
> Nitpicking, but for this kind of situations I think a switch/case
> statement would be much more clear (also avoids adding a variable as you
> use it once):
>
> switch(cli_ctx->cli_protocol_version->version) {
> case 0:
>      DEBUG(..);
>      break;
> case SSS_SUDO_PROTOCOL_VERSION:
>      break;
> default:
>      DEBUG("invalid"...);
>      break;
> }
>
> Simo.
>

OK. New patch is attached.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-sudo-print-message-if-old-protocol-is-used.patch
Type: text/x-patch
Size: 1871 bytes
Desc: not available
URL: <https://lists.fedorahosted.org/pipermail/sssd-devel/attachments/20121115/4dcc5e72/attachment.bin>


More information about the sssd-devel mailing list