-
Notifications
You must be signed in to change notification settings - Fork 272
NSS: Use netgr as memory context in set_netgr_lifetime() - Patch for SSSD-1.14 #444
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NSS: Use netgr as memory context in set_netgr_lifetime() - Patch for SSSD-1.14 #444
Conversation
|
Ack. Just the commit message still talkes about |
|
@pbrezina, thanks for the review. I've changed the commit message. |
|
Adding "Accepted" label per @pbrezina's review. |
src/responder/nss/nsssrv_netgroup.c
Outdated
| tv = tevent_timeval_current_ofs(lifetime, 0); | ||
| te = tevent_add_timer(step_ctx->nctx->rctx->ev, | ||
| step_ctx->nctx->gctx, tv, | ||
| netgr, tv, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did you decide to use netgr as a context?
IMHO it is cleaner to use struct nss_ctx instead of struct getent_ctx
67f739d to
9070d59
Compare
|
Changes done, thanks for the review. |
We've noticed some crashes that happened because gctx is already freed, but the timeout handler is still called. In order to avoid that, let's remove the timeout handler when nss_ctx is freed at other places. Resolves: https://pagure.io/SSSD/sssd/issue/3523 Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
9070d59 to
f38e83a
Compare
|
On 11/13/2017 06:11 PM, lslebodn wrote:
***@***.**** commented on this pull request.
------------------------------------------------------------------------
In src/responder/nss/nsssrv_netgroup.c
<#444 (comment)>:
> @@ -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.
|
|
On (14/11/17 10:20), Pavel Březina wrote:
On 11/13/2017 06:11 PM, lslebodn wrote:
> ***@***.**** commented on this pull request.
>
> ------------------------------------------------------------------------
>
> In src/responder/nss/nsssrv_netgroup.c
> <#444 (comment)>:
>
>> @@ -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
|
|
@pbrezina can it be pushed? |
|
You have already pushed version with |
|
On (15/11/17 11:54), Pavel Březina wrote:
You have already pushed version with `netgr` into 1.13 (#445). I don't think we need to have three different patches in three different sssd versions.
May I know where it was pushed.
I cannot see it in upstream
https://pagure.io/SSSD/sssd/commits/sssd-1-13
ATM there is only patch in master f6a1cef
https://pagure.io/SSSD/sssd/commits/master
LS
|
|
Ah, sorry, you haven't pushed it, just closed it. My bad. Having it on |
We've noticed some crashes that happened because netgr is already freed,
but the timeout handler is still called. In order to avoid that, let's
remove the timeout handler when enum_ctx is freed at other places.
Resolves: https://pagure.io/SSSD/sssd/issue/3523
Signed-off-by: Fabiano Fidêncio fidencio@redhat.com