[SSSD] [PATCH] KRB5_CHILD: Fix handling of get_password return code
Ondrej Kos
okos at redhat.com
Tue Jun 25 13:20:41 UTC 2013
On 06/25/2013 03:01 PM, Lukas Slebodnik wrote:
> On (25/06/13 10:48), Ondrej Kos wrote:
>> On 06/24/2013 05:06 PM, Ondrej Kos wrote:
>>> While working on #1814 i noticed that there's a dead switch statement
>>> (with no case/default), attached patch fixes this issue.
>>>
>>> Ondra
>>>
>>>
>>> _______________________________________________
>>> sssd-devel mailing list
>>> sssd-devel at lists.fedorahosted.org
>>> https://lists.fedorahosted.org/mailman/listinfo/sssd-devel
>>>
>>
>> Looking at the original code, I moved the EINVAL and ENOENT cases
>> together as was originally intended.
>>
>> Patch is attached
>>
>> Ondra
>>
>> --
>> Ondrej Kos
>> Associate Software Engineer
>> Identity Management - SSSD
>> Red Hat Czech
>
>>From 5a406d241949de9f939e96d078669b84f776927e Mon Sep 17 00:00:00 2001
>> From: Ondrej Kos <okos at redhat.com>
>> Date: Mon, 24 Jun 2013 16:55:02 +0200
>> Subject: [PATCH] KRB5_CHILD: Fix handling of get_password return code
>>
>> The switch statement was dead code due to missing case/default.
>> ---
>> src/providers/krb5/krb5_child.c | 15 +++++++++++----
>> 1 file changed, 11 insertions(+), 4 deletions(-)
>>
>> diff --git a/src/providers/krb5/krb5_child.c b/src/providers/krb5/krb5_child.c
>> index e9fbfbeafe774bc82f8be4976cc1b5a67a6acc5b..f67274bf2d761e5457e6c2e50b3351a99eb25054 100644
>> --- a/src/providers/krb5/krb5_child.c
>> +++ b/src/providers/krb5/krb5_child.c
>> @@ -1327,12 +1327,19 @@ static errno_t tgt_req_child(struct krb5_req *kr)
>>
>> ret = sss_authtok_get_password(kr->pd->authtok, &password, NULL);
>> switch (ret) {
>> - if (ret == EACCES) {
>> + case EACCES:
>> DEBUG(SSSDBG_OP_FAILURE, ("Invalid authtok type\n"));
>> return ERR_INVALID_CRED_TYPE;
>> - }
>> - DEBUG(SSSDBG_OP_FAILURE, ("No credentials available\n"));
>> - return ERR_NO_CREDS;
>> + break;
>> +
>> + case ENOENT:
>> + case EINVAL:
>> + DEBUG(SSSDBG_OP_FAILURE, ("No credentials available\n"));
>> + return ERR_NO_CREDS;
>> + break;
>> +
>> + case EOK:
>> + break;
>> }
>
> According to
> www.freeipa.org/page/Coding_Style#Switch
> /* Always have default */
>
> I would prefer:
> case EACCES:
> /* snip */
> case EOK:
> /* snip */
> default:
>
> LS
> _______________________________________________
> sssd-devel mailing list
> sssd-devel at lists.fedorahosted.org
> https://lists.fedorahosted.org/mailman/listinfo/sssd-devel
>
Thanks, new patch is attached.
Ondra
--
Ondrej Kos
Associate Software Engineer
Identity Management - SSSD
Red Hat Czech
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-KRB5_CHILD-Fix-handling-of-get_password-return-code.patch
Type: text/x-patch
Size: 1346 bytes
Desc: not available
URL: <https://lists.fedorahosted.org/pipermail/sssd-devel/attachments/20130625/27df12ba/attachment.bin>
More information about the sssd-devel
mailing list