s4-smbtorture: add RAP-SAM testsuite with a rap_NetUserPasswordSet2 test.
authorGünther Deschner <gd@samba.org>
Fri, 7 May 2010 13:45:23 +0000 (15:45 +0200)
committerGünther Deschner <gd@samba.org>
Tue, 11 May 2010 22:20:41 +0000 (00:20 +0200)
Guenther

source4/torture/config.mk
source4/torture/rap/rap.c
source4/torture/rap/sam.c [new file with mode: 0644]
source4/torture/wscript_build

index 3d566c09958a1af4b92318000dc3bc09b4bcfe55..50d400980f453b411c787cc1d80e39c2a0a0be16 100644 (file)
@@ -140,7 +140,7 @@ PRIVATE_DEPENDENCIES = TORTURE_UTIL LIBCLI_SMB NDR_RAP
 # End SUBSYSTEM TORTURE_RAP
 #################################
 
-TORTURE_RAP_OBJ_FILES = $(torturesrcdir)/rap/rap.o $(torturesrcdir)/rap/rpc.o $(torturesrcdir)/rap/printing.o
+TORTURE_RAP_OBJ_FILES = $(torturesrcdir)/rap/rap.o $(torturesrcdir)/rap/rpc.o $(torturesrcdir)/rap/printing.o $(torturesrcdir)/rap/sam.o
 
 $(eval $(call proto_header_template,$(torturesrcdir)/rap/proto.h,$(TORTURE_RAP_OBJ_FILES:.o=.c)))
 
index 74f7188cd5350d23b9c7c515edcb8003eee7b776..5412c1b52dba60ee10522d4a0bc7750c7c064fcf 100644 (file)
@@ -1760,6 +1760,7 @@ NTSTATUS torture_rap_init(void)
        torture_suite_add_suite(suite, suite_basic);
        torture_suite_add_suite(suite, torture_rap_rpc(suite));
        torture_suite_add_suite(suite, torture_rap_printing(suite));
+       torture_suite_add_suite(suite, torture_rap_sam(suite));
 
        torture_suite_add_1smb_test(suite_basic, "netserverenum", 
                                    test_netserverenum);
diff --git a/source4/torture/rap/sam.c b/source4/torture/rap/sam.c
new file mode 100644 (file)
index 0000000..f3ad5b9
--- /dev/null
@@ -0,0 +1,60 @@
+/*
+   Unix SMB/CIFS implementation.
+   test suite for RAP sam operations
+
+   Copyright (C) Guenther Deschner 2010
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "includes.h"
+#include "libcli/libcli.h"
+#include "torture/torture.h"
+#include "torture/util.h"
+#include "torture/smbtorture.h"
+#include "torture/util.h"
+#include "../librpc/gen_ndr/rap.h"
+#include "torture/rap/proto.h"
+#include "param/param.h"
+#include "../lib/crypto/crypto.h"
+#include "../libcli/auth/libcli_auth.h"
+
+static bool test_userpasswordset2(struct torture_context *tctx,
+                                 struct smbcli_state *cli)
+{
+       struct rap_NetUserPasswordSet2 r;
+
+       r.in.UserName = "gd";
+       r.in.OldPassword = "secret";
+       r.in.NewPassword = "newpwd";
+       r.in.EncryptedPassword = 0;
+       r.in.RealPasswordLength = strlen(r.in.NewPassword);
+
+       torture_comment(tctx, "Testing rap_NetUserPasswordSet2(%s)\n", r.in.UserName);
+
+       torture_assert_ntstatus_ok(tctx,
+               smbcli_rap_netuserpasswordset2(cli->tree, lp_iconv_convenience(tctx->lp_ctx), tctx, &r),
+               "smbcli_rap_netuserpasswordset2 failed");
+
+       return true;
+}
+
+struct torture_suite *torture_rap_sam(TALLOC_CTX *mem_ctx)
+{
+       struct torture_suite *suite = torture_suite_create(mem_ctx, "SAM");
+
+       torture_suite_add_1smb_test(suite, "userpasswordset2", test_userpasswordset2);
+
+       return suite;
+}
index 33f9f15e735d9d82de30c2552ddeb50d6dfe342e..b91ba08096fb9cd78d48670e32e31079896dd007 100644 (file)
@@ -51,7 +51,7 @@ bld.SAMBA_MODULE('torture_rpc',
 bld.RECURSE('drs')
 
 bld.SAMBA_MODULE('TORTURE_RAP',
-       source='rap/rap.c rap/rpc.c rap/printing.c',
+       source='rap/rap.c rap/rpc.c rap/printing.c rap/sam.c',
        autoproto='rap/proto.h',
        subsystem='smbtorture',
        init_function='torture_rap_init',