diff options
author | Volker Lendecke <vl@samba.org> | 2009-10-05 22:09:01 +0200 |
---|---|---|
committer | Volker Lendecke <vl@samba.org> | 2009-10-05 22:12:35 +0200 |
commit | 5bafaa73f6dda13b05744b177cb18a310cb2f749 (patch) | |
tree | 8a5acde3e90630341b027b1378dad2b0f4d9634e /source3 | |
parent | f88e95c6b077b69c6e243ce46961cc12bdcfb911 (diff) | |
download | samba-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')
-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; } |