summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorVolker Lendecke <vlendec@samba.org>2007-06-29 17:40:37 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:23:43 -0500
commitf9df7787e6b1fec9404451eb2220dc34baf5e4a3 (patch)
treeb27a1f7bd6d92bf2c30ff95a949d624a83a2ab6c /source3
parent971b640e0cb8bac510771d126454a8e4d2eff507 (diff)
downloadsamba-f9df7787e6b1fec9404451eb2220dc34baf5e4a3.tar.gz
samba-f9df7787e6b1fec9404451eb2220dc34baf5e4a3.tar.bz2
samba-f9df7787e6b1fec9404451eb2220dc34baf5e4a3.zip
r23661: Another static pstring
(This used to be commit d4256ae5588fddc62bf90082d24140e327a54c8c)
Diffstat (limited to 'source3')
-rw-r--r--source3/rpc_server/srv_ntsvcs_nt.c25
1 files changed, 15 insertions, 10 deletions
diff --git a/source3/rpc_server/srv_ntsvcs_nt.c b/source3/rpc_server/srv_ntsvcs_nt.c
index 79259174fd..6164217a65 100644
--- a/source3/rpc_server/srv_ntsvcs_nt.c
+++ b/source3/rpc_server/srv_ntsvcs_nt.c
@@ -27,13 +27,9 @@
/********************************************************************
********************************************************************/
-static char* get_device_path( const char *device )
+static char* get_device_path(TALLOC_CTX *mem_ctx, const char *device )
{
- static pstring path;
-
- pstr_sprintf( path, "ROOT\\Legacy_%s\\0000", device );
-
- return path;
+ return talloc_asprintf(mem_ctx, "ROOT\\Legacy_%s\\0000", device);
}
/********************************************************************
@@ -52,16 +48,21 @@ WERROR _ntsvcs_get_version( pipes_struct *p, NTSVCS_Q_GET_VERSION *q_u, NTSVCS_R
WERROR _ntsvcs_get_device_list_size( pipes_struct *p, NTSVCS_Q_GET_DEVICE_LIST_SIZE *q_u, NTSVCS_R_GET_DEVICE_LIST_SIZE *r_u )
{
fstring device;
- const char *devicepath;
+ char *devicepath;
if ( !q_u->devicename )
return WERR_ACCESS_DENIED;
rpcstr_pull(device, q_u->devicename->buffer, sizeof(device), q_u->devicename->uni_str_len*2, 0);
- devicepath = get_device_path( device );
+
+ if (!(devicepath = get_device_path(p->mem_ctx, device))) {
+ return WERR_NOMEM;
+ }
r_u->size = strlen(devicepath) + 2;
+ TALLOC_FREE(devicepath);
+
return WERR_OK;
}
@@ -72,17 +73,21 @@ WERROR _ntsvcs_get_device_list_size( pipes_struct *p, NTSVCS_Q_GET_DEVICE_LIST_S
WERROR _ntsvcs_get_device_list( pipes_struct *p, NTSVCS_Q_GET_DEVICE_LIST *q_u, NTSVCS_R_GET_DEVICE_LIST *r_u )
{
fstring device;
- const char *devicepath;
+ char *devicepath;
if ( !q_u->devicename )
return WERR_ACCESS_DENIED;
rpcstr_pull(device, q_u->devicename->buffer, sizeof(device), q_u->devicename->uni_str_len*2, 0);
- devicepath = get_device_path( device );
+
+ if (!(devicepath = get_device_path(p->mem_ctx, device))) {
+ return WERR_NOMEM;
+ }
/* This has to be DOUBLE NULL terminated */
init_unistr2( &r_u->devicepath, devicepath, UNI_STR_DBLTERMINATE );
+ TALLOC_FREE(devicepath);
r_u->needed = r_u->devicepath.uni_str_len;
return WERR_OK;