diff options
author | Arthur de Jong <arthur@arthurdejong.org> | 2009-05-24 11:11:13 +0200 |
---|---|---|
committer | Arthur de Jong <arthur@arthurdejong.org> | 2009-05-24 11:11:13 +0200 |
commit | 817d0ec30cf31a4a1cab4ba0a06119336ded86aa (patch) | |
tree | 3bba2b26cda304715696a5a4179460aee21607e9 | |
parent | 6bdd24fe2857258515496a6eedd7ee8650144582 (diff) |
initialise database modules only once after parsing config
git-svn-id: http://arthurdejong.org/svn/nss-pam-ldapd/nss-ldapd@893 ef36b2f9-881f-0410-afb5-c4e39611909c
-rw-r--r-- | nslcd/alias.c | 2 | ||||
-rw-r--r-- | nslcd/cfg.c | 12 | ||||
-rw-r--r-- | nslcd/common.h | 16 | ||||
-rw-r--r-- | nslcd/ether.c | 2 | ||||
-rw-r--r-- | nslcd/group.c | 2 | ||||
-rw-r--r-- | nslcd/host.c | 2 | ||||
-rw-r--r-- | nslcd/netgroup.c | 2 | ||||
-rw-r--r-- | nslcd/network.c | 2 | ||||
-rw-r--r-- | nslcd/passwd.c | 4 | ||||
-rw-r--r-- | nslcd/protocol.c | 2 | ||||
-rw-r--r-- | nslcd/rpc.c | 2 | ||||
-rw-r--r-- | nslcd/service.c | 2 | ||||
-rw-r--r-- | nslcd/shadow.c | 2 |
13 files changed, 37 insertions, 15 deletions
diff --git a/nslcd/alias.c b/nslcd/alias.c index ab44e57..42a880c 100644 --- a/nslcd/alias.c +++ b/nslcd/alias.c @@ -75,7 +75,7 @@ static int mkfilter_alias_byname(const char *name, attmap_alias_cn,buf2); } -static void alias_init(void) +void alias_init(void) { int i; /* set up search bases */ diff --git a/nslcd/cfg.c b/nslcd/cfg.c index a193ffe..6f443ae 100644 --- a/nslcd/cfg.c +++ b/nslcd/cfg.c @@ -1052,4 +1052,16 @@ void cfg_init(const char *fname) log_log(LOG_ERR,"no base defined in config and couldn't get one from server"); exit(EXIT_FAILURE); } + /* initialise all database modules */ + alias_init(); + ether_init(); + group_init(); + host_init(); + netgroup_init(); + network_init(); + passwd_init(); + protocol_init(); + rpc_init(); + service_init(); + shadow_init(); } diff --git a/nslcd/common.h b/nslcd/common.h index 3503e59..cf49625 100644 --- a/nslcd/common.h +++ b/nslcd/common.h @@ -85,6 +85,20 @@ MUST_USE char *dn2uid(MYLDAP_SESSION *session,const char *dn,char *buf,size_t bu /* transforms the uid into a DN by doing an LDAP lookup */ MUST_USE char *uid2dn(MYLDAP_SESSION *session,const char *uid,char *buf,size_t buflen); +/* these are the functions for initialising the database specific + modules */ +void alias_init(void); +void ether_init(void); +void group_init(void); +void host_init(void); +void netgroup_init(void); +void network_init(void); +void passwd_init(void); +void protocol_init(void); +void rpc_init(void); +void service_init(void); +void shadow_init(void); + /* these are the different functions that handle the database specific actions, see nslcd.h for the action descriptions */ int nslcd_alias_byname(TFILE *fp,MYLDAP_SESSION *session); @@ -141,8 +155,6 @@ int nslcd_shadow_all(TFILE *fp,MYLDAP_SESSION *session); log_log(LOG_WARNING,"nslcd_" __STRING(db) "_" __STRING(fn) "(): filter buffer too small"); \ return -1; \ } \ - /* build the list of attributes */ \ - db##_init(); \ /* perform a search for each search base */ \ for (i=0; (base=db##_bases[i])!=NULL; i++) \ { \ diff --git a/nslcd/ether.c b/nslcd/ether.c index c3ff43d..0f8ca94 100644 --- a/nslcd/ether.c +++ b/nslcd/ether.c @@ -94,7 +94,7 @@ static int mkfilter_ether_byether(const struct ether_addr *addr, attmap_ether_macAddress,buf2); } -static void ether_init(void) +void ether_init(void) { int i; /* set up search bases */ diff --git a/nslcd/group.c b/nslcd/group.c index 8f681eb..fa83de4 100644 --- a/nslcd/group.c +++ b/nslcd/group.c @@ -124,7 +124,7 @@ static int mkfilter_group_bymember(MYLDAP_SESSION *session, attmap_group_uniqueMember,dn); } -static void group_init(void) +void group_init(void) { int i; /* set up search bases */ diff --git a/nslcd/host.c b/nslcd/host.c index fdd327b..db27fa4 100644 --- a/nslcd/host.c +++ b/nslcd/host.c @@ -92,7 +92,7 @@ static int mkfilter_host_byaddr(const char *name, attmap_host_ipHostNumber,buf2); } -static void host_init(void) +void host_init(void) { int i; /* set up search bases */ diff --git a/nslcd/netgroup.c b/nslcd/netgroup.c index 5d80c81..6ba4e11 100644 --- a/nslcd/netgroup.c +++ b/nslcd/netgroup.c @@ -76,7 +76,7 @@ static int mkfilter_netgroup_byname(const char *name, attmap_netgroup_cn,buf2); } -static void netgroup_init(void) +void netgroup_init(void) { int i; /* set up search bases */ diff --git a/nslcd/network.c b/nslcd/network.c index 60eaa6c..a7a49d2 100644 --- a/nslcd/network.c +++ b/nslcd/network.c @@ -91,7 +91,7 @@ static int mkfilter_network_byaddr(const char *name, attmap_network_ipNetworkNumber,buf2); } -static void network_init(void) +void network_init(void) { int i; /* set up search bases */ diff --git a/nslcd/passwd.c b/nslcd/passwd.c index b934257..2b105d6 100644 --- a/nslcd/passwd.c +++ b/nslcd/passwd.c @@ -106,7 +106,7 @@ static int mkfilter_passwd_byuid(uid_t uid, attmap_passwd_uidNumber,(int)uid); } -static void passwd_init(void) +void passwd_init(void) { int i; /* set up search bases */ @@ -257,8 +257,6 @@ char *uid2dn(MYLDAP_SESSION *session,const char *uid,char *buf,size_t buflen) return NULL; /* set up attributes (we don't care, we just want the DN) */ attrs[0]=NULL; - /* initialize default base, scrope, etc */ - passwd_init(); /* we have to look up the entry */ mkfilter_passwd_byname(uid,filter,sizeof(filter)); for (i=0;(i<NSS_LDAP_CONFIG_MAX_BASES)&&((base=passwd_bases[i])!=NULL);i++) diff --git a/nslcd/protocol.c b/nslcd/protocol.c index 9ea56f8..5162bfd 100644 --- a/nslcd/protocol.c +++ b/nslcd/protocol.c @@ -84,7 +84,7 @@ static int mkfilter_protocol_bynumber(int protocol, attmap_protocol_ipProtocolNumber,protocol); } -static void protocol_init(void) +void protocol_init(void) { int i; /* set up search bases */ diff --git a/nslcd/rpc.c b/nslcd/rpc.c index aa9fb0d..0a2c6e4 100644 --- a/nslcd/rpc.c +++ b/nslcd/rpc.c @@ -84,7 +84,7 @@ static int mkfilter_rpc_bynumber(int number, attmap_rpc_oncRpcNumber,number); } -static void rpc_init(void) +void rpc_init(void) { int i; /* set up search bases */ diff --git a/nslcd/service.c b/nslcd/service.c index 3403179..b6888e7 100644 --- a/nslcd/service.c +++ b/nslcd/service.c @@ -110,7 +110,7 @@ static int mkfilter_service_bynumber(int number, attmap_service_ipServicePort,number); } -static void service_init(void) +void service_init(void) { int i; /* set up search bases */ diff --git a/nslcd/shadow.c b/nslcd/shadow.c index a381306..0da00cd 100644 --- a/nslcd/shadow.c +++ b/nslcd/shadow.c @@ -90,7 +90,7 @@ static int mkfilter_shadow_byname(const char *name, attmap_shadow_uid,buf2); } -static void shadow_init(void) +void shadow_init(void) { int i; /* set up search bases */ |