nsswitch/winbindd_util.c

Winbind daemon for NT domain authentication nss module. [詳細]

ソースコードを見る。

データ構造

struct  trustdom_state
struct  init_child_state

関数

winbindd_domaindomain_list (void)
void free_domain_list (void)
static BOOL is_internal_domain (const DOM_SID *sid)
static BOOL is_in_internal_domain (const DOM_SID *sid)
static struct winbindd_domainadd_trusted_domain (const char *domain_name, const char *alt_name, struct winbindd_methods *methods, const DOM_SID *sid)
static void trustdom_recv (void *private_data, BOOL success)
static void add_trusted_domains (struct winbindd_domain *domain)
void rescan_trusted_domains (void)
static void init_child_recv (void *private_data, BOOL success)
static void init_child_getdc_recv (void *private_data, BOOL success)
enum winbindd_result init_child_connection (struct winbindd_domain *domain, void(*continuation)(void *private_data, BOOL success), void *private_data)
enum winbindd_result winbindd_dual_init_connection (struct winbindd_domain *domain, struct winbindd_cli_state *state)
BOOL init_domain_list (void)
winbindd_domainfind_domain_from_name_noinit (const char *domain_name)
 Given a domain name, return the struct winbindd domain info for it
winbindd_domainfind_domain_from_name (const char *domain_name)
winbindd_domainfind_domain_from_sid_noinit (const DOM_SID *sid)
winbindd_domainfind_domain_from_sid (const DOM_SID *sid)
winbindd_domainfind_our_domain (void)
winbindd_domainfind_root_domain (void)
winbindd_domainfind_builtin_domain (void)
winbindd_domainfind_lookup_domain_from_sid (const DOM_SID *sid)
winbindd_domainfind_lookup_domain_from_name (const char *domain_name)
BOOL winbindd_lookup_sid_by_name (TALLOC_CTX *mem_ctx, struct winbindd_domain *domain, const char *domain_name, const char *name, DOM_SID *sid, enum lsa_SidType *type)
BOOL winbindd_lookup_name_by_sid (TALLOC_CTX *mem_ctx, DOM_SID *sid, char **dom_name, char **name, enum lsa_SidType *type)
 Lookup a name in a domain from a sid.
void free_getent_state (struct getent_state *state)
static BOOL assume_domain (const char *domain)
BOOL parse_domain_user (const char *domuser, fstring domain, fstring user)
BOOL parse_domain_user_talloc (TALLOC_CTX *mem_ctx, const char *domuser, char **domain, char **user)
BOOL canonicalize_username (fstring username_inout, fstring domain, fstring user)
void fill_domain_username (fstring name, const char *domain, const char *user, BOOL can_assume)
char * get_winbind_priv_pipe_dir (void)
int open_winbindd_socket (void)
int open_winbindd_priv_socket (void)
void close_winbindd_socket (void)
winbindd_cli_statewinbindd_client_list (void)
void winbindd_add_client (struct winbindd_cli_state *cli)
void winbindd_remove_client (struct winbindd_cli_state *cli)
void winbindd_kill_all_clients (void)
int winbindd_num_clients (void)
NTSTATUS lookup_usergroups_cached (struct winbindd_domain *domain, TALLOC_CTX *mem_ctx, const DOM_SID *user_sid, uint32 *p_num_groups, DOM_SID **user_sids)
void ws_name_replace (char *name, char replace)
void ws_name_return (char *name, char replace)

変数

winbindd_methods cache_methods
winbindd_methods builtin_passdb_methods
winbindd_methods sam_passdb_methods
static struct winbindd_domain_domain_list
static time_t last_trustdom_scan
 When was the last scan of trusted domains done?
static int _winbindd_socket = -1
static int _winbindd_priv_socket = -1
static struct winbindd_cli_state_client_list
static int _num_clients


説明

Winbind daemon for NT domain authentication nss module.

winbindd_util.c で定義されています。


関数

struct winbindd_domain* domain_list ( void   ) 

winbindd_util.c56 行で定義されています。

参照先 _domain_listinit_domain_list()smb_panic().

参照元 child_msg_offline()child_msg_online()close_conns_after_fork()collect_onlinestatus()find_domain_from_name_noinit()find_domain_from_sid_noinit()find_our_domain()fork_domain_child()msg_failed_to_go_online()msg_try_to_go_online()wcache_invalidate_cache()winbind_msg_offline()winbind_msg_online()winbindd_list_groups()winbindd_list_users()winbindd_setgrent_internal()winbindd_setpwent_internal()winbindd_show_sequence().

00057 {
00058         /* Initialise list */
00059 
00060         if ((!_domain_list) && (!init_domain_list())) {
00061                 smb_panic("Init_domain_list failed\n");
00062         }
00063 
00064         return _domain_list;
00065 }

void free_domain_list ( void   ) 

winbindd_util.c69 行で定義されています。

参照先 _domain_listwinbindd_domain::next.

参照元 init_domain_list().

00070 {
00071         struct winbindd_domain *domain = _domain_list;
00072 
00073         while(domain) {
00074                 struct winbindd_domain *next = domain->next;
00075                 
00076                 DLIST_REMOVE(_domain_list, domain);
00077                 SAFE_FREE(domain);
00078                 domain = next;
00079         }
00080 }

static BOOL is_internal_domain ( const DOM_SID sid  )  [static]

winbindd_util.c82 行で定義されています。

参照先 winbindd_domain::sidsid_check_is_builtin()sid_check_is_domain().

参照元 find_lookup_domain_from_sid().

00083 {
00084         if (sid == NULL)
00085                 return False;
00086 
00087         if ( IS_DC )
00088                 return sid_check_is_builtin(sid);
00089 
00090         return (sid_check_is_domain(sid) || sid_check_is_builtin(sid));
00091 }

static BOOL is_in_internal_domain ( const DOM_SID sid  )  [static]

winbindd_util.c93 行で定義されています。

参照先 winbindd_domain::sidsid_check_is_in_builtin()sid_check_is_in_our_domain().

参照元 find_lookup_domain_from_sid().

00094 {
00095         if (sid == NULL)
00096                 return False;
00097 
00098         if ( IS_DC )
00099                 return sid_check_is_in_builtin(sid);
00100 
00101         return (sid_check_is_in_our_domain(sid) || sid_check_is_in_builtin(sid));
00102 }

