diff options
author | Arthur de Jong <arthur@arthurdejong.org> | 2010-12-16 22:50:51 +0100 |
---|---|---|
committer | Arthur de Jong <arthur@arthurdejong.org> | 2010-12-16 22:50:51 +0100 |
commit | f67d6f67b84daa6acd33dd8f4192a72bc46c3a63 (patch) | |
tree | 5a2a84e90cbf80cd3f2ca1616a2d27b694c51d91 /nss/group.c | |
parent | 08f01639626bb2ec2537df7d9f8c5459867c0afb (diff) |
switch to a common back-end with a common constructor and destructor and put file pointer shared between {set,get,end}ent() calls in there
git-svn-id: http://arthurdejong.org/svn/nss-pam-ldapd/nss-pam-ldapd-solaris@1333 ef36b2f9-881f-0410-afb5-c4e39611909c
Diffstat (limited to 'nss/group.c')
-rw-r--r-- | nss/group.c | 32 |
1 files changed, 9 insertions, 23 deletions
diff --git a/nss/group.c b/nss/group.c index 7427e2d..b460445 100644 --- a/nss/group.c +++ b/nss/group.c @@ -247,23 +247,20 @@ static nss_status_t group_getgrgid(nss_backend_t UNUSED(*be),void *args) READ_RESULT(fp)); } -/* thread-local file pointer to an ongoing request */ -static __thread TFILE *grentfp; - -static nss_status_t group_setgrent(nss_backend_t UNUSED(*be),void UNUSED(*args)) +static nss_status_t group_setgrent(nss_backend_t *be,void UNUSED(*args)) { - NSS_SETENT(grentfp); + NSS_SETENT(LDAP_BE(be)->fp); } -static nss_status_t group_getgrent(nss_backend_t UNUSED(*be),void *args) +static nss_status_t group_getgrent(nss_backend_t *be,void *args) { - NSS_GETENT(grentfp,NSLCD_ACTION_GROUP_ALL, - READ_RESULT(grentfp)); + NSS_GETENT(LDAP_BE(be)->fp,NSLCD_ACTION_GROUP_ALL, + READ_RESULT((LDAP_BE(be)->fp))); } -static nss_status_t group_endgrent(nss_backend_t UNUSED(*be),void UNUSED(*args)) +static nss_status_t group_endgrent(nss_backend_t *be,void UNUSED(*args)) { - NSS_ENDENT(grentfp); + NSS_ENDENT(LDAP_BE(be)->fp); } /* @@ -282,14 +279,8 @@ static nss_status_t group_getgroupsbymember(nss_backend_t UNUSED(*be),void *args argp->numgids=(int)start;); } -static nss_status_t group_destructor(nss_backend_t *be,void UNUSED(*args)) -{ - free(be); - return NSS_STATUS_SUCCESS; -} - static nss_backend_op_t group_ops[]={ - group_destructor, + nss_ldap_destructor, group_endgrent, group_setgrent, group_getgrent, @@ -301,12 +292,7 @@ static nss_backend_op_t group_ops[]={ nss_backend_t *_nss_ldap_group_constr(const char UNUSED(*db_name), const char UNUSED(*src_name),const char UNUSED(*cfg_args)) { - nss_backend_t *be; - if (!(be=(nss_backend_t *)malloc(sizeof(*be)))) - return NULL; - be->ops=group_ops; - be->n_ops=sizeof(group_ops)/sizeof(nss_backend_op_t); - return (nss_backend_t *)be; + return nss_ldap_constructor(group_ops,sizeof(group_ops)); } #endif /* NSS_FLAVOUR_SOLARIS */ |