winbind: Don't send "server_id" explicitly for DUMP_DOMAIN_LIST
authorVolker Lendecke <vl@samba.org>
Tue, 13 Feb 2018 13:05:43 +0000 (14:05 +0100)
committerJeremy Allison <jra@samba.org>
Thu, 15 Feb 2018 23:56:36 +0000 (00:56 +0100)
messaging already provides the sender id

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Fri Feb 16 00:56:36 CET 2018 on sn-devel-144

source3/utils/smbcontrol.c
source3/winbindd/winbindd_dual.c

index 4b47d3bed57fb52a07fd1aa3a21b38b83fc6e9b7..c4b563052170eaa5f8be5ebd7ebef3510006791e 100644 (file)
@@ -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 <dest> 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");
        }
index 7b1527c38f3a60a468764d6bb1fae6a131ba5a8d..7fb5aa899e42edb8f76f756e4f94e2eb0ebdbd78 100644 (file)
@@ -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)) {