static struct winbindd_domain* add_trusted_domain ( const char *  domain_name,
const char *  alt_name,
struct winbindd_methods methods,
const DOM_SID sid 
) [static]

winbindd_util.c106 行で定義されています。

参照先 _domain_listwinbindd_domain::alt_namewinbindd_domain::namewinbindd_domain::nextSEC_ADSstrequal().

参照元 init_domain_list()trustdom_recv().

00109 {
00110         struct winbindd_domain *domain;
00111         const char *alternative_name = NULL;
00112         
00113         /* ignore alt_name if we are not in an AD domain */
00114         
00115         if ( (lp_security() == SEC_ADS) && alt_name && *alt_name) {
00116                 alternative_name = alt_name;
00117         }
00118         
00119         /* We can't call domain_list() as this function is called from
00120            init_domain_list() and we'll get stuck in a loop. */
00121         for (domain = _domain_list; domain; domain = domain->next) {
00122                 if (strequal(domain_name, domain->name) ||
00123                     strequal(domain_name, domain->alt_name)) {
00124                         return domain;
00125                 }
00126                 if (alternative_name && *alternative_name) {
00127                         if (strequal(alternative_name, domain->name) ||
00128                             strequal(alternative_name, domain->alt_name)) {
00129                                 return domain;
00130                         }
00131                 }
00132                 if (sid) {
00133                         if (is_null_sid(sid)) {
00134                                 
00135                         } else if (sid_equal(sid, &domain->sid)) {
00136                                 return domain;
00137                         }
00138                 }
00139         }
00140         
00141         /* Create new domain entry */
00142 
00143         if ((domain = SMB_MALLOC_P(struct winbindd_domain)) == NULL)
00144                 return NULL;
00145 
00146         /* Fill in fields */
00147         
00148         ZERO_STRUCTP(domain);
00149 
00150         fstrcpy(domain->name, domain_name);
00151         if (alternative_name) {
00152                 fstrcpy(domain->alt_name, alternative_name);
00153         }
00154 
00155         domain->methods = methods;
00156         domain->backend = NULL;
00157         domain->internal = is_internal_domain(sid);
00158         domain->sequence_number = DOM_SEQUENCE_NONE;
00159         domain->last_seq_check = 0;
00160         domain->initialized = False;
00161         domain->online = is_internal_domain(sid);
00162         domain->check_online_timeout = 0;
00163         if (sid) {
00164                 sid_copy(&domain->sid, sid);
00165         }
00166         
00167         /* Link to domain list */
00168         DLIST_ADD(_domain_list, domain);
00169         
00170         DEBUG(2,("Added domain %s %s %s\n", 
00171                  domain->name, domain->alt_name,
00172                  &domain->sid?sid_string_static(&domain->sid):""));
00173         
00174         return domain;
00175 }

static void trustdom_recv ( void *  private_data,
BOOL  success 
) [static]

winbindd_util.c222 行で定義されています。

参照先 add_trusted_domain()winbindd_response::alt_namecache_methodswinbindd_domain::childwinbindd_response::datawinbindd_response::extra_datafind_domain_from_name_noinit()global_sid_NULLtrustdom_state::mem_ctxtrustdom_state::responsewinbindd_response::resultsetup_domain_child()winbindd_domain::sidwinbindd_response::sidsid_copy()strequal()string_to_sid()WINBINDD_OK.

参照元 add_trusted_domains().

00223 {
00224         struct trustdom_state *state =
00225                 talloc_get_type_abort(private_data, struct trustdom_state);
00226         struct winbindd_response *response = state->response;
00227         char *p;
00228 
00229         if ((!success) || (response->result != WINBINDD_OK)) {
00230                 DEBUG(1, ("Could not receive trustdoms\n"));
00231                 talloc_destroy(state->mem_ctx);
00232                 return;
00233         }
00234 
00235         p = (char *)response->extra_data.data;
00236 
00237         while ((p != NULL) && (*p != '\0')) {
00238                 char *q, *sidstr, *alt_name;
00239                 DOM_SID sid;
00240 
00241                 alt_name = strchr(p, '\\');
00242                 if (alt_name == NULL) {
00243                         DEBUG(0, ("Got invalid trustdom response\n"));
00244                         break;
00245                 }
00246 
00247                 *alt_name = '\0';
00248                 alt_name += 1;
00249 
00250                 sidstr = strchr(alt_name, '\\');
00251                 if (sidstr == NULL) {
00252                         DEBUG(0, ("Got invalid trustdom response\n"));
00253                         break;
00254                 }
00255 
00256                 *sidstr = '\0';
00257                 sidstr += 1;
00258 
00259                 q = strchr(sidstr, '\n');
00260                 if (q != NULL)
00261                         *q = '\0';
00262 
00263                 if (!string_to_sid(&sid, sidstr)) {
00264                         /* Allow NULL sid for sibling domains */
00265                         if ( strcmp(sidstr,"S-0-0") == 0) {
00266                                 sid_copy( &sid, &global_sid_NULL);                              
00267                         } else {                                
00268                                 DEBUG(0, ("Got invalid trustdom response\n"));
00269                                 break;
00270                         }                       
00271                 }
00272 
00273                 if (find_domain_from_name_noinit(p) == NULL) {
00274                         struct winbindd_domain *domain;
00275                         char *alternate_name = NULL;
00276                         
00277                         /* use the real alt_name if we have one, else pass in NULL */
00278 
00279                         if ( !strequal( alt_name, "(null)" ) )
00280                                 alternate_name = alt_name;
00281 
00282                         domain = add_trusted_domain(p, alternate_name,
00283                                                     &cache_methods,
00284                                                     &sid);
00285                         setup_domain_child(domain, &domain->child, NULL);
00286                 }
00287                 p=q;
00288                 if (p != NULL)
00289                         p += 1;
00290         }
00291 
00292         SAFE_FREE(response->extra_data.data);
00293         talloc_destroy(state->mem_ctx);
00294 }

static void add_trusted_domains ( struct winbindd_domain domain  )  [static]

winbindd_util.c188 行で定義されています。

参照先 async_domain_request()winbindd_request::cmdwinbindd_request::lengthtrustdom_state::mem_ctxtrustdom_state::responsetalloc_init()trustdom_recv()WINBINDD_LIST_TRUSTDOM.

