Add server_info to pipes_struct
authorVolker Lendecke <vl@samba.org>
Tue, 24 Jun 2008 12:18:55 +0000 (14:18 +0200)
committerVolker Lendecke <vl@samba.org>
Thu, 26 Jun 2008 11:13:22 +0000 (13:13 +0200)
(This used to be commit d621867bb8767e1c4236d28dd9294a61db6cbb10)

source3/auth/auth_util.c
source3/include/ntdomain.h
source3/include/proto.h
source3/rpc_server/srv_pipe.c
source3/rpc_server/srv_pipe_hnd.c

index b1558bceac86e7366d1b995fb4c2b9e01f77511f..998a81b61ad47cf3b72a2bfd27faa490bd1c84ad 100644 (file)
@@ -1334,6 +1334,22 @@ struct auth_serversupplied_info *copy_serverinfo(TALLOC_CTX *mem_ctx,
        return dst;
 }
 
+/*
+ * Set a new session key. Used in the rpc server where we have to override the
+ * SMB level session key with SystemLibraryDTC
+ */
+
+bool server_info_set_session_key(struct auth_serversupplied_info *info,
+                                DATA_BLOB session_key)
+{
+       TALLOC_FREE(info->user_session_key.data);
+
+       info->user_session_key = data_blob_talloc(
+               info, session_key.data, session_key.length);
+
+       return (info->user_session_key.data != NULL);
+}
+
 static auth_serversupplied_info *guest_info = NULL;
 
 bool init_guest_info(void)
index caf7e3431c14a60f1ca51ccc9edb168bcc131ef2..352d17bd3b371a6a624f9d86b877abfe125892df 100644 (file)
@@ -215,6 +215,8 @@ typedef struct pipes_struct {
 
        uint16 vuid; /* points to the unauthenticated user that opened this pipe. */
 
+       struct auth_serversupplied_info *server_info;
+
        fstring name;
        fstring pipe_srv_name;
        
index 1eb5fbda03736ee92820583768816116ec72d011..6525b838f163d395465d745cbad033b01a5af93c 100644 (file)
@@ -122,6 +122,8 @@ NTSTATUS make_serverinfo_from_username(TALLOC_CTX *mem_ctx,
 struct auth_serversupplied_info *copy_serverinfo(TALLOC_CTX *mem_ctx,
                                                 auth_serversupplied_info *src);
 bool init_guest_info(void);
+bool server_info_set_session_key(struct auth_serversupplied_info *info,
+                                DATA_BLOB session_key);
 NTSTATUS make_server_info_guest(TALLOC_CTX *mem_ctx,
                                auth_serversupplied_info **server_info);
 bool copy_current_user(struct current_user *dst, struct current_user *src);
index 0987a420d593639d9bfe40e0940dfc652d7d56f5..04d18d51c959f0f03ed20a022e8ea1404915655e 100644 (file)
@@ -694,6 +694,16 @@ static bool pipe_ntlmssp_verify_final(pipes_struct *p, DATA_BLOB *p_resp_blob)
                return False;
        }
 
+       TALLOC_FREE(p->server_info);
+
+       p->server_info = copy_serverinfo(p, a->server_info);
+       if (p->server_info == NULL) {
+               DEBUG(0, ("copy_serverinfo failed\n"));
+               return false;
+       }
+
+       server_info_set_session_key(p->server_info, p->session_key);
+
        return True;
 }
 
index 1feed1550c154908787d9d9527a65e202bb0f2b3..9a57a1bdb35c2cf1db63b1e31b2d938cc7105e90 100644 (file)
@@ -314,6 +314,15 @@ static void *make_internal_rpc_pipe_p(const char *pipe_name,
                return NULL;
        }
 
+       p->server_info = copy_serverinfo(p, conn->server_info);
+       if (p->server_info == NULL) {
+               DEBUG(0, ("open_rpc_pipe_p: copy_serverinfo failed\n"));
+               talloc_destroy(p->mem_ctx);
+               close_policy_by_pipe(p);
+               TALLOC_FREE(p);
+               return NULL;
+       }
+
        DLIST_ADD(InternalPipes, p);
 
        memcpy(p->client_address, conn->client_address,