[SCM] Samba Shared Repository - branch v3-4-test updated -
release-4-0-0alpha7-935-g69551b5
Günther Deschner
gd at samba.org
Mon May 11 15:13:15 GMT 2009
The branch, v3-4-test has been updated
via 69551b562a575c300d14bd1691fe5213db71d6bc (commit)
via ac5adbc294eb96db658151a9d278cae0e63ff3a1 (commit)
via 90aac31a2db75895a1b75b8c5e4a8259938ff74b (commit)
via 983d92188dcc5ac4bc31365cea195532e40d1144 (commit)
via bada15c31123c0a7c2716620c19f3a073e7c0067 (commit)
from 92117cd56692303b2018299cd43f229b0db59066 (commit)
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-4-test
- Log -----------------------------------------------------------------
commit 69551b562a575c300d14bd1691fe5213db71d6bc
Author: Günther Deschner <gd at samba.org>
Date: Mon May 11 16:29:39 2009 +0200
s3-selftest: enable RPC-LSA-LOOKUPNAMES against Samba 3.
Guenther
(cherry picked from commit f5cab8913b77c37dc24188b9093b80a0b4d42749)
commit ac5adbc294eb96db658151a9d278cae0e63ff3a1
Author: Günther Deschner <gd at samba.org>
Date: Mon May 11 16:28:42 2009 +0200
s4-smbtorture: add very basic RPC-LSA-LOOKUPNAMES test.
Guenther
(cherry picked from commit 5f015920a80a22f5486e0679f017db3a5ff9d798)
commit 90aac31a2db75895a1b75b8c5e4a8259938ff74b
Author: Günther Deschner <gd at samba.org>
Date: Mon May 11 16:40:26 2009 +0200
s4-smbtorture: add optional very simple reply checks to lsa lookup name tests.
Guenther
(cherry picked from commit 7347373e7cb814d683c603ed958583ff70552a2b)
commit 983d92188dcc5ac4bc31365cea195532e40d1144
Author: Günther Deschner <gd at samba.org>
Date: Mon May 11 14:54:04 2009 +0200
s4-smbtorture: remove trailing whitespace in RPC-LSA test.
Guenther
(cherry picked from commit 7672a033eff9db1203c69de422fb906504a54f77)
commit bada15c31123c0a7c2716620c19f3a073e7c0067
Author: Günther Deschner <gd at samba.org>
Date: Mon May 11 14:51:41 2009 +0200
s4-smbtorture: use struct torture_context in RPC-LSA.
Guenther
(cherry picked from commit 410f17cdebab929c68cd6d68b6e1a29ffe64e8d4)
-----------------------------------------------------------------------
Summary of changes:
source3/script/tests/test_posix_s3.sh | 2 +-
source4/torture/rpc/lsa.c | 901 ++++++++++++++++++---------------
source4/torture/rpc/rpc.c | 1 +
3 files changed, 497 insertions(+), 407 deletions(-)
Changeset truncated at 500 lines:
diff --git a/source3/script/tests/test_posix_s3.sh b/source3/script/tests/test_posix_s3.sh
index 0829b2c..7b8c253 100755
--- a/source3/script/tests/test_posix_s3.sh
+++ b/source3/script/tests/test_posix_s3.sh
@@ -41,7 +41,7 @@ rpc="RPC-AUTHCONTEXT RPC-BINDSAMBA3 RPC-SAMBA3-SRVSVC RPC-SAMBA3-SHARESEC"
rpc="$rpc RPC-SAMBA3-SPOOLSS RPC-SAMBA3-WKSSVC"
rpc="$rpc RPC-NETLOGSAMBA3 RPC-SAMBA3SESSIONKEY RPC-SAMBA3-GETUSERNAME"
rpc="$rpc RPC-SVCCTL RPC-SPOOLSS RPC-SPOOLSS-WIN RPC-NTSVCS"
-rpc="$rpc RPC-LSA-GETUSER RPC-LSA-LOOKUPSIDS"
+rpc="$rpc RPC-LSA-GETUSER RPC-LSA-LOOKUPSIDS RPC-LSA-LOOKUPNAMES"
rpc="$rpc RPC-SAMR-USERS RPC-SAMR-PASSWORDS RPC-SAMR-PASSWORDS-PWDLASTSET RPC-JOIN"
rpc="$rpc RPC-SCHANNEL RPC-SCHANNEL2 RPC-BENCH-SCHANNEL1"
diff --git a/source4/torture/rpc/lsa.c b/source4/torture/rpc/lsa.c
index 454afab..7d03e7e 100644
--- a/source4/torture/rpc/lsa.c
+++ b/source4/torture/rpc/lsa.c
@@ -1,20 +1,20 @@
-/*
+/*
Unix SMB/CIFS implementation.
test suite for lsa rpc operations
Copyright (C) Andrew Tridgell 2003
Copyright (C) Andrew Bartlett <abartlet at samba.org> 2004-2005
-
+
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/>.
*/
@@ -37,7 +37,8 @@ static void init_lsa_String(struct lsa_String *name, const char *s)
name->string = s;
}
-static bool test_OpenPolicy(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx)
+static bool test_OpenPolicy(struct dcerpc_pipe *p,
+ struct torture_context *tctx)
{
struct lsa_ObjectAttribute attr;
struct policy_handle handle;
@@ -65,7 +66,7 @@ static bool test_OpenPolicy(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx)
r.in.access_mask = SEC_FLAG_MAXIMUM_ALLOWED;
r.out.handle = &handle;
- status = dcerpc_lsa_OpenPolicy(p, mem_ctx, &r);
+ status = dcerpc_lsa_OpenPolicy(p, tctx, &r);
if (!NT_STATUS_IS_OK(status)) {
if (NT_STATUS_EQUAL(status, NT_STATUS_ACCESS_DENIED) ||
NT_STATUS_EQUAL(status, NT_STATUS_RPC_PROTSEQ_NOT_SUPPORTED)) {
@@ -80,7 +81,8 @@ static bool test_OpenPolicy(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx)
}
-bool test_lsa_OpenPolicy2(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
+bool test_lsa_OpenPolicy2(struct dcerpc_pipe *p,
+ struct torture_context *tctx,
struct policy_handle **handle)
{
struct lsa_ObjectAttribute attr;
@@ -90,7 +92,7 @@ bool test_lsa_OpenPolicy2(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
printf("\nTesting OpenPolicy2\n");
- *handle = talloc(mem_ctx, struct policy_handle);
+ *handle = talloc(tctx, struct policy_handle);
if (!*handle) {
return false;
}
@@ -112,7 +114,7 @@ bool test_lsa_OpenPolicy2(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
r.in.access_mask = SEC_FLAG_MAXIMUM_ALLOWED;
r.out.handle = *handle;
- status = dcerpc_lsa_OpenPolicy2(p, mem_ctx, &r);
+ status = dcerpc_lsa_OpenPolicy2(p, tctx, &r);
if (!NT_STATUS_IS_OK(status)) {
if (NT_STATUS_EQUAL(status, NT_STATUS_ACCESS_DENIED) ||
NT_STATUS_EQUAL(status, NT_STATUS_RPC_PROTSEQ_NOT_SUPPORTED)) {
@@ -146,8 +148,8 @@ static const char *sid_type_lookup(enum lsa_SidType r)
return "Invalid sid type\n";
}
-static bool test_LookupNames(struct dcerpc_pipe *p,
- TALLOC_CTX *mem_ctx,
+static bool test_LookupNames(struct dcerpc_pipe *p,
+ struct torture_context *tctx,
struct policy_handle *handle,
struct lsa_TransNameArray *tnames)
{
@@ -164,7 +166,7 @@ static bool test_LookupNames(struct dcerpc_pipe *p,
sids.count = 0;
sids.sids = NULL;
- names = talloc_array(mem_ctx, struct lsa_String, tnames->count);
+ names = talloc_array(tctx, struct lsa_String, tnames->count);
for (i=0;i<tnames->count;i++) {
init_lsa_String(&names[i], tnames->names[i].name.string);
}
@@ -179,14 +181,14 @@ static bool test_LookupNames(struct dcerpc_pipe *p,
r.out.sids = &sids;
r.out.domains = &domains;
- status = dcerpc_lsa_LookupNames(p, mem_ctx, &r);
+ status = dcerpc_lsa_LookupNames(p, tctx, &r);
- if (NT_STATUS_EQUAL(status, STATUS_SOME_UNMAPPED) ||
+ if (NT_STATUS_EQUAL(status, STATUS_SOME_UNMAPPED) ||
NT_STATUS_EQUAL(status, NT_STATUS_NONE_MAPPED)) {
for (i=0;i< tnames->count;i++) {
if (i < count && sids.sids[i].sid_type == SID_NAME_UNKNOWN) {
- printf("LookupName of %s was unmapped\n",
- tnames->names[i].name.string);
+ printf("LookupName of %s was unmapped\n",
+ tnames->names[i].name.string);
} else if (i >=count) {
printf("LookupName of %s failed to return a result\n",
tnames->names[i].name.string);
@@ -198,10 +200,10 @@ static bool test_LookupNames(struct dcerpc_pipe *p,
printf("LookupNames failed - %s\n", nt_errstr(status));
return false;
}
-
+
for (i=0;i< tnames->count;i++) {
if (i < count && sids.sids[i].sid_type != tnames->names[i].sid_type) {
- printf("LookupName of %s got unexpected name type: %s\n",
+ printf("LookupName of %s got unexpected name type: %s\n",
tnames->names[i].name.string, sid_type_lookup(sids.sids[i].sid_type));
} else if (i >=count) {
printf("LookupName of %s failed to return a result\n",
@@ -213,9 +215,9 @@ static bool test_LookupNames(struct dcerpc_pipe *p,
return true;
}
-static bool test_LookupNames_bogus(struct dcerpc_pipe *p,
- TALLOC_CTX *mem_ctx,
- struct policy_handle *handle)
+static bool test_LookupNames_bogus(struct dcerpc_pipe *p,
+ struct torture_context *tctx,
+ struct policy_handle *handle)
{
struct lsa_LookupNames r;
struct lsa_TransSidArray sids;
@@ -238,7 +240,7 @@ static bool test_LookupNames_bogus(struct dcerpc_pipe *p,
sids.count = 0;
sids.sids = NULL;
- names = talloc_array(mem_ctx, struct lsa_String, tnames.count);
+ names = talloc_array(tctx, struct lsa_String, tnames.count);
for (i=0;i<tnames.count;i++) {
init_lsa_String(&names[i], tnames.names[i].name.string);
}
@@ -253,7 +255,7 @@ static bool test_LookupNames_bogus(struct dcerpc_pipe *p,
r.out.sids = &sids;
r.out.domains = &domains;
- status = dcerpc_lsa_LookupNames(p, mem_ctx, &r);
+ status = dcerpc_lsa_LookupNames(p, tctx, &r);
if (!NT_STATUS_EQUAL(status, NT_STATUS_NONE_MAPPED)) {
printf("LookupNames failed - %s\n", nt_errstr(status));
return false;
@@ -264,8 +266,8 @@ static bool test_LookupNames_bogus(struct dcerpc_pipe *p,
return true;
}
-static bool test_LookupNames_wellknown(struct dcerpc_pipe *p,
- TALLOC_CTX *mem_ctx,
+static bool test_LookupNames_wellknown(struct dcerpc_pipe *p,
+ struct torture_context *tctx,
struct policy_handle *handle)
{
struct lsa_TranslatedName name;
@@ -278,46 +280,47 @@ static bool test_LookupNames_wellknown(struct dcerpc_pipe *p,
tnames.count = 1;
name.name.string = "NT AUTHORITY\\SYSTEM";
name.sid_type = SID_NAME_WKN_GRP;
- ret &= test_LookupNames(p, mem_ctx, handle, &tnames);
+ ret &= test_LookupNames(p, tctx, handle, &tnames);
name.name.string = "NT AUTHORITY\\ANONYMOUS LOGON";
name.sid_type = SID_NAME_WKN_GRP;
- ret &= test_LookupNames(p, mem_ctx, handle, &tnames);
+ ret &= test_LookupNames(p, tctx, handle, &tnames);
name.name.string = "NT AUTHORITY\\Authenticated Users";
name.sid_type = SID_NAME_WKN_GRP;
- ret &= test_LookupNames(p, mem_ctx, handle, &tnames);
+ ret &= test_LookupNames(p, tctx, handle, &tnames);
#if 0
name.name.string = "NT AUTHORITY";
- ret &= test_LookupNames(p, mem_ctx, handle, &tnames);
+ ret &= test_LookupNames(p, tctx, handle, &tnames);
name.name.string = "NT AUTHORITY\\";
- ret &= test_LookupNames(p, mem_ctx, handle, &tnames);
+ ret &= test_LookupNames(p, tctx, handle, &tnames);
#endif
name.name.string = "BUILTIN\\";
name.sid_type = SID_NAME_DOMAIN;
- ret &= test_LookupNames(p, mem_ctx, handle, &tnames);
+ ret &= test_LookupNames(p, tctx, handle, &tnames);
name.name.string = "BUILTIN\\Administrators";
name.sid_type = SID_NAME_ALIAS;
- ret &= test_LookupNames(p, mem_ctx, handle, &tnames);
+ ret &= test_LookupNames(p, tctx, handle, &tnames);
name.name.string = "SYSTEM";
name.sid_type = SID_NAME_WKN_GRP;
- ret &= test_LookupNames(p, mem_ctx, handle, &tnames);
+ ret &= test_LookupNames(p, tctx, handle, &tnames);
name.name.string = "Everyone";
name.sid_type = SID_NAME_WKN_GRP;
- ret &= test_LookupNames(p, mem_ctx, handle, &tnames);
+ ret &= test_LookupNames(p, tctx, handle, &tnames);
return ret;
}
-static bool test_LookupNames2(struct dcerpc_pipe *p,
- TALLOC_CTX *mem_ctx,
+static bool test_LookupNames2(struct dcerpc_pipe *p,
+ struct torture_context *tctx,
struct policy_handle *handle,
- struct lsa_TransNameArray2 *tnames)
+ struct lsa_TransNameArray2 *tnames,
+ bool check_result)
{
struct lsa_LookupNames2 r;
struct lsa_TransSidArray2 sids;
@@ -332,7 +335,7 @@ static bool test_LookupNames2(struct dcerpc_pipe *p,
sids.count = 0;
sids.sids = NULL;
- names = talloc_array(mem_ctx, struct lsa_String, tnames->count);
+ names = talloc_array(tctx, struct lsa_String, tnames->count);
for (i=0;i<tnames->count;i++) {
init_lsa_String(&names[i], tnames->names[i].name.string);
}
@@ -349,22 +352,31 @@ static bool test_LookupNames2(struct dcerpc_pipe *p,
r.out.sids = &sids;
r.out.domains = &domains;
- status = dcerpc_lsa_LookupNames2(p, mem_ctx, &r);
+ status = dcerpc_lsa_LookupNames2(p, tctx, &r);
if (!NT_STATUS_IS_OK(status)) {
printf("LookupNames2 failed - %s\n", nt_errstr(status));
return false;
}
+ if (check_result) {
+ torture_assert_int_equal(tctx, count, sids.count,
+ "unexpected number of results returned");
+ if (sids.count > 0) {
+ torture_assert(tctx, sids.sids, "invalid sid buffer");
+ }
+ }
+
printf("\n");
return true;
}
-static bool test_LookupNames3(struct dcerpc_pipe *p,
- TALLOC_CTX *mem_ctx,
+static bool test_LookupNames3(struct dcerpc_pipe *p,
+ struct torture_context *tctx,
struct policy_handle *handle,
- struct lsa_TransNameArray2 *tnames)
+ struct lsa_TransNameArray2 *tnames,
+ bool check_result)
{
struct lsa_LookupNames3 r;
struct lsa_TransSidArray3 sids;
@@ -379,7 +391,7 @@ static bool test_LookupNames3(struct dcerpc_pipe *p,
sids.count = 0;
sids.sids = NULL;
- names = talloc_array(mem_ctx, struct lsa_String, tnames->count);
+ names = talloc_array(tctx, struct lsa_String, tnames->count);
for (i=0;i<tnames->count;i++) {
init_lsa_String(&names[i], tnames->names[i].name.string);
}
@@ -396,20 +408,29 @@ static bool test_LookupNames3(struct dcerpc_pipe *p,
r.out.sids = &sids;
r.out.domains = &domains;
- status = dcerpc_lsa_LookupNames3(p, mem_ctx, &r);
+ status = dcerpc_lsa_LookupNames3(p, tctx, &r);
if (!NT_STATUS_IS_OK(status)) {
printf("LookupNames3 failed - %s\n", nt_errstr(status));
return false;
}
+ if (check_result) {
+ torture_assert_int_equal(tctx, count, sids.count,
+ "unexpected number of results returned");
+ if (sids.count > 0) {
+ torture_assert(tctx, sids.sids, "invalid sid buffer");
+ }
+ }
+
printf("\n");
return true;
}
-static bool test_LookupNames4(struct dcerpc_pipe *p,
- TALLOC_CTX *mem_ctx,
- struct lsa_TransNameArray2 *tnames)
+static bool test_LookupNames4(struct dcerpc_pipe *p,
+ struct torture_context *tctx,
+ struct lsa_TransNameArray2 *tnames,
+ bool check_result)
{
struct lsa_LookupNames4 r;
struct lsa_TransSidArray3 sids;
@@ -424,7 +445,7 @@ static bool test_LookupNames4(struct dcerpc_pipe *p,
sids.count = 0;
sids.sids = NULL;
- names = talloc_array(mem_ctx, struct lsa_String, tnames->count);
+ names = talloc_array(tctx, struct lsa_String, tnames->count);
for (i=0;i<tnames->count;i++) {
init_lsa_String(&names[i], tnames->names[i].name.string);
}
@@ -440,20 +461,28 @@ static bool test_LookupNames4(struct dcerpc_pipe *p,
r.out.sids = &sids;
r.out.domains = &domains;
- status = dcerpc_lsa_LookupNames4(p, mem_ctx, &r);
+ status = dcerpc_lsa_LookupNames4(p, tctx, &r);
if (!NT_STATUS_IS_OK(status)) {
printf("LookupNames4 failed - %s\n", nt_errstr(status));
return false;
}
+ if (check_result) {
+ torture_assert_int_equal(tctx, count, sids.count,
+ "unexpected number of results returned");
+ if (sids.count > 0) {
+ torture_assert(tctx, sids.sids, "invalid sid buffer");
+ }
+ }
+
printf("\n");
return true;
}
-static bool test_LookupSids(struct dcerpc_pipe *p,
- TALLOC_CTX *mem_ctx,
+static bool test_LookupSids(struct dcerpc_pipe *p,
+ struct torture_context *tctx,
struct policy_handle *handle,
struct lsa_SidArray *sids)
{
@@ -477,7 +506,7 @@ static bool test_LookupSids(struct dcerpc_pipe *p,
r.out.names = &names;
r.out.domains = &domains;
- status = dcerpc_lsa_LookupSids(p, mem_ctx, &r);
+ status = dcerpc_lsa_LookupSids(p, tctx, &r);
if (!NT_STATUS_IS_OK(status)) {
printf("LookupSids failed - %s\n", nt_errstr(status));
return false;
@@ -485,7 +514,7 @@ static bool test_LookupSids(struct dcerpc_pipe *p,
printf("\n");
- if (!test_LookupNames(p, mem_ctx, handle, &names)) {
+ if (!test_LookupNames(p, tctx, handle, &names)) {
return false;
}
@@ -493,8 +522,8 @@ static bool test_LookupSids(struct dcerpc_pipe *p,
}
-static bool test_LookupSids2(struct dcerpc_pipe *p,
- TALLOC_CTX *mem_ctx,
+static bool test_LookupSids2(struct dcerpc_pipe *p,
+ struct torture_context *tctx,
struct policy_handle *handle,
struct lsa_SidArray *sids)
{
@@ -520,7 +549,7 @@ static bool test_LookupSids2(struct dcerpc_pipe *p,
r.out.names = &names;
r.out.domains = &domains;
- status = dcerpc_lsa_LookupSids2(p, mem_ctx, &r);
+ status = dcerpc_lsa_LookupSids2(p, tctx, &r);
if (!NT_STATUS_IS_OK(status)) {
printf("LookupSids2 failed - %s\n", nt_errstr(status));
return false;
@@ -528,19 +557,19 @@ static bool test_LookupSids2(struct dcerpc_pipe *p,
printf("\n");
- if (!test_LookupNames2(p, mem_ctx, handle, &names)) {
+ if (!test_LookupNames2(p, tctx, handle, &names, false)) {
return false;
}
- if (!test_LookupNames3(p, mem_ctx, handle, &names)) {
+ if (!test_LookupNames3(p, tctx, handle, &names, false)) {
return false;
}
return true;
}
-static bool test_LookupSids3(struct dcerpc_pipe *p,
- TALLOC_CTX *mem_ctx,
+static bool test_LookupSids3(struct dcerpc_pipe *p,
+ struct torture_context *tctx,
struct lsa_SidArray *sids)
{
struct lsa_LookupSids3 r;
@@ -564,29 +593,29 @@ static bool test_LookupSids3(struct dcerpc_pipe *p,
r.out.count = &count;
r.out.names = &names;
- status = dcerpc_lsa_LookupSids3(p, mem_ctx, &r);
+ status = dcerpc_lsa_LookupSids3(p, tctx, &r);
if (!NT_STATUS_IS_OK(status)) {
if (NT_STATUS_EQUAL(status, NT_STATUS_ACCESS_DENIED) ||
NT_STATUS_EQUAL(status, NT_STATUS_RPC_PROTSEQ_NOT_SUPPORTED)) {
printf("not considering %s to be an error\n", nt_errstr(status));
return true;
}
- printf("LookupSids3 failed - %s - not considered an error\n",
+ printf("LookupSids3 failed - %s - not considered an error\n",
nt_errstr(status));
return false;
}
printf("\n");
- if (!test_LookupNames4(p, mem_ctx, &names)) {
+ if (!test_LookupNames4(p, tctx, &names, false)) {
return false;
}
return true;
}
-bool test_many_LookupSids(struct dcerpc_pipe *p,
- TALLOC_CTX *mem_ctx,
+bool test_many_LookupSids(struct dcerpc_pipe *p,
+ struct torture_context *tctx,
struct policy_handle *handle)
{
uint32_t count;
@@ -598,11 +627,11 @@ bool test_many_LookupSids(struct dcerpc_pipe *p,
sids.num_sids = 100;
- sids.sids = talloc_array(mem_ctx, struct lsa_SidPtr, sids.num_sids);
+ sids.sids = talloc_array(tctx, struct lsa_SidPtr, sids.num_sids);
for (i=0; i<sids.num_sids; i++) {
const char *sidstr = "S-1-5-32-545";
- sids.sids[i].sid = dom_sid_parse_talloc(mem_ctx, sidstr);
+ sids.sids[i].sid = dom_sid_parse_talloc(tctx, sidstr);
}
count = sids.num_sids;
@@ -622,16 +651,16 @@ bool test_many_LookupSids(struct dcerpc_pipe *p,
r.out.count = &count;
r.out.names = &names;
r.out.domains = &domains;
-
- status = dcerpc_lsa_LookupSids(p, mem_ctx, &r);
+
+ status = dcerpc_lsa_LookupSids(p, tctx, &r);
if (!NT_STATUS_IS_OK(status)) {
printf("LookupSids failed - %s\n", nt_errstr(status));
return false;
}
-
+
printf("\n");
-
- if (!test_LookupNames(p, mem_ctx, handle, &names)) {
--
Samba Shared Repository
More information about the samba-cvs
mailing list