参照元 rescan_trusted_domains().

00189 {
00190         TALLOC_CTX *mem_ctx;
00191         struct winbindd_request *request;
00192         struct winbindd_response *response;
00193 
00194         struct trustdom_state *state;
00195 
00196         mem_ctx = talloc_init("add_trusted_domains");
00197         if (mem_ctx == NULL) {
00198                 DEBUG(0, ("talloc_init failed\n"));
00199                 return;
00200         }
00201 
00202         request = TALLOC_ZERO_P(mem_ctx, struct winbindd_request);
00203         response = TALLOC_P(mem_ctx, struct winbindd_response);
00204         state = TALLOC_P(mem_ctx, struct trustdom_state);
00205 
00206         if ((request == NULL) || (response == NULL) || (state == NULL)) {
00207                 DEBUG(0, ("talloc failed\n"));
00208                 talloc_destroy(mem_ctx);
00209                 return;
00210         }
00211 
00212         state->mem_ctx = mem_ctx;
00213         state->response = response;
00214 
00215         request->length = sizeof(*request);
00216         request->cmd = WINBINDD_LIST_TRUSTDOM;
00217 
00218         async_domain_request(mem_ctx, domain, request, response,
00219                              trustdom_recv, state);
00220 }

void rescan_trusted_domains ( void   ) 

winbindd_util.c300 行で定義されています。

参照先 add_trusted_domains()find_our_domain()last_trustdom_scan.

参照元 process_loop().

00301 {
00302         time_t now = time(NULL);
00303         
00304         /* see if the time has come... */
00305         
00306         if ((now >= last_trustdom_scan) &&
00307             ((now-last_trustdom_scan) < WINBINDD_RESCAN_FREQ) )
00308                 return;
00309                 
00310         /* this will only add new domains we didn't already know about */
00311         
00312         add_trusted_domains( find_our_domain() );
00313 
00314         last_trustdom_scan = now;
00315         
00316         return; 
00317 }

static void init_child_recv ( void *  private_data,
BOOL  success 
) [static]

winbindd_util.c414 行で定義されています。

参照先 winbindd_domain::active_directorywinbindd_domain::alt_nameinit_child_state::continuationwinbindd_response::datainit_child_state::domainwinbindd_response::domain_infoinit_dc_connection()init_child_state::mem_ctxwinbindd_domain::namewinbindd_domain::native_modeinit_child_state::private_datainit_child_state::responsewinbindd_response::resultwinbindd_domain::sequence_numberwinbindd_domain::sidstring_to_sid()WINBINDD_OK.

参照元 init_child_connection()init_child_getdc_recv().

00415 {
00416         struct init_child_state *state =
00417                 talloc_get_type_abort(private_data, struct init_child_state);
00418 
00419         DEBUG(5, ("Received child initialization response for domain %s\n",
00420                   state->domain->name));
00421 
00422         if ((!success) || (state->response->result != WINBINDD_OK)) {
00423                 DEBUG(3, ("Could not init child\n"));
00424                 state->continuation(state->private_data, False);
00425                 talloc_destroy(state->mem_ctx);
00426                 return;
00427         }
00428 
00429         fstrcpy(state->domain->name,
00430                 state->response->data.domain_info.name);
00431         fstrcpy(state->domain->alt_name,
00432                 state->response->data.domain_info.alt_name);
00433         string_to_sid(&state->domain->sid,
00434                       state->response->data.domain_info.sid);
00435         state->domain->native_mode =
00436                 state->response->data.domain_info.native_mode;
00437         state->domain->active_directory =
00438                 state->response->data.domain_info.active_directory;
00439         state->domain->sequence_number =
00440                 state->response->data.domain_info.sequence_number;
00441 
00442         init_dc_connection(state->domain);
00443 
00444         if (state->continuation != NULL)
00445                 state->continuation(state->private_data, True);
00446         talloc_destroy(state->mem_ctx);
00447 }

static void init_child_getdc_recv ( void *  private_data,
BOOL  success 
) [static]

winbindd_util.c392 行で定義されています。

参照先 async_request()winbindd_domain::childwinbindd_request::cmdwinbindd_request::datawinbindd_response::datawinbindd_response::dc_nameinit_child_state::domainwinbindd_request::domain_nameinit_child_recv()winbindd_request::init_conninit_child_state::mem_ctxwinbindd_domain::nameinit_child_state::requestinit_child_state::responsewinbindd_response::resultWINBINDD_INIT_CONNECTIONWINBINDD_OK.

参照元 init_child_connection().

00393 {
00394         struct init_child_state *state =
00395                 talloc_get_type_abort(private_data, struct init_child_state);
00396         const char *dcname = "";
00397 
00398         DEBUG(10, ("Received getdcname response\n"));
00399 
00400         if (success && (state->response->result == WINBINDD_OK)) {
00401                 dcname = state->response->data.dc_name;
00402         }
00403 
00404         state->request->cmd = WINBINDD_INIT_CONNECTION;
00405         fstrcpy(state->request->domain_name, state->domain->name);
00406         state->request->data.init_conn.is_primary = False;
00407         fstrcpy(state->request->data.init_conn.dcname, dcname);
00408 
00409         async_request(state->mem_ctx, &state->domain->child,
00410                       state->request, state->response,
00411                       init_child_recv, state);
00412 }

enum winbindd_result init_child_connection ( struct winbindd_domain domain,
void(*)(void *private_data, BOOL success)  continuation,
void *  private_data 
)

winbindd_util.c331 行で定義されています。

参照先 async_domain_request()async_request()winbindd_domain::childwinbindd_request::cmdinit_child_state::continuationwinbindd_request::datainit_child_state::domainwinbindd_request::domain_namefind_our_domain()init_child_getdc_recv()init_child_recv()winbindd_request::init_connwinbindd_request::lengthinit_child_state::mem_ctxwinbindd_domain::namewinbindd_domain::primaryinit_child_state::private_datainit_child_state::requestinit_child_state::responsetalloc_init()WINBINDD_ERRORWINBINDD_GETDCNAMEWINBINDD_INIT_CONNECTIONWINBINDD_PENDING.

参照元 async_domain_request()winbindd_domain_info().

