svn commit: samba r18344 - in branches/SAMBA_4_0/source: librpc/idl
torture/rpc
idra at samba.org
idra at samba.org
Sun Sep 10 21:51:46 GMT 2006
Author: idra
Date: 2006-09-10 21:51:46 +0000 (Sun, 10 Sep 2006)
New Revision: 18344
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=18344
Log:
add a test to show hoe NetNameValidate behaves.
fix the misleading idl names
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 2006-09-10 14:19:38 UTC (rev 18343)
+++ branches/SAMBA_4_0/source/librpc/idl/srvsvc.idl 2006-09-10 21:51:46 UTC (rev 18344)
@@ -1348,9 +1348,9 @@
/* Function: 0x21 */
WERROR srvsvc_NetNameValidate(
[in] [string,charset(UTF16)] uint16 *server_unc,
- [in] [string,charset(UTF16)] uint16 path[],
- [in] uint32 pathtype,
- [in] uint32 pathflags
+ [in] [string,charset(UTF16)] uint16 name[],
+ [in] uint32 name_type,
+ [in] uint32 flags
);
/******************/
@@ -1362,10 +1362,10 @@
/* Function: 0x23 */
WERROR srvsvc_NetPRNameCompare(
[in] [string,charset(UTF16)] uint16 *server_unc,
- [in] [string,charset(UTF16)] uint16 path1[],
- [in] [string,charset(UTF16)] uint16 path2[],
- [in] uint32 pathtype,
- [in] uint32 pathflags
+ [in] [string,charset(UTF16)] uint16 name1[],
+ [in] [string,charset(UTF16)] uint16 name2[],
+ [in] uint32 name_type,
+ [in] uint32 flags
);
/**************************/
Modified: branches/SAMBA_4_0/source/torture/rpc/srvsvc.c
===================================================================
--- branches/SAMBA_4_0/source/torture/rpc/srvsvc.c 2006-09-10 14:19:38 UTC (rev 18343)
+++ branches/SAMBA_4_0/source/torture/rpc/srvsvc.c 2006-09-10 21:51:46 UTC (rev 18344)
@@ -766,6 +766,78 @@
return ret;
}
+/**************************/
+/* srvsvc_NetName */
+/**************************/
+
+static BOOL test_NetNameValidate(struct dcerpc_pipe *p,
+ TALLOC_CTX *mem_ctx)
+{
+ NTSTATUS status;
+ struct srvsvc_NetNameValidate r;
+ char *invalidc;
+ int i, n;
+
+ r.in.server_unc = talloc_asprintf(mem_ctx, "\\\\%s", dcerpc_server_name(p));
+ r.in.flags = 0x0;
+
+ printf("testing NetNameValidate\n");
+
+ /* valid path types only between 1 and 13 */
+ for (i = 1; i < 14; i++) {
+
+ /* Find maximum length accepted by this type */
+ r.in.name_type = i;
+ r.in.name = talloc_strdup(mem_ctx, "A");
+ n = 0;
+
+ while (W_ERROR_IS_OK(r.out.result)) {
+ status = dcerpc_srvsvc_NetNameValidate(p, mem_ctx, &r);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("NetNameValidate failed while checking maximum size (%s)\n",
+ nt_errstr(status));
+ break;
+ }
+
+ r.in.name = talloc_append_string(mem_ctx, r.in.name, "A");
+ if (!r.in.name) {
+ printf("NetNameValidate: Out of memory!\n");
+ return False;
+ }
+ n++;
+ }
+
+ talloc_free(r.in.name);
+
+ printf("Maximum length for type %d: %d\n", i, n);
+
+ /* find invalid chars for this type check only ASCII between 0x20 and 0x7e */
+
+ invalidc = NULL;
+
+ for (n = 0x20; n < 0x7e; n++) {
+ r.in.name = talloc_asprintf(mem_ctx, "%c", (char)n);
+
+ status = dcerpc_srvsvc_NetNameValidate(p, mem_ctx, &r);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("NetNameValidate failed while checking valid chars (%s)\n",
+ nt_errstr(status));
+ break;
+ }
+
+ if (!W_ERROR_IS_OK(r.out.result)) {
+ invalidc = talloc_asprintf_append(invalidc, "%c", (char)n);
+ }
+
+ talloc_free(r.in.name);
+ }
+
+ printf("Invalid chars for type %d: %s\n", i, invalidc);
+ }
+
+ return True;
+}
+
BOOL torture_rpc_srvsvc(struct torture_context *torture)
{
NTSTATUS status;
@@ -795,7 +867,8 @@
ret &= test_NetRemoteTOD(p, mem_ctx);
ret &= test_NetShareEnum(p, mem_ctx, True);
ret &= test_NetShareGetInfo(p, mem_ctx, "ADMIN$", True);
-
+ ret &= test_NetNameValidate(p, mem_ctx);
+
status = torture_rpc_connection(mem_ctx, &p, &dcerpc_table_srvsvc);
if (!binding) {
More information about the samba-cvs
mailing list