diff options
-rw-r--r-- | source3/include/nss_info.h | 2 | ||||
-rw-r--r-- | source3/winbindd/nss_info.c | 28 |
2 files changed, 16 insertions, 14 deletions
diff --git a/source3/include/nss_info.h b/source3/include/nss_info.h index 90d992a3b9..a60a6f0dc0 100644 --- a/source3/include/nss_info.h +++ b/source3/include/nss_info.h @@ -83,8 +83,6 @@ NTSTATUS smb_register_idmap_nss(int version, const char *name, struct nss_info_methods *methods); -NTSTATUS nss_init( const char **nss_list ); - NTSTATUS nss_get_info( const char *domain, const DOM_SID *user_sid, TALLOC_CTX *ctx, ADS_STRUCT *ads, LDAPMessage *msg, 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; } |