summaryrefslogtreecommitdiff
path: root/source3/winbindd
diff options
context:
space:
mode:
authorBo Yang <boyang@samba.org>2009-05-22 02:12:59 +0800
committerBo Yang <boyang@samba.org>2009-05-22 02:12:59 +0800
commitcbe3dabb9d1fe4e16e14c50550df2afab7e4a21e (patch)
treecc015c34f0bafa9c15b5abab22250cc2ad33c07a /source3/winbindd
parent8c7a579bdcca32897bd9ee716a488568b721ed90 (diff)
downloadsamba-cbe3dabb9d1fe4e16e14c50550df2afab7e4a21e.tar.gz
samba-cbe3dabb9d1fe4e16e14c50550df2afab7e4a21e.tar.bz2
samba-cbe3dabb9d1fe4e16e14c50550df2afab7e4a21e.zip
s3: Fix onlinestatus msg to return status of all domain instead of omitting trusted domains
Signed-off-by: Bo Yang <boyang@samba.org>
Diffstat (limited to 'source3/winbindd')
-rw-r--r--source3/winbindd/winbindd_dual.c129
1 files changed, 51 insertions, 78 deletions
diff --git a/source3/winbindd/winbindd_dual.c b/source3/winbindd/winbindd_dual.c
index 893303e7f4..a69d34f30c 100644
--- a/source3/winbindd/winbindd_dual.c
+++ b/source3/winbindd/winbindd_dual.c
@@ -692,29 +692,66 @@ void winbind_msg_online(struct messaging_context *msg_ctx,
}
}
-/* Forward the online/offline messages to our children. */
+static const char *collect_onlinestatus(TALLOC_CTX *mem_ctx)
+{
+ struct winbindd_domain *domain;
+ char *buf = NULL;
+
+ if ((buf = talloc_asprintf(mem_ctx, "global:%s ",
+ get_global_winbindd_state_offline() ?
+ "Offline":"Online")) == NULL) {
+ return NULL;
+ }
+
+ for (domain = domain_list(); domain; domain = domain->next) {
+ if ((buf = talloc_asprintf_append_buffer(buf, "%s:%s ",
+ domain->name,
+ domain->online ?
+ "Online":"Offline")) == NULL) {
+ return NULL;
+ }
+ }
+
+ buf = talloc_asprintf_append_buffer(buf, "\n");
+
+ DEBUG(5,("collect_onlinestatus: %s", buf));
+
+ return buf;
+}
+
void winbind_msg_onlinestatus(struct messaging_context *msg_ctx,
void *private_data,
uint32_t msg_type,
struct server_id server_id,
DATA_BLOB *data)
{
- struct winbindd_child *child;
+ TALLOC_CTX *mem_ctx;
+ const char *message;
+ struct server_id *sender;
+
+ DEBUG(5,("winbind_msg_onlinestatus received.\n"));
+
+ if (!data->data) {
+ return;
+ }
- DEBUG(10,("winbind_msg_onlinestatus: got onlinestatus message.\n"));
+ sender = (struct server_id *)data->data;
- for (child = children; child != NULL; child = child->next) {
- if (child->domain && child->domain->primary) {
- DEBUG(10,("winbind_msg_onlinestatus: "
- "sending message to pid %u of primary domain.\n",
- (unsigned int)child->pid));
- messaging_send_buf(msg_ctx, pid_to_procid(child->pid),
- MSG_WINBIND_ONLINESTATUS,
- (uint8 *)data->data,
- data->length);
- break;
- }
+ mem_ctx = talloc_init("winbind_msg_onlinestatus");
+ if (mem_ctx == NULL) {
+ return;
}
+
+ message = collect_onlinestatus(mem_ctx);
+ if (message == NULL) {
+ talloc_destroy(mem_ctx);
+ return;
+ }
+
+ messaging_send_buf(msg_ctx, *sender, MSG_WINBIND_ONLINESTATUS,
+ (uint8 *)message, strlen(message) + 1);
+
+ talloc_destroy(mem_ctx);
}
void winbind_msg_dump_event_list(struct messaging_context *msg_ctx,
@@ -1068,68 +1105,6 @@ static void child_msg_online(struct messaging_context *msg,
}
}
-static const char *collect_onlinestatus(TALLOC_CTX *mem_ctx)
-{
- struct winbindd_domain *domain;
- char *buf = NULL;
-
- if ((buf = talloc_asprintf(mem_ctx, "global:%s ",
- get_global_winbindd_state_offline() ?
- "Offline":"Online")) == NULL) {
- return NULL;
- }
-
- for (domain = domain_list(); domain; domain = domain->next) {
- if ((buf = talloc_asprintf_append_buffer(buf, "%s:%s ",
- domain->name,
- domain->online ?
- "Online":"Offline")) == NULL) {
- return NULL;
- }
- }
-
- buf = talloc_asprintf_append_buffer(buf, "\n");
-
- DEBUG(5,("collect_onlinestatus: %s", buf));
-
- return buf;
-}
-
-static void child_msg_onlinestatus(struct messaging_context *msg_ctx,
- void *private_data,
- uint32_t msg_type,
- struct server_id server_id,
- DATA_BLOB *data)
-{
- TALLOC_CTX *mem_ctx;
- const char *message;
- struct server_id *sender;
-
- DEBUG(5,("winbind_msg_onlinestatus received.\n"));
-
- if (!data->data) {
- return;
- }
-
- sender = (struct server_id *)data->data;
-
- mem_ctx = talloc_init("winbind_msg_onlinestatus");
- if (mem_ctx == NULL) {
- return;
- }
-
- message = collect_onlinestatus(mem_ctx);
- if (message == NULL) {
- talloc_destroy(mem_ctx);
- return;
- }
-
- messaging_send_buf(msg_ctx, *sender, MSG_WINBIND_ONLINESTATUS,
- (uint8 *)message, strlen(message) + 1);
-
- talloc_destroy(mem_ctx);
-}
-
static void child_msg_dump_event_list(struct messaging_context *msg,
void *private_data,
uint32_t msg_type,
@@ -1296,8 +1271,6 @@ static bool fork_domain_child(struct winbindd_child *child)
messaging_register(winbind_messaging_context(), NULL,
MSG_WINBIND_ONLINE, child_msg_online);
messaging_register(winbind_messaging_context(), NULL,
- 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);