データ構造 | |
struct | nss_function_entry |
struct | nss_domain_entry |
struct | nss_info_methods |
関数 | |
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, char **homedir, char **shell, char **gecos, gid_t *p_gid) |
NTSTATUS | nss_close (const char *parameters) |
NTSTATUS smb_register_idmap_nss | ( | int | version, | |
const char * | name, | |||
struct nss_info_methods * | methods | |||
) |
nss_info.c の 49 行で定義されています。
参照先 backends・methods・nss_function_entry::methods・nss_function_entry::name・nss_get_backend()・smb_xstrdup().
参照元 idmap_ad_init()・nss_info_template_init().
00050 { 00051 struct nss_function_entry *entry; 00052 00053 if ((version != SMB_NSS_INFO_INTERFACE_VERSION)) { 00054 DEBUG(0, ("smb_register_idmap_nss: Failed to register idmap_nss module.\n" 00055 "The module was compiled against SMB_NSS_INFO_INTERFACE_VERSION %d,\n" 00056 "current SMB_NSS_INFO_INTERFACE_VERSION is %d.\n" 00057 "Please recompile against the current version of samba!\n", 00058 version, SMB_NSS_INFO_INTERFACE_VERSION)); 00059 return NT_STATUS_OBJECT_TYPE_MISMATCH; 00060 } 00061 00062 if (!name || !name[0] || !methods) { 00063 DEBUG(0,("smb_register_idmap_nss: called with NULL pointer or empty name!\n")); 00064 return NT_STATUS_INVALID_PARAMETER; 00065 } 00066 00067 if ( nss_get_backend(name) ) { 00068 DEBUG(0,("smb_register_idmap_nss: idmap module %s " 00069 "already registered!\n", name)); 00070 return NT_STATUS_OBJECT_NAME_COLLISION; 00071 } 00072 00073 entry = SMB_XMALLOC_P(struct nss_function_entry); 00074 entry->name = smb_xstrdup(name); 00075 entry->methods = methods; 00076 00077 DLIST_ADD(backends, entry); 00078 DEBUG(5, ("smb_register_idmap_nss: Successfully added idmap " 00079 "nss backend '%s'\n", name)); 00080 00081 return NT_STATUS_OK; 00082 }
NTSTATUS nss_init | ( | const char ** | nss_list | ) |
nss_info.c の 131 行で定義されています。
参照先 nss_domain_entry::backend・nss_domain_entry::domain・nss_info_methods::init・nss_function_entry::methods・nss_domain_list・nss_get_backend()・parse_nss_parm()・smb_probe_module()・status・talloc_strdup().
参照元 find_nss_domain().
00132 { 00133 NTSTATUS status; 00134 static NTSTATUS nss_initialized = NT_STATUS_UNSUCCESSFUL; 00135 int i; 00136 char *backend, *domain; 00137 struct nss_function_entry *nss_backend; 00138 struct nss_domain_entry *nss_domain; 00139 00140 /* check for previous successful initializations */ 00141 00142 if ( NT_STATUS_IS_OK(nss_initialized) ) 00143 return NT_STATUS_OK; 00144 00145 /* The "template" backend should alqays be registered as it 00146 is a static module */ 00147 00148 if ( (nss_backend = nss_get_backend( "template" )) == NULL ) { 00149 static_init_nss_info; 00150 } 00151 00152 /* Create the list of nss_domains (loading any shared plugins 00153 as necessary) */ 00154 00155 for ( i=0; nss_list && nss_list[i]; i++ ) { 00156 00157 if ( !parse_nss_parm(nss_list[i], &backend, &domain) ) { 00158 DEBUG(0,("nss_init: failed to parse \"%s\"!\n", 00159 nss_list[i])); 00160 continue; 00161 } 00162 00163 /* validate the backend */ 00164 00165 if ( (nss_backend = nss_get_backend( backend )) == NULL ) { 00166 /* attempt to register the backend */ 00167 status = smb_probe_module( "nss_info", backend ); 00168 if ( !NT_STATUS_IS_OK(status) ) { 00169 continue; 00170 } 00171 00172 /* try again */ 00173 if ( (nss_backend = nss_get_backend( backend )) == NULL ) { 00174 DEBUG(0,("nss_init: unregistered backend %s!. Skipping\n", 00175 backend)); 00176 continue; 00177 } 00178 00179 } 00180 00181 /* fill in the nss_domain_entry and add it to the 00182 list of domains */ 00183 00184 nss_domain = TALLOC_ZERO_P( nss_domain_list, struct nss_domain_entry ); 00185 if ( !nss_domain ) { 00186 DEBUG(0,("nss_init: talloc() failure!\n")); 00187 return NT_STATUS_NO_MEMORY; 00188 } 00189 00190 nss_domain->backend = nss_backend; 00191 nss_domain->domain = talloc_strdup( nss_domain, domain ); 00192 00193 status = nss_domain->backend->methods->init( nss_domain ); 00194 if ( NT_STATUS_IS_OK( status ) ) { 00195 DLIST_ADD( nss_domain_list, nss_domain ); 00196 } else { 00197 DEBUG(0,("nss_init: Failed to init backend for %s domain!\n", 00198 nss_domain->domain)); 00199 } 00200 00201 /* cleanup */ 00202 00203 SAFE_FREE( backend ); 00204 SAFE_FREE( domain ); 00205 } 00206 00207 if ( !nss_domain_list ) { 00208 DEBUG(3,("nss_init: no nss backends configured. " 00209 "Defaulting to \"template\".\n")); 00210 00211 00212 /* we shouild default to use template here */ 00213 } 00214 00215 00216 nss_initialized = NT_STATUS_OK; 00217 00218 return NT_STATUS_OK; 00219 }
NTSTATUS nss_get_info | ( | const char * | domain, | |
const DOM_SID * | user_sid, | |||
TALLOC_CTX * | ctx, | |||
ADS_STRUCT * | ads, | |||
LDAPMessage * | msg, | |||
char ** | homedir, | |||
char ** | shell, | |||
char ** | gecos, | |||
gid_t * | p_gid | |||
) |
nss_info.c の 257 行で定義されています。
参照先 nss_domain_entry::backend・find_nss_domain()・nss_info_methods::get_nss_info・nss_function_entry::methods.
参照元 query_user()・query_user_list().
00262 { 00263 struct nss_domain_entry *p; 00264 struct nss_info_methods *m; 00265 00266 if ( (p = find_nss_domain( domain )) == NULL ) { 00267 DEBUG(4,("nss_get_info: Failed to find nss domain pointer for %s\n", 00268 domain )); 00269 return NT_STATUS_NOT_FOUND; 00270 } 00271 00272 m = p->backend->methods; 00273 00274 return m->get_nss_info( p, user_sid, ctx, ads, msg, 00275 homedir, shell, gecos, p_gid ); 00276 }
NTSTATUS nss_close | ( | const char * | parameters | ) |
nss_info.c の 281 行で定義されています。
参照先 nss_domain_entry::backend・nss_info_methods::close_fn・nss_function_entry::methods・nss_domain_entry::next・nss_domain_list.
00282 { 00283 struct nss_domain_entry *p = nss_domain_list; 00284 struct nss_domain_entry *q; 00285 00286 while ( p && p->backend && p->backend->methods ) { 00287 /* close the backend */ 00288 p->backend->methods->close_fn(); 00289 00290 /* free the memory */ 00291 q = p; 00292 p = p->next; 00293 TALLOC_FREE( q ); 00294 } 00295 00296 return NT_STATUS_OK; 00297 }