00335 {
00336         TALLOC_CTX *mem_ctx;
00337         struct winbindd_request *request;
00338         struct winbindd_response *response;
00339         struct init_child_state *state;
00340         struct winbindd_domain *request_domain;
00341 
00342         mem_ctx = talloc_init("init_child_connection");
00343         if (mem_ctx == NULL) {
00344                 DEBUG(0, ("talloc_init failed\n"));
00345                 return WINBINDD_ERROR;
00346         }
00347 
00348         request = TALLOC_ZERO_P(mem_ctx, struct winbindd_request);
00349         response = TALLOC_P(mem_ctx, struct winbindd_response);
00350         state = TALLOC_P(mem_ctx, struct init_child_state);
00351 
00352         if ((request == NULL) || (response == NULL) || (state == NULL)) {
00353                 DEBUG(0, ("talloc failed\n"));
00354                 TALLOC_FREE(mem_ctx);
00355                 continuation(private_data, False);
00356                 return WINBINDD_ERROR;
00357         }
00358 
00359         request->length = sizeof(*request);
00360 
00361         state->mem_ctx = mem_ctx;
00362         state->domain = domain;
00363         state->request = request;
00364         state->response = response;
00365         state->continuation = continuation;
00366         state->private_data = private_data;
00367 
00368         if (IS_DC || domain->primary) {
00369                 /* The primary domain has to find the DC name itself */
00370                 request->cmd = WINBINDD_INIT_CONNECTION;
00371                 fstrcpy(request->domain_name, domain->name);
00372                 request->data.init_conn.is_primary = True;
00373                 fstrcpy(request->data.init_conn.dcname, "");
00374                 async_request(mem_ctx, &domain->child, request, response,
00375                               init_child_recv, state);
00376                 return WINBINDD_PENDING;
00377         }
00378 
00379         /* This is *not* the primary domain, let's ask our DC about a DC
00380          * name */
00381 
00382         request->cmd = WINBINDD_GETDCNAME;
00383         fstrcpy(request->domain_name, domain->name);
00384 
00385         request_domain = find_our_domain();
00386         
00387         async_domain_request(mem_ctx, request_domain, request, response,
00388                              init_child_getdc_recv, state);
00389         return WINBINDD_PENDING;
00390 }

enum winbindd_result winbindd_dual_init_connection ( struct winbindd_domain domain,
struct winbindd_cli_state state 
)

winbindd_util.c449 行で定義されています。

参照先 winbindd_domain::active_directorywinbindd_domain::alt_namewinbindd_response::datawinbindd_request::datawinbindd_domain::dcnameinit_child_state::domainwinbindd_response::domain_infowinbindd_request::domain_namewinbindd_request::init_conninit_dc_connection()winbindd_domain::initializedwinbindd_domain::namewinbindd_domain::native_modewinbindd_domain::onlinewinbindd_domain::primarywinbindd_cli_state::requestwinbindd_cli_state::responsewinbindd_domain::sequence_numberwinbindd_domain::sidsid_string_static()WINBINDD_OK.

00451 {
00452         /* Ensure null termination */
00453         state->request.domain_name
00454                 [sizeof(state->request.domain_name)-1]='\0';
00455         state->request.data.init_conn.dcname
00456                 [sizeof(state->request.data.init_conn.dcname)-1]='\0';
00457 
00458         if (strlen(state->request.data.init_conn.dcname) > 0) {
00459                 fstrcpy(domain->dcname, state->request.data.init_conn.dcname);
00460         }
00461 
00462         init_dc_connection(domain);
00463 
00464         if (!domain->initialized) {
00465                 /* If we return error here we can't do any cached authentication,
00466                    but we may be in disconnected mode and can't initialize correctly.
00467                    Do what the previous code did and just return without initialization,
00468                    once we go online we'll re-initialize.
00469                 */
00470                 DEBUG(5, ("winbindd_dual_init_connection: %s returning without initialization "
00471                         "online = %d\n", domain->name, (int)domain->online ));
00472         }
00473 
00474         fstrcpy(state->response.data.domain_info.name, domain->name);
00475         fstrcpy(state->response.data.domain_info.alt_name, domain->alt_name);
00476         fstrcpy(state->response.data.domain_info.sid,
00477                 sid_string_static(&domain->sid));
00478         
00479         state->response.data.domain_info.native_mode
00480                 = domain->native_mode;
00481         state->response.data.domain_info.active_directory
00482                 = domain->active_directory;
00483         state->response.data.domain_info.primary
00484                 = domain->primary;
00485         state->response.data.domain_info.sequence_number =
00486                 domain->sequence_number;
00487 
00488         return WINBINDD_OK;
00489 }

BOOL init_domain_list ( void   ) 

winbindd_util.c492 行で定義されています。

参照先 add_trusted_domain()builtin_passdb_methodscache_methodswinbindd_domain::childfree_domain_list()get_global_sam_name()get_global_sam_sid()global_sid_Builtinlp_workgroup()winbindd_domain::primaryROLE_DOMAIN_MEMBERsam_passdb_methodssecrets_fetch_domain_sid()set_domain_online_request()setup_domain_child().

参照元 domain_list()main().

00493 {
00494         struct winbindd_domain *domain;
00495         int role = lp_server_role();
00496 
00497         /* Free existing list */
00498         free_domain_list();
00499 
00500         /* Add ourselves as the first entry. */
00501 
00502         if ( role == ROLE_DOMAIN_MEMBER ) {
00503                 DOM_SID our_sid;
00504 
00505                 if (!secrets_fetch_domain_sid(lp_workgroup(), &our_sid)) {
00506                         DEBUG(0, ("Could not fetch our SID - did we join?\n"));
00507                         return False;
00508                 }
00509         
00510                 domain = add_trusted_domain( lp_workgroup(), lp_realm(),
00511                                              &cache_methods, &our_sid);
00512                 domain->primary = True;
00513                 setup_domain_child(domain, &domain->child, NULL);
00514                 
00515                 /* Even in the parent winbindd we'll need to
00516                    talk to the DC, so try and see if we can
00517                    contact it. Theoretically this isn't neccessary
00518                    as the init_dc_connection() in init_child_recv()
00519                    will do this, but we can start detecting the DC
00520                    early here. */
00521                 set_domain_online_request(domain);
00522         }
00523 
00524         /* Local SAM */
00525 
00526         domain = add_trusted_domain(get_global_sam_name(), NULL,
00527                                     &sam_passdb_methods, get_global_sam_sid());
00528         if ( role != ROLE_DOMAIN_MEMBER ) {
00529                 domain->primary = True;
00530         }
00531         setup_domain_child(domain, &domain->child, NULL);
00532 
00533         /* BUILTIN domain */
00534 
00535         domain = add_trusted_domain("BUILTIN", NULL, &builtin_passdb_methods,
00536                                     &global_sid_Builtin);
00537         setup_domain_child(domain, &domain->child, NULL);
00538 
00539         return True;
00540 }

