summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source4/librpc/idl/srvsvc.idl14
-rw-r--r--source4/torture/rpc/srvsvc.c75
2 files changed, 81 insertions, 8 deletions
diff --git a/source4/librpc/idl/srvsvc.idl b/source4/librpc/idl/srvsvc.idl
index 8cd9d63864..4f1f70c6e8 100644
--- a/source4/librpc/idl/srvsvc.idl
+++ b/source4/librpc/idl/srvsvc.idl
@@ -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
);
/**************************/
diff --git a/source4/torture/rpc/srvsvc.c b/source4/torture/rpc/srvsvc.c
index dc48516b91..78bde03ded 100644
--- a/source4/torture/rpc/srvsvc.c
+++ b/source4/torture/rpc/srvsvc.c
@@ -766,6 +766,78 @@ static BOOL test_NetRemoteTOD(struct dcerpc_pipe *p,
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 @@ BOOL torture_rpc_srvsvc(struct torture_context *torture)
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) {