summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2008-07-12 12:20:08 +0200
committerVolker Lendecke <vl@samba.org>2008-07-26 13:20:10 +0200
commit1ee37bc9c3d3a4aefc50efc90db42b81f51bcd03 (patch)
treec1568b0660f6aa8a8c20734b8ac850fa0b33a135
parentbdf1747c98e0622dd4b91fa1f45551d0c5c3ca4c (diff)
downloadsamba-1ee37bc9c3d3a4aefc50efc90db42b81f51bcd03.tar.gz
samba-1ee37bc9c3d3a4aefc50efc90db42b81f51bcd03.tar.bz2
samba-1ee37bc9c3d3a4aefc50efc90db42b81f51bcd03.zip
Refactor make_internal_rpc_pipe_p: connection_struct is not needed
(This used to be commit defcf0eecfb8eb035d9ca80530720b9e6873f6c7)
-rw-r--r--source3/include/ntdomain.h7
-rw-r--r--source3/include/proto.h4
-rw-r--r--source3/rpc_server/srv_pipe_hnd.c32
3 files changed, 20 insertions, 23 deletions
diff --git a/source3/include/ntdomain.h b/source3/include/ntdomain.h
index 23bbe9aba2..484f173afe 100644
--- a/source3/include/ntdomain.h
+++ b/source3/include/ntdomain.h
@@ -318,8 +318,11 @@ typedef struct smb_np_struct {
* returns: state information representing the connection.
* is stored in np_state, above.
*/
- void * (*namedpipe_create)(const char *pipe_name,
- connection_struct *conn, uint16 vuid);
+ struct pipes_struct *(*namedpipe_create)(
+ const char *pipe_name,
+ const char *client_address,
+ struct auth_serversupplied_info *server_info,
+ uint16_t vuid);
/* call to perform a write namedpipe operation
*/
diff --git a/source3/include/proto.h b/source3/include/proto.h
index 47986ee5ef..6e503efadd 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -8845,6 +8845,10 @@ bool close_rpc_pipe_hnd(smb_np_struct *p);
void pipe_close_conn(connection_struct *conn);
smb_np_struct *get_rpc_pipe_p(uint16 pnum);
smb_np_struct *get_rpc_pipe(int pnum);
+struct pipes_struct *make_internal_rpc_pipe_p(const char *pipe_name,
+ const char *client_address,
+ struct auth_serversupplied_info *server_info,
+ uint16_t vuid);
/* The following definitions come from rpc_server/srv_samr_nt.c */
diff --git a/source3/rpc_server/srv_pipe_hnd.c b/source3/rpc_server/srv_pipe_hnd.c
index c0b525c06b..aa5bd5394a 100644
--- a/source3/rpc_server/srv_pipe_hnd.c
+++ b/source3/rpc_server/srv_pipe_hnd.c
@@ -65,8 +65,6 @@ static ssize_t read_from_internal_pipe(void *np_conn, char *data, size_t n,
bool *is_data_outstanding);
static ssize_t write_to_internal_pipe(void *np_conn, char *data, size_t n);
static bool close_internal_rpc_pipe_hnd(void *np_conn);
-static void *make_internal_rpc_pipe_p(const char *pipe_name,
- connection_struct *conn, uint16 vuid);
/****************************************************************************
Internal Pipe iterator functions.
@@ -217,7 +215,8 @@ smb_np_struct *open_rpc_pipe_p(const char *pipe_name,
p->namedpipe_write = write_to_internal_pipe;
p->namedpipe_close = close_internal_rpc_pipe_hnd;
- p->np_state = p->namedpipe_create(pipe_name, conn, vuid);
+ p->np_state = p->namedpipe_create(pipe_name, conn->client_address,
+ conn->server_info, vuid);
if (p->np_state == NULL) {
DEBUG(0,("open_rpc_pipe_p: make_internal_rpc_pipe_p failed.\n"));
@@ -266,19 +265,15 @@ smb_np_struct *open_rpc_pipe_p(const char *pipe_name,
Make an internal namedpipes structure
****************************************************************************/
-static void *make_internal_rpc_pipe_p(const char *pipe_name,
- connection_struct *conn, uint16 vuid)
+struct pipes_struct *make_internal_rpc_pipe_p(const char *pipe_name,
+ const char *client_address,
+ struct auth_serversupplied_info *server_info,
+ uint16_t vuid)
{
pipes_struct *p;
- user_struct *vuser = get_valid_user_struct(vuid);
DEBUG(4,("Create pipe requested %s\n", pipe_name));
- if (!vuser && vuid != UID_FIELD_INVALID) {
- DEBUG(0,("ERROR! vuid %d did not map to a valid vuser struct!\n", vuid));
- return NULL;
- }
-
p = TALLOC_ZERO_P(NULL, pipes_struct);
if (!p) {
@@ -314,7 +309,7 @@ static void *make_internal_rpc_pipe_p(const char *pipe_name,
return NULL;
}
- p->server_info = copy_serverinfo(p, conn->server_info);
+ p->server_info = copy_serverinfo(p, server_info);
if (p->server_info == NULL) {
DEBUG(0, ("open_rpc_pipe_p: copy_serverinfo failed\n"));
talloc_destroy(p->mem_ctx);
@@ -325,21 +320,16 @@ static void *make_internal_rpc_pipe_p(const char *pipe_name,
DLIST_ADD(InternalPipes, p);
- memcpy(p->client_address, conn->client_address,
- sizeof(p->client_address));
+ memcpy(p->client_address, client_address, sizeof(p->client_address));
p->endian = RPC_LITTLE_ENDIAN;
ZERO_STRUCT(p->pipe_user);
+ p->pipe_user.vuid = vuid;
p->pipe_user.ut.uid = (uid_t)-1;
p->pipe_user.ut.gid = (gid_t)-1;
-
- /* Store the session key and NT_TOKEN */
- if (vuser) {
- p->pipe_user.nt_user_token = dup_nt_token(
- NULL, vuser->server_info->ptok);
- }
+ p->pipe_user.nt_user_token = dup_nt_token(NULL, server_info->ptok);
/*
* Initialize the outgoing RPC data buffer with no memory.
@@ -351,7 +341,7 @@ static void *make_internal_rpc_pipe_p(const char *pipe_name,
DEBUG(4,("Created internal pipe %s (pipes_open=%d)\n",
pipe_name, pipes_open));
- return (void*)p;
+ return p;
}
/****************************************************************************