struct winbindd_domain* find_domain_from_name_noinit ( const char *  domain_name  ) 

Given a domain name, return the struct winbindd domain info for it

覚え書き:
Do *not* pass lp_workgroup() to this function. domain_list may modify it's value, and free that pointer. Instead, our local domain may be found by calling find_our_domain(). directly.
戻り値:
The domain structure for the named domain, if it is working.

winbindd_util.c554 行で定義されています。

参照先 winbindd_domain::alt_namedomain_list()winbindd_domain::namewinbindd_domain::nextstrequal().

参照元 find_auth_domain()find_domain_from_name()find_lookup_domain_from_name()idmap_rid_id_to_sid()trustdom_recv()winbindd_domain_info()winbindd_getgroups()winbindd_show_sequence().

00555 {
00556         struct winbindd_domain *domain;
00557 
00558         /* Search through list */
00559 
00560         for (domain = domain_list(); domain != NULL; domain = domain->next) {
00561                 if (strequal(domain_name, domain->name) ||
00562                     (domain->alt_name[0] &&
00563                      strequal(domain_name, domain->alt_name))) {
00564                         return domain;
00565                 }
00566         }
00567 
00568         /* Not found */
00569 
00570         return NULL;
00571 }

struct winbindd_domain* find_domain_from_name ( const char *  domain_name  ) 

winbindd_util.c573 行で定義されています。

参照先 find_domain_from_name_noinit()init_dc_connection()winbindd_domain::initialized.

参照元 convert_fn()find_root_domain()get_sam_group_entries()get_sam_user_entries()krb5_ticket_gain_handler()winbindd_dual_pam_auth()winbindd_dual_pam_auth_crap()winbindd_dual_pam_auth_kerberos()winbindd_dual_pam_auth_samlogon()winbindd_getgrent()winbindd_getgrnam()winbindd_getpwnam()winbindd_gettoken_async()winbindd_pam_chauthtok()winbindd_pam_chng_pswd_auth_crap().

00574 {
00575         struct winbindd_domain *domain;
00576 
00577         domain = find_domain_from_name_noinit(domain_name);
00578 
00579         if (domain == NULL)
00580                 return NULL;
00581 
00582         if (!domain->initialized)
00583                 init_dc_connection(domain);
00584 
00585         return domain;
00586 }

struct winbindd_domain* find_domain_from_sid_noinit ( const DOM_SID sid  ) 

winbindd_util.c590 行で定義されています。

参照先 domain_list()winbindd_domain::nextwinbindd_domain::sidsid_compare_domain().

参照元 find_domain_from_sid()find_idmap_domain_from_sid()getgrgid_got_sid()winbindd_getpwsid()winbindd_gettoken_async()winbindd_getuserdomgroups().

00591 {
00592         struct winbindd_domain *domain;
00593 
00594         /* Search through list */
00595 
00596         for (domain = domain_list(); domain != NULL; domain = domain->next) {
00597                 if (sid_compare_domain(sid, &domain->sid) == 0)
00598                         return domain;
00599         }
00600 
00601         /* Not found */
00602 
00603         return NULL;
00604 }

struct winbindd_domain* find_domain_from_sid ( const DOM_SID sid  ) 

winbindd_util.c608 行で定義されています。

参照先 find_domain_from_sid_noinit()init_dc_connection()winbindd_domain::initializedwinbindd_domain::sid.

参照元 add_expanded_sid()find_builtin_domain()find_lookup_domain_from_sid().

00609 {
00610         struct winbindd_domain *domain;
00611 
00612         domain = find_domain_from_sid_noinit(sid);
00613 
00614         if (domain == NULL)
00615                 return NULL;
00616 
00617         if (!domain->initialized)
00618                 init_dc_connection(domain);
00619 
00620         return domain;
00621 }

struct winbindd_domain* find_our_domain ( void   ) 

winbindd_util.c623 行で定義されています。

参照先 domain_list()winbindd_domain::nextwinbindd_domain::primarysmb_panic().

参照元 ads_cached_connection()find_auth_domain()find_lookup_domain_from_name()find_lookup_domain_from_sid()find_root_domain()get_cache()get_dc_name_via_netlogon()idmap_can_map()init_child_connection()rescan_trusted_domains()winbindd_check_machine_acct()winbindd_dual_check_machine_acct()winbindd_dual_pam_auth_crap()winbindd_dual_pam_auth_kerberos()winbindd_dual_pam_auth_samlogon()winbindd_getdcname()winbindd_gettoken_async()winbindd_list_trusted_domains().

00624 {
00625         struct winbindd_domain *domain;
00626 
00627         /* Search through list */
00628 
00629         for (domain = domain_list(); domain != NULL; domain = domain->next) {
00630                 if (domain->primary)
00631                         return domain;
00632         }
00633 
00634         smb_panic("Could not find our domain\n");
00635         return NULL;
00636 }

struct winbindd_domain* find_root_domain ( void   ) 

winbindd_util.c638 行で定義されています。

参照先 find_domain_from_name()find_our_domain()winbindd_domain::forest_name.

参照元 lookupname_recv().

00639 {
00640         struct winbindd_domain *ours = find_our_domain();       
00641         
00642         if ( !ours )
00643                 return NULL;
00644         
00645         if ( strlen(ours->forest_name) == 0 )
00646                 return NULL;
00647         
00648         return find_domain_from_name( ours->forest_name );
00649 }

struct winbindd_domain* find_builtin_domain ( void   ) 

winbindd_util.c651 行で定義されています。

参照先 find_domain_from_sid()winbindd_domain::sidsmb_panic()string_to_sid().

参照元 winbindd_gettoken_async().

00652 {
00653         DOM_SID sid;
00654         struct winbindd_domain *domain;
00655 
00656         string_to_sid(&sid, "S-1-5-32");
00657         domain = find_domain_from_sid(&sid);
00658 
00659         if (domain == NULL)
00660                 smb_panic("Could not find BUILTIN domain\n");
00661 
00662         return domain;
00663 }

