[SCM] Samba Shared Repository - branch master updated
Andrew Bartlett
abartlet at samba.org
Wed May 12 19:28:09 MDT 2010
The branch, master has been updated
via 72e65a0... s3:winbindd Provide a winbindd_register_handlers() helper function for s3compat
via f5c0f90... s3:winbindd Split helper functions to allow s3compat to call them
via 7f70b53... s3:Winbindd Move winbindd_event_context to a different file
via cdf0704... s3:winbindd Rename 'children' to 'winbindd_children' and make static
via 4ef847a... s3:libsmb/namecache Remove namecache_enable()
via 426d92e... s3:smbd Remove calls to namecache_enable()
via 82fb4eb... s3:winbindd Remove call to namecache_enable().
via 468fb4f... s3:auth Make get_ntlm_challenge more like Samba4
from 1101c62... Pass more SMB2 oplock tests. Only oplock stream tests left to fix.
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 72e65a05213e857b4aaef9951df318c10e9774ae
Author: Andrew Bartlett <abartlet at samba.org>
Date: Tue May 11 21:37:30 2010 +1000
s3:winbindd Provide a winbindd_register_handlers() helper function for s3compat
This function provides a useful entry point for s3compat to set things
up in winbindd.
Andrew Bartlett
commit f5c0f90da5f5372ca6b7a72daa8d073a2444a068
Author: Andrew Bartlett <abartlet at samba.org>
Date: Tue May 11 21:31:18 2010 +1000
s3:winbindd Split helper functions to allow s3compat to call them
This provides a more useful entry point for s3compat.
Andrew Bartlett
commit 7f70b53dd65941ad7c2153947e3c6ea13b28b281
Author: Andrew Bartlett <abartlet at samba.org>
Date: Tue May 11 20:24:42 2010 +1000
s3:Winbindd Move winbindd_event_context to a different file
This allows this function to be easily replaced in s3compat
Andrew Bartlett
commit cdf07042728efc2d2bfeb56d1a8cdecc516a2411
Author: Andrew Bartlett <abartlet at samba.org>
Date: Tue May 11 20:22:06 2010 +1000
s3:winbindd Rename 'children' to 'winbindd_children' and make static
commit 4ef847a3b7031147711751f96e002f120bb05f04
Author: Andrew Bartlett <abartlet at samba.org>
Date: Tue May 11 10:04:30 2010 +1000
s3:libsmb/namecache Remove namecache_enable()
No caller honours the return value, and this call only prints a
DEBUG(). Removing this reduces the number of initialisation
boilerplate calls s3compat has to make.
Andrew Bartlett
commit 426d92eedbe002624ab8553d23ec9ea1465acefa
Author: Andrew Bartlett <abartlet at samba.org>
Date: Tue May 11 10:02:52 2010 +1000
s3:smbd Remove calls to namecache_enable()
This only prints a DEBUG()
Andrew Bartlett
commit 82fb4ebca761521bddf3a8a76b41b061569995e4
Author: Andrew Bartlett <abartlet at samba.org>
Date: Tue May 11 09:59:48 2010 +1000
s3:winbindd Remove call to namecache_enable().
This call only prints a DEBUG()
Andrew Bartlett
commit 468fb4fee49aa0cd1919fcd3803d2490e2ac568d
Author: Andrew Bartlett <abartlet at samba.org>
Date: Mon Dec 14 19:43:59 2009 +1100
s3:auth Make get_ntlm_challenge more like Samba4
This helps with the upcoming NTLMSSP merge, and allows errors to be returned.
Andrew Bartlett
-----------------------------------------------------------------------
Summary of changes:
source3/Makefile.in | 1 +
source3/auth/auth.c | 5 +-
source3/include/auth.h | 4 +-
source3/libsmb/namecache.c | 28 --
source3/smbd/server.c | 2 -
source3/winbindd/winbindd.c | 261 ++++++++++----------
source3/winbindd/winbindd_dual.c | 18 +-
.../{smbd/noquotas.c => winbindd/winbindd_event.c} | 32 ++--
source3/winbindd/winbindd_proto.h | 7 +-
9 files changed, 166 insertions(+), 192 deletions(-)
copy source3/{smbd/noquotas.c => winbindd/winbindd_event.c} (57%)
Changeset truncated at 500 lines:
diff --git a/source3/Makefile.in b/source3/Makefile.in
index 5e63602..06e288c 100644
--- a/source3/Makefile.in
+++ b/source3/Makefile.in
@@ -1155,6 +1155,7 @@ IDMAP_ADEX_OBJ = \
WINBINDD_OBJ1 = \
winbindd/winbindd.o \
+ winbindd/winbindd_event.o \
winbindd/winbindd_group.o \
winbindd/winbindd_util.o \
winbindd/winbindd_cache.o \
diff --git a/source3/auth/auth.c b/source3/auth/auth.c
index 317fe30..b4995ce 100644
--- a/source3/auth/auth.c
+++ b/source3/auth/auth.c
@@ -76,7 +76,7 @@ static struct auth_init_function_entry *auth_find_backend_entry(const char *name
Returns a const char of length 8 bytes.
****************************************************************************/
-static void get_ntlm_challenge(struct auth_context *auth_context,
+static NTSTATUS get_ntlm_challenge(struct auth_context *auth_context,
uint8_t chal[8])
{
DATA_BLOB challenge = data_blob_null;
@@ -87,7 +87,7 @@ static void get_ntlm_challenge(struct auth_context *auth_context,
DEBUG(5, ("get_ntlm_challenge (auth subsystem): returning previous challenge by module %s (normal)\n",
auth_context->challenge_set_by));
memcpy(chal, auth_context->challenge.data, 8);
- return;
+ return NT_STATUS_OK;
}
auth_context->challenge_may_be_modified = False;
@@ -138,6 +138,7 @@ static void get_ntlm_challenge(struct auth_context *auth_context,
auth_context->challenge_set_by=challenge_set_by;
memcpy(chal, auth_context->challenge.data, 8);
+ return NT_STATUS_OK;
}
diff --git a/source3/include/auth.h b/source3/include/auth.h
index efae56a..09ad631 100644
--- a/source3/include/auth.h
+++ b/source3/include/auth.h
@@ -91,8 +91,8 @@ struct auth_context {
/* What order are the various methods in? Try to stop it changing under us */
struct auth_methods *auth_method_list;
- void (*get_ntlm_challenge)(struct auth_context *auth_context,
- uint8_t chal[8]);
+ NTSTATUS (*get_ntlm_challenge)(struct auth_context *auth_context,
+ uint8_t chal[8]);
NTSTATUS (*check_ntlm_password)(const struct auth_context *auth_context,
const struct auth_usersupplied_info *user_info,
struct auth_serversupplied_info **server_info);
diff --git a/source3/libsmb/namecache.c b/source3/libsmb/namecache.c
index dcfc609..174ea1b 100644
--- a/source3/libsmb/namecache.c
+++ b/source3/libsmb/namecache.c
@@ -26,34 +26,6 @@
#define NBTKEY_FMT "NBT/%s#%02X"
/**
- * Initialise namecache system. Function calls gencache
- * initialisation function to perform necessary actions
- *
- * @return true upon successful initialisation of the cache or
- * false on failure
- **/
-
-bool namecache_enable(void)
-{
- /*
- * Check if name caching disabled by setting the name cache
- * timeout to zero.
- */
-
- if (lp_name_cache_timeout() == 0) {
- DEBUG(5, ("namecache_enable: disabling netbios name cache\n"));
- return False;
- }
-
- /* I leave it for now, though I don't think we really
- * need this (mimir, 27.09.2002) */
- DEBUG(5, ("namecache_enable: enabling netbios namecache, timeout %d "
- "seconds\n", lp_name_cache_timeout()));
-
- return True;
-}
-
-/**
* Generates a key for netbios name lookups on basis of
* netbios name and type.
* The caller must free returned key string when finished.
diff --git a/source3/smbd/server.c b/source3/smbd/server.c
index 5d4aca1..2c20750 100644
--- a/source3/smbd/server.c
+++ b/source3/smbd/server.c
@@ -1309,8 +1309,6 @@ extern void build_options(bool screen);
exit(1);
}
- namecache_enable();
-
if (!W_ERROR_IS_OK(registry_init_full()))
exit(1);
diff --git a/source3/winbindd/winbindd.c b/source3/winbindd/winbindd.c
index f651e60..1c87a14 100644
--- a/source3/winbindd/winbindd.c
+++ b/source3/winbindd/winbindd.c
@@ -37,16 +37,6 @@ static bool interactive = False;
extern bool override_logfile;
-struct event_context *winbind_event_context(void)
-{
- static struct event_context *ctx;
-
- if (!ctx && !(ctx = event_context_init(NULL))) {
- smb_panic("Could not init winbind event context");
- }
- return ctx;
-}
-
struct messaging_context *winbind_messaging_context(void)
{
static struct messaging_context *ctx;
@@ -773,40 +763,23 @@ void request_ok(struct winbindd_cli_state *state)
/* Process a new connection by adding it to the client connection list */
-static void new_connection(int listen_sock, bool privileged)
+void winbindd_accepted_new_connection(int accepted_sock, bool privileged)
{
- struct sockaddr_un sunaddr;
struct winbindd_cli_state *state;
struct tevent_req *req;
- socklen_t len;
- int sock;
-
- /* Accept connection */
-
- len = sizeof(sunaddr);
-
- do {
- sock = accept(listen_sock, (struct sockaddr *)(void *)&sunaddr,
- &len);
- } while (sock == -1 && errno == EINTR);
-
- if (sock == -1)
- return;
-
- DEBUG(6,("accepted socket %d\n", sock));
/* Create new connection structure */
if ((state = TALLOC_ZERO_P(NULL, struct winbindd_cli_state)) == NULL) {
- close(sock);
+ close(accepted_sock);
return;
}
- state->sock = sock;
+ state->sock = accepted_sock;
state->out_queue = tevent_queue_create(state, "winbind client reply");
if (state->out_queue == NULL) {
- close(sock);
+ close(accepted_sock);
TALLOC_FREE(state);
return;
}
@@ -819,16 +792,40 @@ static void new_connection(int listen_sock, bool privileged)
WINBINDD_MAX_EXTRA_DATA);
if (req == NULL) {
TALLOC_FREE(state);
- close(sock);
+ close(accepted_sock);
return;
}
tevent_req_set_callback(req, winbind_client_request_read, state);
/* Add to connection list */
+ /* Once the client is added here, we can be sure something will close it eventually */
winbindd_add_client(state);
}
+static void new_connection(int listen_sock, bool privileged)
+{
+ struct sockaddr_un sunaddr;
+ socklen_t len;
+ int sock;
+
+ /* Accept connection */
+
+ len = sizeof(sunaddr);
+
+ do {
+ sock = accept(listen_sock, (struct sockaddr *)(void *)&sunaddr,
+ &len);
+ } while (sock == -1 && errno == EINTR);
+
+ if (sock == -1)
+ return;
+
+ DEBUG(6,("accepted socket %d\n", sock));
+
+ winbindd_accepted_new_connection(sock, privileged);
+}
+
static void winbind_client_request_read(struct tevent_req *req)
{
struct winbindd_cli_state *state = tevent_req_callback_data(
@@ -1013,6 +1010,106 @@ bool winbindd_use_cache(void)
return !opt_nocache;
}
+void winbindd_register_handlers(void)
+{
+ struct tevent_timer *te;
+ /* Don't use winbindd_reinit_after_fork here as
+ * we're just starting up and haven't created any
+ * winbindd-specific resources we must free yet. JRA.
+ */
+
+ if (!NT_STATUS_IS_OK(reinit_after_fork(winbind_messaging_context(),
+ winbind_event_context(),
+ false))) {
+ DEBUG(0,("reinit_after_fork() failed\n"));
+ exit(1);
+ }
+
+ /* Setup signal handlers */
+
+ if (!winbindd_setup_sig_term_handler(true))
+ exit(1);
+ if (!winbindd_setup_sig_hup_handler(NULL))
+ exit(1);
+ if (!winbindd_setup_sig_chld_handler())
+ exit(1);
+ if (!winbindd_setup_sig_usr2_handler())
+ exit(1);
+
+ CatchSignal(SIGPIPE, SIG_IGN); /* Ignore sigpipe */
+
+ /*
+ * Ensure all cache and idmap caches are consistent
+ * and initialized before we startup.
+ */
+ if (!winbindd_cache_validate_and_initialize()) {
+ exit(1);
+ }
+
+ /* get broadcast messages */
+
+ if (!serverid_register_self(FLAG_MSG_GENERAL|FLAG_MSG_DBWRAP)) {
+ DEBUG(1, ("Could not register myself in serverid.tdb\n"));
+ exit(1);
+ }
+
+ /* React on 'smbcontrol winbindd reload-config' in the same way
+ as to SIGHUP signal */
+ messaging_register(winbind_messaging_context(), NULL,
+ MSG_SMB_CONF_UPDATED, msg_reload_services);
+ messaging_register(winbind_messaging_context(), NULL,
+ MSG_SHUTDOWN, msg_shutdown);
+
+ /* Handle online/offline messages. */
+ messaging_register(winbind_messaging_context(), NULL,
+ MSG_WINBIND_OFFLINE, winbind_msg_offline);
+ messaging_register(winbind_messaging_context(), NULL,
+ MSG_WINBIND_ONLINE, winbind_msg_online);
+ messaging_register(winbind_messaging_context(), NULL,
+ MSG_WINBIND_ONLINESTATUS, winbind_msg_onlinestatus);
+
+ messaging_register(winbind_messaging_context(), NULL,
+ MSG_DUMP_EVENT_LIST, winbind_msg_dump_event_list);
+
+ messaging_register(winbind_messaging_context(), NULL,
+ MSG_WINBIND_VALIDATE_CACHE,
+ winbind_msg_validate_cache);
+
+ messaging_register(winbind_messaging_context(), NULL,
+ MSG_WINBIND_DUMP_DOMAIN_LIST,
+ winbind_msg_dump_domain_list);
+
+ /* Register handler for MSG_DEBUG. */
+ messaging_register(winbind_messaging_context(), NULL,
+ MSG_DEBUG,
+ winbind_msg_debug);
+
+ netsamlogon_cache_init(); /* Non-critical */
+
+ /* clear the cached list of trusted domains */
+
+ wcache_tdc_clear();
+
+ if (!init_domain_list()) {
+ DEBUG(0,("unable to initialize domain list\n"));
+ exit(1);
+ }
+
+ init_idmap_child();
+ init_locator_child();
+
+ smb_nscd_flush_user_cache();
+ smb_nscd_flush_group_cache();
+
+ te = tevent_add_timer(winbind_event_context(), NULL, timeval_zero(),
+ rescan_trusted_domains, NULL);
+ if (te == NULL) {
+ DEBUG(0, ("Could not trigger rescan_trusted_domains()\n"));
+ exit(1);
+ }
+
+}
+
/* Main function */
int main(int argc, char **argv, char **envp)
@@ -1041,7 +1138,6 @@ int main(int argc, char **argv, char **envp)
poptContext pc;
int opt;
TALLOC_CTX *frame = talloc_stackframe();
- struct tevent_timer *te;
/* glibc (?) likes to print "User defined signal 1" and exit if a
SIGUSR[12] is received before a handler is installed */
@@ -1166,10 +1262,6 @@ int main(int argc, char **argv, char **envp)
return False;
}
- /* Enable netbios namecache */
-
- namecache_enable();
-
/* Unblock all signals we are interested in as they may have been
blocked by the parent process. */
@@ -1197,93 +1289,7 @@ int main(int argc, char **argv, char **envp)
TimeInit();
- /* Don't use winbindd_reinit_after_fork here as
- * we're just starting up and haven't created any
- * winbindd-specific resources we must free yet. JRA.
- */
-
- if (!NT_STATUS_IS_OK(reinit_after_fork(winbind_messaging_context(),
- winbind_event_context(),
- false))) {
- DEBUG(0,("reinit_after_fork() failed\n"));
- exit(1);
- }
-
- /* Setup signal handlers */
-
- if (!winbindd_setup_sig_term_handler(true))
- exit(1);
- if (!winbindd_setup_sig_hup_handler(NULL))
- exit(1);
- if (!winbindd_setup_sig_chld_handler())
- exit(1);
- if (!winbindd_setup_sig_usr2_handler())
- exit(1);
-
- CatchSignal(SIGPIPE, SIG_IGN); /* Ignore sigpipe */
-
- /*
- * Ensure all cache and idmap caches are consistent
- * and initialized before we startup.
- */
- if (!winbindd_cache_validate_and_initialize()) {
- exit(1);
- }
-
- /* get broadcast messages */
-
- if (!serverid_register_self(FLAG_MSG_GENERAL|FLAG_MSG_DBWRAP)) {
- DEBUG(1, ("Could not register myself in serverid.tdb\n"));
- exit(1);
- }
-
- /* React on 'smbcontrol winbindd reload-config' in the same way
- as to SIGHUP signal */
- messaging_register(winbind_messaging_context(), NULL,
- MSG_SMB_CONF_UPDATED, msg_reload_services);
- messaging_register(winbind_messaging_context(), NULL,
- MSG_SHUTDOWN, msg_shutdown);
-
- /* Handle online/offline messages. */
- messaging_register(winbind_messaging_context(), NULL,
- MSG_WINBIND_OFFLINE, winbind_msg_offline);
- messaging_register(winbind_messaging_context(), NULL,
- MSG_WINBIND_ONLINE, winbind_msg_online);
- messaging_register(winbind_messaging_context(), NULL,
- MSG_WINBIND_ONLINESTATUS, winbind_msg_onlinestatus);
-
- messaging_register(winbind_messaging_context(), NULL,
- MSG_DUMP_EVENT_LIST, winbind_msg_dump_event_list);
-
- messaging_register(winbind_messaging_context(), NULL,
- MSG_WINBIND_VALIDATE_CACHE,
- winbind_msg_validate_cache);
-
- messaging_register(winbind_messaging_context(), NULL,
- MSG_WINBIND_DUMP_DOMAIN_LIST,
- winbind_msg_dump_domain_list);
-
- /* Register handler for MSG_DEBUG. */
- messaging_register(winbind_messaging_context(), NULL,
- MSG_DEBUG,
- winbind_msg_debug);
-
- netsamlogon_cache_init(); /* Non-critical */
-
- /* clear the cached list of trusted domains */
-
- wcache_tdc_clear();
-
- if (!init_domain_list()) {
- DEBUG(0,("unable to initialize domain list\n"));
- exit(1);
- }
-
- init_idmap_child();
- init_locator_child();
-
- smb_nscd_flush_user_cache();
- smb_nscd_flush_group_cache();
+ winbindd_register_handlers();
/* setup listen sockets */
@@ -1292,13 +1298,6 @@ int main(int argc, char **argv, char **envp)
exit(1);
}
- te = tevent_add_timer(winbind_event_context(), NULL, timeval_zero(),
- rescan_trusted_domains, NULL);
- if (te == NULL) {
- DEBUG(0, ("Could not trigger rescan_trusted_domains()\n"));
- exit(1);
- }
-
TALLOC_FREE(frame);
/* Loop waiting for requests */
while (1) {
diff --git a/source3/winbindd/winbindd_dual.c b/source3/winbindd/winbindd_dual.c
index c622b3c..2ae32e7 100644
--- a/source3/winbindd/winbindd_dual.c
+++ b/source3/winbindd/winbindd_dual.c
@@ -422,13 +422,13 @@ void setup_child(struct winbindd_domain *domain, struct winbindd_child *child,
SMB_ASSERT(child->rpccli != NULL);
}
-struct winbindd_child *children = NULL;
+static struct winbindd_child *winbindd_children = NULL;
void winbind_child_died(pid_t pid)
{
struct winbindd_child *child;
- for (child = children; child != NULL; child = child->next) {
+ for (child = winbindd_children; child != NULL; child = child->next) {
if (child->pid == pid) {
break;
}
@@ -441,7 +441,7 @@ void winbind_child_died(pid_t pid)
/* This will be re-added in fork_domain_child() */
- DLIST_REMOVE(children, child);
+ DLIST_REMOVE(winbindd_children, child);
close(child->sock);
child->sock = -1;
@@ -476,7 +476,7 @@ void winbind_msg_debug(struct messaging_context *msg_ctx,
debug_message(msg_ctx, private_data, MSG_DEBUG, server_id, data);
- for (child = children; child != NULL; child = child->next) {
+ for (child = winbindd_children; child != NULL; child = child->next) {
DEBUG(10,("winbind_msg_debug: sending message to pid %u.\n",
(unsigned int)child->pid));
@@ -521,7 +521,7 @@ void winbind_msg_offline(struct messaging_context *msg_ctx,
set_domain_offline(domain);
}
- for (child = children; child != NULL; child = child->next) {
+ for (child = winbindd_children; child != NULL; child = child->next) {
/* Don't send message to internal children. We've already
done so above. */
if (!child->domain || winbindd_internal_child(child)) {
@@ -596,7 +596,7 @@ void winbind_msg_online(struct messaging_context *msg_ctx,
--
Samba Shared Repository
More information about the samba-cvs
mailing list