summaryrefslogtreecommitdiff
path: root/nss/common.c
diff options
context:
space:
mode:
authorArthur de Jong <arthur@arthurdejong.org>2010-10-15 11:22:47 +0000
committerArthur de Jong <arthur@arthurdejong.org>2010-10-15 11:22:47 +0000
commit4ea9ad10160da3dcb572527c7ea9dcaa8182bc6a (patch)
tree370d24c1eeb32723b800f2507e5c010598cafc49 /nss/common.c
parent1fab81db27cbe228d576ce5bda756d3af42e3817 (diff)
switch to using SETs to follow the netgroups
git-svn-id: http://arthurdejong.org/svn/nss-pam-ldapd/nss-pam-ldapd-solaris@1281 ef36b2f9-881f-0410-afb5-c4e39611909c
Diffstat (limited to 'nss/common.c')
-rw-r--r--nss/common.c91
1 files changed, 1 insertions, 90 deletions
diff --git a/nss/common.c b/nss/common.c
index c3c0616..20a3136 100644
--- a/nss/common.c
+++ b/nss/common.c
@@ -1,8 +1,7 @@
/*
- common.c - common functions for NSS lookups
+ common.c - common definitions
Copyright (C) 2010 Arthur de Jong
- Copyright (C) 2010 Symas Corporation
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -20,92 +19,4 @@
02110-1301 USA
*/
-#include "config.h"
-
-#ifdef HAVE_STDINT_H
-#include <stdint.h>
-#endif /* HAVE_STDINT_H */
-#include <unistd.h>
-#include <stdio.h>
-#include <sys/socket.h>
-#include <sys/un.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <errno.h>
-#ifdef HAVE_NSS_H
-#include <nss.h>
-#endif /* HAVE_NSS_H */
-#include <string.h>
-
-#include "nslcd.h"
-#include "common.h"
-#include "common/tio.h"
-
-/* flag used to disable NSS lookups using this module */
int _nss_ldap_enablelookups=1;
-
-#ifdef NSS_FLAVOUR_SOLARIS
-/* Adapted from PADL */
-
-/* add a nested netgroup or group to the namelist */
-nss_status_t _nss_ldap_namelist_push(struct name_list **head,const char *name)
-{
- struct name_list *nl;
- nl=(struct name_list *)malloc(sizeof(*nl));
- if (nl==NULL)
- return NSS_STATUS_TRYAGAIN;
- nl->name=strdup(name);
- if (nl->name==NULL)
- {
- free(nl);
- return NSS_STATUS_TRYAGAIN;
- }
- nl->next=*head;
- *head=nl;
- return NSS_STATUS_SUCCESS;
-}
-
-/* remove last nested netgroup or group from the namelist */
-void _nss_ldap_namelist_pop(struct name_list **head)
-{
- struct name_list *nl;
- nl=*head;
- *head=nl->next;
- free(nl->name);
- free(nl);
-}
-
-/* cleanup nested netgroup or group namelist */
-void _nss_ldap_namelist_destroy(struct name_list **head)
-{
- struct name_list *p,*next;
- for (p=*head;p!=NULL;p=next)
- {
- next=p->next;
- if (p->name!=NULL)
- free(p->name);
- free(p);
- }
- *head=NULL;
-}
-
-/*
- *Check whether we have already seen a netgroup or group,
- *to avoid loops in nested netgroup traversal
- */
-int _nss_ldap_namelist_find(struct name_list *head,const char *netgroup)
-{
- struct name_list *p;
- int found=0;
- for (p=head;p!=NULL;p=p->next)
- {
- if (strcasecmp(p->name,netgroup)==0)
- {
- found++;
- break;
- }
- }
- return found;
-}
-
-#endif /* NSS_FLAVOUR_SOLARIS */