sssd.git - sssd with jhrozek's patches index : sssd.git adlookup aramco bycert dpstr experimental-fo f23 intg_test krb5test ldapdebug master mdbtest memberof misc mpgfix nonroot nonroot-libcap nsscrash19 oneway override-pb pk11child pwrap refactor refactor-fo review review-negcache review-sc rhel-6.7 rhel-6.8 rhel-7.1 rhel-7.2 rhel5.10 rhel5.8 rhel5.9 rhel6.3 rhel6.4 rhel6.5 rhel6.6 rhel7.0 sbus-1-11 selinux sid_index simo_ccname srvbackport sssd-1-10 sssd-1-11 sssd-1-12 sssd-1-5 sssd-1-8 sssd-1-9 subdomfo sysdb tests sssd with jhrozek's patches Jakub Hrozek summaryrefslogtreecommitdiffstats log msg author committer range path: root/src diff options context: 12345678910152025303540 space: includeignore mode: unifiedssdiffstat only author Sumit Bose <sbose@redhat.com> 2011-03-07 10:12:19 +0100 committer Stephen Gallagher <sgallagh@redhat.com> 2011-03-07 07:59:13 -0500 commit eb5e51f6e067442cac630d5e5a85f11b8e9da71b (patch) tree 596de2b3892670398c5ff89cb4e49e89ef750d50 /src parent 3c578c093cb1f71eddb408b5b6f285bcdc840c17 (diff) download sssd-eb5e51f6e067442cac630d5e5a85f11b8e9da71b.tar.gz sssd-eb5e51f6e067442cac630d5e5a85f11b8e9da71b.tar.xz sssd-eb5e51f6e067442cac630d5e5a85f11b8e9da71b.zip Refactor set_netgroup_entry() To avoid wrong or missing netgroup names in the getent_ctx destructor set_netgroup_entry() now takes the name out of the getent_ctx struct instead of using a separate argument. Diffstat (limited to 'src') -rw-r--r-- src/responder/nss/nsssrv_netgroup.c 11 1 files changed, 7 insertions, 4 deletions diff --git a/src/responder/nss/nsssrv_netgroup.c b/src/responder/nss/nsssrv_netgroup.c index 07cd2bdc1..6d74330d5 100644 --- a/src/responder/nss/nsssrv_netgroup.c +++ b/src/responder/nss/nsssrv_netgroup.c @@ -57,16 +57,19 @@ static errno_t get_netgroup_entry(struct nss_ctx *nctx, static int netgr_hash_remove (TALLOC_CTX *ctx); static errno_t set_netgroup_entry(struct nss_ctx *nctx, - char *name, struct getent_ctx *netgr) { hash_key_t key; hash_value_t value; int hret; + if (netgr->name == NULL) { + DEBUG(1, ("Missing netgroup name.\n")); + return EINVAL; + } /* Add this entry to the hash table */ key.type = HASH_KEY_STRING; - key.str = name; + key.str = netgr->name; value.type = HASH_VALUE_PTR; value.ptr = netgr; hret = hash_enter(nctx->netgroups, &key, &value); @@ -270,7 +273,7 @@ static struct tevent_req *setnetgrent_send(TALLOC_CTX *mem_ctx, goto error; } - ret = set_netgroup_entry(nctx, client->netgr_name, state->netgr); + ret = set_netgroup_entry(nctx, state->netgr); if (ret != EOK) { DEBUG(1, ("set_netgroup_entry failed.\n")); talloc_free(state->netgr); @@ -501,7 +504,7 @@ static errno_t lookup_netgr_step(struct setent_step_ctx *step_ctx) return ENOMEM; } - ret = set_netgroup_entry(step_ctx->nctx, step_ctx->name, netgr); + ret = set_netgroup_entry(step_ctx->nctx, netgr); if (ret != EOK) { DEBUG(1, ("set_netgroup_entry failed, ignored.\n")); } generated by cgit (git 2.34.1) at 2022-09-24 16:11:39 +0000