summaryrefslogtreecommitdiff
path: root/source/rpc_server/srv_ntsvcs_nt.c
diff options
context:
space:
mode:
Diffstat (limited to 'source/rpc_server/srv_ntsvcs_nt.c')
-rw-r--r--source/rpc_server/srv_ntsvcs_nt.c25
1 files changed, 10 insertions, 15 deletions
diff --git a/source/rpc_server/srv_ntsvcs_nt.c b/source/rpc_server/srv_ntsvcs_nt.c
index 6164217a65f..79259174fd2 100644
--- a/source/rpc_server/srv_ntsvcs_nt.c
+++ b/source/rpc_server/srv_ntsvcs_nt.c
@@ -27,9 +27,13 @@
/********************************************************************
********************************************************************/
-static char* get_device_path(TALLOC_CTX *mem_ctx, const char *device )
+static char* get_device_path( const char *device )
{
- return talloc_asprintf(mem_ctx, "ROOT\\Legacy_%s\\0000", device);
+ static pstring path;
+
+ pstr_sprintf( path, "ROOT\\Legacy_%s\\0000", device );
+
+ return path;
}
/********************************************************************
@@ -48,21 +52,16 @@ 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;
- char *devicepath;
+ const 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);
-
- if (!(devicepath = get_device_path(p->mem_ctx, device))) {
- return WERR_NOMEM;
- }
+ devicepath = get_device_path( device );
r_u->size = strlen(devicepath) + 2;
- TALLOC_FREE(devicepath);
-
return WERR_OK;
}
@@ -73,21 +72,17 @@ 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;
- char *devicepath;
+ const 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);
-
- if (!(devicepath = get_device_path(p->mem_ctx, device))) {
- return WERR_NOMEM;
- }
+ devicepath = get_device_path( device );
/* 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;