URL: https://github.com/SSSD/sssd/pull/444
Title: #444: NSS: Use netgr as memory context in set_netgr_lifetime() - Patch 
for SSSD-1.14

lslebodn commented:
"""
On (14/11/17 10:20), Pavel Březina wrote:
>On 11/13/2017 06:11 PM, lslebodn wrote:
>> *@lslebodn* commented on this pull request.
>>
>> ------------------------------------------------------------------------
>>
>> In src/responder/nss/nsssrv_netgroup.c
>> <https://github.com/SSSD/sssd/pull/444#discussion_r150604225>:
>>
>>> @@ -428,7 +428,7 @@ static void set_netgr_lifetime(uint32_t lifetime,
>>
>>      tv = tevent_timeval_current_ofs(lifetime, 0);
>>      te = tevent_add_timer(step_ctx->nctx->rctx->ev,
>> -                          step_ctx->nctx->gctx, tv,
>> +                          netgr, tv,
>>
>> Why did you decide to use |netgr| as a context?
>>
>> IMHO it is cleaner to use |struct nss_ctx| instead of |struct getent_ctx|
>
>The timer will free `netgr`. IMHO it is correct to cancel the timer when
>`netgr` is no longer available therefore using it as memory context is
>correct.
>

All structures `getent_ctx` are allocated on `nctx`. So it is very minimal
change and it is closes to change in master

```
sh$ git grep "struct getent_ctx" | grep talloc
src/responder/nss/nsssrv_cmd.c:    state->nctx->pctx = talloc_zero(nctx, struct 
getent_ctx);
src/responder/nss/nsssrv_cmd.c:    state->nctx->gctx = talloc_zero(nctx, struct 
getent_ctx);
src/responder/nss/nsssrv_netgroup.c:        *netgr = talloc_get_type(value.ptr, 
struct getent_ctx);
src/responder/nss/nsssrv_netgroup.c:            talloc_get_type(ctx, struct 
getent_ctx);
src/responder/nss/nsssrv_netgroup.c:        state->netgr = talloc_zero(nctx, 
struct getent_ctx);
src/responder/nss/nsssrv_netgroup.c:        netgr = talloc_zero(step_ctx->nctx, 
struct getent_ctx);
src/responder/nss/nsssrv_netgroup.c:            talloc_get_type(pvt, struct 
getent_ctx);
src/responder/nss/nsssrv_netgroup.c:    netgr = 
talloc_get_type(item->value.ptr, struct getent_ctx);
src/responder/nss/nsssrv_services.c:    state->nctx->svcctx = talloc_zero(nctx, 
struct getent_ctx);
```

LS

"""

See the full comment at 
https://github.com/SSSD/sssd/pull/444#issuecomment-344288390
_______________________________________________
sssd-devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to