summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2008-03-10 14:25:45 +0100
committerGünther Deschner <gd@samba.org>2008-03-10 14:46:27 +0100
commit758ceaaaafab432b9cf5e6cdede0d35ee1f4852d (patch)
treedfe3678c4ca607360de79e5f6e314cc18f7bb7a6
parentb175ffa7024ee6bea89d51a4cfafdff71a63fb7d (diff)
downloadsamba-758ceaaaafab432b9cf5e6cdede0d35ee1f4852d.tar.gz
samba-758ceaaaafab432b9cf5e6cdede0d35ee1f4852d.tar.bz2
samba-758ceaaaafab432b9cf5e6cdede0d35ee1f4852d.zip
Use rpccli_srvsvc_NetShareAdd in net.
Guenther (This used to be commit 6686d97617cc0a630ea1ab1c30f741943f151db6)
-rw-r--r--source3/utils/net_rpc.c56
1 files changed, 45 insertions, 11 deletions
diff --git a/source3/utils/net_rpc.c b/source3/utils/net_rpc.c
index 15450cfafa..78d43e484b 100644
--- a/source3/utils/net_rpc.c
+++ b/source3/utils/net_rpc.c
@@ -3255,12 +3255,16 @@ static NTSTATUS rpc_share_add_internals(const DOM_SID *domain_sid,
const char **argv)
{
WERROR result;
+ NTSTATUS status;
char *sharename;
char *path;
uint32 type = STYPE_DISKTREE; /* only allow disk shares to be added */
uint32 num_users=0, perms=0;
char *password=NULL; /* don't allow a share password */
uint32 level = 2;
+ union srvsvc_NetShareInfo info;
+ struct srvsvc_NetShareInfo2 info2;
+ uint32_t parm_error = 0;
if ((sharename = talloc_strdup(mem_ctx, argv[0])) == NULL) {
return NT_STATUS_NO_MEMORY;
@@ -3271,11 +3275,24 @@ static NTSTATUS rpc_share_add_internals(const DOM_SID *domain_sid,
return NT_STATUS_UNSUCCESSFUL;
*path++ = '\0';
- result = rpccli_srvsvc_net_share_add(pipe_hnd, mem_ctx, sharename, type,
- opt_comment, perms, opt_maxusers,
- num_users, path, password,
- level, NULL);
- return werror_to_ntstatus(result);
+ info2.name = sharename;
+ info2.type = type;
+ info2.comment = opt_comment;
+ info2.permissions = perms;
+ info2.max_users = opt_maxusers;
+ info2.current_users = num_users;
+ info2.path = path;
+ info2.password = password;
+
+ info.info2 = &info2;
+
+ status = rpccli_srvsvc_NetShareAdd(pipe_hnd, mem_ctx,
+ pipe_hnd->cli->desthost,
+ level,
+ &info,
+ &parm_error,
+ &result);
+ return status;
}
static int rpc_share_add(int argc, const char **argv)
@@ -5050,6 +5067,10 @@ static NTSTATUS rpc_sh_share_add(TALLOC_CTX *mem_ctx,
int argc, const char **argv)
{
WERROR result;
+ NTSTATUS status;
+ uint32_t parm_err = 0;
+ union srvsvc_NetShareInfo info;
+ struct srvsvc_NetShareInfo2 info2;
if ((argc < 2) || (argc > 3)) {
d_fprintf(stderr, "usage: %s <share> <path> [comment]\n",
@@ -5057,12 +5078,25 @@ static NTSTATUS rpc_sh_share_add(TALLOC_CTX *mem_ctx,
return NT_STATUS_INVALID_PARAMETER;
}
- result = rpccli_srvsvc_net_share_add(
- pipe_hnd, mem_ctx, argv[0], STYPE_DISKTREE,
- (argc == 3) ? argv[2] : "",
- 0, 0, 0, argv[1], NULL, 2, NULL);
-
- return werror_to_ntstatus(result);
+ info2.name = argv[0];
+ info2.type = STYPE_DISKTREE;
+ info2.comment = (argc == 3) ? argv[2] : "";
+ info2.permissions = 0;
+ info2.max_users = 0;
+ info2.current_users = 0;
+ info2.path = argv[1];
+ info2.password = NULL;
+
+ info.info2 = &info2;
+
+ status = rpccli_srvsvc_NetShareAdd(pipe_hnd, mem_ctx,
+ pipe_hnd->cli->desthost,
+ 2,
+ &info,
+ &parm_err,
+ &result);
+
+ return status;
}
static NTSTATUS rpc_sh_share_delete(TALLOC_CTX *mem_ctx,