summaryrefslogtreecommitdiff
path: root/source4/torture/rpc
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2009-02-05 16:39:28 +0100
committerJelmer Vernooij <jelmer@samba.org>2009-02-05 16:39:28 +0100
commit6d139ca4680abcbda5110f2f0886aa038ff62088 (patch)
tree7d61db40fb058bcbf08ccd8e0dadc365b819371b /source4/torture/rpc
parent4a9b3052caeb8bb144803b49dcfae82395172bc3 (diff)
parentafa960cbbcd609123d710c301e7a9a070c1fed70 (diff)
downloadsamba-6d139ca4680abcbda5110f2f0886aa038ff62088.tar.gz
samba-6d139ca4680abcbda5110f2f0886aa038ff62088.tar.bz2
samba-6d139ca4680abcbda5110f2f0886aa038ff62088.zip
Merge branch 'master' of ssh://git.samba.org/data/git/samba
Conflicts: librpc/ndr.pc.in
Diffstat (limited to 'source4/torture/rpc')
-rw-r--r--source4/torture/rpc/eventlog.c35
-rw-r--r--source4/torture/rpc/samba3rpc.c14
-rw-r--r--source4/torture/rpc/samsync.c44
-rw-r--r--source4/torture/rpc/winreg.c20
4 files changed, 65 insertions, 48 deletions
diff --git a/source4/torture/rpc/eventlog.c b/source4/torture/rpc/eventlog.c
index d5bc4e6501..2fd9d923f1 100644
--- a/source4/torture/rpc/eventlog.c
+++ b/source4/torture/rpc/eventlog.c
@@ -125,9 +125,10 @@ static bool test_ReadEventLog(struct torture_context *tctx,
while (1) {
DATA_BLOB blob;
- struct eventlog_Record rec;
- struct ndr_pull *ndr;
+ struct EVENTLOGRECORD rec;
enum ndr_err_code ndr_err;
+ uint32_t size = 0;
+ uint32_t pos = 0;
/* Read first for number of bytes in record */
@@ -140,6 +141,7 @@ static bool test_ReadEventLog(struct torture_context *tctx,
status = dcerpc_eventlog_ReadEventLogW(p, tctx, &r);
if (NT_STATUS_EQUAL(r.out.result, NT_STATUS_END_OF_FILE)) {
+ /* FIXME: still need to decode then */
break;
}
@@ -156,17 +158,32 @@ static bool test_ReadEventLog(struct torture_context *tctx,
torture_assert_ntstatus_ok(tctx, status, "ReadEventLog failed");
/* Decode a user-marshalled record */
+ size = IVAL(r.out.data, pos);
- blob.length = *r.out.sent_size;
- blob.data = talloc_steal(tctx, r.out.data);
+ while (size > 0) {
- ndr = ndr_pull_init_blob(&blob, tctx, lp_iconv_convenience(tctx->lp_ctx));
+ blob = data_blob_const(r.out.data + pos, size);
+ dump_data(0, blob.data, blob.length);
- ndr_err = ndr_pull_eventlog_Record(
- ndr, NDR_SCALARS|NDR_BUFFERS, &rec);
- status = ndr_map_error2ntstatus(ndr_err);
+ ndr_err = ndr_pull_struct_blob_all(&blob, tctx,
+ lp_iconv_convenience(tctx->lp_ctx), &rec,
+ (ndr_pull_flags_fn_t)ndr_pull_EVENTLOGRECORD);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ status = ndr_map_error2ntstatus(ndr_err);
+ torture_assert_ntstatus_ok(tctx, status,
+ "ReadEventLog failed parsing event log record");
+ }
- NDR_PRINT_DEBUG(eventlog_Record, &rec);
+ NDR_PRINT_DEBUG(EVENTLOGRECORD, &rec);
+
+ pos += size;
+
+ if (pos + 4 > *r.out.sent_size) {
+ break;
+ }
+
+ size = IVAL(r.out.data, pos);
+ }
torture_assert_ntstatus_ok(tctx, status,
"ReadEventLog failed parsing event log record");
diff --git a/source4/torture/rpc/samba3rpc.c b/source4/torture/rpc/samba3rpc.c
index 2207786f17..5b493db813 100644
--- a/source4/torture/rpc/samba3rpc.c
+++ b/source4/torture/rpc/samba3rpc.c
@@ -49,7 +49,7 @@
#include "libcli/auth/libcli_auth.h"
#include "../lib/crypto/crypto.h"
#include "auth/ntlmssp/ntlmssp.h"
-#include "libcli/security/proto.h"
+#include "libcli/security/security.h"
#include "param/param.h"
#include "lib/registry/registry.h"
#include "libcli/resolve/resolve.h"
@@ -1867,7 +1867,7 @@ bool torture_samba3_rpc_getusername(struct torture_context *torture)
d_printf("(%s) whoami on user connection failed\n",
__location__);
ret = false;
- goto delete;
+ goto del;
}
talloc_free(tree);
@@ -1881,7 +1881,7 @@ bool torture_samba3_rpc_getusername(struct torture_context *torture)
ret = false;
}
- delete:
+ del:
if (!delete_user(cli, torture->lp_ctx,
cmdline_credentials,
cli_credentials_get_username(user_creds))) {
@@ -3050,7 +3050,7 @@ static NTSTATUS enumkeys(struct dcerpc_pipe *p, struct policy_handle *handle,
TALLOC_CTX *mem_ctx, int depth)
{
struct winreg_EnumKey r;
- struct winreg_StringBuf class, name;
+ struct winreg_StringBuf kclass, name;
NTSTATUS status;
NTTIME t = 0;
@@ -3058,13 +3058,13 @@ static NTSTATUS enumkeys(struct dcerpc_pipe *p, struct policy_handle *handle,
return NT_STATUS_OK;
}
- class.name = "";
- class.size = 1024;
+ kclass.name = "";
+ kclass.size = 1024;
r.in.handle = handle;
r.in.enum_index = 0;
r.in.name = &name;
- r.in.keyclass = &class;
+ r.in.keyclass = &kclass;
r.out.name = &name;
r.in.last_changed_time = &t;
diff --git a/source4/torture/rpc/samsync.c b/source4/torture/rpc/samsync.c
index a3fc6f740f..00798214f3 100644
--- a/source4/torture/rpc/samsync.c
+++ b/source4/torture/rpc/samsync.c
@@ -830,14 +830,14 @@ static bool samsync_handle_secret(TALLOC_CTX *mem_ctx, struct samsync_state *sam
{
struct netr_DELTA_SECRET *secret = delta->delta_union.secret;
const char *name = delta->delta_id_union.name;
- struct samsync_secret *new = talloc(samsync_state, struct samsync_secret);
+ struct samsync_secret *nsec = talloc(samsync_state, struct samsync_secret);
struct samsync_secret *old = talloc(mem_ctx, struct samsync_secret);
struct lsa_QuerySecret q;
struct lsa_OpenSecret o;
struct policy_handle sec_handle;
struct lsa_DATA_BUF_PTR bufp1;
struct lsa_DATA_BUF_PTR bufp2;
- NTTIME new_mtime;
+ NTTIME nsec_mtime;
NTTIME old_mtime;
bool ret = true;
DATA_BLOB lsa_blob1, lsa_blob_out, session_key;
@@ -849,12 +849,12 @@ static bool samsync_handle_secret(TALLOC_CTX *mem_ctx, struct samsync_state *sam
creds_arcfour_crypt(samsync_state->creds, secret->old_cipher.cipher_data,
secret->old_cipher.maxlen);
- new->name = talloc_reference(new, name);
- new->secret = data_blob_talloc(new, secret->current_cipher.cipher_data, secret->current_cipher.maxlen);
- new->mtime = secret->current_cipher_set_time;
+ nsec->name = talloc_reference(nsec, name);
+ nsec->secret = data_blob_talloc(nsec, secret->current_cipher.cipher_data, secret->current_cipher.maxlen);
+ nsec->mtime = secret->current_cipher_set_time;
- new = talloc_reference(samsync_state, new);
- DLIST_ADD(samsync_state->secrets, new);
+ nsec = talloc_reference(samsync_state, nsec);
+ DLIST_ADD(samsync_state->secrets, nsec);
old->name = talloc_reference(old, name);
old->secret = data_blob_const(secret->old_cipher.cipher_data, secret->old_cipher.maxlen);
@@ -882,13 +882,13 @@ static bool samsync_handle_secret(TALLOC_CTX *mem_ctx, struct samsync_state *sam
}
- ZERO_STRUCT(new_mtime);
+ ZERO_STRUCT(nsec_mtime);
ZERO_STRUCT(old_mtime);
/* fetch the secret back again */
q.in.sec_handle = &sec_handle;
q.in.new_val = &bufp1;
- q.in.new_mtime = &new_mtime;
+ q.in.new_mtime = &nsec_mtime;
q.in.old_val = &bufp2;
q.in.old_mtime = &old_mtime;
@@ -957,26 +957,26 @@ static bool samsync_handle_secret(TALLOC_CTX *mem_ctx, struct samsync_state *sam
}
if (!q.out.new_mtime) {
- printf("NEW mtime not available on LSA for secret %s\n", new->name);
+ printf("NEW mtime not available on LSA for secret %s\n", nsec->name);
ret = false;
}
- if (new->mtime != *q.out.new_mtime) {
+ if (nsec->mtime != *q.out.new_mtime) {
printf("NEW mtime on secret %s does not match between SAMSYNC (%s) and LSA (%s)\n",
- new->name, nt_time_string(mem_ctx, new->mtime),
+ nsec->name, nt_time_string(mem_ctx, nsec->mtime),
nt_time_string(mem_ctx, *q.out.new_mtime));
ret = false;
}
- if (new->secret.length != lsa_blob_out.length) {
+ if (nsec->secret.length != lsa_blob_out.length) {
printf("Returned secret %s doesn't match: %d != %d\n",
- new->name, (int)new->secret.length, (int)lsa_blob_out.length);
+ nsec->name, (int)nsec->secret.length, (int)lsa_blob_out.length);
ret = false;
} else if (memcmp(lsa_blob_out.data,
- new->secret.data, new->secret.length) != 0) {
+ nsec->secret.data, nsec->secret.length) != 0) {
printf("Returned secret %s doesn't match: \n",
- new->name);
+ nsec->name);
DEBUG(1, ("SamSync Secret:\n"));
- dump_data(1, new->secret.data, new->secret.length);
+ dump_data(1, nsec->secret.data, nsec->secret.length);
DEBUG(1, ("LSA Secret:\n"));
dump_data(1, lsa_blob_out.data, lsa_blob_out.length);
ret = false;
@@ -994,7 +994,7 @@ static bool samsync_handle_trusted_domain(TALLOC_CTX *mem_ctx, struct samsync_st
struct netr_DELTA_TRUSTED_DOMAIN *trusted_domain = delta->delta_union.trusted_domain;
struct dom_sid *dom_sid = delta->delta_id_union.sid;
- struct samsync_trusted_domain *new = talloc(samsync_state, struct samsync_trusted_domain);
+ struct samsync_trusted_domain *ndom = talloc(samsync_state, struct samsync_trusted_domain);
struct lsa_OpenTrustedDomain t;
struct policy_handle trustdom_handle;
struct lsa_QueryTrustedDomainInfo q;
@@ -1003,8 +1003,8 @@ static bool samsync_handle_trusted_domain(TALLOC_CTX *mem_ctx, struct samsync_st
int levels [] = {1, 3, 8};
int i;
- new->name = talloc_reference(new, trusted_domain->domain_name.string);
- new->sid = talloc_reference(new, dom_sid);
+ ndom->name = talloc_reference(ndom, trusted_domain->domain_name.string);
+ ndom->sid = talloc_reference(ndom, dom_sid);
t.in.handle = samsync_state->lsa_handle;
t.in.access_mask = SEC_FLAG_MAXIMUM_ALLOWED;
@@ -1044,8 +1044,8 @@ static bool samsync_handle_trusted_domain(TALLOC_CTX *mem_ctx, struct samsync_st
We would like to do this, but it is NOT_SUPPORTED on win2k3
TEST_SEC_DESC_EQUAL(trusted_domain->sdbuf, lsa, &trustdom_handle);
*/
- new = talloc_reference(samsync_state, new);
- DLIST_ADD(samsync_state->trusted_domains, new);
+ ndom = talloc_reference(samsync_state, ndom);
+ DLIST_ADD(samsync_state->trusted_domains, ndom);
return ret;
}
diff --git a/source4/torture/rpc/winreg.c b/source4/torture/rpc/winreg.c
index b544e74181..b85dac7bf1 100644
--- a/source4/torture/rpc/winreg.c
+++ b/source4/torture/rpc/winreg.c
@@ -104,7 +104,7 @@ static bool test_NotifyChangeKeyValue(struct dcerpc_pipe *p,
static bool test_CreateKey(struct dcerpc_pipe *p, struct torture_context *tctx,
struct policy_handle *handle, const char *name,
- const char *class)
+ const char *kclass)
{
struct winreg_CreateKey r;
struct policy_handle newhandle;
@@ -114,7 +114,7 @@ static bool test_CreateKey(struct dcerpc_pipe *p, struct torture_context *tctx,
r.in.handle = handle;
r.out.new_handle = &newhandle;
init_winreg_String(&r.in.name, name);
- init_winreg_String(&r.in.keyclass, class);
+ init_winreg_String(&r.in.keyclass, kclass);
r.in.options = 0x0;
r.in.access_mask = SEC_FLAG_MAXIMUM_ALLOWED;
r.in.action_taken = r.out.action_taken = &action_taken;
@@ -135,7 +135,7 @@ static bool test_CreateKey(struct dcerpc_pipe *p, struct torture_context *tctx,
static bool test_CreateKey_sd(struct dcerpc_pipe *p,
struct torture_context *tctx,
struct policy_handle *handle, const char *name,
- const char *class,
+ const char *kclass,
struct policy_handle *newhandle)
{
struct winreg_CreateKey r;
@@ -169,7 +169,7 @@ static bool test_CreateKey_sd(struct dcerpc_pipe *p,
r.in.handle = handle;
r.out.new_handle = newhandle;
init_winreg_String(&r.in.name, name);
- init_winreg_String(&r.in.keyclass, class);
+ init_winreg_String(&r.in.keyclass, kclass);
r.in.options = 0x0;
r.in.access_mask = SEC_FLAG_MAXIMUM_ALLOWED;
r.in.action_taken = r.out.action_taken = &action_taken;
@@ -1393,7 +1393,7 @@ static bool test_DeleteKey(struct dcerpc_pipe *p, struct torture_context *tctx,
static bool test_QueryInfoKey(struct dcerpc_pipe *p,
struct torture_context *tctx,
- struct policy_handle *handle, char *class)
+ struct policy_handle *handle, char *kclass)
{
struct winreg_QueryInfoKey r;
uint32_t num_subkeys, max_subkeylen, max_classlen,
@@ -1415,7 +1415,7 @@ static bool test_QueryInfoKey(struct dcerpc_pipe *p,
r.out.classname = talloc(tctx, struct winreg_String);
r.in.classname = talloc(tctx, struct winreg_String);
- init_winreg_String(r.in.classname, class);
+ init_winreg_String(r.in.classname, kclass);
torture_assert_ntstatus_ok(tctx,
dcerpc_winreg_QueryInfoKey(p, tctx, &r),
@@ -1435,18 +1435,18 @@ static bool test_EnumKey(struct dcerpc_pipe *p, struct torture_context *tctx,
bool test_security)
{
struct winreg_EnumKey r;
- struct winreg_StringBuf class, name;
+ struct winreg_StringBuf kclass, name;
NTSTATUS status;
NTTIME t = 0;
- class.name = "";
- class.size = 1024;
+ kclass.name = "";
+ kclass.size = 1024;
ZERO_STRUCT(r);
r.in.handle = handle;
r.in.enum_index = 0;
r.in.name = &name;
- r.in.keyclass = &class;
+ r.in.keyclass = &kclass;
r.out.name = &name;
r.in.last_changed_time = &t;