summaryrefslogtreecommitdiff
path: root/source3/winbindd/nss_info.c
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2009-10-05 22:09:01 +0200
committerVolker Lendecke <vl@samba.org>2009-10-05 22:12:35 +0200
commit5bafaa73f6dda13b05744b177cb18a310cb2f749 (patch)
tree8a5acde3e90630341b027b1378dad2b0f4d9634e /source3/winbindd/nss_info.c
parentf88e95c6b077b69c6e243ce46961cc12bdcfb911 (diff)
downloadsamba-5bafaa73f6dda13b05744b177cb18a310cb2f749.tar.gz
samba-5bafaa73f6dda13b05744b177cb18a310cb2f749.tar.bz2
samba-5bafaa73f6dda13b05744b177cb18a310cb2f749.zip
s3:winbind: Slightly simplify the logic of nss_init(), make it static
Diffstat (limited to 'source3/winbindd/nss_info.c')
-rw-r--r--source3/winbindd/nss_info.c28
1 files changed, 16 insertions, 12 deletions
diff --git a/source3/winbindd/nss_info.c b/source3/winbindd/nss_info.c
index ecf942a5d3..663fc9a2a5 100644
--- a/source3/winbindd/nss_info.c
+++ b/source3/winbindd/nss_info.c
@@ -164,23 +164,25 @@ static NTSTATUS nss_domain_list_add_domain(const char *domain,
to initialize the state on a per domain basis.
*******************************************************************/
- NTSTATUS nss_init( const char **nss_list )
+static NTSTATUS nss_init(const char **nss_list)
{
NTSTATUS status;
- static NTSTATUS nss_initialized = NT_STATUS_UNSUCCESSFUL;
+ static bool nss_initialized = false;
int i;
char *backend, *domain;
struct nss_function_entry *nss_backend;
/* check for previous successful initializations */
- if ( NT_STATUS_IS_OK(nss_initialized) )
+ if (nss_initialized) {
return NT_STATUS_OK;
+ }
/* The "template" backend should always be registered as it
is a static module */
- if ( (nss_backend = nss_get_backend( "template" )) == NULL ) {
+ nss_backend = nss_get_backend("template");
+ if (nss_backend == NULL) {
static_init_nss_info;
}
@@ -200,19 +202,21 @@ static NTSTATUS nss_domain_list_add_domain(const char *domain,
/* validate the backend */
- if ( (nss_backend = nss_get_backend( backend )) == NULL ) {
+ nss_backend = nss_get_backend(backend);
+ if (nss_backend == NULL) {
/* attempt to register the backend */
status = smb_probe_module( "nss_info", backend );
if ( !NT_STATUS_IS_OK(status) ) {
continue;
}
+ }
- /* try again */
- if ( (nss_backend = nss_get_backend( backend )) == NULL ) {
- DEBUG(0,("nss_init: unregistered backend %s!. Skipping\n",
- backend));
- continue;
- }
+ /* try again */
+ nss_backend = nss_get_backend(backend);
+ if (nss_backend == NULL) {
+ DEBUG(0, ("nss_init: unregistered backend %s!. "
+ "Skipping\n", backend));
+ continue;
}
/*
@@ -244,7 +248,7 @@ static NTSTATUS nss_domain_list_add_domain(const char *domain,
/* we should default to use template here */
}
- nss_initialized = NT_STATUS_OK;
+ nss_initialized = true;
return NT_STATUS_OK;
}