net: Fix bug #5542 (samsync contains empty passwords).
authorGünther Deschner <gd@samba.org>
Fri, 13 Jun 2008 10:20:01 +0000 (12:20 +0200)
committerGünther Deschner <gd@samba.org>
Fri, 13 Jun 2008 10:23:57 +0000 (12:23 +0200)
Guenther
(cherry picked from commit 1a22e975dd1255f3557c1cd873d877aa35822afc)
(This used to be commit ad8392cf7c817ee29a03bc6f515bf1cc18a29eda)

source3/utils/net.h
source3/utils/net_ads.c
source3/utils/net_rpc_samsync.c

index ef5cfa73de445f67b422d43ab2eea1b8d71f1d1b..65c8d75584970b67e5645470ad65d922360a9e68 100644 (file)
@@ -23,6 +23,7 @@
  */
 
 #include "lib/netapi/netapi.h"
+#include "libnet/libnet.h"
 
 struct net_context {
        const char *opt_requester_name;
index 8c39fa955fe8f0cb6be0ec12570bb9040c55d8d6..c0d04acd0b13cb885478650f8c53d744cafe2b74 100644 (file)
@@ -23,8 +23,6 @@
 #include "includes.h"
 #include "utils/net.h"
 
-#include "libnet/libnet.h"
-
 #ifdef HAVE_ADS
 
 /* when we do not have sufficient input parameters to contact a remote domain
index bd8118ab8ed27d6c16585702426e215628d6d185..44c95f9509c20067038c2998a821b69d496aa068 100644 (file)
@@ -336,6 +336,7 @@ static void dump_database(struct rpc_pipe_client *pipe_hnd,
        struct netr_Authenticator return_authenticator;
        uint16_t restart_state = 0;
        uint32_t sync_context = 0;
+       DATA_BLOB session_key;
 
        ZERO_STRUCT(return_authenticator);
 
@@ -386,6 +387,14 @@ static void dump_database(struct rpc_pipe_client *pipe_hnd,
                        break;
                }
 
+               session_key = data_blob_const(pipe_hnd->dc->sess_key, 16);
+
+               samsync_fix_delta_array(mem_ctx,
+                                       &session_key,
+                                       true,
+                                       database_id,
+                                       delta_enum_array);
+
                /* Display results */
                for (i = 0; i < delta_enum_array->num_deltas; i++) {
                        display_sam_entry(&delta_enum_array->delta_enum[i]);
@@ -1169,6 +1178,7 @@ static NTSTATUS fetch_database(struct rpc_pipe_client *pipe_hnd, uint32 db_type,
        enum netr_SamDatabaseID database_id = db_type;
        uint16_t restart_state = 0;
        uint32_t sync_context = 0;
+       DATA_BLOB session_key;
 
        if (!(mem_ctx = talloc_init("fetch_database")))
                return NT_STATUS_NO_MEMORY;
@@ -1215,6 +1225,14 @@ static NTSTATUS fetch_database(struct rpc_pipe_client *pipe_hnd, uint32 db_type,
                        break;
                }
 
+               session_key = data_blob_const(pipe_hnd->dc->sess_key, 16);
+
+               samsync_fix_delta_array(mem_ctx,
+                                       &session_key,
+                                       true,
+                                       database_id,
+                                       delta_enum_array);
+
                for (i = 0; i < delta_enum_array->num_deltas; i++) {
                        fetch_sam_entry(&delta_enum_array->delta_enum[i], dom_sid);
                }
@@ -1990,6 +2008,7 @@ static NTSTATUS fetch_database_to_ldif(struct rpc_pipe_client *pipe_hnd,
        enum netr_SamDatabaseID database_id = db_type;
        uint16_t restart_state = 0;
        uint32_t sync_context = 0;
+       DATA_BLOB session_key;
 
        /* Set up array for mapping accounts to groups */
        /* Array element is the group rid */
@@ -2122,6 +2141,14 @@ static NTSTATUS fetch_database_to_ldif(struct rpc_pipe_client *pipe_hnd,
                        break;
                }
 
+               session_key = data_blob_const(pipe_hnd->dc->sess_key, 16);
+
+               samsync_fix_delta_array(mem_ctx,
+                                       &session_key,
+                                       true,
+                                       database_id,
+                                       delta_enum_array);
+
                num_deltas = delta_enum_array->num_deltas;
 
                /* Re-allocate memory for groupmap and accountmap arrays */