summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source3/include/ntdomain.h2
-rw-r--r--source3/rpc_server/srv_pipe_hnd.c19
2 files changed, 12 insertions, 9 deletions
diff --git a/source3/include/ntdomain.h b/source3/include/ntdomain.h
index 25d7e44e53..6537d5a7fb 100644
--- a/source3/include/ntdomain.h
+++ b/source3/include/ntdomain.h
@@ -306,7 +306,7 @@ typedef struct smb_np_struct {
bool open; /* open connection */
uint16 device_state;
uint16 priority;
- fstring name;
+ char *name;
/* When replying to an SMBtrans, this is the maximum amount of
data that can be sent in the initial reply. */
diff --git a/source3/rpc_server/srv_pipe_hnd.c b/source3/rpc_server/srv_pipe_hnd.c
index 969c9ecda3..95ce496ba6 100644
--- a/source3/rpc_server/srv_pipe_hnd.c
+++ b/source3/rpc_server/srv_pipe_hnd.c
@@ -195,14 +195,21 @@ smb_np_struct *open_rpc_pipe_p(const char *pipe_name,
DEBUG(5,("open_rpc_pipe_p: name %s pnum=%x\n", p->name, p->pnum));
}
- p = SMB_MALLOC_P(smb_np_struct);
+ p = talloc(NULL, smb_np_struct);
if (!p) {
- DEBUG(0,("ERROR! no memory for pipes_struct!\n"));
+ DEBUG(0,("ERROR! no memory for smb_np_struct!\n"));
return NULL;
}
ZERO_STRUCTP(p);
+ p->name = talloc_strdup(p, pipe_name);
+ if (p->name == NULL) {
+ TALLOC_FREE(p);
+ DEBUG(0,("ERROR! no memory for pipe name!\n"));
+ return NULL;
+ }
+
/* add a dso mechanism instead of this, here */
p->namedpipe_create = make_internal_rpc_pipe_p;
@@ -241,9 +248,7 @@ smb_np_struct *open_rpc_pipe_p(const char *pipe_name,
p->vuid = vuid;
p->max_trans_reply = 0;
-
- fstrcpy(p->name, pipe_name);
-
+
DEBUG(4,("Opened pipe %s with handle %x (pipes_open=%d)\n",
pipe_name, i, pipes_open));
@@ -1163,9 +1168,7 @@ bool close_rpc_pipe_hnd(smb_np_struct *p)
"pipe from open db.\n", p->name));
}
- ZERO_STRUCTP(p);
-
- SAFE_FREE(p);
+ TALLOC_FREE(p);
return True;
}