struct winbindd_domain* find_lookup_domain_from_sid ( const DOM_SID sid  ) 

winbindd_util.c667 行で定義されています。

参照先 find_domain_from_sid()find_our_domain()is_in_internal_domain()is_internal_domain()winbindd_domain::sidsid_string_static().

参照元 add_expanded_sid()lookup_cached_sid()winbindd_lookup_name_by_sid()winbindd_lookuprids()winbindd_lookupsid_async().

00668 {
00669         /* A DC can't ask the local smbd for remote SIDs, here winbindd is the
00670          * one to contact the external DC's. On member servers the internal
00671          * domains are different: These are part of the local SAM. */
00672 
00673         DEBUG(10, ("find_lookup_domain_from_sid(%s)\n",
00674                    sid_string_static(sid)));
00675 
00676         if (IS_DC || is_internal_domain(sid) || is_in_internal_domain(sid)) {
00677                 DEBUG(10, ("calling find_domain_from_sid\n"));
00678                 return find_domain_from_sid(sid);
00679         }
00680 
00681         /* On a member server a query for SID or name can always go to our
00682          * primary DC. */
00683 
00684         DEBUG(10, ("calling find_our_domain\n"));
00685         return find_our_domain();
00686 }

struct winbindd_domain* find_lookup_domain_from_name ( const char *  domain_name  ) 

winbindd_util.c688 行で定義されています。

参照先 find_domain_from_name_noinit()find_our_domain()get_global_sam_name()strequal().

参照元 lookup_cached_name()winbindd_lookupname_async().

00689 {
00690         if (IS_DC || strequal(domain_name, "BUILTIN") ||
00691             strequal(domain_name, get_global_sam_name()))
00692                 return find_domain_from_name_noinit(domain_name);
00693 
00694         return find_our_domain();
00695 }

BOOL winbindd_lookup_sid_by_name ( TALLOC_CTX mem_ctx,
struct winbindd_domain domain,
const char *  domain_name,
const char *  name,
DOM_SID sid,
enum lsa_SidType type 
)

winbindd_util.c699 行で定義されています。

参照先 winbindd_domain::methodswinbindd_methods::name_to_sidresultwinbindd_domain::sidSID_NAME_UNKNOWN.

参照元 winbindd_dual_lookupname()winbindd_getgrnam().

00704 {
00705         NTSTATUS result;
00706 
00707         /* Lookup name */
00708         result = domain->methods->name_to_sid(domain, mem_ctx, domain_name, name, sid, type);
00709 
00710         /* Return sid and type if lookup successful */
00711         if (!NT_STATUS_IS_OK(result)) {
00712                 *type = SID_NAME_UNKNOWN;
00713         }
00714 
00715         return NT_STATUS_IS_OK(result);
00716 }

BOOL winbindd_lookup_name_by_sid ( TALLOC_CTX mem_ctx,
DOM_SID sid,
char **  dom_name,
char **  name,
enum lsa_SidType type 
)

Lookup a name in a domain from a sid.

引数:
sid Security ID you want to look up.
name On success, set to the name corresponding to sid.
dom_name On success, set to the 'domain name' corresponding to sid.
type On success, contains the type of name: alias, group or user.
戻り値:
True if the name exists, in which case name and type are set, otherwise False.

winbindd_util.c729 行で定義されています。

参照先 find_lookup_domain_from_sid()winbindd_domain::methodsresultwinbindd_domain::sidSID_NAME_UNKNOWNwinbindd_methods::sid_to_name.

参照元 getgrgid_got_sid()winbindd_dual_lookupsid().

00734 {
00735         NTSTATUS result;
00736         struct winbindd_domain *domain;
00737 
00738         *dom_name = NULL;
00739         *name = NULL;
00740 
00741         domain = find_lookup_domain_from_sid(sid);
00742 
00743         if (!domain) {
00744                 DEBUG(1,("Can't find domain from sid\n"));
00745                 return False;
00746         }
00747 
00748         /* Lookup name */
00749 
00750         result = domain->methods->sid_to_name(domain, mem_ctx, sid, dom_name, name, type);
00751 
00752         /* Return name and type if successful */
00753         
00754         if (NT_STATUS_IS_OK(result)) {
00755                 return True;
00756         }
00757 
00758         *type = SID_NAME_UNKNOWN;
00759         
00760         return False;
00761 }

void free_getent_state ( struct getent_state state  ) 

winbindd_util.c765 行で定義されています。

参照先 getent_state::nextgetent_state::sam_entries.

参照元 remove_client()winbindd_endgrent()winbindd_endpwent()winbindd_setgrent_internal()winbindd_setpwent_internal().

00766 {
00767         struct getent_state *temp;
00768 
00769         /* Iterate over state list */
00770 
00771         temp = state;
00772 
00773         while(temp != NULL) {
00774                 struct getent_state *next;
00775 
00776                 /* Free sam entries then list entry */
00777 
00778                 SAFE_FREE(state->sam_entries);
00779                 DLIST_REMOVE(state, state);
00780                 next = temp->next;
00781 
00782                 SAFE_FREE(temp);
00783                 temp = next;
00784         }
00785 }

static BOOL assume_domain ( const char *  domain  )  [static]

winbindd_util.c789 行で定義されています。

参照先 get_global_sam_name()lp_workgroup()ROLE_DOMAIN_MEMBERROLE_STANDALONEstrequal().

参照元 fill_domain_username()parse_domain_user().

00790 {
00791         /* never assume the domain on a standalone server */
00792 
00793         if ( lp_server_role() == ROLE_STANDALONE )
00794                 return False;
00795 
00796         /* domain member servers may possibly assume for the domain name */
00797 
00798         if ( lp_server_role() == ROLE_DOMAIN_MEMBER ) {
00799                 if ( !strequal(lp_workgroup(), domain) )
00800                         return False;
00801 
00802                 if ( lp_winbind_use_default_domain() || lp_winbind_trusted_domains_only() )
00803                         return True;
00804         } 
00805 
00806         /* only left with a domain controller */
00807 
00808         if ( strequal(get_global_sam_name(), domain) )  {
00809                 return True;
00810         }
00811         
00812         return False;
00813 }

