[SSSD] [PATCH] ad_account_can_shortcut(): return bool instead of errno

Pavel Březina pbrezina at redhat.com
Wed Feb 19 13:10:22 UTC 2014


On 02/19/2014 01:04 PM, Jakub Hrozek wrote:
> On Fri, Feb 14, 2014 at 01:27:49PM +0100, Pavel Březina wrote:
>> https://fedorahosted.org/sssd/ticket/2210
>
>>  From ffc027f41f5b4d410212ad3b938c145e90b5bbf4 Mon Sep 17 00:00:00 2001
>> From: =?UTF-8?q?Pavel=20B=C5=99ezina?= <pbrezina at redhat.com>
>> Date: Fri, 14 Feb 2014 12:58:07 +0100
>> Subject: [PATCH 1/2] ad_account_can_shortcut(): return bool instead of errno
>>
>> Resolves:
>> https://fedorahosted.org/sssd/ticket/2210
>> ---
>>   src/providers/ad/ad_id.c | 30 ++++++++----------------------
>>   1 file changed, 8 insertions(+), 22 deletions(-)
>>
>> diff --git a/src/providers/ad/ad_id.c b/src/providers/ad/ad_id.c
>> index f8e663944d1caa5a5cfab5e786d0f39aa912d5d1..98ccc5db9d239ab2123a007d215743795edfc12d 100644
>> --- a/src/providers/ad/ad_id.c
>> +++ b/src/providers/ad/ad_id.c
>> @@ -239,12 +239,11 @@ get_conn_list(struct be_req *breq, struct ad_id_ctx *ad_ctx,
>>       return clist;
>>   }
>>
>> -static errno_t ad_account_can_shortcut(struct be_ctx *be_ctx,
>> +static bool ad_account_can_shortcut(struct be_ctx *be_ctx,
>>                                          struct sdap_idmap_ctx *idmap_ctx,
>>                                          int filter_type,
>>                                          const char *filter_value,
>> -                                       const char *filter_domain,
>> -                                       bool *_shortcut)
>> +                                       const char *filter_domain)
>
> Please don't break the indentation.
>
>>   {
>>       struct sss_domain_info *domain = be_ctx->domain;
>>       struct sss_domain_info *req_dom = NULL;
>> @@ -258,7 +257,6 @@ static errno_t ad_account_can_shortcut(struct be_ctx *be_ctx,
>>       if (!sdap_idmap_domain_has_algorithmic_mapping(idmap_ctx, domain->name,
>>                                                      domain->domain_id)) {
>>           shortcut = false;
>> -        ret = EOK;
>>           goto done;
>>       }
>>
>> @@ -269,6 +267,8 @@ static errno_t ad_account_can_shortcut(struct be_ctx *be_ctx,
>>           id = strtouint32(filter_value, NULL, 10);
>>           if (errno != 0) {
>>               ret = errno;
>> +            DEBUG(SSSDBG_MINOR_FAILURE, "Unable to convert filter value to "
>> +                  "number [%d]: %s\n", ret, strerror(ret));
>
> Some branches rely on 'shortcut' being set to false after declaration,
> soe set shortcut to false explicitly before the jump, can we use one or
> the other?
>
>>               goto done;
>>           }
>>

Thank you for review. New patch is attached.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-ad_account_can_shortcut-return-bool-instead-of-errno.patch
Type: text/x-patch
Size: 4333 bytes
Desc: not available
URL: <https://lists.fedorahosted.org/pipermail/sssd-devel/attachments/20140219/5d0a41cc/attachment.bin>


More information about the sssd-devel mailing list