diff options
author | Gerald Carter <jerry@samba.org> | 2005-08-16 21:15:41 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 11:00:33 -0500 |
commit | b2bfa0c775a321764c6c58e07d8ad2ac0763eec0 (patch) | |
tree | d748264bcefc24ea90c71d6f595c04b411140f5b /source3/nsswitch | |
parent | 5cb0c45cba6a1696801595e02337edf58d7d5c05 (diff) | |
download | samba-b2bfa0c775a321764c6c58e07d8ad2ac0763eec0.tar.gz samba-b2bfa0c775a321764c6c58e07d8ad2ac0763eec0.tar.bz2 samba-b2bfa0c775a321764c6c58e07d8ad2ac0763eec0.zip |
r9330: Remove the classic dual daemon since it was not being used.
It was already gone in trunk anyways.
working on fixing BUG 3000 which does work now but we are flying
without a cache.
(This used to be commit 4936d6d8b28edc59a3d17defcdf255ea6e0ba4e0)
Diffstat (limited to 'source3/nsswitch')
-rw-r--r-- | source3/nsswitch/winbindd.c | 46 | ||||
-rw-r--r-- | source3/nsswitch/winbindd_cache.c | 15 | ||||
-rw-r--r-- | source3/nsswitch/winbindd_dual.c | 180 |
3 files changed, 3 insertions, 238 deletions
diff --git a/source3/nsswitch/winbindd.c b/source3/nsswitch/winbindd.c index dec52088f8..43bd5ed450 100644 --- a/source3/nsswitch/winbindd.c +++ b/source3/nsswitch/winbindd.c @@ -27,7 +27,6 @@ #include "winbindd.h" BOOL opt_nocache = False; -BOOL opt_dual_daemon = True; static BOOL interactive = False; extern BOOL override_logfile; @@ -139,12 +138,6 @@ static void print_winbindd_status(void) static void flush_caches(void) { -#if 0 - /* Clear cached user and group enumation info */ - if (!opt_dual_daemon) /* Until we have coherent cache flush. */ - wcache_flush_cache(); -#endif - /* We need to invalidate cached user list entries on a SIGHUP otherwise cached access denied errors due to restrict anonymous hang around until the sequence number changes. */ @@ -692,30 +685,6 @@ static BOOL remove_idle_client(void) return False; } -/* Process a complete received packet from a client */ - -void winbind_process_packet(struct winbindd_cli_state *state) -{ - /* Process request */ - - /* Ensure null termination of entire request */ - state->request.null_term = '\0'; - - state->pid = state->request.pid; - - process_request(state); - - /* Update client state */ - - state->read_buf_len = 0; - state->write_buf_len = sizeof(struct winbindd_response); - - /* we might need to send it to the dual daemon */ - if (opt_dual_daemon) { - dual_send_request(state); - } -} - /* Process incoming clients on listen_sock. We use a tricky non-blocking, non-forking, non-threaded model which allows us to handle many simultaneous connections while remaining impervious to many denial of @@ -764,10 +733,6 @@ static void process_loop(void) timeout.tv_sec = WINBINDD_ESTABLISH_LOOP; timeout.tv_usec = 0; - if (opt_dual_daemon) { - maxfd = dual_select_setup(&w_fds, maxfd); - } - /* Set up client readers and writers */ state = winbindd_client_list(); @@ -811,12 +776,6 @@ static void process_loop(void) exit(1); } - /* Create a new connection if listen_sock readable */ - - if (opt_dual_daemon) { - dual_select(&w_fds); - } - ev = fd_events; while (ev != NULL) { struct fd_event *next = ev->next; @@ -917,7 +876,6 @@ int main(int argc, char **argv) { "stdout", 'S', POPT_ARG_VAL, &log_stdout, True, "Log to stdout" }, { "foreground", 'F', POPT_ARG_VAL, &Fork, False, "Daemon in foreground mode" }, { "interactive", 'i', POPT_ARG_NONE, NULL, 'i', "Interactive mode" }, - { "single-daemon", 'Y', POPT_ARG_VAL, &opt_dual_daemon, False, "Single daemon mode" }, { "no-caching", 'n', POPT_ARG_VAL, &opt_nocache, True, "Disable caching" }, POPT_COMMON_SAMBA POPT_TABLEEND @@ -1048,10 +1006,6 @@ int main(int argc, char **argv) setpgid( (pid_t)0, (pid_t)0); #endif - if (opt_dual_daemon) { - do_dual_daemon(); - } - /* Initialise messaging system */ if (!message_init()) { diff --git a/source3/nsswitch/winbindd_cache.c b/source3/nsswitch/winbindd_cache.c index c4eab0be96..27fe6192da 100644 --- a/source3/nsswitch/winbindd_cache.c +++ b/source3/nsswitch/winbindd_cache.c @@ -469,21 +469,12 @@ static struct cache_entry *wcache_fetch(struct winbind_cache *cache, centry->sequence_number = centry_uint32(centry); if (centry_expired(domain, kstr, centry)) { - extern BOOL opt_dual_daemon; - DEBUG(10,("wcache_fetch: entry %s expired for domain %s\n", kstr, domain->name )); - if (opt_dual_daemon) { - extern BOOL background_process; - background_process = True; - DEBUG(10,("wcache_fetch: background processing expired entry %s for domain %s\n", - kstr, domain->name )); - } else { - centry_free(centry); - free(kstr); - return NULL; - } + centry_free(centry); + free(kstr); + return NULL; } DEBUG(10,("wcache_fetch: returning entry %s for domain %s\n", diff --git a/source3/nsswitch/winbindd_dual.c b/source3/nsswitch/winbindd_dual.c index 46b3ce2258..d4bcf4e384 100644 --- a/source3/nsswitch/winbindd_dual.c +++ b/source3/nsswitch/winbindd_dual.c @@ -36,22 +36,6 @@ #undef DBGC_CLASS #define DBGC_CLASS DBGC_WINBIND -extern BOOL opt_dual_daemon; -BOOL background_process = False; -int dual_daemon_pipe = -1; - - -/* a list of requests ready to be sent to the dual daemon */ -struct dual_list { - struct dual_list *next; - char *data; - int length; - int offset; -}; - -static struct dual_list *dual_list; -static struct dual_list *dual_list_end; - /* Read some data from a client connection */ static void dual_client_read(struct winbindd_cli_state *state) @@ -86,167 +70,6 @@ static void dual_client_read(struct winbindd_cli_state *state) } /* - setup a select() including the dual daemon pipe - */ -int dual_select_setup(fd_set *fds, int maxfd) -{ - if (dual_daemon_pipe == -1 || - !dual_list) { - return maxfd; - } - - FD_SET(dual_daemon_pipe, fds); - if (dual_daemon_pipe > maxfd) { - maxfd = dual_daemon_pipe; - } - return maxfd; -} - - -/* - a hook called from the main winbindd select() loop to handle writes - to the dual daemon pipe -*/ -void dual_select(fd_set *fds) -{ - int n; - - if (dual_daemon_pipe == -1 || - !dual_list || - !FD_ISSET(dual_daemon_pipe, fds)) { - return; - } - - n = sys_write(dual_daemon_pipe, - &dual_list->data[dual_list->offset], - dual_list->length - dual_list->offset); - - if (n <= 0) { - /* the pipe is dead! fall back to normal operation */ - dual_daemon_pipe = -1; - return; - } - - dual_list->offset += n; - - if (dual_list->offset == dual_list->length) { - struct dual_list *next; - next = dual_list->next; - free(dual_list->data); - free(dual_list); - dual_list = next; - if (!dual_list) { - dual_list_end = NULL; - } - } -} - -/* - send a request to the background daemon - this is called for stale cached entries -*/ -void dual_send_request(struct winbindd_cli_state *state) -{ - struct dual_list *list; - - if (!background_process) return; - - list = SMB_MALLOC_P(struct dual_list); - if (!list) return; - - list->next = NULL; - list->data = memdup(&state->request, sizeof(state->request)); - list->length = sizeof(state->request); - list->offset = 0; - - if (!dual_list_end) { - dual_list = list; - dual_list_end = list; - } else { - dual_list_end->next = list; - dual_list_end = list; - } - - background_process = False; -} - - -/* -the main dual daemon -*/ -void do_dual_daemon(void) -{ - int fdpair[2]; - struct winbindd_cli_state state; - - if (pipe(fdpair) != 0) { - return; - } - - ZERO_STRUCT(state); - state.pid = getpid(); - - dual_daemon_pipe = fdpair[1]; - state.sock = fdpair[0]; - - if (sys_fork() != 0) { - close(fdpair[0]); - return; - } - close(fdpair[1]); - - /* tdb needs special fork handling */ - if (tdb_reopen_all() == -1) { - DEBUG(0,("tdb_reopen_all failed.\n")); - _exit(0); - } - - dual_daemon_pipe = -1; - opt_dual_daemon = False; - - while (1) { - /* free up any talloc memory */ - lp_talloc_free(); - main_loop_talloc_free(); - - /* fetch a request from the main daemon */ - dual_client_read(&state); - - if (state.finished) { - /* we lost contact with our parent */ - exit(0); - } - - /* process full rquests */ - if (state.read_buf_len == sizeof(state.request)) { - DEBUG(4,("dual daemon request %d\n", (int)state.request.cmd)); - - /* special handling for the stateful requests */ - switch (state.request.cmd) { - case WINBINDD_GETPWENT: - winbindd_setpwent(&state); - break; - - case WINBINDD_GETGRENT: - case WINBINDD_GETGRLST: - winbindd_setgrent(&state); - break; - default: - break; - } - - winbind_process_packet(&state); - SAFE_FREE(state.response.extra_data); - - free_getent_state(state.getpwent_state); - free_getent_state(state.getgrent_state); - state.getpwent_state = NULL; - state.getgrent_state = NULL; - } - } -} - -/* * Machinery for async requests sent to children. You set up a * winbindd_request, select a child to query, and issue a async_request * call. When the request is completed, the callback function you specified is @@ -645,9 +468,6 @@ static BOOL fork_domain_child(struct winbindd_child *child) reopen_logs(); } - dual_daemon_pipe = -1; - opt_dual_daemon = False; - while (1) { /* free up any talloc memory */ lp_talloc_free(); |