[SCM] Samba Shared Repository - branch master updated
Günther Deschner
gd at samba.org
Tue May 11 16:17:20 MDT 2010
The branch, master has been updated
via 19d99a6... s4-smbtorture: add torture_create_testuser_max_pwlen() that allows to set maxpwlen.
via 40e7a58... s4-smbtorture: autolookup domain in torture_create_testuser() if none was given.
from 4955ccf... Fix more SMB2-OPLOCK bugs. Only 3 more issues to address then we're good to go on this test.
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 19d99a64262735581c20d88ca449ca14f247f361
Author: Günther Deschner <gd at samba.org>
Date: Tue May 11 23:55:53 2010 +0200
s4-smbtorture: add torture_create_testuser_max_pwlen() that allows to set maxpwlen.
required for upcoming rap pwd tests.
Guenther
commit 40e7a5879c3cca212d302d3bce78e1c6e588849c
Author: Günther Deschner <gd at samba.org>
Date: Tue May 11 17:46:18 2010 +0200
s4-smbtorture: autolookup domain in torture_create_testuser() if none was given.
Guenther
-----------------------------------------------------------------------
Summary of changes:
source4/torture/rpc/testjoin.c | 103 ++++++++++++++++++++++++++++++++-------
1 files changed, 84 insertions(+), 19 deletions(-)
Changeset truncated at 500 lines:
diff --git a/source4/torture/rpc/testjoin.c b/source4/torture/rpc/testjoin.c
index cba9093..0e61960 100644
--- a/source4/torture/rpc/testjoin.c
+++ b/source4/torture/rpc/testjoin.c
@@ -114,11 +114,12 @@ static NTSTATUS DeleteUser_byname(struct dcerpc_binding_handle *b,
when finished
*/
-struct test_join *torture_create_testuser(struct torture_context *torture,
- const char *username,
- const char *domain,
- uint16_t acct_type,
- const char **random_password)
+struct test_join *torture_create_testuser_max_pwlen(struct torture_context *torture,
+ const char *username,
+ const char *domain,
+ uint16_t acct_type,
+ const char **random_password,
+ int max_pw_len)
{
NTSTATUS status;
struct samr_Connect c;
@@ -185,21 +186,76 @@ struct test_join *torture_create_testuser(struct torture_context *torture,
return NULL;
}
- printf("Opening domain %s\n", domain);
+ if (domain) {
+ printf("Opening domain %s\n", domain);
- name.string = domain;
- l.in.connect_handle = &handle;
- l.in.domain_name = &name;
- l.out.sid = &sid;
+ name.string = domain;
+ l.in.connect_handle = &handle;
+ l.in.domain_name = &name;
+ l.out.sid = &sid;
- status = dcerpc_samr_LookupDomain_r(b, join, &l);
- if (!NT_STATUS_IS_OK(status)) {
- printf("LookupDomain failed - %s\n", nt_errstr(status));
- goto failed;
- }
- if (!NT_STATUS_IS_OK(l.out.result)) {
- printf("LookupDomain failed - %s\n", nt_errstr(l.out.result));
- goto failed;
+ status = dcerpc_samr_LookupDomain_r(b, join, &l);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("LookupDomain failed - %s\n", nt_errstr(status));
+ goto failed;
+ }
+ if (!NT_STATUS_IS_OK(l.out.result)) {
+ printf("LookupDomain failed - %s\n", nt_errstr(l.out.result));
+ goto failed;
+ }
+ } else {
+ struct samr_EnumDomains e;
+ uint32_t resume_handle = 0, num_entries;
+ struct samr_SamArray *sam;
+ int i;
+
+ e.in.connect_handle = &handle;
+ e.in.buf_size = (uint32_t)-1;
+ e.in.resume_handle = &resume_handle;
+ e.out.sam = &sam;
+ e.out.num_entries = &num_entries;
+ e.out.resume_handle = &resume_handle;
+
+ status = dcerpc_samr_EnumDomains_r(b, join, &e);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("EnumDomains failed - %s\n", nt_errstr(status));
+ goto failed;
+ }
+ if (!NT_STATUS_IS_OK(e.out.result)) {
+ printf("EnumDomains failed - %s\n", nt_errstr(e.out.result));
+ goto failed;
+ }
+ if ((num_entries != 2) || (sam && sam->count != 2)) {
+ printf("unexpected number of domains\n");
+ goto failed;
+ }
+ for (i=0; i < 2; i++) {
+ if (!strequal(sam->entries[i].name.string, "builtin")) {
+ domain = sam->entries[i].name.string;
+ break;
+ }
+ }
+ if (domain) {
+ printf("Opening domain %s\n", domain);
+
+ name.string = domain;
+ l.in.connect_handle = &handle;
+ l.in.domain_name = &name;
+ l.out.sid = &sid;
+
+ status = dcerpc_samr_LookupDomain_r(b, join, &l);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("LookupDomain failed - %s\n", nt_errstr(status));
+ goto failed;
+ }
+ if (!NT_STATUS_IS_OK(l.out.result)) {
+ printf("LookupDomain failed - %s\n", nt_errstr(l.out.result));
+ goto failed;
+ }
+ } else {
+ printf("cannot proceed without domain name\n");
+ goto failed;
+ }
}
talloc_steal(join, *l.out.sid);
@@ -262,7 +318,7 @@ again:
policy_min_pw_len = pwp.out.info->min_password_length;
}
- random_pw = generate_random_password(join, MAX(8, policy_min_pw_len), 255);
+ random_pw = generate_random_password(join, MAX(8, policy_min_pw_len), max_pw_len);
printf("Setting account password '%s'\n", random_pw);
@@ -339,6 +395,15 @@ failed:
}
+struct test_join *torture_create_testuser(struct torture_context *torture,
+ const char *username,
+ const char *domain,
+ uint16_t acct_type,
+ const char **random_password)
+{
+ return torture_create_testuser_max_pwlen(torture, username, domain, acct_type, random_password, 255);
+}
+
_PUBLIC_ struct test_join *torture_join_domain(struct torture_context *tctx,
const char *machine_name,
uint32_t acct_flags,
--
Samba Shared Repository
More information about the samba-cvs
mailing list