BOOL parse_domain_user ( const char *  domuser,
fstring  domain,
fstring  user 
)

winbindd_util.c817 行で定義されています。

参照先 assume_domain()lp_workgroup()strupper_m().

参照元 canonicalize_username()parse_domain_user_talloc()winbindd_dual_ccache_ntlm_auth()winbindd_dual_pam_auth()winbindd_dual_pam_auth_cached()winbindd_dual_pam_auth_kerberos()winbindd_dual_pam_auth_samlogon()winbindd_dual_pam_chauthtok()winbindd_dual_pam_chng_pswd_auth_crap()winbindd_getgrnam()winbindd_getpwnam()winbindd_raw_kerberos_login().

00818 {
00819         char *p = strchr(domuser,*lp_winbind_separator());
00820 
00821         if ( !p ) {
00822                 fstrcpy(user, domuser);
00823 
00824                 if ( assume_domain(lp_workgroup())) {
00825                         fstrcpy(domain, lp_workgroup());
00826                 } else {
00827                         return False;
00828                 }
00829         } else {
00830                 fstrcpy(user, p+1);
00831                 fstrcpy(domain, domuser);
00832                 domain[PTR_DIFF(p, domuser)] = 0;
00833         }
00834         
00835         strupper_m(domain);
00836         
00837         return True;
00838 }

BOOL parse_domain_user_talloc ( TALLOC_CTX mem_ctx,
const char *  domuser,
char **  domain,
char **  user 
)

winbindd_util.c840 行で定義されています。

参照先 parse_domain_user()talloc_strdup().

参照元 winbindd_getgroups().

00842 {
00843         fstring fstr_domain, fstr_user;
00844         if (!parse_domain_user(domuser, fstr_domain, fstr_user)) {
00845                 return False;
00846         }
00847         *domain = talloc_strdup(mem_ctx, fstr_domain);
00848         *user = talloc_strdup(mem_ctx, fstr_user);
00849         return ((*domain != NULL) && (*user != NULL));
00850 }

BOOL canonicalize_username ( fstring  username_inout,
fstring  domain,
fstring  user 
)

winbindd_util.c861 行で定義されています。

参照先 parse_domain_user().

参照元 winbindd_ccache_ntlm_auth()winbindd_pam_auth()winbindd_pam_chauthtok()winbindd_pam_logoff().

00862 {
00863         if (!parse_domain_user(username_inout, domain, user)) {
00864                 return False;
00865         }
00866         slprintf(username_inout, sizeof(fstring) - 1, "%s%c%s",
00867                  domain, *lp_winbind_separator(),
00868                  user);
00869         return True;
00870 }

void fill_domain_username ( fstring  name,
const char *  domain,
const char *  user,
BOOL  can_assume 
)

winbindd_util.c886 行で定義されています。

参照先 assume_domain()strlcpy()strlower_m().

参照元 add_member()fill_grent()fill_grent_mem()getpwsid_sid2gid_recv()winbindd_dual_pam_auth()winbindd_dual_pam_auth_crap()winbindd_fill_pwent()winbindd_getgrent()winbindd_list_groups()winbindd_list_users().

00887 {
00888         fstring tmp_user;
00889 
00890         fstrcpy(tmp_user, user);
00891         strlower_m(tmp_user);
00892 
00893         if (can_assume && assume_domain(domain)) {
00894                 strlcpy(name, tmp_user, sizeof(fstring));
00895         } else {
00896                 slprintf(name, sizeof(fstring) - 1, "%s%c%s",
00897                          domain, *lp_winbind_separator(),
00898                          tmp_user);
00899         }
00900 }

char* get_winbind_priv_pipe_dir ( void   ) 

winbindd_util.c906 行で定義されています。

参照先 lock_path().

参照元 open_winbindd_priv_socket()winbindd_pam_auth_crap()winbindd_priv_pipe_dir().

00907 {
00908         return lock_path(WINBINDD_PRIV_SOCKET_SUBDIR);
00909 }

int open_winbindd_socket ( void   ) 

winbindd_util.c916 行で定義されています。

参照先 create_pipe_sock().

参照元 process_loop().

00917 {
00918         if (_winbindd_socket == -1) {
00919                 _winbindd_socket = create_pipe_sock(
00920                         WINBINDD_SOCKET_DIR, WINBINDD_SOCKET_NAME, 0755);
00921                 DEBUG(10, ("open_winbindd_socket: opened socket fd %d\n",
00922                            _winbindd_socket));
00923         }
00924 
00925         return _winbindd_socket;
00926 }

int open_winbindd_priv_socket ( void   ) 

winbindd_util.c928 行で定義されています。

参照先 create_pipe_sock()get_winbind_priv_pipe_dir().

参照元 process_loop().

00929 {
00930         if (_winbindd_priv_socket == -1) {
00931                 _winbindd_priv_socket = create_pipe_sock(
00932                         get_winbind_priv_pipe_dir(), WINBINDD_SOCKET_NAME, 0750);
00933                 DEBUG(10, ("open_winbindd_priv_socket: opened socket fd %d\n",
00934                            _winbindd_priv_socket));
00935         }
00936 
00937         return _winbindd_priv_socket;
00938 }

void close_winbindd_socket ( void   ) 

winbindd_util.c942 行で定義されています。

00943 {
00944         if (_winbindd_socket != -1) {
00945                 DEBUG(10, ("close_winbindd_socket: closing socket fd %d\n",
00946                            _winbindd_socket));
00947                 close(_winbindd_socket);
00948                 _winbindd_socket = -1;
00949         }
00950         if (_winbindd_priv_socket != -1) {
00951                 DEBUG(10, ("close_winbindd_socket: closing socket fd %d\n",
00952                            _winbindd_priv_socket));
00953                 close(_winbindd_priv_socket);
00954                 _winbindd_priv_socket = -1;
00955         }
00956 }

struct winbindd_cli_state* winbindd_client_list ( void   ) 

winbindd_util.c967 行で定義されています。

参照先 _client_list.

参照元 process_loop()remove_idle_client()winbindd_kill_all_clients()winbindd_status().

00968 {
00969         return _client_list;
00970 }

void winbindd_add_client ( struct winbindd_cli_state cli  ) 

winbindd_util.c974 行で定義されています。

参照先 _client_listcli.

参照元 new_connection().

