]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s4-srvsvc: merge srvsvc_NetShareAdd from s3 idl.
authorGünther Deschner <gd@samba.org>
Wed, 29 Oct 2008 13:52:49 +0000 (14:52 +0100)
committerGünther Deschner <gd@samba.org>
Fri, 31 Oct 2008 01:44:31 +0000 (02:44 +0100)
Guenther

source4/libnet/libnet_share.c
source4/librpc/idl/srvsvc.idl
source4/rpc_server/srvsvc/dcesrv_srvsvc.c
source4/torture/libnet/libnet_share.c
source4/torture/rpc/srvsvc.c

index e24ba8161a9d5fd67a38ef55c8820c2f58a664a3..5affb27ead8363a7ecd817c3db111b2dd9cc61ec 100644 (file)
@@ -115,6 +115,7 @@ NTSTATUS libnet_AddShare(struct libnet_context *ctx,
        NTSTATUS status;
        struct libnet_RpcConnect c;
        struct srvsvc_NetShareAdd s;
+       union srvsvc_NetShareInfo info;
 
        c.level              = LIBNET_RPC_CONNECT_SERVER;
        c.in.name            = r->in.server_name;
@@ -129,8 +130,10 @@ NTSTATUS libnet_AddShare(struct libnet_context *ctx,
                return status;
        }
 
+       info.info2              = &r->in.share;
+
        s.in.level              = 2;
-       s.in.info.info2         = &r->in.share;
+       s.in.info               = &info;
        s.in.server_unc         = talloc_asprintf(mem_ctx, "\\\\%s", r->in.server_name);
  
        status = dcerpc_srvsvc_NetShareAdd(c.out.dcerpc_pipe, mem_ctx, &s);     
index c5d1debc0a21982cc22822e0432fb8ea6bedab37..f74bf1205a1b894250154e1be7384d16471aa440 100644 (file)
@@ -565,7 +565,7 @@ import "security.idl", "svcctl.idl";
        WERROR srvsvc_NetShareAdd(
                [in,unique]   [string,charset(UTF16)] uint16 *server_unc,
                [in]   uint32 level,
-               [in,switch_is(level)] srvsvc_NetShareInfo info,
+               [in,ref,switch_is(level)] srvsvc_NetShareInfo *info,
                [in,out,unique]   uint32 *parm_error
                );
 
index edb48cee291da4ca05565152d2ebae0c9d68d966..b58efbd61ab53ef121d89124808c06a39ef8ba00 100644 (file)
@@ -458,7 +458,7 @@ static WERROR dcesrv_srvsvc_NetShareAdd(struct dcesrv_call_state *dce_call, TALL
 
                info[i].name = SHARE_TYPE;
                info[i].type = SHARE_INFO_STRING;
-               switch (r->in.info.info2->type) {
+               switch (r->in.info->info2->type) {
                case 0x00:
                        info[i].value = talloc_strdup(info, "DISK");
                        break;
@@ -474,16 +474,16 @@ static WERROR dcesrv_srvsvc_NetShareAdd(struct dcesrv_call_state *dce_call, TALL
                W_ERROR_HAVE_NO_MEMORY(info[i].value);
                i++;
 
-               if (r->in.info.info2->path && r->in.info.info2->path[0]) {
+               if (r->in.info->info2->path && r->in.info->info2->path[0]) {
                        info[i].name = SHARE_PATH;
                        info[i].type = SHARE_INFO_STRING;
 
                        /* Windows will send a path in a form of C:\example\path */
-                       if (r->in.info.info2->path[1] == ':') {
-                               info[i].value = talloc_strdup(info, &r->in.info.info2->path[2]);
+                       if (r->in.info->info2->path[1] == ':') {
+                               info[i].value = talloc_strdup(info, &r->in.info->info2->path[2]);
                        } else {
                                /* very strange let's try to set as is */
-                               info[i].value = talloc_strdup(info, r->in.info.info2->path);
+                               info[i].value = talloc_strdup(info, r->in.info->info2->path);
                        }
                        W_ERROR_HAVE_NO_MEMORY(info[i].value);
                        all_string_sub((char *)info[i].value, "\\", "/", 0);
@@ -491,19 +491,19 @@ static WERROR dcesrv_srvsvc_NetShareAdd(struct dcesrv_call_state *dce_call, TALL
                        i++;
                }
 
-               if (r->in.info.info2->comment && r->in.info.info2->comment[0]) {
+               if (r->in.info->info2->comment && r->in.info->info2->comment[0]) {
                        info[i].name = SHARE_COMMENT;
                        info[i].type = SHARE_INFO_STRING;
-                       info[i].value = talloc_strdup(info, r->in.info.info2->comment);
+                       info[i].value = talloc_strdup(info, r->in.info->info2->comment);
                        W_ERROR_HAVE_NO_MEMORY(info[i].value);
 
                        i++;
                }
 
-               if (r->in.info.info2->password && r->in.info.info2->password[0]) {
+               if (r->in.info->info2->password && r->in.info->info2->password[0]) {
                        info[i].name = SHARE_PASSWORD;
                        info[i].type = SHARE_INFO_STRING;
-                       info[i].value = talloc_strdup(info, r->in.info.info2->password);
+                       info[i].value = talloc_strdup(info, r->in.info->info2->password);
                        W_ERROR_HAVE_NO_MEMORY(info[i].value);
 
                        i++;
@@ -512,12 +512,12 @@ static WERROR dcesrv_srvsvc_NetShareAdd(struct dcesrv_call_state *dce_call, TALL
                info[i].name = SHARE_MAX_CONNECTIONS;
                info[i].type = SHARE_INFO_INT;
                info[i].value = talloc(info, int);
-               *((int *)info[i].value) = r->in.info.info2->max_users;
+               *((int *)info[i].value) = r->in.info->info2->max_users;
                i++;
 
                /* TODO: security descriptor */
 
-               nterr = share_create(sctx, r->in.info.info2->name, info, i);
+               nterr = share_create(sctx, r->in.info->info2->name, info, i);
                if (!NT_STATUS_IS_OK(nterr)) {
                        return ntstatus_to_werror(nterr);
                }
@@ -556,7 +556,7 @@ static WERROR dcesrv_srvsvc_NetShareAdd(struct dcesrv_call_state *dce_call, TALL
 
                info[i].name = SHARE_TYPE;
                info[i].type = SHARE_INFO_STRING;
-               switch (r->in.info.info502->type) {
+               switch (r->in.info->info502->type) {
                case 0x00:
                        info[i].value = talloc_strdup(info, "DISK");
                        break;
@@ -572,16 +572,16 @@ static WERROR dcesrv_srvsvc_NetShareAdd(struct dcesrv_call_state *dce_call, TALL
                W_ERROR_HAVE_NO_MEMORY(info[i].value);
                i++;
 
-               if (r->in.info.info502->path && r->in.info.info502->path[0]) {
+               if (r->in.info->info502->path && r->in.info->info502->path[0]) {
                        info[i].name = SHARE_PATH;
                        info[i].type = SHARE_INFO_STRING;
 
                        /* Windows will send a path in a form of C:\example\path */
-                       if (r->in.info.info502->path[1] == ':') {
-                               info[i].value = talloc_strdup(info, &r->in.info.info502->path[2]);
+                       if (r->in.info->info502->path[1] == ':') {
+                               info[i].value = talloc_strdup(info, &r->in.info->info502->path[2]);
                        } else {
                                /* very strange let's try to set as is */
-                               info[i].value = talloc_strdup(info, r->in.info.info502->path);
+                               info[i].value = talloc_strdup(info, r->in.info->info502->path);
                        }
                        W_ERROR_HAVE_NO_MEMORY(info[i].value);
                        all_string_sub((char *)info[i].value, "\\", "/", 0);
@@ -589,19 +589,19 @@ static WERROR dcesrv_srvsvc_NetShareAdd(struct dcesrv_call_state *dce_call, TALL
                        i++;
                }
 
-               if (r->in.info.info502->comment && r->in.info.info502->comment[0]) {
+               if (r->in.info->info502->comment && r->in.info->info502->comment[0]) {
                        info[i].name = SHARE_COMMENT;
                        info[i].type = SHARE_INFO_STRING;
-                       info[i].value = talloc_strdup(info, r->in.info.info502->comment);
+                       info[i].value = talloc_strdup(info, r->in.info->info502->comment);
                        W_ERROR_HAVE_NO_MEMORY(info[i].value);
 
                        i++;
                }
 
-               if (r->in.info.info502->password && r->in.info.info502->password[0]) {
+               if (r->in.info->info502->password && r->in.info->info502->password[0]) {
                        info[i].name = SHARE_PASSWORD;
                        info[i].type = SHARE_INFO_STRING;
-                       info[i].value = talloc_strdup(info, r->in.info.info502->password);
+                       info[i].value = talloc_strdup(info, r->in.info->info502->password);
                        W_ERROR_HAVE_NO_MEMORY(info[i].value);
 
                        i++;
@@ -610,12 +610,12 @@ static WERROR dcesrv_srvsvc_NetShareAdd(struct dcesrv_call_state *dce_call, TALL
                info[i].name = SHARE_MAX_CONNECTIONS;
                info[i].type = SHARE_INFO_INT;
                info[i].value = talloc(info, int);
-               *((int *)info[i].value) = r->in.info.info502->max_users;
+               *((int *)info[i].value) = r->in.info->info502->max_users;
                i++;
 
                /* TODO: security descriptor */
 
-               nterr = share_create(sctx, r->in.info.info502->name, info, i);
+               nterr = share_create(sctx, r->in.info->info502->name, info, i);
                if (!NT_STATUS_IS_OK(nterr)) {
                        return ntstatus_to_werror(nterr);
                }
index 76a29851e1161701ea309a5c5fe6d65110aa8de9..e49461357afc5617483300c29d29c4182bcdcedb 100644 (file)
@@ -170,6 +170,7 @@ static bool test_addshare(struct dcerpc_pipe *svc_pipe, TALLOC_CTX *mem_ctx, con
 {
        NTSTATUS status;
        struct srvsvc_NetShareAdd add;
+       union srvsvc_NetShareInfo info;
        struct srvsvc_NetShareInfo2 i;
        
        i.name         = share;
@@ -180,9 +181,11 @@ static bool test_addshare(struct dcerpc_pipe *svc_pipe, TALLOC_CTX *mem_ctx, con
        i.password     = NULL;
        i.permissions  = 0x0;
 
+       info.info2 = &i;
+
        add.in.server_unc = host;
        add.in.level      = 2;
-       add.in.info.info2 = &i;
+       add.in.info       = &info;
        add.in.parm_error = NULL;
 
        status = dcerpc_srvsvc_NetShareAdd(svc_pipe, mem_ctx, &add);
index 55352278e7fe763109732384e8e3ae8768e95aec..b890f11ab83bac9482be8ea077127ea1453f4df1 100644 (file)
@@ -447,6 +447,7 @@ static bool test_NetShareAddSetDel(struct torture_context *tctx,
        struct srvsvc_NetShareGetInfo q;
        struct srvsvc_NetShareDel d;
        struct sec_desc_buf sd_buf;
+       union srvsvc_NetShareInfo info;
        struct {
                uint32_t level;
                WERROR expected;
@@ -468,17 +469,18 @@ static bool test_NetShareAddSetDel(struct torture_context *tctx,
                talloc_asprintf(tctx, "\\\\%s", dcerpc_server_name(p));
        r.in.share_name = talloc_strdup(tctx, "testshare");
 
+       info.info2 = talloc(tctx, struct srvsvc_NetShareInfo2);
+       info.info2->name = r.in.share_name;
+       info.info2->type = STYPE_DISKTREE;
+       info.info2->comment = talloc_strdup(tctx, "test comment");
+       info.info2->permissions = 123434566;
+       info.info2->max_users = -1;
+       info.info2->current_users = 0;
+       info.info2->path = talloc_strdup(tctx, "C:\\");
+       info.info2->password = NULL;
+
+       a.in.info = &info;
        a.in.level = 2;
-       a.in.info.info2 = talloc(tctx, struct srvsvc_NetShareInfo2);
-       a.in.info.info2->name = r.in.share_name;
-       a.in.info.info2->type = STYPE_DISKTREE;
-       a.in.info.info2->comment = talloc_strdup(tctx, "test comment");
-       a.in.info.info2->permissions = 123434566;
-       a.in.info.info2->max_users = -1;
-       a.in.info.info2->current_users = 0;
-       a.in.info.info2->path = talloc_strdup(tctx, "C:\\");
-       a.in.info.info2->password = NULL;
-
        a.in.parm_error = NULL;
 
        status = dcerpc_srvsvc_NetShareAdd(p, tctx, &a);