[SCM] Samba Shared Repository - branch master updated -
release-4-0-0alpha7-1536-g7672a03
Günther Deschner
gd at samba.org
Mon May 11 13:28:36 GMT 2009
The branch, master has been updated
via 7672a033eff9db1203c69de422fb906504a54f77 (commit)
via 410f17cdebab929c68cd6d68b6e1a29ffe64e8d4 (commit)
from fe474861f87dc02081acf34d756329c66cc5c805 (commit)
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 7672a033eff9db1203c69de422fb906504a54f77
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
commit 410f17cdebab929c68cd6d68b6e1a29ffe64e8d4
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
-----------------------------------------------------------------------
Summary of changes:
source4/torture/rpc/lsa.c | 802 ++++++++++++++++++++++-----------------------
1 files changed, 399 insertions(+), 403 deletions(-)
Changeset truncated at 500 lines:
diff --git a/source4/torture/rpc/lsa.c b/source4/torture/rpc/lsa.c
index 454afab..e10bc77 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,44 +280,44 @@ 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)
{
@@ -332,7 +334,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,7 +351,7 @@ 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;
@@ -361,8 +363,8 @@ static bool test_LookupNames2(struct dcerpc_pipe *p,
}
-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)
{
@@ -379,7 +381,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,7 +398,7 @@ 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;
@@ -407,8 +409,8 @@ static bool test_LookupNames3(struct dcerpc_pipe *p,
return true;
}
-static bool test_LookupNames4(struct dcerpc_pipe *p,
- TALLOC_CTX *mem_ctx,
+static bool test_LookupNames4(struct dcerpc_pipe *p,
+ struct torture_context *tctx,
struct lsa_TransNameArray2 *tnames)
{
struct lsa_LookupNames4 r;
@@ -424,7 +426,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,7 +442,7 @@ 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;
@@ -452,8 +454,8 @@ static bool test_LookupNames4(struct dcerpc_pipe *p,
}
-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 +479,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 +487,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 +495,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 +522,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 +530,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)) {
return false;
}
- if (!test_LookupNames3(p, mem_ctx, handle, &names)) {
+ if (!test_LookupNames3(p, tctx, handle, &names)) {
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 +566,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)) {
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 +600,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 +624,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)) {
+
+ if (!test_LookupNames(p, tctx, handle, &names)) {
return false;
}
} else if (p->conn->security_state.auth_info->auth_type == DCERPC_AUTH_TYPE_SCHANNEL &&
@@ -644,7 +646,7 @@ bool test_many_LookupSids(struct dcerpc_pipe *p,
names.names = NULL;
printf("\nTesting LookupSids3\n");
-
+
r.in.sids = &sids;
r.in.names = &names;
r.in.level = 1;
@@ -654,19 +656,19 @@ bool test_many_LookupSids(struct dcerpc_pipe *p,
r.out.count = &count;
r.out.names = &names;
r.out.domains = &domains;
-
- 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\n",
+ printf("LookupSids3 failed - %s\n",
nt_errstr(status));
return false;
}
- if (!test_LookupNames4(p, mem_ctx, &names)) {
+ if (!test_LookupNames4(p, tctx, &names)) {
return false;
}
}
@@ -694,8 +696,8 @@ static void lookupsids_cb(struct rpc_request *req)
}
}
-static bool test_LookupSids_async(struct dcerpc_pipe *p,
- TALLOC_CTX *mem_ctx,
+static bool test_LookupSids_async(struct dcerpc_pipe *p,
+ struct torture_context *tctx,
struct policy_handle *handle)
{
struct lsa_SidArray sids;
@@ -709,17 +711,17 @@ static bool test_LookupSids_async(struct dcerpc_pipe *p,
bool ret = true;
const int num_async_requests = 50;
- count = talloc_array(mem_ctx, uint32_t, num_async_requests);
- names = talloc_array(mem_ctx, struct lsa_TransNameArray, num_async_requests);
- r = talloc_array(mem_ctx, struct lsa_LookupSids, num_async_requests);
+ count = talloc_array(tctx, uint32_t, num_async_requests);
+ names = talloc_array(tctx, struct lsa_TransNameArray, num_async_requests);
+ r = talloc_array(tctx, struct lsa_LookupSids, num_async_requests);
--
Samba Shared Repository
More information about the samba-cvs
mailing list