summaryrefslogtreecommitdiff
path: root/source3/rpc_server
diff options
context:
space:
mode:
authorVolker Lendecke <vlendec@samba.org>2006-10-21 17:00:47 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:15:36 -0500
commit2a10d7686553a2c2377165b7f80269d2dcae8847 (patch)
tree57aeaaf00ce40449e9a603d05124ce22c6636d36 /source3/rpc_server
parentf916352de90f5f5cd1e33d7264895e9d7e2992b5 (diff)
downloadsamba-2a10d7686553a2c2377165b7f80269d2dcae8847.tar.gz
samba-2a10d7686553a2c2377165b7f80269d2dcae8847.tar.bz2
samba-2a10d7686553a2c2377165b7f80269d2dcae8847.zip
r19448: Convert delete_share_security to struct share_params plus some cleanups
(This used to be commit c73d0815a3a1f58b951caa62fac601a8f4630894)
Diffstat (limited to 'source3/rpc_server')
-rw-r--r--source3/rpc_server/srv_srvsvc_nt.c28
1 files changed, 15 insertions, 13 deletions
diff --git a/source3/rpc_server/srv_srvsvc_nt.c b/source3/rpc_server/srv_srvsvc_nt.c
index ec39c2a482..0e7f749a4e 100644
--- a/source3/rpc_server/srv_srvsvc_nt.c
+++ b/source3/rpc_server/srv_srvsvc_nt.c
@@ -1680,12 +1680,11 @@ WERROR _srvsvc_NetShareAdd(pipes_struct *p, const char *server_unc, uint32_t lev
WERROR _srvsvc_NetShareDel(pipes_struct *p, const char *server_unc, const char *share_name, uint32_t reserved)
{
- pstring command;
+ char *command;
int ret;
- int snum;
+ struct share_params *params;
SE_PRIV se_diskop = SE_DISK_OPERATOR;
BOOL is_disk_op;
- fstring tmp_share_name;
DEBUG(5,("_srv_net_share_del: %d\n", __LINE__));
@@ -1696,14 +1695,12 @@ WERROR _srvsvc_NetShareDel(pipes_struct *p, const char *server_unc, const char *
return WERR_ACCESS_DENIED;
}
- fstrcpy(tmp_share_name, share_name);
- snum = find_service(tmp_share_name);
-
- if (snum < 0)
+ if (!(params = get_share_params(p->mem_ctx, share_name))) {
return WERR_NO_SUCH_SHARE;
+ }
/* No change to printer shares. */
- if (lp_print_ok(snum))
+ if (lp_print_ok(params->service))
return WERR_ACCESS_DENIED;
is_disk_op = user_has_privileges( p->pipe_user.nt_user_token, &se_diskop );
@@ -1715,9 +1712,12 @@ WERROR _srvsvc_NetShareDel(pipes_struct *p, const char *server_unc, const char *
DEBUG(10,("_srv_net_share_del: No delete share command\n"));
return WERR_ACCESS_DENIED;
}
-
- slprintf(command, sizeof(command)-1, "%s \"%s\" \"%s\"",
- lp_delete_share_cmd(), dyn_CONFIGFILE, lp_servicename(snum));
+
+ if (asprintf(&command, "%s \"%s\" \"%s\"",
+ lp_delete_share_cmd(), dyn_CONFIGFILE,
+ lp_servicename(params->service)) == -1) {
+ return WERR_NOMEM;
+ }
DEBUG(10,("_srv_net_share_del: Running [%s]\n", command ));
@@ -1733,6 +1733,8 @@ WERROR _srvsvc_NetShareDel(pipes_struct *p, const char *server_unc, const char *
if ( is_disk_op )
unbecome_root();
+
+ SAFE_FREE(command);
/********* END SeDiskOperatorPrivilege BLOCK *********/
@@ -1742,9 +1744,9 @@ WERROR _srvsvc_NetShareDel(pipes_struct *p, const char *server_unc, const char *
return WERR_ACCESS_DENIED;
/* Delete the SD in the database. */
- delete_share_security(snum);
+ delete_share_security(params);
- lp_killservice(snum);
+ lp_killservice(params->service);
return WERR_OK;
}