データ構造 | |
struct | winbindd_async_request |
struct | domain_request_state |
struct | winbindd_child_dispatch_table |
関数 | |
static void | child_read_request (struct winbindd_cli_state *state) |
static void | async_request_fail (struct winbindd_async_request *state) |
static void | async_main_request_sent (void *private_data, BOOL success) |
static void | async_request_sent (void *private_data, BOOL success) |
static void | async_reply_recv (void *private_data, BOOL success) |
static void | schedule_async_request (struct winbindd_child *child) |
void | async_request (TALLOC_CTX *mem_ctx, struct winbindd_child *child, struct winbindd_request *request, struct winbindd_response *response, void(*continuation)(void *private_data, BOOL success), void *private_data) |
static void | async_request_timeout_handler (struct event_context *ctx, struct timed_event *te, const struct timeval *now, void *private_data) |
static BOOL | fork_domain_child (struct winbindd_child *child) |
static void | domain_init_recv (void *private_data_data, BOOL success) |
void | async_domain_request (TALLOC_CTX *mem_ctx, struct winbindd_domain *domain, struct winbindd_request *request, struct winbindd_response *response, void(*continuation)(void *private_data_data, BOOL success), void *private_data_data) |
static void | recvfrom_child (void *private_data_data, BOOL success) |
void | sendto_child (struct winbindd_cli_state *state, struct winbindd_child *child) |
void | sendto_domain (struct winbindd_cli_state *state, struct winbindd_domain *domain) |
static void | child_process_request (struct winbindd_domain *domain, struct winbindd_cli_state *state) |
void | setup_domain_child (struct winbindd_domain *domain, struct winbindd_child *child, const char *explicit_logfile) |
void | winbind_child_died (pid_t pid) |
void | winbindd_flush_negative_conn_cache (struct winbindd_domain *domain) |
void | winbind_msg_offline (int msg_type, struct process_id src, void *buf, size_t len, void *private_data) |
void | winbind_msg_online (int msg_type, struct process_id src, void *buf, size_t len, void *private_data) |
void | winbind_msg_onlinestatus (int msg_type, struct process_id src, void *buf, size_t len, void *private_data) |
static void | account_lockout_policy_handler (struct event_context *ctx, struct timed_event *te, const struct timeval *now, void *private_data) |
static void | child_msg_offline (int msg_type, struct process_id src, void *buf, size_t len, void *private_data) |
static void | child_msg_online (int msg_type, struct process_id src, void *buf, size_t len, void *private_data) |
static const char * | collect_onlinestatus (TALLOC_CTX *mem_ctx) |
static void | child_msg_onlinestatus (int msg_type, struct process_id src, void *buf, size_t len, void *private_data) |
変数 | |
BOOL | override_logfile |
static struct winbindd_child_dispatch_table | child_dispatch_table [] |
winbindd_child * | children = NULL |
static void child_read_request | ( | struct winbindd_cli_state * | state | ) | [static] |
winbindd_dual.c の 41 行で定義されています。
参照先 winbindd_request::data・winbindd_request::extra_data・winbindd_request::extra_len・winbindd_cli_state::finished・len・read_data()・winbindd_cli_state::request・winbindd_cli_state::sock.
00042 { 00043 ssize_t len; 00044 00045 /* Read data */ 00046 00047 len = read_data(state->sock, (char *)&state->request, 00048 sizeof(state->request)); 00049 00050 if (len != sizeof(state->request)) { 00051 DEBUG(len > 0 ? 0 : 3, ("Got invalid request length: %d\n", (int)len)); 00052 state->finished = True; 00053 return; 00054 } 00055 00056 if (state->request.extra_len == 0) { 00057 state->request.extra_data.data = NULL; 00058 return; 00059 } 00060 00061 DEBUG(10, ("Need to read %d extra bytes\n", (int)state->request.extra_len)); 00062 00063 state->request.extra_data.data = 00064 SMB_MALLOC_ARRAY(char, state->request.extra_len + 1); 00065 00066 if (state->request.extra_data.data == NULL) { 00067 DEBUG(0, ("malloc failed\n")); 00068 state->finished = True; 00069 return; 00070 } 00071 00072 /* Ensure null termination */ 00073 state->request.extra_data.data[state->request.extra_len] = '\0'; 00074 00075 len = read_data(state->sock, state->request.extra_data.data, 00076 state->request.extra_len); 00077 00078 if (len != state->request.extra_len) { 00079 DEBUG(0, ("Could not read extra data\n")); 00080 state->finished = True; 00081 return; 00082 } 00083 }
static void async_request_fail | ( | struct winbindd_async_request * | state | ) | [static] |
winbindd_dual.c の 191 行で定義されています。
参照先 winbindd_async_request::child・winbindd_async_request::child_pid・winbindd_async_request::continuation・winbindd_response::length・winbindd_child::pid・winbindd_async_request::private_data・winbindd_async_request::reply_timeout_event・winbindd_child::requests・winbindd_async_request::response・winbindd_response::result・winbind_child_died()・WINBINDD_ERROR.
参照元 async_main_request_sent()・async_reply_recv()・async_request_sent().
00192 { 00193 DLIST_REMOVE(state->child->requests, state); 00194 00195 TALLOC_FREE(state->reply_timeout_event); 00196 00197 SMB_ASSERT(state->child_pid != (pid_t)0); 00198 00199 /* If not already reaped, send kill signal to child. */ 00200 if (state->child->pid == state->child_pid) { 00201 kill(state->child_pid, SIGTERM); 00202 00203 /* 00204 * Close the socket to the child. 00205 */ 00206 winbind_child_died(state->child_pid); 00207 } 00208 00209 state->response->length = sizeof(struct winbindd_response); 00210 state->response->result = WINBINDD_ERROR; 00211 state->continuation(state->private_data, False); 00212 }
static void async_main_request_sent | ( | void * | private_data, | |
BOOL | success | |||
) | [static] |
winbindd_dual.c の 144 行で定義されています。
参照先 async_request_fail()・async_request_sent()・winbindd_async_request::child・winbindd_request::data・winbindd_child::event・winbindd_request::extra_data・winbindd_request::extra_len・winbindd_async_request::request・setup_async_write().
00145 { 00146 struct winbindd_async_request *state = 00147 talloc_get_type_abort(private_data, struct winbindd_async_request); 00148 00149 if (!success) { 00150 DEBUG(5, ("Could not send async request\n")); 00151 async_request_fail(state); 00152 return; 00153 } 00154 00155 if (state->request->extra_len == 0) { 00156 async_request_sent(private_data, True); 00157 return; 00158 } 00159 00160 setup_async_write(&state->child->event, state->request->extra_data.data, 00161 state->request->extra_len, 00162 async_request_sent, state); 00163 }
static void async_request_sent | ( | void * | private_data, | |
BOOL | success | |||
) | [static] |
winbindd_dual.c の 214 行で定義されています。
参照先 async_reply_recv()・async_request_fail()・async_request_timeout_handler()・winbindd_async_request::child・winbindd_async_request::child_pid・winbindd_child::event・event_add_timed()・winbindd_async_request::reply_timeout_event・winbindd_async_request::response・winbindd_response::result・setup_async_read()・smb_panic()・timeval_current_ofs()・winbind_event_context().
参照元 async_main_request_sent().
00215 { 00216 struct winbindd_async_request *state = 00217 talloc_get_type_abort(private_data_data, struct winbindd_async_request); 00218 00219 if (!success) { 00220 DEBUG(5, ("Could not send async request to child pid %u\n", 00221 (unsigned int)state->child_pid )); 00222 async_request_fail(state); 00223 return; 00224 } 00225 00226 /* Request successfully sent to the child, setup the wait for reply */ 00227 00228 setup_async_read(&state->child->event, 00229 &state->response->result, 00230 sizeof(state->response->result), 00231 async_reply_recv, state); 00232 00233 /* 00234 * Set up a timeout of 300 seconds for the response. 00235 * If we don't get it close the child socket and 00236 * report failure. 00237 */ 00238 00239 state->reply_timeout_event = event_add_timed(winbind_event_context(), 00240 NULL, 00241 timeval_current_ofs(300,0), 00242 "async_request_timeout", 00243 async_request_timeout_handler, 00244 state); 00245 if (!state->reply_timeout_event) { 00246 smb_panic("async_request_sent: failed to add timeout handler.\n"); 00247 } 00248 }
static void async_reply_recv | ( | void * | private_data, | |
BOOL | success | |||
) | [static] |
winbindd_dual.c の 250 行で定義されています。
参照先 async_request_fail()・cache_cleanup_response()・cache_retrieve_response()・winbindd_async_request::child・winbindd_async_request::child_pid・winbindd_async_request::continuation・winbindd_response::length・winbindd_async_request::private_data・winbindd_async_request::reply_timeout_event・winbindd_child::requests・winbindd_async_request::response・schedule_async_request().
参照元 async_request_sent()・async_request_timeout_handler().
00251 { 00252 struct winbindd_async_request *state = 00253 talloc_get_type_abort(private_data, struct winbindd_async_request); 00254 struct winbindd_child *child = state->child; 00255 00256 TALLOC_FREE(state->reply_timeout_event); 00257 00258 state->response->length = sizeof(struct winbindd_response); 00259 00260 if (!success) { 00261 DEBUG(5, ("Could not receive async reply from child pid %u\n", 00262 (unsigned int)state->child_pid )); 00263 00264 cache_cleanup_response(state->child_pid); 00265 async_request_fail(state); 00266 return; 00267 } 00268 00269 SMB_ASSERT(cache_retrieve_response(state->child_pid, 00270 state->response)); 00271 00272 cache_cleanup_response(state->child_pid); 00273 00274 DLIST_REMOVE(child->requests, state); 00275 00276 schedule_async_request(child); 00277 00278 state->continuation(state->private_data, True); 00279 }
static void schedule_async_request | ( | struct winbindd_child * | child | ) | [static] |
winbindd_dual.c の 283 行で定義されています。
参照先 async_main_request_sent()・winbindd_async_request::child・winbindd_child::event・fd_event::flags・fork_domain_child()・winbindd_async_request::next・winbindd_child::pid・winbindd_async_request::request・winbindd_child::requests・setup_async_write().
参照元 async_reply_recv()・async_request().
00284 { 00285 struct winbindd_async_request *request = child->requests; 00286 00287 if (request == NULL) { 00288 return; 00289 } 00290 00291 if (child->event.flags != 0) { 00292 return; /* Busy */ 00293 } 00294 00295 if ((child->pid == 0) && (!fork_domain_child(child))) { 00296 /* Cancel all outstanding requests */ 00297 00298 while (request != NULL) { 00299 /* request might be free'd in the continuation */ 00300 struct winbindd_async_request *next = request->next; 00301 request->continuation(request->private_data, False); 00302 request = next; 00303 } 00304 return; 00305 } 00306 00307 /* Now we know who we're sending to - remember the pid. */ 00308 request->child_pid = child->pid; 00309 00310 setup_async_write(&child->event, request->request, 00311 sizeof(*request->request), 00312 async_main_request_sent, request); 00313 00314 return; 00315 }
void async_request | ( | TALLOC_CTX * | mem_ctx, | |
struct winbindd_child * | child, | |||
struct winbindd_request * | request, | |||
struct winbindd_response * | response, | |||
void(*)(void *private_data, BOOL success) | continuation, | |||
void * | private_data | |||
) |
winbindd_dual.c の 111 行で定義されています。
参照先 winbindd_async_request::child・winbindd_async_request::continuation・winbindd_async_request::mem_ctx・winbindd_async_request::private_data・winbindd_async_request::reply_timeout_event・winbindd_async_request::request・winbindd_child::requests・winbindd_async_request::response・schedule_async_request().
参照元 async_domain_request()・do_async()・domain_init_recv()・init_child_connection()・init_child_getdc_recv()・sendto_child().
00116 { 00117 struct winbindd_async_request *state; 00118 00119 SMB_ASSERT(continuation != NULL); 00120 00121 state = TALLOC_P(mem_ctx, struct winbindd_async_request); 00122 00123 if (state == NULL) { 00124 DEBUG(0, ("talloc failed\n")); 00125 continuation(private_data, False); 00126 return; 00127 } 00128 00129 state->mem_ctx = mem_ctx; 00130 state->child = child; 00131 state->reply_timeout_event = NULL; 00132 state->request = request; 00133 state->response = response; 00134 state->continuation = continuation; 00135 state->private_data = private_data; 00136 00137 DLIST_ADD_END(child->requests, state, struct winbindd_async_request *); 00138 00139 schedule_async_request(child); 00140 00141 return; 00142 }
static void async_request_timeout_handler | ( | struct event_context * | ctx, | |
struct timed_event * | te, | |||
const struct timeval * | now, | |||
void * | private_data | |||
) | [static] |
winbindd_dual.c の 170 行で定義されています。
参照先 async_reply_recv()・winbindd_async_request::child_pid.
参照元 async_request_sent().
00174 { 00175 struct winbindd_async_request *state = 00176 talloc_get_type_abort(private_data, struct winbindd_async_request); 00177 00178 DEBUG(0,("async_request_timeout_handler: child pid %u is not responding. " 00179 "Closing connection to it.\n", 00180 state->child_pid )); 00181 00182 /* Deal with the reply - set to error. */ 00183 async_reply_recv(private_data, False); 00184 }
static BOOL fork_domain_child | ( | struct winbindd_child * | child | ) | [static] |
winbindd_dual.c の 883 行で定義されています。
参照先 add_fd_event()・CatchChild()・winbindd_domain::check_online_event・winbindd_domain::child・child_msg_offline()・child_msg_online()・child_msg_onlinestatus()・children・close_conns_after_fork()・winbindd_child::domain・domain_list()・errno・winbindd_child::event・fd_event::fd・fd_event::flags・winbindd_child::logfilename・message_block()・message_deregister()・message_register()・message_unblock()・winbindd_domain::next・winbindd_child::next・override_logfile・winbindd_child::pid・winbindd_cli_state::pid・winbindd_child::prev・winbindd_domain::primary・reopen_logs()・winbindd_child::requests・winbindd_cli_state::sock・winbindd_domain::startup・winbindd_domain::startup_time・strerror()・sys_fork()・sys_getpid()・tdb_reopen_all().
00884 { 00885 int fdpair[2]; 00886 struct winbindd_cli_state state; 00887 struct winbindd_domain *domain; 00888 struct winbindd_domain *primary_domain = NULL; 00889 00890 if (socketpair(AF_UNIX, SOCK_STREAM, 0, fdpair) != 0) { 00891 DEBUG(0, ("Could not open child pipe: %s\n", 00892 strerror(errno))); 00893 return False; 00894 } 00895 00896 ZERO_STRUCT(state); 00897 state.pid = sys_getpid(); 00898 00899 /* Ensure we don't process messages whilst we're 00900 changing the disposition for the child. */ 00901 message_block(); 00902 00903 child->pid = sys_fork(); 00904 00905 if (child->pid == -1) { 00906 DEBUG(0, ("Could not fork: %s\n", strerror(errno))); 00907 message_unblock(); 00908 return False; 00909 } 00910 00911 if (child->pid != 0) { 00912 /* Parent */ 00913 close(fdpair[0]); 00914 child->next = child->prev = NULL; 00915 DLIST_ADD(children, child); 00916 child->event.fd = fdpair[1]; 00917 child->event.flags = 0; 00918 child->requests = NULL; 00919 add_fd_event(&child->event); 00920 /* We're ok with online/offline messages now. */ 00921 message_unblock(); 00922 return True; 00923 } 00924 00925 /* Child */ 00926 00927 /* Stop zombies in children */ 00928 CatchChild(); 00929 00930 state.sock = fdpair[0]; 00931 close(fdpair[1]); 00932 00933 /* tdb needs special fork handling */ 00934 if (tdb_reopen_all(1) == -1) { 00935 DEBUG(0,("tdb_reopen_all failed.\n")); 00936 _exit(0); 00937 } 00938 00939 close_conns_after_fork(); 00940 00941 if (!override_logfile) { 00942 lp_set_logfile(child->logfilename); 00943 reopen_logs(); 00944 } 00945 00946 /* Don't handle the same messages as our parent. */ 00947 message_deregister(MSG_SMB_CONF_UPDATED); 00948 message_deregister(MSG_SHUTDOWN); 00949 message_deregister(MSG_WINBIND_OFFLINE); 00950 message_deregister(MSG_WINBIND_ONLINE); 00951 message_deregister(MSG_WINBIND_ONLINESTATUS); 00952 00953 /* The child is ok with online/offline messages now. */ 00954 message_unblock(); 00955 00956 /* Handle online/offline messages. */ 00957 message_register(MSG_WINBIND_OFFLINE, child_msg_offline, NULL); 00958 message_register(MSG_WINBIND_ONLINE, child_msg_online, NULL); 00959 message_register(MSG_WINBIND_ONLINESTATUS, child_msg_onlinestatus, 00960 NULL); 00961 00962 if ( child->domain ) { 00963 child->domain->startup = True; 00964 child->domain->startup_time = time(NULL); 00965 } 00966 00967 /* Ensure we have no pending check_online events other 00968 than one for this domain or the primary domain. */ 00969 00970 for (domain = domain_list(); domain; domain = domain->next) { 00971 if (domain->primary) { 00972 primary_domain = domain; 00973 } 00974 if ((domain != child->domain) && !domain->primary) { 00975 TALLOC_FREE(domain->check_online_event); 00976 } 00977 } 00978 00979 /* Ensure we're not handling an event inherited from 00980 our parent. */ 00981 00982 cancel_named_event(winbind_event_context(), 00983 "krb5_ticket_refresh_handler"); 00984 00985 /* We might be in the idmap child...*/ 00986 if (child->domain && !(child->domain->internal) && 00987 lp_winbind_offline_logon()) { 00988 00989 set_domain_online_request(child->domain); 00990 00991 if (primary_domain != child->domain) { 00992 /* We need to talk to the primary 00993 * domain as well as the trusted 00994 * domain inside a trusted domain 00995 * child. 00996 * See the code in : 00997 * winbindd_dual_pam_auth_samlogon() 00998 * especially the calling of 00999 * contact_domain = find_our_domain() 01000 * in the non-DC case for details. 01001 */ 01002 set_domain_online_request(primary_domain); 01003 } 01004 01005 child->lockout_policy_event = event_add_timed( 01006 winbind_event_context(), NULL, timeval_zero(), 01007 "account_lockout_policy_handler", 01008 account_lockout_policy_handler, 01009 child); 01010 } 01011 01012 while (1) { 01013 01014 int ret; 01015 fd_set read_fds; 01016 struct timeval t; 01017 struct timeval *tp; 01018 struct timeval now; 01019 01020 /* free up any talloc memory */ 01021 lp_TALLOC_FREE(); 01022 main_loop_TALLOC_FREE(); 01023 01024 /* check for signals */ 01025 winbind_check_sigterm(false); 01026 winbind_check_sighup(override_logfile ? NULL : 01027 child->logfilename); 01028 01029 run_events(winbind_event_context(), 0, NULL, NULL); 01030 01031 GetTimeOfDay(&now); 01032 01033 if (child->domain && child->domain->startup && 01034 (now.tv_sec > child->domain->startup_time + 30)) { 01035 /* No longer in "startup" mode. */ 01036 DEBUG(10,("fork_domain_child: domain %s no longer in 'startup' mode.\n", 01037 child->domain->name )); 01038 child->domain->startup = False; 01039 } 01040 01041 tp = get_timed_events_timeout(winbind_event_context(), &t); 01042 if (tp) { 01043 DEBUG(11,("select will use timeout of %u.%u seconds\n", 01044 (unsigned int)tp->tv_sec, (unsigned int)tp->tv_usec )); 01045 } 01046 01047 /* Handle messages */ 01048 01049 message_dispatch(); 01050 01051 FD_ZERO(&read_fds); 01052 FD_SET(state.sock, &read_fds); 01053 01054 ret = sys_select(state.sock + 1, &read_fds, NULL, NULL, tp); 01055 01056 if (ret == 0) { 01057 DEBUG(11,("nothing is ready yet, continue\n")); 01058 continue; 01059 } 01060 01061 if (ret == -1 && errno == EINTR) { 01062 /* We got a signal - continue. */ 01063 continue; 01064 } 01065 01066 if (ret == -1 && errno != EINTR) { 01067 DEBUG(0,("select error occured\n")); 01068 perror("select"); 01069 return False; 01070 } 01071 01072 /* fetch a request from the main daemon */ 01073 child_read_request(&state); 01074 01075 if (state.finished) { 01076 /* we lost contact with our parent */ 01077 exit(0); 01078 } 01079 01080 DEBUG(4,("child daemon request %d\n", (int)state.request.cmd)); 01081 01082 ZERO_STRUCT(state.response); 01083 state.request.null_term = '\0'; 01084 child_process_request(child->domain, &state); 01085 01086 SAFE_FREE(state.request.extra_data.data); 01087 01088 cache_store_response(sys_getpid(), &state.response); 01089 01090 SAFE_FREE(state.response.extra_data.data); 01091 01092 /* We just send the result code back, the result 01093 * structure needs to be fetched via the 01094 * winbindd_cache. Hmm. That needs fixing... */ 01095 01096 if (write_data(state.sock, 01097 (const char *)&state.response.result, 01098 sizeof(state.response.result)) != 01099 sizeof(state.response.result)) { 01100 DEBUG(0, ("Could not write result\n")); 01101 exit(1); 01102 } 01103 } 01104 }
static void domain_init_recv | ( | void * | private_data_data, | |
BOOL | success | |||
) | [static] |
winbindd_dual.c の 395 行で定義されています。
参照先 async_request()・winbindd_domain::child・domain_request_state::continuation・domain_request_state::domain・domain_request_state::mem_ctx・domain_request_state::private_data_data・domain_request_state::request・domain_request_state::response.
00396 { 00397 struct domain_request_state *state = 00398 talloc_get_type_abort(private_data_data, struct domain_request_state); 00399 00400 if (!success) { 00401 DEBUG(5, ("Domain init returned an error\n")); 00402 state->continuation(state->private_data_data, False); 00403 return; 00404 } 00405 00406 async_request(state->mem_ctx, &state->domain->child, 00407 state->request, state->response, 00408 state->continuation, state->private_data_data); 00409 }
void async_domain_request | ( | TALLOC_CTX * | mem_ctx, | |
struct winbindd_domain * | domain, | |||
struct winbindd_request * | request, | |||
struct winbindd_response * | response, | |||
void(*)(void *private_data_data, BOOL success) | continuation, | |||
void * | private_data_data | |||
) |
winbindd_dual.c の 328 行で定義されています。
参照先 async_request()・winbindd_domain::child・domain_request_state::continuation・domain_request_state::domain・domain_init_recv()・init_child_connection()・winbindd_domain::initialized・domain_request_state::mem_ctx・domain_request_state::private_data_data・domain_request_state::request・domain_request_state::response.
参照元 add_trusted_domains()・do_async_domain()・init_child_connection()・sendto_domain()・sequence_recv()・winbindd_show_sequence().
00334 { 00335 struct domain_request_state *state; 00336 00337 if (domain->initialized) { 00338 async_request(mem_ctx, &domain->child, request, response, 00339 continuation, private_data_data); 00340 return; 00341 } 00342 00343 state = TALLOC_P(mem_ctx, struct domain_request_state); 00344 if (state == NULL) { 00345 DEBUG(0, ("talloc failed\n")); 00346 continuation(private_data_data, False); 00347 return; 00348 } 00349 00350 state->mem_ctx = mem_ctx; 00351 state->domain = domain; 00352 state->request = request; 00353 state->response = response; 00354 state->continuation = continuation; 00355 state->private_data_data = private_data_data; 00356 00357 init_child_connection(domain, domain_init_recv, state); 00358 }
static void recvfrom_child | ( | void * | private_data_data, | |
BOOL | success | |||
) | [static] |
winbindd_dual.c の 360 行で定義されています。
参照先 request_error()・request_ok()・winbindd_cli_state::response・winbindd_response::result・result・WINBINDD_OK・WINBINDD_PENDING.
参照元 sendto_child()・sendto_domain().
00361 { 00362 struct winbindd_cli_state *state = 00363 talloc_get_type_abort(private_data_data, struct winbindd_cli_state); 00364 enum winbindd_result result = state->response.result; 00365 00366 /* This is an optimization: The child has written directly to the 00367 * response buffer. The request itself is still in pending state, 00368 * state that in the result code. */ 00369 00370 state->response.result = WINBINDD_PENDING; 00371 00372 if ((!success) || (result != WINBINDD_OK)) { 00373 request_error(state); 00374 return; 00375 } 00376 00377 request_ok(state); 00378 }
void sendto_child | ( | struct winbindd_cli_state * | state, | |
struct winbindd_child * | child | |||
) |
winbindd_dual.c の 380 行で定義されています。
参照先 async_request()・winbindd_cli_state::mem_ctx・recvfrom_child()・winbindd_cli_state::request・winbindd_cli_state::response.
参照元 winbindd_allocate_gid()・winbindd_allocate_uid().
00382 { 00383 async_request(state->mem_ctx, child, &state->request, 00384 &state->response, recvfrom_child, state); 00385 }
void sendto_domain | ( | struct winbindd_cli_state * | state, | |
struct winbindd_domain * | domain | |||
) |
winbindd_dual.c の 387 行で定義されています。
参照先 async_domain_request()・winbindd_cli_state::mem_ctx・recvfrom_child()・winbindd_cli_state::request・winbindd_cli_state::response.
参照元 winbindd_ccache_ntlm_auth()・winbindd_check_machine_acct()・winbindd_getdcname()・winbindd_getuserdomgroups()・winbindd_list_trusted_domains()・winbindd_lookuprids()・winbindd_pam_auth()・winbindd_pam_auth_crap()・winbindd_pam_chauthtok()・winbindd_pam_chng_pswd_auth_crap()・winbindd_pam_logoff()・winbindd_show_sequence().
00389 { 00390 async_domain_request(state->mem_ctx, domain, 00391 &state->request, &state->response, 00392 recvfrom_child, state); 00393 }
static void child_process_request | ( | struct winbindd_domain * | domain, | |
struct winbindd_cli_state * | state | |||
) | [static] |
winbindd_dual.c の 458 行で定義されています。
参照先 child_dispatch_table・winbindd_child_dispatch_table::cmd・winbindd_request::cmd・winbindd_child_dispatch_table::fn・winbindd_response::length・winbindd_cli_state::mem_ctx・winbindd_cli_state::request・winbindd_cli_state::response・winbindd_response::result・talloc_init()・winbindd_child_dispatch_table::winbindd_cmd_name・WINBINDD_ERROR.
00460 { 00461 struct winbindd_child_dispatch_table *table; 00462 00463 /* Free response data - we may be interrupted and receive another 00464 command before being able to send this data off. */ 00465 00466 state->response.result = WINBINDD_ERROR; 00467 state->response.length = sizeof(struct winbindd_response); 00468 00469 state->mem_ctx = talloc_init("winbind request"); 00470 if (state->mem_ctx == NULL) 00471 return; 00472 00473 /* Process command */ 00474 00475 for (table = child_dispatch_table; table->fn; table++) { 00476 if (state->request.cmd == table->cmd) { 00477 DEBUG(10,("process_request: request fn %s\n", 00478 table->winbindd_cmd_name )); 00479 state->response.result = table->fn(domain, state); 00480 break; 00481 } 00482 } 00483 00484 if (!table->fn) { 00485 DEBUG(10,("process_request: unknown request fn number %d\n", 00486 (int)state->request.cmd )); 00487 state->response.result = WINBINDD_ERROR; 00488 } 00489 00490 talloc_destroy(state->mem_ctx); 00491 }
void setup_domain_child | ( | struct winbindd_domain * | domain, | |
struct winbindd_child * | child, | |||
const char * | explicit_logfile | |||
) |
winbindd_dual.c の 493 行で定義されています。
参照先 winbindd_child::domain・dyn_LOGFILEBASE・winbindd_child::logfilename・winbindd_domain::name・pstr_sprintf()・smb_panic().
参照元 init_domain_list()・init_idmap_child()・trustdom_recv().
00496 { 00497 if (explicit_logfile != NULL) { 00498 pstr_sprintf(child->logfilename, "%s/winbindd-%s.log", 00499 dyn_LOGFILEBASE, explicit_logfile); 00500 } else if (domain != NULL) { 00501 pstr_sprintf(child->logfilename, "%s/wb-%s.log", 00502 dyn_LOGFILEBASE, domain->name); 00503 } else { 00504 smb_panic("Internal error: domain == NULL && " 00505 "explicit_logfile == NULL"); 00506 } 00507 00508 child->domain = domain; 00509 }
void winbind_child_died | ( | pid_t | pid | ) |
winbindd_dual.c の 513 行で定義されています。
参照先 children・winbindd_child::next・winbindd_child::pid.
参照元 async_request_fail().
00514 { 00515 struct winbindd_child *child; 00516 00517 for (child = children; child != NULL; child = child->next) { 00518 if (child->pid == pid) { 00519 break; 00520 } 00521 } 00522 00523 if (child == NULL) { 00524 DEBUG(5, ("Already reaped child %u died\n", (unsigned int)pid)); 00525 return; 00526 } 00527 00528 /* This will be re-added in fork_domain_child() */ 00529 00530 DLIST_REMOVE(children, child); 00531 00532 remove_fd_event(&child->event); 00533 close(child->event.fd); 00534 child->event.fd = 0; 00535 child->event.flags = 0; 00536 child->pid = 0; 00537 00538 schedule_async_request(child); 00539 }
void winbindd_flush_negative_conn_cache | ( | struct winbindd_domain * | domain | ) |
winbindd_dual.c の 543 行で定義されています。
参照先 winbindd_domain::alt_name・winbindd_child::domain・flush_negative_conn_cache_for_domain()・winbindd_domain::name.
参照元 child_msg_online()・winbind_msg_online()・winbindd_dual_pam_auth().
00544 { 00545 flush_negative_conn_cache_for_domain(domain->name); 00546 if (*domain->alt_name) { 00547 flush_negative_conn_cache_for_domain(domain->alt_name); 00548 } 00549 }
void winbind_msg_offline | ( | int | msg_type, | |
struct process_id | src, | |||
void * | buf, | |||
size_t | len, | |||
void * | private_data | |||
) |
winbindd_dual.c の 553 行で定義されています。
参照先 winbindd_child::domain・domain_list()・idmap_child()・winbindd_domain::internal・message_send_pid()・winbindd_domain::name・winbindd_domain::next・winbindd_child::pid・pid_to_procid()・winbindd_domain::primary・set_domain_offline()・set_global_winbindd_state_offline().
参照元 main().
00555 { 00556 struct winbindd_child *child; 00557 struct winbindd_domain *domain; 00558 00559 DEBUG(10,("winbind_msg_offline: got offline message.\n")); 00560 00561 if (!lp_winbind_offline_logon()) { 00562 DEBUG(10,("winbind_msg_offline: rejecting offline message.\n")); 00563 return; 00564 } 00565 00566 /* Set our global state as offline. */ 00567 if (!set_global_winbindd_state_offline()) { 00568 DEBUG(10,("winbind_msg_offline: offline request failed.\n")); 00569 return; 00570 } 00571 00572 /* Set all our domains as offline. */ 00573 for (domain = domain_list(); domain; domain = domain->next) { 00574 if (domain->internal) { 00575 continue; 00576 } 00577 DEBUG(5,("winbind_msg_offline: marking %s offline.\n", domain->name)); 00578 set_domain_offline(domain); 00579 00580 /* Send an offline message to the idmap child when our 00581 primary domain goes offline */ 00582 00583 if ( domain->primary ) { 00584 struct winbindd_child *idmap = idmap_child(); 00585 00586 if ( idmap->pid != 0 ) { 00587 message_send_pid(pid_to_procid(idmap->pid), 00588 MSG_WINBIND_OFFLINE, 00589 domain->name, 00590 strlen(domain->name)+1, 00591 False); 00592 } 00593 } 00594 } 00595 00596 for (child = children; child != NULL; child = child->next) { 00597 /* Don't send message to idmap child. We've already 00598 done so above. */ 00599 if (!child->domain || (child == idmap_child())) { 00600 continue; 00601 } 00602 00603 /* Or internal domains (this should not be possible....) */ 00604 if (child->domain->internal) { 00605 continue; 00606 } 00607 00608 /* Each winbindd child should only process requests for one domain - make sure 00609 we only set it online / offline for that domain. */ 00610 00611 DEBUG(10,("winbind_msg_offline: sending message to pid %u for domain %s.\n", 00612 (unsigned int)child->pid, domain->name )); 00613 00614 message_send_pid(pid_to_procid(child->pid), MSG_WINBIND_OFFLINE, child->domain->name, 00615 strlen(child->domain->name)+1, False); 00616 } 00617 }
void winbind_msg_online | ( | int | msg_type, | |
struct process_id | src, | |||
void * | buf, | |||
size_t | len, | |||
void * | private_data | |||
) |
winbindd_dual.c の 621 行で定義されています。
参照先 winbindd_child::domain・domain_list()・idmap_child()・winbindd_domain::internal・message_send_pid()・winbindd_domain::name・winbindd_domain::next・winbindd_child::pid・pid_to_procid()・winbindd_domain::primary・set_domain_online_request()・set_global_winbindd_state_online()・smb_nscd_flush_group_cache()・smb_nscd_flush_user_cache()・winbindd_flush_negative_conn_cache().
参照元 main().
00623 { 00624 struct winbindd_child *child; 00625 struct winbindd_domain *domain; 00626 00627 DEBUG(10,("winbind_msg_online: got online message.\n")); 00628 00629 if (!lp_winbind_offline_logon()) { 00630 DEBUG(10,("winbind_msg_online: rejecting online message.\n")); 00631 return; 00632 } 00633 00634 /* Set our global state as online. */ 00635 set_global_winbindd_state_online(); 00636 00637 smb_nscd_flush_user_cache(); 00638 smb_nscd_flush_group_cache(); 00639 00640 /* Set all our domains as online. */ 00641 for (domain = domain_list(); domain; domain = domain->next) { 00642 if (domain->internal) { 00643 continue; 00644 } 00645 DEBUG(5,("winbind_msg_online: requesting %s to go online.\n", domain->name)); 00646 00647 winbindd_flush_negative_conn_cache(domain); 00648 set_domain_online_request(domain); 00649 00650 /* Send an online message to the idmap child when our 00651 primary domain comes back online */ 00652 00653 if ( domain->primary ) { 00654 struct winbindd_child *idmap = idmap_child(); 00655 00656 if ( idmap->pid != 0 ) { 00657 message_send_pid(pid_to_procid(idmap->pid), 00658 MSG_WINBIND_ONLINE, 00659 domain->name, 00660 strlen(domain->name)+1, 00661 False); 00662 } 00663 00664 } 00665 } 00666 00667 for (child = children; child != NULL; child = child->next) { 00668 /* Don't send message to idmap child. */ 00669 if (!child->domain || (child == idmap_child())) { 00670 continue; 00671 } 00672 00673 /* Or internal domains (this should not be possible....) */ 00674 if (child->domain->internal) { 00675 continue; 00676 } 00677 00678 /* Each winbindd child should only process requests for one domain - make sure 00679 we only set it online / offline for that domain. */ 00680 00681 DEBUG(10,("winbind_msg_online: sending message to pid %u for domain %s.\n", 00682 (unsigned int)child->pid, child->domain->name )); 00683 00684 message_send_pid(pid_to_procid(child->pid), MSG_WINBIND_ONLINE, child->domain->name, 00685 strlen(child->domain->name)+1, False); 00686 } 00687 }
void winbind_msg_onlinestatus | ( | int | msg_type, | |
struct process_id | src, | |||
void * | buf, | |||
size_t | len, | |||
void * | private_data | |||
) |
winbindd_dual.c の 690 行で定義されています。
参照先 children・winbindd_child::domain・message_send_pid()・winbindd_child::next・winbindd_child::pid・pid_to_procid()・winbindd_domain::primary.
参照元 main().
00692 { 00693 struct winbindd_child *child; 00694 00695 DEBUG(10,("winbind_msg_onlinestatus: got onlinestatus message.\n")); 00696 00697 for (child = children; child != NULL; child = child->next) { 00698 if (child->domain && child->domain->primary) { 00699 DEBUG(10,("winbind_msg_onlinestatus: " 00700 "sending message to pid %u of primary domain.\n", 00701 (unsigned int)child->pid)); 00702 message_send_pid(pid_to_procid(child->pid), 00703 MSG_WINBIND_ONLINESTATUS, buf, len, False); 00704 break; 00705 } 00706 } 00707 }
static void account_lockout_policy_handler | ( | struct event_context * | ctx, | |
struct timed_event * | te, | |||
const struct timeval * | now, | |||
void * | private_data | |||
) | [static] |
winbindd_dual.c の 710 行で定義されています。
参照先 winbindd_child::domain・event_add_timed()・lockout_policy()・winbindd_child::lockout_policy_event・winbindd_domain::methods・methods・nt_errstr()・result・talloc_init()・timeval_current_ofs()・winbind_event_context().
00714 { 00715 struct winbindd_child *child = 00716 (struct winbindd_child *)private_data; 00717 TALLOC_CTX *mem_ctx = NULL; 00718 struct winbindd_methods *methods; 00719 SAM_UNK_INFO_12 lockout_policy; 00720 NTSTATUS result; 00721 00722 DEBUG(10,("account_lockout_policy_handler called\n")); 00723 00724 TALLOC_FREE(child->lockout_policy_event); 00725 00726 methods = child->domain->methods; 00727 00728 mem_ctx = talloc_init("account_lockout_policy_handler ctx"); 00729 if (!mem_ctx) { 00730 result = NT_STATUS_NO_MEMORY; 00731 } else { 00732 result = methods->lockout_policy(child->domain, mem_ctx, &lockout_policy); 00733 } 00734 00735 talloc_destroy(mem_ctx); 00736 00737 if (!NT_STATUS_IS_OK(result)) { 00738 DEBUG(10,("account_lockout_policy_handler: lockout_policy failed error %s\n", 00739 nt_errstr(result))); 00740 } 00741 00742 child->lockout_policy_event = event_add_timed(winbind_event_context(), NULL, 00743 timeval_current_ofs(3600, 0), 00744 "account_lockout_policy_handler", 00745 account_lockout_policy_handler, 00746 child); 00747 }
static void child_msg_offline | ( | int | msg_type, | |
struct process_id | src, | |||
void * | buf, | |||
size_t | len, | |||
void * | private_data | |||
) | [static] |
winbindd_dual.c の 751 行で定義されています。
参照先 domain_list()・winbindd_domain::internal・winbindd_domain::name・winbindd_domain::next・set_domain_offline()・set_global_winbindd_state_offline()・strequal().
参照元 fork_domain_child().
00753 { 00754 struct winbindd_domain *domain; 00755 const char *domainname = (const char *)buf; 00756 00757 if (buf == NULL || len == 0) { 00758 return; 00759 } 00760 00761 DEBUG(5,("child_msg_offline received for domain %s.\n", domainname)); 00762 00763 if (!lp_winbind_offline_logon()) { 00764 DEBUG(10,("child_msg_offline: rejecting offline message.\n")); 00765 return; 00766 } 00767 00768 /* Set our global state as offline. */ 00769 if (!set_global_winbindd_state_offline()) { 00770 DEBUG(10,("child_msg_offline: offline request failed.\n")); 00771 return; 00772 } 00773 00774 /* Mark the requested domain offline. */ 00775 00776 for (domain = domain_list(); domain; domain = domain->next) { 00777 if (domain->internal) { 00778 continue; 00779 } 00780 if (strequal(domain->name, domainname)) { 00781 DEBUG(5,("child_msg_offline: marking %s offline.\n", domain->name)); 00782 set_domain_offline(domain); 00783 } 00784 } 00785 }
static void child_msg_online | ( | int | msg_type, | |
struct process_id | src, | |||
void * | buf, | |||
size_t | len, | |||
void * | private_data | |||
) | [static] |
winbindd_dual.c の 789 行で定義されています。
参照先 domain_list()・winbindd_domain::internal・winbindd_domain::name・winbindd_domain::next・set_domain_online_request()・set_global_winbindd_state_online()・strequal()・winbindd_flush_negative_conn_cache().
参照元 fork_domain_child().
00791 { 00792 struct winbindd_domain *domain; 00793 const char *domainname = (const char *)buf; 00794 00795 if (buf == NULL || len == 0) { 00796 return; 00797 } 00798 00799 DEBUG(5,("child_msg_online received for domain %s.\n", domainname)); 00800 00801 if (!lp_winbind_offline_logon()) { 00802 DEBUG(10,("child_msg_online: rejecting online message.\n")); 00803 return; 00804 } 00805 00806 /* Set our global state as online. */ 00807 set_global_winbindd_state_online(); 00808 00809 /* Try and mark everything online - delete any negative cache entries 00810 to force a reconnect now. */ 00811 00812 for (domain = domain_list(); domain; domain = domain->next) { 00813 if (domain->internal) { 00814 continue; 00815 } 00816 if (strequal(domain->name, domainname)) { 00817 DEBUG(5,("child_msg_online: requesting %s to go online.\n", domain->name)); 00818 winbindd_flush_negative_conn_cache(domain); 00819 set_domain_online_request(domain); 00820 } 00821 } 00822 }
static const char* collect_onlinestatus | ( | TALLOC_CTX * | mem_ctx | ) | [static] |
winbindd_dual.c の 824 行で定義されています。
参照先 buf・domain_list()・get_global_winbindd_state_offline()・winbindd_domain::name・winbindd_domain::next・winbindd_domain::online・talloc_asprintf()・talloc_asprintf_append().
00825 { 00826 struct winbindd_domain *domain; 00827 char *buf = NULL; 00828 00829 if ((buf = talloc_asprintf(mem_ctx, "global:%s ", 00830 get_global_winbindd_state_offline() ? 00831 "Offline":"Online")) == NULL) { 00832 return NULL; 00833 } 00834 00835 for (domain = domain_list(); domain; domain = domain->next) { 00836 if ((buf = talloc_asprintf_append(buf, "%s:%s ", 00837 domain->name, 00838 domain->online ? 00839 "Online":"Offline")) == NULL) { 00840 return NULL; 00841 } 00842 } 00843 00844 buf = talloc_asprintf_append(buf, "\n"); 00845 00846 DEBUG(5,("collect_onlinestatus: %s", buf)); 00847 00848 return buf; 00849 }
static void child_msg_onlinestatus | ( | int | msg_type, | |
struct process_id | src, | |||
void * | buf, | |||
size_t | len, | |||
void * | private_data | |||
) | [static] |
winbindd_dual.c の 851 行で定義されています。
参照先 collect_onlinestatus()・message・message_send_pid()・talloc_init().
参照元 fork_domain_child().
00853 { 00854 TALLOC_CTX *mem_ctx; 00855 const char *message; 00856 struct process_id *sender; 00857 00858 DEBUG(5,("winbind_msg_onlinestatus received.\n")); 00859 00860 if (!buf) { 00861 return; 00862 } 00863 00864 sender = (struct process_id *)buf; 00865 00866 mem_ctx = talloc_init("winbind_msg_onlinestatus"); 00867 if (mem_ctx == NULL) { 00868 return; 00869 } 00870 00871 message = collect_onlinestatus(mem_ctx); 00872 if (message == NULL) { 00873 talloc_destroy(mem_ctx); 00874 return; 00875 } 00876 00877 message_send_pid(*sender, MSG_WINBIND_ONLINESTATUS, 00878 message, strlen(message) + 1, True); 00879 00880 talloc_destroy(mem_ctx); 00881 }
struct winbindd_child_dispatch_table child_dispatch_table[] [static] |
struct winbindd_child* children = NULL |