diff options
author | Darshan Purandare <dpurandare@isilon.com> | 2008-07-01 11:37:13 -0700 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2008-07-01 17:52:24 -0700 |
commit | 065760ede0b4d785adf8a5dcdd9237a494b4876a (patch) | |
tree | ff3141f61b9674c1273858fce45f8947de07de91 | |
parent | 570d5ecdbd0614fb0633410e47da4a4083ab1636 (diff) | |
download | samba-065760ede0b4d785adf8a5dcdd9237a494b4876a.tar.gz samba-065760ede0b4d785adf8a5dcdd9237a494b4876a.tar.bz2 samba-065760ede0b4d785adf8a5dcdd9237a494b4876a.zip |
MSG_DEBUG now forwarded to all the winbindd children by parent.
smbcontrol winbindd debug level would only set the debug level of the
parent winbindd process and not the child processes. This patch adds
the functionality of broadcasting the debug message to all winbindd
children. Now the debug level message is propagated to all the winbindd
processes that includes parent and children.
(This used to be commit cfbcfc3ffe74f28ec874a6bf1ab93f55f405b6e6)
-rw-r--r-- | source3/include/proto.h | 1 | ||||
-rw-r--r-- | source3/lib/debug.c | 2 | ||||
-rw-r--r-- | source3/winbindd/winbindd.c | 5 | ||||
-rw-r--r-- | source3/winbindd/winbindd_dual.c | 34 | ||||
-rw-r--r-- | source3/winbindd/winbindd_proto.h | 5 |
5 files changed, 46 insertions, 1 deletions
diff --git a/source3/include/proto.h b/source3/include/proto.h index 13f392d544..e918b258c8 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -502,6 +502,7 @@ const char *debug_classname_from_index(int ndx); int debug_add_class(const char *classname); int debug_lookup_classname(const char *classname); bool debug_parse_levels(const char *params_str); +void debug_message(struct messaging_context *msg_ctx, void *private_data, uint32_t msg_type, struct server_id src, DATA_BLOB *data); void debug_init(void); void debug_register_msgs(struct messaging_context *msg_ctx); void setup_logging(const char *pname, bool interactive); diff --git a/source3/lib/debug.c b/source3/lib/debug.c index a76a8dbf53..2ded6bdc33 100644 --- a/source3/lib/debug.c +++ b/source3/lib/debug.c @@ -476,7 +476,7 @@ bool debug_parse_levels(const char *params_str) Receive a "set debug level" message. ****************************************************************************/ -static void debug_message(struct messaging_context *msg_ctx, +void debug_message(struct messaging_context *msg_ctx, void *private_data, uint32_t msg_type, struct server_id src, diff --git a/source3/winbindd/winbindd.c b/source3/winbindd/winbindd.c index ec3bf68e2a..4b7efe81eb 100644 --- a/source3/winbindd/winbindd.c +++ b/source3/winbindd/winbindd.c @@ -1249,6 +1249,11 @@ int main(int argc, char **argv, char **envp) 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 */ diff --git a/source3/winbindd/winbindd_dual.c b/source3/winbindd/winbindd_dual.c index 29849e9e78..c3bcb715bb 100644 --- a/source3/winbindd/winbindd_dual.c +++ b/source3/winbindd/winbindd_dual.c @@ -501,6 +501,36 @@ void winbindd_flush_negative_conn_cache(struct winbindd_domain *domain) } } +/* + * Parent winbindd process sets its own debug level first and then + * sends a message to all the winbindd children to adjust their debug + * level to that of parents. + */ + +void winbind_msg_debug(struct messaging_context *msg_ctx, + void *private_data, + uint32_t msg_type, + struct server_id server_id, + DATA_BLOB *data) +{ + struct winbindd_child *child; + + DEBUG(10,("winbind_msg_debug: got debug message.\n")); + + debug_message(msg_ctx, private_data, MSG_DEBUG, server_id, data); + + for (child = children; child != NULL; child = child->next) { + + DEBUG(10,("winbind_msg_debug: sending message to pid %u.\n", + (unsigned int)child->pid)); + + messaging_send_buf(msg_ctx, pid_to_procid(child->pid), + MSG_DEBUG, + data->data, + strlen((char *) data->data) + 1); + } +} + /* Set our domains as offline and forward the offline message to our children. */ void winbind_msg_offline(struct messaging_context *msg_ctx, @@ -1044,6 +1074,8 @@ static bool fork_domain_child(struct winbindd_child *child) MSG_DUMP_EVENT_LIST, NULL); messaging_deregister(winbind_messaging_context(), MSG_WINBIND_DUMP_DOMAIN_LIST, NULL); + messaging_deregister(winbind_messaging_context(), + MSG_DEBUG, NULL); /* Handle online/offline messages. */ messaging_register(winbind_messaging_context(), NULL, @@ -1054,6 +1086,8 @@ static bool fork_domain_child(struct winbindd_child *child) MSG_WINBIND_ONLINESTATUS, child_msg_onlinestatus); messaging_register(winbind_messaging_context(), NULL, MSG_DUMP_EVENT_LIST, child_msg_dump_event_list); + messaging_register(winbind_messaging_context(), NULL, + MSG_DEBUG, debug_message); if ( child->domain ) { child->domain->startup = True; diff --git a/source3/winbindd/winbindd_proto.h b/source3/winbindd/winbindd_proto.h index 84ea67b9ec..7f68cbfbc2 100644 --- a/source3/winbindd/winbindd_proto.h +++ b/source3/winbindd/winbindd_proto.h @@ -300,6 +300,11 @@ void setup_child(struct winbindd_child *child, const char *logname); void winbind_child_died(pid_t pid); void winbindd_flush_negative_conn_cache(struct winbindd_domain *domain); +void winbind_msg_debug(struct messaging_context *msg_ctx, + void *private_data, + uint32_t msg_type, + struct server_id server_id, + DATA_BLOB *data); void winbind_msg_offline(struct messaging_context *msg_ctx, void *private_data, uint32_t msg_type, |