svn commit: samba r4434 - in branches/SAMBA_4_0/source: librpc/idl torture/rpc

metze at samba.org metze at samba.org
Fri Dec 31 06:19:05 GMT 2004


Author: metze
Date: 2004-12-31 06:19:05 +0000 (Fri, 31 Dec 2004)
New Revision: 4434

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=4434

Log:
- fix some NetShare* idl functions

- add torture test for NetShareCheck()

metze

Modified:
   branches/SAMBA_4_0/source/librpc/idl/srvsvc.idl
   branches/SAMBA_4_0/source/torture/rpc/srvsvc.c


Changeset:
Modified: branches/SAMBA_4_0/source/librpc/idl/srvsvc.idl
===================================================================
--- branches/SAMBA_4_0/source/librpc/idl/srvsvc.idl	2004-12-31 06:08:43 UTC (rev 4433)
+++ branches/SAMBA_4_0/source/librpc/idl/srvsvc.idl	2004-12-31 06:19:05 UTC (rev 4434)
@@ -518,7 +518,7 @@
 	/* Function: 0x11 */
 	WERROR srvsvc_NetShareSetInfo(
 		[in]   unistr *server_unc,
-		[in]   unistr *share_name,
+		[in]   unistr share_name,
 		[in]   uint32 level,
 		[in,switch_is(level)] srvsvc_NetShareInfo info,
 		[in,out]   uint32 *parm_error
@@ -528,7 +528,7 @@
 	/* Function: 0x12 */
 	WERROR srvsvc_NetShareDel(
 		[in]   unistr *server_unc,
-		[in]   unistr *share_name,
+		[in]   unistr share_name,
 		[in]   uint32 reserved
 		);
 
@@ -536,7 +536,7 @@
 	/* Function: 0x13 */
 	WERROR srvsvc_NetShareDelSticky(
 		[in]   unistr *server_unc,
-		[in]   unistr *share_name,
+		[in]   unistr share_name,
 		[in]   uint32 reserved
 		);
 	
@@ -544,7 +544,7 @@
 	/* Function: 0x14 */
 	WERROR srvsvc_NetShareCheck(
 		[in]   unistr *server_unc,
-		[in]   unistr *share_name,
+		[in]   unistr device_name,
 		[out]   uint32 type
 		);
 

Modified: branches/SAMBA_4_0/source/torture/rpc/srvsvc.c
===================================================================
--- branches/SAMBA_4_0/source/torture/rpc/srvsvc.c	2004-12-31 06:08:43 UTC (rev 4433)
+++ branches/SAMBA_4_0/source/torture/rpc/srvsvc.c	2004-12-31 06:19:05 UTC (rev 4434)
@@ -448,6 +448,32 @@
 	return ret;
 }
 
+static BOOL test_NetShareCheck(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
+			       const char *device_name)
+{
+	NTSTATUS status;
+	struct srvsvc_NetShareCheck r;
+	BOOL ret = True;
+
+	r.in.server_unc = talloc_asprintf(mem_ctx, "\\\\%s", dcerpc_server_name(p));
+	r.in.device_name = device_name;
+
+	printf("testing NetShareCheck on device '%s'\n", r.in.device_name);
+
+	status = dcerpc_srvsvc_NetShareCheck(p, mem_ctx, &r);
+	if (!NT_STATUS_IS_OK(status)) {
+		printf("dcerpc_srvsvc_NetShareCheck on device '%s' failed - %s\n",
+			r.in.device_name, nt_errstr(status));
+		ret = False;
+	} else if (!W_ERROR_IS_OK(r.out.result)) {
+		printf("NetShareCheck on device '%s' failed - %s\n",
+			r.in.device_name, win_errstr(r.out.result));
+		ret = False;
+	}
+
+	return ret;
+}
+
 /**************************/
 /* srvsvc_NetShare        */
 /**************************/
@@ -489,13 +515,18 @@
 		}
 
 		/* call srvsvc_NetShareGetInfo for each returned share */
-		if (r.in.level == 1) {
-			for (j=0;j<r.out.ctr.ctr1->count;j++) {
+		if (r.in.level == 2) {
+			for (j=0;j<r.out.ctr.ctr2->count;j++) {
 				const char *name;
-				name = r.out.ctr.ctr1->array[j].name;
+				const char *device;
+				name = r.out.ctr.ctr2->array[j].name;
 				if (!test_NetShareGetInfo(p, mem_ctx, name)) {
 					ret = False;
 				}
+				device = r.out.ctr.ctr2->array[j].path;
+				if (!test_NetShareCheck(p, mem_ctx, device)) {
+					ret = False;
+				}
 			}
 		}
 	}



More information about the samba-cvs mailing list