From: Volker Lendecke Date: Tue, 13 Feb 2018 13:05:43 +0000 (+0100) Subject: winbind: Don't send "server_id" explicitly for DUMP_DOMAIN_LIST X-Git-Tag: tevent-0.9.36~72 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f8313d715b073a36b95c09f40c1f2dfc9bf7d5b6;p=thirdparty%2Fsamba.git winbind: Don't send "server_id" explicitly for DUMP_DOMAIN_LIST messaging already provides the sender id Signed-off-by: Volker Lendecke Reviewed-by: Jeremy Allison Autobuild-User(master): Jeremy Allison Autobuild-Date(master): Fri Feb 16 00:56:36 CET 2018 on sn-devel-144 --- diff --git a/source3/utils/smbcontrol.c b/source3/utils/smbcontrol.c index 4b47d3bed57..c4b56305217 100644 --- a/source3/utils/smbcontrol.c +++ b/source3/utils/smbcontrol.c @@ -1204,11 +1204,6 @@ static bool do_winbind_dump_domain_list(struct tevent_context *ev_ctx, { const char *domain = NULL; int domain_len = 0; - struct server_id myid; - uint8_t *buf = NULL; - int buf_len = 0; - - myid = messaging_server_id(msg_ctx); if (argc < 1 || argc > 2) { fprintf(stderr, "Usage: smbcontrol dump-domain-list " @@ -1224,19 +1219,9 @@ static bool do_winbind_dump_domain_list(struct tevent_context *ev_ctx, messaging_register(msg_ctx, NULL, MSG_WINBIND_DUMP_DOMAIN_LIST, print_pid_string_cb); - buf_len = sizeof(myid)+domain_len; - buf = SMB_MALLOC_ARRAY(uint8_t, buf_len); - if (!buf) { - return false; - } - - memcpy(buf, &myid, sizeof(myid)); - memcpy(&buf[sizeof(myid)], domain, domain_len); - if (!send_message(msg_ctx, pid, MSG_WINBIND_DUMP_DOMAIN_LIST, - buf, buf_len)) + domain, domain_len)) { - SAFE_FREE(buf); return false; } @@ -1244,7 +1229,6 @@ static bool do_winbind_dump_domain_list(struct tevent_context *ev_ctx, /* No replies were received within the timeout period */ - SAFE_FREE(buf); if (num_replies == 0) { printf("No replies received\n"); } diff --git a/source3/winbindd/winbindd_dual.c b/source3/winbindd/winbindd_dual.c index 7b1527c38f3..7fb5aa899e4 100644 --- a/source3/winbindd/winbindd_dual.c +++ b/source3/winbindd/winbindd_dual.c @@ -848,7 +848,6 @@ void winbind_msg_dump_domain_list(struct messaging_context *msg_ctx, { TALLOC_CTX *mem_ctx; const char *message = NULL; - struct server_id *sender = NULL; const char *domain = NULL; char *s = NULL; NTSTATUS status; @@ -856,22 +855,13 @@ void winbind_msg_dump_domain_list(struct messaging_context *msg_ctx, DEBUG(5,("winbind_msg_dump_domain_list received.\n")); - if (!data || !data->data) { - return; - } - - if (data->length < sizeof(struct server_id)) { - return; - } - mem_ctx = talloc_init("winbind_msg_dump_domain_list"); if (!mem_ctx) { return; } - sender = (struct server_id *)data->data; - if (data->length > sizeof(struct server_id)) { - domain = (const char *)data->data+sizeof(struct server_id); + if (data->length > 0) { + domain = (const char *)data->data; } if (domain) { @@ -886,7 +876,7 @@ void winbind_msg_dump_domain_list(struct messaging_context *msg_ctx, return; } - messaging_send_buf(msg_ctx, *sender, + messaging_send_buf(msg_ctx, server_id, MSG_WINBIND_DUMP_DOMAIN_LIST, (const uint8_t *)message, strlen(message) + 1); @@ -911,7 +901,7 @@ void winbind_msg_dump_domain_list(struct messaging_context *msg_ctx, } } - status = messaging_send_buf(msg_ctx, *sender, + status = messaging_send_buf(msg_ctx, server_id, MSG_WINBIND_DUMP_DOMAIN_LIST, (uint8_t *)s, strlen(s) + 1); if (!NT_STATUS_IS_OK(status)) {