svn commit: samba r5783 - in branches/SAMBA_4_0/source: librpc/idl
rpc_server/samr torture/rpc
abartlet at samba.org
abartlet at samba.org
Sun Mar 13 06:43:34 GMT 2005
Author: abartlet
Date: 2005-03-13 06:43:34 +0000 (Sun, 13 Mar 2005)
New Revision: 5783
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=5783
Log:
Test renaming of accounts in the RPC-SAMR test, and add support into
the SAMR server.
Andrew Bartlett
Modified:
branches/SAMBA_4_0/source/librpc/idl/samr.idl
branches/SAMBA_4_0/source/rpc_server/samr/dcesrv_samr.c
branches/SAMBA_4_0/source/torture/rpc/samr.c
Changeset:
Modified: branches/SAMBA_4_0/source/librpc/idl/samr.idl
===================================================================
--- branches/SAMBA_4_0/source/librpc/idl/samr.idl 2005-03-13 03:16:07 UTC (rev 5782)
+++ branches/SAMBA_4_0/source/librpc/idl/samr.idl 2005-03-13 06:43:34 UTC (rev 5783)
@@ -665,7 +665,8 @@
/* this defines the bits used for fields_present in info21 */
typedef [bitmap32bit] bitmap {
- SAMR_FIELD_NAME = 0x00000002,
+ SAMR_FIELD_ACCOUNT_NAME = 0x00000001,
+ SAMR_FIELD_FULL_NAME = 0x00000002,
SAMR_FIELD_DESCRIPTION = 0x00000010,
SAMR_FIELD_COMMENT = 0x00000020,
SAMR_FIELD_LOGON_SCRIPT = 0x00000100,
Modified: branches/SAMBA_4_0/source/rpc_server/samr/dcesrv_samr.c
===================================================================
--- branches/SAMBA_4_0/source/rpc_server/samr/dcesrv_samr.c 2005-03-13 03:16:07 UTC (rev 5782)
+++ branches/SAMBA_4_0/source/rpc_server/samr/dcesrv_samr.c 2005-03-13 06:43:34 UTC (rev 5783)
@@ -2635,6 +2635,10 @@
SET_STRING(msg, info6.full_name.string, "displayName");
break;
+ case 7:
+ SET_STRING(msg, info7.account_name.string, "samAccountName");
+ break;
+
case 8:
SET_STRING(msg, info8.full_name.string, "displayName");
break;
@@ -2674,7 +2678,9 @@
case 21:
#define IFSET(bit) if (bit & r->in.info->info21.fields_present)
- IFSET(SAMR_FIELD_NAME)
+ IFSET(SAMR_FIELD_ACCOUNT_NAME)
+ SET_STRING(msg, info21.account_name.string, "samAccountName");
+ IFSET(SAMR_FIELD_FULL_NAME)
SET_STRING(msg, info21.full_name.string, "displayName");
IFSET(SAMR_FIELD_DESCRIPTION)
SET_STRING(msg, info21.description.string, "description");
@@ -2704,7 +2710,9 @@
case 23:
#define IFSET(bit) if (bit & r->in.info->info23.info.fields_present)
- IFSET(SAMR_FIELD_NAME)
+ IFSET(SAMR_FIELD_ACCOUNT_NAME)
+ SET_STRING(msg, info23.info.account_name.string, "samAccountName");
+ IFSET(SAMR_FIELD_FULL_NAME)
SET_STRING(msg, info23.info.full_name.string, "displayName");
IFSET(SAMR_FIELD_DESCRIPTION)
SET_STRING(msg, info23.info.description.string, "description");
@@ -2756,7 +2764,9 @@
case 25:
#define IFSET(bit) if (bit & r->in.info->info25.info.fields_present)
- IFSET(SAMR_FIELD_NAME)
+ IFSET(SAMR_FIELD_ACCOUNT_NAME)
+ SET_STRING(msg, info25.info.account_name.string, "samAccountName");
+ IFSET(SAMR_FIELD_FULL_NAME)
SET_STRING(msg, info25.info.full_name.string, "displayName");
IFSET(SAMR_FIELD_DESCRIPTION)
SET_STRING(msg, info25.info.description.string, "description");
Modified: branches/SAMBA_4_0/source/torture/rpc/samr.c
===================================================================
--- branches/SAMBA_4_0/source/torture/rpc/samr.c 2005-03-13 03:16:07 UTC (rev 5782)
+++ branches/SAMBA_4_0/source/torture/rpc/samr.c 2005-03-13 06:43:34 UTC (rev 5783)
@@ -28,8 +28,8 @@
#define TEST_ACCOUNT_NAME "samrtorturetest"
#define TEST_ALIASNAME "samrtorturetestalias"
#define TEST_GROUPNAME "samrtorturetestgroup"
-#define TEST_MACHINENAME "samrtorturetestmach$"
-#define TEST_DOMAINNAME "samrtorturetestdom$"
+#define TEST_MACHINENAME "samrtestmach$"
+#define TEST_DOMAINNAME "samrtestdom$"
static BOOL test_QueryUserInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
@@ -162,7 +162,8 @@
static BOOL test_SetUserInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
- struct policy_handle *handle, uint32_t base_acct_flags)
+ struct policy_handle *handle, uint32_t base_acct_flags,
+ const char *base_account_name)
{
NTSTATUS status;
struct samr_SetUserInfo s;
@@ -171,6 +172,7 @@
struct samr_QueryUserInfo q0;
union samr_UserInfo u;
BOOL ret = True;
+ const char *test_account_name;
uint32_t user_extra_flags = 0;
if (base_acct_flags == ACB_NORMAL) {
@@ -191,24 +193,24 @@
#define TESTCALL(call, r) \
status = dcerpc_samr_ ##call(p, mem_ctx, &r); \
if (!NT_STATUS_IS_OK(status)) { \
- printf(#call " level %u failed - %s (line %d)\n", \
- r.in.level, nt_errstr(status), __LINE__); \
+ printf(#call " level %u failed - %s (%s)\n", \
+ r.in.level, nt_errstr(status), __location__); \
ret = False; \
break; \
}
#define STRING_EQUAL(s1, s2, field) \
if ((s1 && !s2) || (s2 && !s1) || strcmp(s1, s2)) { \
- printf("Failed to set %s to '%s' (line %d)\n", \
- #field, s2, __LINE__); \
+ printf("Failed to set %s to '%s' (%s)\n", \
+ #field, s2, __location__); \
ret = False; \
break; \
}
#define INT_EQUAL(i1, i2, field) \
if (i1 != i2) { \
- printf("Failed to set %s to 0x%x - got 0x%x (line %d)\n", \
- #field, i2, i1, __LINE__); \
+ printf("Failed to set %s to 0x%x - got 0x%x (%s)\n", \
+ #field, i2, i1, __location__); \
ret = False; \
break; \
}
@@ -278,6 +280,22 @@
TEST_USERINFO_STRING(21, comment, 21, comment, "xx21-21 comment",
SAMR_FIELD_COMMENT);
+ test_account_name = talloc_asprintf(mem_ctx, "%sxx7-1", base_account_name);
+ TEST_USERINFO_STRING(7, account_name, 1, account_name, base_account_name, 0);
+ test_account_name = talloc_asprintf(mem_ctx, "%sxx7-3", base_account_name);
+ TEST_USERINFO_STRING(7, account_name, 3, account_name, base_account_name, 0);
+ test_account_name = talloc_asprintf(mem_ctx, "%sxx7-5", base_account_name);
+ TEST_USERINFO_STRING(7, account_name, 5, account_name, base_account_name, 0);
+ test_account_name = talloc_asprintf(mem_ctx, "%sxx7-6", base_account_name);
+ TEST_USERINFO_STRING(7, account_name, 6, account_name, base_account_name, 0);
+ test_account_name = talloc_asprintf(mem_ctx, "%sxx7-7", base_account_name);
+ TEST_USERINFO_STRING(7, account_name, 7, account_name, base_account_name, 0);
+ test_account_name = talloc_asprintf(mem_ctx, "%sxx7-21", base_account_name);
+ TEST_USERINFO_STRING(7, account_name, 21, account_name, base_account_name, 0);
+ test_account_name = base_account_name;
+ TEST_USERINFO_STRING(21, account_name, 21, account_name, base_account_name,
+ SAMR_FIELD_ACCOUNT_NAME);
+
TEST_USERINFO_STRING(6, full_name, 1, full_name, "xx6-1 full_name", 0);
TEST_USERINFO_STRING(6, full_name, 3, full_name, "xx6-3 full_name", 0);
TEST_USERINFO_STRING(6, full_name, 5, full_name, "xx6-5 full_name", 0);
@@ -286,7 +304,7 @@
TEST_USERINFO_STRING(6, full_name, 21, full_name, "xx6-21 full_name", 0);
TEST_USERINFO_STRING(8, full_name, 21, full_name, "xx8-21 full_name", 0);
TEST_USERINFO_STRING(21, full_name, 21, full_name, "xx21-21 full_name",
- SAMR_FIELD_NAME);
+ SAMR_FIELD_FULL_NAME);
TEST_USERINFO_STRING(11, logon_script, 3, logon_script, "xx11-3 logon_script", 0);
TEST_USERINFO_STRING(11, logon_script, 5, logon_script, "xx11-5 logon_script", 0);
@@ -1265,7 +1283,8 @@
static BOOL test_user_ops(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
- struct policy_handle *handle, uint32_t base_acct_flags)
+ struct policy_handle *handle, uint32_t base_acct_flags,
+ const char *base_acct_name)
{
BOOL ret = True;
@@ -1281,7 +1300,8 @@
ret = False;
}
- if (!test_SetUserInfo(p, mem_ctx, handle, base_acct_flags)) {
+ if (!test_SetUserInfo(p, mem_ctx, handle, base_acct_flags,
+ base_acct_name)) {
ret = False;
}
@@ -1604,7 +1624,7 @@
}
}
- if (!test_user_ops(p, mem_ctx, user_handle, acct_flags)) {
+ if (!test_user_ops(p, mem_ctx, user_handle, acct_flags, name.string)) {
ret = False;
}
@@ -1755,7 +1775,7 @@
}
}
- if (!test_user_ops(p, mem_ctx, &user_handle, acct_flags)) {
+ if (!test_user_ops(p, mem_ctx, &user_handle, acct_flags, name.string)) {
ret = False;
}
More information about the samba-cvs
mailing list