mirror of
https://github.com/samba-team/samba.git
synced 2025-02-26 21:57:41 +03:00
s3:winbind: Slightly simplify the logic of nss_init(), make it static
This commit is contained in:
parent
f88e95c6b0
commit
5bafaa73f6
@ -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,
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user