00975 {
00976         DLIST_ADD(_client_list, cli);
00977         _num_clients++;
00978 }

void winbindd_remove_client ( struct winbindd_cli_state cli  ) 

winbindd_util.c982 行で定義されています。

参照先 _client_listcli.

参照元 remove_client()winbindd_kill_all_clients().

00983 {
00984         DLIST_REMOVE(_client_list, cli);
00985         _num_clients--;
00986 }

void winbindd_kill_all_clients ( void   ) 

winbindd_util.c990 行で定義されています。

参照先 winbindd_cli_state::nextwinbindd_client_list()winbindd_remove_client().

00991 {
00992         struct winbindd_cli_state *cl = winbindd_client_list();
00993 
00994         DEBUG(10, ("winbindd_kill_all_clients: going postal\n"));
00995 
00996         while (cl) {
00997                 struct winbindd_cli_state *next;
00998                 
00999                 next = cl->next;
01000                 winbindd_remove_client(cl);
01001                 cl = next;
01002         }
01003 }

int winbindd_num_clients ( void   ) 

winbindd_util.c1007 行で定義されています。

参照元 winbindd_status().

01008 {
01009         return _num_clients;
01010 }

NTSTATUS lookup_usergroups_cached ( struct winbindd_domain domain,
TALLOC_CTX mem_ctx,
const DOM_SID user_sid,
uint32 *  p_num_groups,
DOM_SID **  user_sids 
)

winbindd_util.c1012 行で定義されています。

参照先 add_sid_to_array()net_user_info_3::dom_sidDOM_GID::g_ridnet_user_info_3::gidsnetsamlogon_cache_get()net_user_info_3::num_groupsDOM_SID2::sidsid_append_rid()sid_compose()sid_copy()statusnet_user_info_3::user_rid.

参照元 lookup_usergroups().

01016 {
01017         NET_USER_INFO_3 *info3 = NULL;
01018         NTSTATUS status = NT_STATUS_NO_MEMORY;
01019         int i;
01020         size_t num_groups = 0;
01021         DOM_SID group_sid, primary_group;
01022         
01023         DEBUG(3,(": lookup_usergroups_cached\n"));
01024         
01025         *user_sids = NULL;
01026         num_groups = 0;
01027         *p_num_groups = 0;
01028 
01029         info3 = netsamlogon_cache_get(mem_ctx, user_sid);
01030 
01031         if (info3 == NULL) {
01032                 return NT_STATUS_OBJECT_NAME_NOT_FOUND;
01033         }
01034 
01035         if (info3->num_groups == 0) {
01036                 TALLOC_FREE(info3);
01037                 return NT_STATUS_UNSUCCESSFUL;
01038         }
01039         
01040         /* always add the primary group to the sid array */
01041         sid_compose(&primary_group, &info3->dom_sid.sid, info3->user_rid);
01042         
01043         if (!add_sid_to_array(mem_ctx, &primary_group, user_sids, &num_groups)) {
01044                 TALLOC_FREE(info3);
01045                 return NT_STATUS_NO_MEMORY;
01046         }
01047 
01048         for (i=0; i<info3->num_groups; i++) {
01049                 sid_copy(&group_sid, &info3->dom_sid.sid);
01050                 sid_append_rid(&group_sid, info3->gids[i].g_rid);
01051 
01052                 if (!add_sid_to_array(mem_ctx, &group_sid, user_sids,
01053                                  &num_groups)) {
01054                         TALLOC_FREE(info3);
01055                         return NT_STATUS_NO_MEMORY;
01056                 }
01057         }
01058 
01059         TALLOC_FREE(info3);
01060         *p_num_groups = num_groups;
01061         status = (user_sids != NULL) ? NT_STATUS_OK : NT_STATUS_NO_MEMORY;
01062         
01063         DEBUG(3,(": lookup_usergroups_cached succeeded\n"));
01064 
01065         return status;
01066 }

void ws_name_replace ( char *  name,
char  replace 
)

winbindd_util.c1072 行で定義されています。

参照先 all_string_sub()replace_char().

参照元 getpwsid_queryuser_recv()msrpc_rids_to_names()msrpc_sid_to_name()winbindd_getgrnam().

01073 {
01074         char replace_char[2] = { 0x0, 0x0 };
01075     
01076         if ( !lp_winbind_normalize_names() || (replace == '\0') ) 
01077                 return;
01078 
01079         replace_char[0] = replace;      
01080         all_string_sub( name, " ", replace_char, 0 );
01081 
01082         return; 
01083 }

void ws_name_return ( char *  name,
char  replace 
)

winbindd_util.c1089 行で定義されています。

参照先 all_string_sub()replace_char().

参照元 msrpc_name_to_sid()winbindd_dual_pam_auth()winbindd_getgroups()winbindd_getpwnam()winbindd_pam_auth().

01090 {
01091         char replace_char[2] = { 0x0, 0x0 };
01092     
01093         if ( !lp_winbind_normalize_names() || (replace == '\0') ) 
01094                 return;
01095         
01096         replace_char[0] = replace;      
01097         all_string_sub( name, replace_char, " ", 0 );
01098 
01099         return; 
01100 }


変数

struct winbindd_methods cache_methods

winbindd_cache.c2721 行で定義されています。

参照元 init_domain_list()trustdom_recv().

struct winbindd_methods builtin_passdb_methods

winbindd_passdb.c668 行で定義されています。

struct winbindd_methods sam_passdb_methods

winbindd_passdb.c687 行で定義されています。

参照元 init_domain_list().

struct winbindd_domain* _domain_list [static]

winbindd_util.c46 行で定義されています。

参照元 add_trusted_domain()domain_list()free_domain_list().

time_t last_trustdom_scan [static]

When was the last scan of trusted domains done?

0 == not ever

winbindd_util.c54 行で定義されています。

参照元 rescan_trusted_domains().

int _winbindd_socket = -1 [static]

winbindd_util.c913 行で定義されています。

int _winbindd_priv_socket = -1 [static]

winbindd_util.c914 行で定義されています。

struct winbindd_cli_state* _client_list [static]

winbindd_util.c962 行で定義されています。

参照元 winbindd_add_client()winbindd_client_list()winbindd_remove_client().

int _num_clients [static]

winbindd_util.c963 行で定義されています。


Sambaに対してSat Aug 29 21:23:58 2009に生成されました。  doxygen 1.4.7