summaryrefslogtreecommitdiffstats
path: root/source4/torture
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2011-06-24 16:26:23 +1000
committerAndrew Bartlett <abartlet@samba.org>2011-06-24 16:26:23 +1000
commit6da26870e0ae5acd6ff49a30ec2f6886b44d095e (patch)
tree850c71039563c16a5d563c47e7ba2ab645baf198 /source4/torture
parent6925a799d04c6fa59dd2ddef1f5510f9bb7d17d1 (diff)
parent2610c05b5b95cc7036b3d6dfb894c6cfbdb68483 (diff)
downloadsamba-4.0.0alpha16.tar.gz
samba-4.0.0alpha16.tar.xz
samba-4.0.0alpha16.zip
Merge 2610c05b5b95cc7036b3d6dfb894c6cfbdb68483 as Samba-4.0alpha16samba-4.0.0alpha16
Diffstat (limited to 'source4/torture')
-rw-r--r--source4/torture/basic/attr.c2
-rw-r--r--source4/torture/basic/mangle_test.c4
-rw-r--r--source4/torture/dfs/domaindfs.c143
-rw-r--r--source4/torture/drs/python/getnc_exop.py146
-rw-r--r--source4/torture/drs/rpc/dssync.c10
-rw-r--r--source4/torture/drs/rpc/msds_intid.c5
-rw-r--r--source4/torture/gentest.c14
-rw-r--r--source4/torture/ldap/cldapbench.c3
-rw-r--r--source4/torture/libnet/libnet_BecomeDC.c15
-rw-r--r--source4/torture/libnetapi/libnetapi.c30
-rw-r--r--source4/torture/libnetapi/wscript_build3
-rw-r--r--source4/torture/libsmbclient/wscript_build5
-rw-r--r--source4/torture/local/dbspeed.c8
-rw-r--r--source4/torture/locktest.c2
-rw-r--r--source4/torture/masktest.c14
-rw-r--r--source4/torture/nbt/browse.c54
-rw-r--r--source4/torture/nbt/dgram.c23
-rw-r--r--source4/torture/nbt/nbt.c4
-rw-r--r--source4/torture/nbt/register.c8
-rw-r--r--source4/torture/nbt/wins.c4
-rw-r--r--source4/torture/nbt/winsbench.c4
-rw-r--r--source4/torture/nbt/winsreplication.c151
-rw-r--r--source4/torture/ndr/dfsblob.c2
-rw-r--r--source4/torture/ndr/ndr.c1
-rw-r--r--source4/torture/ndr/string.c198
-rw-r--r--source4/torture/rap/rap.c17
-rw-r--r--source4/torture/raw/acls.c29
-rw-r--r--source4/torture/raw/open.c10
-rw-r--r--source4/torture/raw/qfileinfo.c2
-rw-r--r--source4/torture/raw/streams.c8
-rw-r--r--source4/torture/rpc/dsgetinfo.c2
-rw-r--r--source4/torture/rpc/remote_pac.c7
-rw-r--r--source4/torture/rpc/rpc.c2
-rw-r--r--source4/torture/rpc/spoolss_notify.c35
-rw-r--r--source4/torture/rpc/testjoin.c4
-rw-r--r--source4/torture/smb2/acls.c7
-rw-r--r--source4/torture/smbtorture.c2
-rw-r--r--source4/torture/torture.c16
-rw-r--r--source4/torture/unix/whoami.c4
-rw-r--r--source4/torture/winbind/struct_based.c1
-rw-r--r--source4/torture/wscript_build2
41 files changed, 743 insertions, 258 deletions
diff --git a/source4/torture/basic/attr.c b/source4/torture/basic/attr.c
index 09d1ae29684..2f0248e20fb 100644
--- a/source4/torture/basic/attr.c
+++ b/source4/torture/basic/attr.c
@@ -374,7 +374,7 @@ error_exit_file:
[0x%x], got attr 0x%x, should be 0x%x\n",
open_attrs_table[j],
(uint16_t)attr,
- open_attrs_table[j]|FILE_ATTRIBUTE_DIRECTORY);
+ (unsigned int)(open_attrs_table[j]|FILE_ATTRIBUTE_DIRECTORY));
CHECK_MAX_FAILURES(error_exit_dir);
}
diff --git a/source4/torture/basic/mangle_test.c b/source4/torture/basic/mangle_test.c
index 0b7d696e677..d549a0c1eb3 100644
--- a/source4/torture/basic/mangle_test.c
+++ b/source4/torture/basic/mangle_test.c
@@ -20,7 +20,7 @@
#include "includes.h"
#include "system/filesys.h"
#include "system/dir.h"
-#include <tdb.h>
+#include "../lib/tdb_compat/tdb_compat.h"
#include "../lib/util/util_tdb.h"
#include "libcli/libcli.h"
#include "torture/util.h"
@@ -167,7 +167,7 @@ bool torture_mangle(struct torture_context *torture,
int i;
/* we will use an internal tdb to store the names we have used */
- tdb = tdb_open(NULL, 100000, TDB_INTERNAL, 0, 0);
+ tdb = tdb_open_compat(NULL, 100000, TDB_INTERNAL, 0, 0, NULL, NULL);
if (!tdb) {
printf("ERROR: Failed to open tdb\n");
return false;
diff --git a/source4/torture/dfs/domaindfs.c b/source4/torture/dfs/domaindfs.c
index 467e104e25a..89e9cc1426a 100644
--- a/source4/torture/dfs/domaindfs.c
+++ b/source4/torture/dfs/domaindfs.c
@@ -55,20 +55,24 @@ static bool test_getdomainreferral(struct torture_context *tctx,
talloc_asprintf(tctx,
"Not expected version for referral entry 0 got %d expected 3",
resp.referral_entries[0].version));
- torture_assert_int_equal(tctx, resp.referral_entries[0].referral.v3.data.server_type,
+ torture_assert_int_equal(tctx, resp.referral_entries[0].referral.v3.server_type,
DFS_SERVER_NON_ROOT,
talloc_asprintf(tctx,
"Wrong server type, expected non root server and got %d",
- resp.referral_entries[0].referral.v3.data.server_type));
- torture_assert_int_equal(tctx, resp.referral_entries[0].referral.v3.data.entry_flags,
+ resp.referral_entries[0].referral.v3.server_type));
+ torture_assert_int_equal(tctx, resp.referral_entries[0].referral.v3.entry_flags,
DFS_FLAG_REFERRAL_DOMAIN_RESP,
talloc_asprintf(tctx,
"Wrong entry flag expected to have a domain response and got %d",
- resp.referral_entries[0].referral.v3.data.entry_flags));
+ resp.referral_entries[0].referral.v3.entry_flags));
torture_assert_int_equal(tctx, strlen(
- resp.referral_entries[0].referral.v3.data.referrals.r2.special_name) > 0,
+ resp.referral_entries[0].referral.v3.referrals.r2.special_name) > 0,
1,
"Length of domain is 0 or less");
+ torture_assert_int_equal(tctx,
+ resp.referral_entries[0].referral.v3.referrals.r2.special_name[0] == '\\',
+ 1,
+ "domain didn't start with a \\");
return true;
}
@@ -88,9 +92,9 @@ static bool test_getdcreferral(struct torture_context *tctx,
dfs_cli_do_call(cli->tree, &r),
"Get Domain referral failed");
- str = resp.referral_entries[0].referral.v3.data.referrals.r2.special_name;
+ str = resp.referral_entries[0].referral.v3.referrals.r2.special_name;
if( strchr(str, '.') == NULL ) {
- str = resp.referral_entries[1].referral.v3.data.referrals.r2.special_name;
+ str = resp.referral_entries[1].referral.v3.referrals.r2.special_name;
}
r2.in.req.max_referral_level = 3;
@@ -112,34 +116,38 @@ static bool test_getdcreferral(struct torture_context *tctx,
talloc_asprintf(tctx,
"Not expected version for referral entry 0 got %d expected 3",
resp2.referral_entries[0].version));
- torture_assert_int_equal(tctx, resp2.referral_entries[0].referral.v3.data.server_type,
+ torture_assert_int_equal(tctx, resp2.referral_entries[0].referral.v3.server_type,
DFS_SERVER_NON_ROOT,
talloc_asprintf(tctx,
"Wrong server type, expected non root server and got %d",
- resp2.referral_entries[0].referral.v3.data.server_type));
- torture_assert_int_equal(tctx, resp2.referral_entries[0].referral.v3.data.entry_flags,
+ resp2.referral_entries[0].referral.v3.server_type));
+ torture_assert_int_equal(tctx, resp2.referral_entries[0].referral.v3.entry_flags,
DFS_FLAG_REFERRAL_DOMAIN_RESP,
talloc_asprintf(tctx,
"Wrong entry flag expected to have a domain response and got %d",
- resp2.referral_entries[0].referral.v3.data.entry_flags));
+ resp2.referral_entries[0].referral.v3.entry_flags));
torture_assert_int_equal(tctx, strlen(
- resp2.referral_entries[0].referral.v3.data.referrals.r2.special_name) > 0,
+ resp2.referral_entries[0].referral.v3.referrals.r2.special_name) > 0,
1,
"Length of domain is 0 or less");
torture_assert_int_equal(tctx, strlen(
- resp2.referral_entries[0].referral.v3.data.referrals.r2.expanded_names[0]) > 0,
+ resp2.referral_entries[0].referral.v3.referrals.r2.expanded_names[0]) > 0,
1,
"Length of first dc is less than 0");
- str = strchr(resp2.referral_entries[0].referral.v3.data.referrals.r2.expanded_names[0], '.');
- str2 = resp2.referral_entries[0].referral.v3.data.referrals.r2.special_name;
+ str = strchr(resp2.referral_entries[0].referral.v3.referrals.r2.expanded_names[0], '.');
+ str2 = resp2.referral_entries[0].referral.v3.referrals.r2.special_name;
if (str2[0] == '\\') {
str2++;
}
torture_assert_int_equal(tctx, strlen(str) >0, 1 ,"Length of domain too short");
str++;
torture_assert_int_equal(tctx, strcmp(str,str2), 0,
- talloc_asprintf(tctx, "Pb domain of the dc is not"\
- "the same as the requested: domain = %s got =%s",str2 ,str));
+ talloc_asprintf(tctx, "Pb domain of the dc is not "\
+ "the same as the requested: domain was = %s got =%s",str2 ,str));
+ torture_assert_int_equal(tctx,
+ resp.referral_entries[0].referral.v3.referrals.r2.special_name[0] == '\\',
+ 1,
+ "dc name didn't start with a \\");
r3.in.req.max_referral_level = 3;
/*
@@ -164,22 +172,22 @@ static bool test_getdcreferral(struct torture_context *tctx,
talloc_asprintf(tctx,
"Not expected version for referral entry 0 got %d expected 3",
resp3.referral_entries[0].version));
- torture_assert_int_equal(tctx, resp3.referral_entries[0].referral.v3.data.server_type,
+ torture_assert_int_equal(tctx, resp3.referral_entries[0].referral.v3.server_type,
DFS_SERVER_NON_ROOT,
talloc_asprintf(tctx,
"Wrong server type, expected non root server and got %d",
- resp3.referral_entries[0].referral.v3.data.server_type));
- torture_assert_int_equal(tctx, resp3.referral_entries[0].referral.v3.data.entry_flags,
+ resp3.referral_entries[0].referral.v3.server_type));
+ torture_assert_int_equal(tctx, resp3.referral_entries[0].referral.v3.entry_flags,
DFS_FLAG_REFERRAL_DOMAIN_RESP,
talloc_asprintf(tctx,
"Wrong entry flag expected to have a domain response and got %d",
- resp3.referral_entries[0].referral.v3.data.entry_flags));
+ resp3.referral_entries[0].referral.v3.entry_flags));
torture_assert_int_equal(tctx, strlen(
- resp3.referral_entries[0].referral.v3.data.referrals.r2.special_name) > 0,
+ resp3.referral_entries[0].referral.v3.referrals.r2.special_name) > 0,
1,
"Length of domain is 0 or less");
torture_assert_int_equal(tctx, strlen(
- resp3.referral_entries[0].referral.v3.data.referrals.r2.expanded_names[0]) > 0,
+ resp3.referral_entries[0].referral.v3.referrals.r2.expanded_names[0]) > 0,
1,
"Length of first dc is less than 0");
return true;
@@ -202,9 +210,9 @@ static bool test_getdcreferral_netbios(struct torture_context *tctx,
r2.in.req.max_referral_level = 3;
- str = resp.referral_entries[0].referral.v3.data.referrals.r2.special_name;
+ str = resp.referral_entries[0].referral.v3.referrals.r2.special_name;
if( strchr(str, '.') != NULL ) {
- str = resp.referral_entries[1].referral.v3.data.referrals.r2.special_name;
+ str = resp.referral_entries[1].referral.v3.referrals.r2.special_name;
}
r2.in.req.servername = str;
@@ -224,26 +232,26 @@ static bool test_getdcreferral_netbios(struct torture_context *tctx,
talloc_asprintf(tctx,
"Not expected version for referral entry 0 got %d expected 3",
resp2.referral_entries[0].version));
- torture_assert_int_equal(tctx, resp2.referral_entries[0].referral.v3.data.server_type,
+ torture_assert_int_equal(tctx, resp2.referral_entries[0].referral.v3.server_type,
DFS_SERVER_NON_ROOT,
talloc_asprintf(tctx,
"Wrong server type, expected non root server and got %d",
- resp2.referral_entries[0].referral.v3.data.server_type));
- torture_assert_int_equal(tctx, resp2.referral_entries[0].referral.v3.data.entry_flags,
+ resp2.referral_entries[0].referral.v3.server_type));
+ torture_assert_int_equal(tctx, resp2.referral_entries[0].referral.v3.entry_flags,
DFS_FLAG_REFERRAL_DOMAIN_RESP,
talloc_asprintf(tctx,
"Wrong entry flag expected to have a domain response and got %d",
- resp2.referral_entries[0].referral.v3.data.entry_flags));
+ resp2.referral_entries[0].referral.v3.entry_flags));
torture_assert_int_equal(tctx, strlen(
- resp2.referral_entries[0].referral.v3.data.referrals.r2.special_name) > 0,
+ resp2.referral_entries[0].referral.v3.referrals.r2.special_name) > 0,
1,
"Length of domain is 0 or less");
torture_assert_int_equal(tctx, strlen(
- resp2.referral_entries[0].referral.v3.data.referrals.r2.expanded_names[0]) > 0,
+ resp2.referral_entries[0].referral.v3.referrals.r2.expanded_names[0]) > 0,
1,
"Length of first dc is less than 0");
torture_assert(tctx, strchr(
- resp2.referral_entries[0].referral.v3.data.referrals.r2.expanded_names[0],'.') == NULL,
+ resp2.referral_entries[0].referral.v3.referrals.r2.expanded_names[0],'.') == NULL,
"referral contains dots it's not a netbios name");
r3.in.req.max_referral_level = 3;
@@ -269,26 +277,26 @@ static bool test_getdcreferral_netbios(struct torture_context *tctx,
talloc_asprintf(tctx,
"Not expected version for referral entry 0 got %d expected 3",
resp3.referral_entries[0].version));
- torture_assert_int_equal(tctx, resp3.referral_entries[0].referral.v3.data.server_type,
+ torture_assert_int_equal(tctx, resp3.referral_entries[0].referral.v3.server_type,
DFS_SERVER_NON_ROOT,
talloc_asprintf(tctx,
"Wrong server type, expected non root server and got %d",
- resp3.referral_entries[0].referral.v3.data.server_type));
- torture_assert_int_equal(tctx, resp3.referral_entries[0].referral.v3.data.entry_flags,
+ resp3.referral_entries[0].referral.v3.server_type));
+ torture_assert_int_equal(tctx, resp3.referral_entries[0].referral.v3.entry_flags,
DFS_FLAG_REFERRAL_DOMAIN_RESP,
talloc_asprintf(tctx,
"Wrong entry flag expected to have a domain response and got %d",
- resp3.referral_entries[0].referral.v3.data.entry_flags));
+ resp3.referral_entries[0].referral.v3.entry_flags));
torture_assert_int_equal(tctx, strlen(
- resp3.referral_entries[0].referral.v3.data.referrals.r2.special_name) > 0,
+ resp3.referral_entries[0].referral.v3.referrals.r2.special_name) > 0,
1,
"Length of domain is 0 or less");
torture_assert_int_equal(tctx, strlen(
- resp3.referral_entries[0].referral.v3.data.referrals.r2.expanded_names[0]) > 0,
+ resp3.referral_entries[0].referral.v3.referrals.r2.expanded_names[0]) > 0,
1,
"Length of first dc is less than 0");
torture_assert(tctx, strchr(
- resp3.referral_entries[0].referral.v3.data.referrals.r2.expanded_names[0],'.') == NULL,
+ resp3.referral_entries[0].referral.v3.referrals.r2.expanded_names[0],'.') == NULL,
"referral contains dots it's not a netbios name");
return true;
}
@@ -299,6 +307,9 @@ static bool test_getsysvolreferral(struct torture_context *tctx,
const char* str;
struct dfs_GetDFSReferral r, r2, r3;
struct dfs_referral_resp resp, resp2, resp3;
+ uint8_t zeros[16];
+
+ memset(zeros, 0, sizeof(zeros));
r.in.req.max_referral_level = 3;
r.in.req.servername = "";
@@ -308,9 +319,9 @@ static bool test_getsysvolreferral(struct torture_context *tctx,
dfs_cli_do_call(cli->tree, &r),
"Get Domain referral failed");
- str = resp.referral_entries[0].referral.v3.data.referrals.r2.special_name;
+ str = resp.referral_entries[0].referral.v3.referrals.r2.special_name;
if( strchr(str, '.') == NULL ) {
- str = resp.referral_entries[1].referral.v3.data.referrals.r2.special_name;
+ str = resp.referral_entries[1].referral.v3.referrals.r2.special_name;
}
r2.in.req.max_referral_level = 3;
@@ -339,25 +350,41 @@ static bool test_getsysvolreferral(struct torture_context *tctx,
talloc_asprintf(tctx,
"Not expected version for referral entry 0 got %d expected 3",
resp3.referral_entries[0].version));
- torture_assert_int_equal(tctx, resp3.referral_entries[0].referral.v3.data.server_type,
+ torture_assert_int_equal(tctx, resp3.referral_entries[0].referral.v3.server_type,
DFS_SERVER_NON_ROOT,
talloc_asprintf(tctx,
"Wrong server type, expected non root server and got %d",
- resp3.referral_entries[0].referral.v3.data.server_type));
- torture_assert_int_equal(tctx, resp3.referral_entries[0].referral.v3.data.entry_flags,
+ resp3.referral_entries[0].referral.v3.server_type));
+ torture_assert_int_equal(tctx, resp3.referral_entries[0].referral.v3.entry_flags,
0,
talloc_asprintf(tctx,
"Wrong entry flag expected to have a non domain response and got %d",
- resp3.referral_entries[0].referral.v3.data.entry_flags));
+ resp3.referral_entries[0].referral.v3.entry_flags));
torture_assert_int_equal(tctx, strlen(
- resp3.referral_entries[0].referral.v3.data.referrals.r2.special_name) > 0,
+ resp3.referral_entries[0].referral.v3.referrals.r1.DFS_path) > 0,
1,
"Length of domain is 0 or less");
+ torture_assert_int_equal(tctx, strstr(resp3.referral_entries[0].referral.v3.referrals.r1.DFS_path,
+ str+1) != NULL, 1,
+ talloc_asprintf(tctx,
+ "Wrong DFS_path %s unable to find substring %s in it",
+ resp3.referral_entries[0].referral.v3.referrals.r1.DFS_path,
+ str+1));
torture_assert_int_equal(tctx, strlen(
- resp2.referral_entries[0].referral.v3.data.referrals.r2.expanded_names[0]) > 0,
+ resp3.referral_entries[0].referral.v3.referrals.r1.netw_address) > 0,
1,
"Length of first referral is less than 0");
-
+ torture_assert_int_equal(tctx, strstr(resp3.referral_entries[0].referral.v3.referrals.r1.netw_address,
+ str+1) != NULL, 1,
+ talloc_asprintf(tctx,
+ "Wrong DFS_path %s unable to find substring %s in it",
+ resp3.referral_entries[0].referral.v3.referrals.r1.netw_address,
+ str+1));
+#if 0
+ /*
+ * Due to strange behavior with XP and level 4
+ * we are obliged to degrade to level 3 ...
+ */
r3.in.req.max_referral_level = 4;
torture_assert_ntstatus_ok(tctx,
@@ -368,6 +395,20 @@ static bool test_getsysvolreferral(struct torture_context *tctx,
talloc_asprintf(tctx,
"Not expected version for referral entry 0 got %d expected 4",
resp3.referral_entries[0].version));
+ torture_assert_int_equal(tctx, memcmp(resp3.referral_entries[0].referral.v3.service_site_guid.value, zeros, 16), 0,
+ talloc_asprintf(tctx,
+ "Service_site_guid is not NULL as expected"));
+#endif
+ r3.in.req.max_referral_level = 4;
+
+ torture_assert_ntstatus_ok(tctx,
+ dfs_cli_do_call(cli->tree, &r3),
+ "Get sysvol Domain referral failed");
+
+ torture_assert_int_equal(tctx, resp3.referral_entries[0].version, 3,
+ talloc_asprintf(tctx,
+ "Not expected version for referral entry 0 got %d expected 3 in degraded mode",
+ resp3.referral_entries[0].version));
#if 0
/*
* We do not support fallback indication for the moment
@@ -375,12 +416,12 @@ static bool test_getsysvolreferral(struct torture_context *tctx,
torture_assert_int_equal(tctx, resp3.header_flags,
DFS_HEADER_FLAG_STORAGE_SVR | DFS_HEADER_FLAG_TARGET_BCK,
"Header flag different it's not a referral for a storage with fallback");
-#endif
torture_assert_int_equal(tctx, resp3.referral_entries[0].referral.v4.entry_flags,
DFS_FLAG_REFERRAL_FIRST_TARGET_SET,
talloc_asprintf(tctx,
"Wrong entry flag expected to have a non domain response and got %d",
resp3.referral_entries[0].referral.v4.entry_flags));
+#endif
return true;
}
@@ -426,14 +467,14 @@ static bool test_getsysvolplusreferral(struct torture_context *tctx,
"Get Domain referral failed");
r2.in.req.max_referral_level = 3;
- r2.in.req.servername = resp.referral_entries[0].referral.v3.data.referrals.r2.special_name;
+ r2.in.req.servername = resp.referral_entries[0].referral.v3.referrals.r2.special_name;
r2.out.resp = &resp2;
torture_assert_ntstatus_ok(tctx,
dfs_cli_do_call(cli->tree, &r2),
"Get DC Domain referral failed");
- str = resp2.referral_entries[0].referral.v3.data.referrals.r2.special_name;
+ str = resp2.referral_entries[0].referral.v3.referrals.r2.special_name;
r3.in.req.max_referral_level = 3;
r3.in.req.servername = talloc_asprintf(tctx, "%s\\sysvol\\foo", str);
r3.out.resp = &resp3;
diff --git a/source4/torture/drs/python/getnc_exop.py b/source4/torture/drs/python/getnc_exop.py
new file mode 100644
index 00000000000..904c0133334
--- /dev/null
+++ b/source4/torture/drs/python/getnc_exop.py
@@ -0,0 +1,146 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+#
+# Tests various schema replication scenarios
+#
+# Copyright (C) Kamen Mazdrashki <kamenim@samba.org> 2011
+#
+# 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/>.
+#
+
+#
+# Usage:
+# export DC1=dc1_dns_name
+# export DC2=dc2_dns_name
+# export SUBUNITRUN=$samba4srcdir/scripting/bin/subunitrun
+# PYTHONPATH="$PYTHONPATH:$samba4srcdir/torture/drs/python" $SUBUNITRUN getnc_exop -U"$DOMAIN/$DC_USERNAME"%"$DC_PASSWORD"
+#
+
+import drs_base
+import samba.tests
+
+from ldb import SCOPE_BASE
+
+from samba.dcerpc import drsuapi, misc, drsblobs
+from samba.drs_utils import drs_DsBind
+
+
+class DrsReplicaSyncTestCase(drs_base.DrsBaseTestCase):
+ """Intended as a semi-black box test case for DsGetNCChanges
+ implementation for extended operations. It should be testing
+ how DsGetNCChanges handles different input params (mostly invalid).
+ Final goal is to make DsGetNCChanges as binary compatible to
+ Windows implementation as possible"""
+
+ def setUp(self):
+ super(DrsReplicaSyncTestCase, self).setUp()
+
+ def tearDown(self):
+ super(DrsReplicaSyncTestCase, self).tearDown()
+
+ def _exop_req8(self, dest_dsa, invocation_id, nc_dn_str, exop):
+ req8 = drsuapi.DsGetNCChangesRequest8()
+
+ req8.destination_dsa_guid = misc.GUID(dest_dsa)
+ req8.source_dsa_invocation_id = misc.GUID(invocation_id)
+ req8.naming_context = drsuapi.DsReplicaObjectIdentifier()
+ req8.naming_context.dn = unicode(nc_dn_str)
+ req8.highwatermark = drsuapi.DsReplicaHighWaterMark()
+ req8.highwatermark.tmp_highest_usn = 0
+ req8.highwatermark.reserved_usn = 0
+ req8.highwatermark.highest_usn = 0
+ req8.uptodateness_vector = None
+ req8.replica_flags = 0
+ req8.max_object_count = 0
+ req8.max_ndr_size = 402116
+ req8.extended_op = exop
+ req8.fsmo_info = 0
+ req8.partial_attribute_set = None
+ req8.partial_attribute_set_ex = None
+ req8.mapping_ctr.num_mappings = 0
+ req8.mapping_ctr.mappings = None
+
+ return req8
+
+ def _ds_bind(self, server_name):
+ binding_str = "ncacn_ip_tcp:%s[print,seal]" % server_name
+
+ drs = drsuapi.drsuapi(binding_str, self.get_loadparm(), self.get_credentials())
+ (drs_handle, supported_extensions) = drs_DsBind(drs)
+ return (drs, drs_handle)
+
+ def _determine_fSMORoleOwner(self, fsmo_obj_dn):
+ """Returns (owner, not_owner) pair where:
+ owner: dns name for FSMO owner
+ not_owner: dns name for DC not owning the FSMO"""
+ # collect info to return later
+ fsmo_info_1 = {"dns_name": self.dnsname_dc1,
+ "invocation_id": self.ldb_dc1.get_invocation_id(),
+ "ntds_guid": self.ldb_dc1.get_ntds_GUID()}
+ fsmo_info_2 = {"dns_name": self.dnsname_dc2,
+ "invocation_id": self.ldb_dc2.get_invocation_id(),
+ "ntds_guid": self.ldb_dc2.get_ntds_GUID()}
+ # determine the owner dc
+ res = self.ldb_dc1.search(fsmo_obj_dn,
+ scope=SCOPE_BASE, attrs=["fSMORoleOwner"])
+ assert len(res) == 1, "Only one fSMORoleOwner value expected for %s!"%fsmo_obj_dn
+ fsmo_owner = res[0]["fSMORoleOwner"][0]
+ if fsmo_owner == self.info_dc1["dsServiceName"][0]:
+ return (fsmo_info_1, fsmo_info_2)
+ return (fsmo_info_2, fsmo_info_1)
+
+ def _check_exop_failed(self, ctr6, expected_failure):
+ self.assertEqual(ctr6.extended_ret, expected_failure)
+ #self.assertEqual(ctr6.object_count, 0)
+ #self.assertEqual(ctr6.first_object, None)
+ self.assertEqual(ctr6.more_data, False)
+ self.assertEqual(ctr6.nc_object_count, 0)
+ self.assertEqual(ctr6.nc_linked_attributes_count, 0)
+ self.assertEqual(ctr6.linked_attributes_count, 0)
+ self.assertEqual(ctr6.linked_attributes, None)
+ self.assertEqual(ctr6.drs_error[0], 0)
+
+ def test_FSMONotOwner(self):
+ """Test role transfer with against DC not owner of the role"""
+ fsmo_dn = self.ldb_dc1.get_schema_basedn()
+ (fsmo_owner, fsmo_not_owner) = self._determine_fSMORoleOwner(fsmo_dn)
+
+ req8 = self._exop_req8(dest_dsa=fsmo_owner["ntds_guid"],
+ invocation_id=fsmo_not_owner["invocation_id"],
+ nc_dn_str=fsmo_dn,
+ exop=drsuapi.DRSUAPI_EXOP_FSMO_REQ_ROLE)
+
+ (drs, drs_handle) = self._ds_bind(fsmo_not_owner["dns_name"])
+ (level, ctr) = drs.DsGetNCChanges(drs_handle, 8, req8)
+ self.assertEqual(level, 6, "Expected level 6 response!")
+ self._check_exop_failed(ctr, drsuapi.DRSUAPI_EXOP_ERR_FSMO_NOT_OWNER)
+ self.assertEqual(ctr.source_dsa_guid, misc.GUID(fsmo_not_owner["ntds_guid"]))
+ self.assertEqual(ctr.source_dsa_invocation_id, misc.GUID(fsmo_not_owner["invocation_id"]))
+
+ def test_InvalidDestDSA(self):
+ """Test role transfer with invalid destination DSA guid"""
+ fsmo_dn = self.ldb_dc1.get_schema_basedn()
+ (fsmo_owner, fsmo_not_owner) = self._determine_fSMORoleOwner(fsmo_dn)
+
+ req8 = self._exop_req8(dest_dsa="9c637462-5b8c-4467-aef2-bdb1f57bc4ef",
+ invocation_id=fsmo_owner["invocation_id"],
+ nc_dn_str=fsmo_dn,
+ exop=drsuapi.DRSUAPI_EXOP_FSMO_REQ_ROLE)
+
+ (drs, drs_handle) = self._ds_bind(fsmo_owner["dns_name"])
+ (level, ctr) = drs.DsGetNCChanges(drs_handle, 8, req8)
+ self.assertEqual(level, 6, "Expected level 6 response!")
+ self._check_exop_failed(ctr, drsuapi.DRSUAPI_EXOP_ERR_UNKNOWN_CALLER)
+ self.assertEqual(ctr.source_dsa_guid, misc.GUID(fsmo_owner["ntds_guid"]))
+ self.assertEqual(ctr.source_dsa_invocation_id, misc.GUID(fsmo_owner["invocation_id"]))
diff --git a/source4/torture/drs/rpc/dssync.c b/source4/torture/drs/rpc/dssync.c
index 2ec3ded2877..8279e736b19 100644
--- a/source4/torture/drs/rpc/dssync.c
+++ b/source4/torture/drs/rpc/dssync.c
@@ -105,8 +105,9 @@ static struct DsSyncTest *test_create_context(struct torture_context *tctx)
make_nbt_name_server(&name, ctx->drsuapi_binding->host);
/* do an initial name resolution to find its IP */
- status = resolve_name(lpcfg_resolve_context(tctx->lp_ctx), &name, tctx,
- &ctx->dest_address, tctx->ev);
+ status = resolve_name_ex(lpcfg_resolve_context(tctx->lp_ctx),
+ 0, 0, &name, tctx,
+ &ctx->dest_address, tctx->ev);
if (!NT_STATUS_IS_OK(status)) {
printf("Failed to resolve %s - %s\n",
name.name, nt_errstr(status));
@@ -270,10 +271,7 @@ static bool test_LDAPBind(struct torture_context *tctx, struct DsSyncTest *ctx,
return NULL;
}
- ldb_set_modules_dir(ldb,
- talloc_asprintf(ldb,
- "%s/ldb",
- lpcfg_modulesdir(tctx->lp_ctx)));
+ ldb_set_modules_dir(ldb, modules_path(ldb, "ldb"));
if (ldb_set_opaque(ldb, "credentials", credentials)) {
talloc_free(ldb);
diff --git a/source4/torture/drs/rpc/msds_intid.c b/source4/torture/drs/rpc/msds_intid.c
index 53f4992ba29..14c6454abe1 100644
--- a/source4/torture/drs/rpc/msds_intid.c
+++ b/source4/torture/drs/rpc/msds_intid.c
@@ -283,10 +283,7 @@ static bool _test_LDAPBind(struct torture_context *tctx,
return NULL;
}
- ldb_set_modules_dir(ldb,
- talloc_asprintf(ldb,
- "%s/ldb",
- lpcfg_modulesdir(tctx->lp_ctx)));
+ ldb_set_modules_dir(ldb, modules_path(ldb, "ldb"));
if (ldb_set_opaque(ldb, "credentials", credentials) != LDB_SUCCESS) {
talloc_free(ldb);
diff --git a/source4/torture/gentest.c b/source4/torture/gentest.c
index 6f69460dc8a..9b6e7fc0fd5 100644
--- a/source4/torture/gentest.c
+++ b/source4/torture/gentest.c
@@ -2318,6 +2318,18 @@ static void gen_setfileinfo(int instance, union smb_setfileinfo *info)
case RAW_SFILEINFO_UNIX_INFO2:
case RAW_SFILEINFO_UNIX_LINK:
case RAW_SFILEINFO_UNIX_HLINK:
+ case RAW_SFILEINFO_LINK_INFORMATION:
+ case RAW_SFILEINFO_PIPE_INFORMATION:
+ case RAW_SFILEINFO_VALID_DATA_INFORMATION:
+ case RAW_SFILEINFO_SHORT_NAME_INFORMATION:
+ case RAW_SFILEINFO_1027:
+ case RAW_SFILEINFO_1030:
+ case RAW_SFILEINFO_1031:
+ case RAW_SFILEINFO_1036:
+ case RAW_SFILEINFO_1041:
+ case RAW_SFILEINFO_1042:
+ case RAW_SFILEINFO_1043:
+ case RAW_SFILEINFO_1044:
/* Untested */
break;
}
@@ -3247,7 +3259,7 @@ static bool split_unc_name(const char *unc, char **server, char **share)
ev = s4_event_context_init(talloc_autofree_context());
- gensec_init(lp_ctx);
+ gensec_init();
ret = start_gentest(ev, lp_ctx);
diff --git a/source4/torture/ldap/cldapbench.c b/source4/torture/ldap/cldapbench.c
index 5c7e56f40bd..7d02a2580b1 100644
--- a/source4/torture/ldap/cldapbench.c
+++ b/source4/torture/ldap/cldapbench.c
@@ -215,7 +215,8 @@ bool torture_bench_cldap(struct torture_context *torture)
make_nbt_name_server(&name, torture_setting_string(torture, "host", NULL));
/* do an initial name resolution to find its IP */
- status = resolve_name(lpcfg_resolve_context(torture->lp_ctx), &name, torture, &address, torture->ev);
+ status = resolve_name_ex(lpcfg_resolve_context(torture->lp_ctx),
+ 0, 0, &name, torture, &address, torture->ev);
if (!NT_STATUS_IS_OK(status)) {
printf("Failed to resolve %s - %s\n",
name.name, nt_errstr(status));
diff --git a/source4/torture/libnet/libnet_BecomeDC.c b/source4/torture/libnet/libnet_BecomeDC.c
index 0fbad00d7b8..9f569e6a486 100644
--- a/source4/torture/libnet/libnet_BecomeDC.c
+++ b/source4/torture/libnet/libnet_BecomeDC.c
@@ -44,7 +44,7 @@ bool torture_net_become_dc(struct torture_context *torture)
struct ldb_message *msg;
int ldb_ret;
uint32_t i;
- char *sam_ldb_path;
+ char *private_dir;
const char *address;
struct nbt_name name;
const char *netbios_name;
@@ -67,8 +67,9 @@ bool torture_net_become_dc(struct torture_context *torture)
make_nbt_name_server(&name, torture_setting_string(torture, "host", NULL));
/* do an initial name resolution to find its IP */
- status = resolve_name(lpcfg_resolve_context(torture->lp_ctx),
- &name, torture, &address, torture->ev);
+ status = resolve_name_ex(lpcfg_resolve_context(torture->lp_ctx),
+ 0, 0,
+ &name, torture, &address, torture->ev);
torture_assert_ntstatus_ok(torture, status, talloc_asprintf(torture,
"Failed to resolve %s - %s\n",
name.name, nt_errstr(status)));
@@ -143,13 +144,13 @@ bool torture_net_become_dc(struct torture_context *torture)
talloc_unlink(s, ldb);
lp_ctx = libnet_vampire_cb_lp_ctx(s);
- sam_ldb_path = talloc_asprintf(s, "%s/%s", location, "private/sam.ldb");
- lpcfg_set_cmdline(lp_ctx, "sam database", sam_ldb_path);
- torture_comment(torture, "Reopen the SAM LDB with system credentials and all replicated data: %s\n", sam_ldb_path);
+ private_dir = talloc_asprintf(s, "%s/%s", location, "private");
+ lpcfg_set_cmdline(lp_ctx, "private dir", private_dir);
+ torture_comment(torture, "Reopen the SAM LDB with system credentials and all replicated data: %s\n", private_dir);
ldb = samdb_connect(s, torture->ev, lp_ctx, system_session(lp_ctx), 0);
torture_assert_goto(torture, ldb != NULL, ret, cleanup,
talloc_asprintf(torture,
- "Failed to open '%s'\n", sam_ldb_path));
+ "Failed to open '%s/sam.ldb'\n", private_dir));
torture_assert_goto(torture, dsdb_uses_global_schema(ldb), ret, cleanup,
"Uses global schema");
diff --git a/source4/torture/libnetapi/libnetapi.c b/source4/torture/libnetapi/libnetapi.c
index 633dc6cc3e3..92c7b3a394e 100644
--- a/source4/torture/libnetapi/libnetapi.c
+++ b/source4/torture/libnetapi/libnetapi.c
@@ -17,11 +17,13 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "includes.h"
+#include "source3/include/includes.h"
#include "torture/smbtorture.h"
#include "auth/credentials/credentials.h"
#include "lib/cmdline/popt_common.h"
-#include <netapi.h>
+#include "source3/lib/netapi/netapi.h"
+#include "source3/lib/netapi/netapi_private.h"
+#include "source4/param/param.h"
#include "torture/libnetapi/proto.h"
bool torture_libnetapi_init_context(struct torture_context *tctx,
@@ -30,13 +32,19 @@ bool torture_libnetapi_init_context(struct torture_context *tctx,
NET_API_STATUS status;
struct libnetapi_ctx *ctx;
- status = libnetapi_init(&ctx);
+ if (!lp_load(lpcfg_configfile(tctx->lp_ctx), true, false, false, true)) {
+ fprintf(stderr, "error loading %s\n", lpcfg_configfile(tctx->lp_ctx));
+ return W_ERROR_V(WERR_GENERAL_FAILURE);
+ }
+
+ init_names();
+ load_interfaces();
+
+ status = libnetapi_net_init(&ctx);
if (status != 0) {
return false;
}
- libnetapi_set_debuglevel(ctx,
- talloc_asprintf(ctx, "%d", DEBUGLEVEL));
libnetapi_set_username(ctx,
cli_credentials_get_username(cmdline_credentials));
libnetapi_set_password(ctx,
@@ -52,10 +60,16 @@ static bool torture_libnetapi_initialize(struct torture_context *tctx)
NET_API_STATUS status;
struct libnetapi_ctx *ctx;
+ /* We must do this first, as otherwise we fail if we don't
+ * have an smb.conf in the default path (we need to use the
+ * torture smb.conf */
+ torture_assert(tctx, torture_libnetapi_init_context(tctx, &ctx),
+ "failed to initialize libnetapi");
+
status = libnetapi_init(&ctx);
- if (status != 0) {
- return false;
- }
+
+ torture_assert(tctx, ctx != NULL, "Failed to get a libnetapi_ctx");
+ torture_assert_int_equal(tctx, status, 0, "libnetapi_init failed despite alredy being set up");
libnetapi_free(ctx);
diff --git a/source4/torture/libnetapi/wscript_build b/source4/torture/libnetapi/wscript_build
index a087c96662d..4f579c9820d 100644
--- a/source4/torture/libnetapi/wscript_build
+++ b/source4/torture/libnetapi/wscript_build
@@ -5,8 +5,7 @@ bld.SAMBA_MODULE('TORTURE_LIBNETAPI',
autoproto='proto.h',
subsystem='smbtorture',
init_function='torture_libnetapi_init',
- deps='POPT_CREDENTIALS NETAPI',
+ deps='POPT_CREDENTIALS netapi',
internal_module=True,
- enabled=False
)
diff --git a/source4/torture/libsmbclient/wscript_build b/source4/torture/libsmbclient/wscript_build
index 8f93487389f..8b2c516dbfc 100644
--- a/source4/torture/libsmbclient/wscript_build
+++ b/source4/torture/libsmbclient/wscript_build
@@ -6,9 +6,8 @@ bld.SAMBA_MODULE('TORTURE_LIBSMBCLIENT',
autoproto='proto.h',
subsystem='smbtorture',
init_function='torture_libsmbclient_init',
- deps='POPT_CREDENTIALS SMBCLIENT',
- internal_module=True,
- enabled=False
+ deps='POPT_CREDENTIALS libsmb/smbclient',
+ internal_module=True
)
diff --git a/source4/torture/local/dbspeed.c b/source4/torture/local/dbspeed.c
index 8768b349eff..614a9b52ae9 100644
--- a/source4/torture/local/dbspeed.c
+++ b/source4/torture/local/dbspeed.c
@@ -21,11 +21,11 @@
#include "includes.h"
#include "system/filesys.h"
-#include <tdb.h>
+#include "tdb_compat.h"
#include <ldb.h>
#include <ldb_errors.h>
#include "ldb_wrap.h"
-#include "lib/tdb_wrap.h"
+#include "lib/util/tdb_wrap.h"
#include "torture/smbtorture.h"
#include "param/param.h"
@@ -97,7 +97,7 @@ static bool test_tdb_speed(struct torture_context *torture, const void *_data)
i = random() % torture_entries;
key.dptr = (uint8_t *)talloc_asprintf(tmp_ctx, "S-1-5-21-53173311-3623041448-2049097239-%u", i);
key.dsize = strlen((char *)key.dptr)+1;
- data = tdb_fetch(tdbw->tdb, key);
+ data = tdb_fetch_compat(tdbw->tdb, key);
talloc_free(key.dptr);
if (data.dptr == NULL) {
torture_result(torture, TORTURE_FAIL, "Failed to find SID %d!", i);
@@ -106,7 +106,7 @@ static bool test_tdb_speed(struct torture_context *torture, const void *_data)
free(data.dptr);
key.dptr = (uint8_t *)talloc_asprintf(tmp_ctx, "UID %u", i);
key.dsize = strlen((char *)key.dptr)+1;
- data = tdb_fetch(tdbw->tdb, key);
+ data = tdb_fetch_compat(tdbw->tdb, key);
talloc_free(key.dptr);
if (data.dptr == NULL) {
torture_result(torture, TORTURE_FAIL, "Failed to find UID %d!", i);
diff --git a/source4/torture/locktest.c b/source4/torture/locktest.c
index 445a626e7be..77fcb69eafd 100644
--- a/source4/torture/locktest.c
+++ b/source4/torture/locktest.c
@@ -644,7 +644,7 @@ static void usage(poptContext pc)
ev = s4_event_context_init(talloc_autofree_context());
- gensec_init(lp_ctx);
+ gensec_init();
DEBUG(0,("seed=%u base=%d range=%d min_length=%d\n",
seed, lock_base, lock_range, min_length));
diff --git a/source4/torture/masktest.c b/source4/torture/masktest.c
index 9c66291087f..a711634b24c 100644
--- a/source4/torture/masktest.c
+++ b/source4/torture/masktest.c
@@ -49,7 +49,7 @@ static bool reg_match_one(struct smbcli_state *cli, const char *pattern, const c
if (ISDOTDOT(file)) file = ".";
- return ms_fnmatch(pattern, file, cli->transport->negotiate.protocol)==0;
+ return ms_fnmatch_protocol(pattern, file, cli->transport->negotiate.protocol)==0;
}
static char *reg_test(struct smbcli_state *cli, TALLOC_CTX *mem_ctx, const char *pattern, const char *long_name, const char *short_name)
@@ -153,10 +153,8 @@ static void get_real_name(TALLOC_CTX *mem_ctx, struct smbcli_state *cli,
listfn, &state);
if (f_info_hit) {
- *short_name = talloc_strdup(mem_ctx, last_hit.short_name);
- strlower(*short_name);
- *long_name = talloc_strdup(mem_ctx, last_hit.long_name);
- strlower(*long_name);
+ *short_name = strlower_talloc(mem_ctx, last_hit.short_name);
+ *long_name = strlower_talloc(mem_ctx, last_hit.long_name);
}
if (*short_name == '\0') {
@@ -177,7 +175,7 @@ static void testpair(TALLOC_CTX *mem_ctx, struct smbcli_state *cli, char *mask,
count++;
- safe_strcpy(res1, "---", sizeof(res1));
+ strlcpy(res1, "---", sizeof(res1));
state.mem_ctx = mem_ctx;
@@ -191,7 +189,7 @@ static void testpair(TALLOC_CTX *mem_ctx, struct smbcli_state *cli, char *mask,
resultp = res1;
short_name = talloc_strdup(mem_ctx, "");
get_real_name(mem_ctx, cli, &long_name, &short_name);
- safe_strcpy(res1, "---", sizeof(res1));
+ strlcpy(res1, "---", sizeof(res1));
smbcli_list_new(cli->tree, mask,
FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_DIRECTORY,
RAW_SEARCH_DATA_BOTH_DIRECTORY_INFO,
@@ -362,7 +360,7 @@ static void usage(poptContext pc)
ev = s4_event_context_init(mem_ctx);
- gensec_init(lp_ctx);
+ gensec_init();
lpcfg_smbcli_options(lp_ctx, &options);
lpcfg_smbcli_session_options(lp_ctx, &session_options);
diff --git a/source4/torture/nbt/browse.c b/source4/torture/nbt/browse.c
deleted file mode 100644
index dcf96ba3ef3..00000000000
--- a/source4/torture/nbt/browse.c
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- Unix SMB/CIFS implementation.
-
- Browse service
-
- (C) Jelmer Vernooij 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/>.
-*/
-
-#include "includes.h"
-#include "librpc/gen_ndr/nbt.h"
-#include "libcli/resolve/resolve.h"
-#include "torture/torture.h"
-
-/*
- test nbt dgram operations
-*/
-bool torture_nbt_browse(struct torture_context *torture)
-{
- const char *address;
- struct nbt_name name;
- TALLOC_CTX *mem_ctx = talloc_new(NULL);
- NTSTATUS status;
- bool ret = true;
-
- name.name = lpcfg_workgroup();
- name.type = NBT_NAME_BROWSER;
- name.scope = NULL;
-
- /* do an initial name resolution to find its IP */
- status = resolve_name(&name, mem_ctx, &address, torture->ev);
- if (!NT_STATUS_IS_OK(status)) {
- printf("Failed to resolve %s - %s\n",
- name.name, nt_errstr(status));
- talloc_free(mem_ctx);
- return false;
- }
-
- talloc_free(mem_ctx);
-
- return ret;
-}
diff --git a/source4/torture/nbt/dgram.c b/source4/torture/nbt/dgram.c
index 36914bdcc36..aa4759edaf9 100644
--- a/source4/torture/nbt/dgram.c
+++ b/source4/torture/nbt/dgram.c
@@ -86,11 +86,13 @@ static bool nbt_test_netlogon(struct torture_context *tctx)
/* do an initial name resolution to find its IP */
torture_assert_ntstatus_ok(tctx,
- resolve_name(lpcfg_resolve_context(tctx->lp_ctx), &name, tctx, &address, tctx->ev),
+ resolve_name_ex(lpcfg_resolve_context(tctx->lp_ctx),
+ 0, 0,
+ &name, tctx, &address, tctx->ev),
talloc_asprintf(tctx, "Failed to resolve %s", name.name));
- load_interfaces(tctx, lpcfg_interfaces(tctx->lp_ctx), &ifaces);
- myaddress = talloc_strdup(dgmsock, iface_best_ip(ifaces, address));
+ load_interface_list(tctx, tctx->lp_ctx, &ifaces);
+ myaddress = talloc_strdup(dgmsock, iface_list_best_ip(ifaces, address));
socket_address = socket_address_from_strings(dgmsock, dgmsock->sock->backend_name,
@@ -180,11 +182,13 @@ static bool nbt_test_netlogon2(struct torture_context *tctx)
/* do an initial name resolution to find its IP */
torture_assert_ntstatus_ok(tctx,
- resolve_name(lpcfg_resolve_context(tctx->lp_ctx), &name, tctx, &address, tctx->ev),
+ resolve_name_ex(lpcfg_resolve_context(tctx->lp_ctx),
+ 0, 0,
+ &name, tctx, &address, tctx->ev),
talloc_asprintf(tctx, "Failed to resolve %s", name.name));
- load_interfaces(tctx, lpcfg_interfaces(tctx->lp_ctx), &ifaces);
- myaddress = talloc_strdup(dgmsock, iface_best_ip(ifaces, address));
+ load_interface_list(tctx, tctx->lp_ctx, &ifaces);
+ myaddress = talloc_strdup(dgmsock, iface_list_best_ip(ifaces, address));
socket_address = socket_address_from_strings(dgmsock, dgmsock->sock->backend_name,
myaddress, lpcfg_dgram_port(tctx->lp_ctx));
@@ -450,11 +454,12 @@ static bool nbt_test_ntlogon(struct torture_context *tctx)
/* do an initial name resolution to find its IP */
torture_assert_ntstatus_ok(tctx,
- resolve_name(lpcfg_resolve_context(tctx->lp_ctx), &name, tctx, &address, tctx->ev),
+ resolve_name_ex(lpcfg_resolve_context(tctx->lp_ctx),
+ 0, 0, &name, tctx, &address, tctx->ev),
talloc_asprintf(tctx, "Failed to resolve %s", name.name));
- load_interfaces(tctx, lpcfg_interfaces(tctx->lp_ctx), &ifaces);
- myaddress = talloc_strdup(dgmsock, iface_best_ip(ifaces, address));
+ load_interface_list(tctx, tctx->lp_ctx, &ifaces);
+ myaddress = talloc_strdup(dgmsock, iface_list_best_ip(ifaces, address));
socket_address = socket_address_from_strings(dgmsock, dgmsock->sock->backend_name,
myaddress, lpcfg_dgram_port(tctx->lp_ctx));
diff --git a/source4/torture/nbt/nbt.c b/source4/torture/nbt/nbt.c
index 7c45f867e74..1b7fe49cf84 100644
--- a/source4/torture/nbt/nbt.c
+++ b/source4/torture/nbt/nbt.c
@@ -39,7 +39,9 @@ bool torture_nbt_get_name(struct torture_context *tctx,
/* do an initial name resolution to find its IP */
torture_assert_ntstatus_ok(tctx,
- resolve_name(lpcfg_resolve_context(tctx->lp_ctx), name, tctx, address, tctx->ev),
+ resolve_name_ex(lpcfg_resolve_context(tctx->lp_ctx),
+ 0, 0,
+ name, tctx, address, tctx->ev),
talloc_asprintf(tctx,
"Failed to resolve %s", name->name));
diff --git a/source4/torture/nbt/register.c b/source4/torture/nbt/register.c
index d52ae4181ec..24ca328b30f 100644
--- a/source4/torture/nbt/register.c
+++ b/source4/torture/nbt/register.c
@@ -54,9 +54,9 @@ static bool nbt_register_own(struct torture_context *tctx)
if (!torture_nbt_get_name(tctx, &name, &address))
return false;
- load_interfaces(tctx, lpcfg_interfaces(tctx->lp_ctx), &ifaces);
+ load_interface_list(tctx, tctx->lp_ctx, &ifaces);
- myaddress = iface_best_ip(ifaces, address);
+ myaddress = iface_list_best_ip(ifaces, address);
socket_address = socket_address_from_strings(tctx, nbtsock->sock->backend_name,
myaddress, 0);
@@ -123,9 +123,9 @@ static bool nbt_refresh_own(struct torture_context *tctx)
if (!torture_nbt_get_name(tctx, &name, &address))
return false;
- load_interfaces(tctx, lpcfg_interfaces(tctx->lp_ctx), &ifaces);
+ load_interface_list(tctx, tctx->lp_ctx, &ifaces);
- myaddress = iface_best_ip(ifaces, address);
+ myaddress = iface_list_best_ip(ifaces, address);
socket_address = socket_address_from_strings(tctx, nbtsock->sock->backend_name,
myaddress, 0);
diff --git a/source4/torture/nbt/wins.c b/source4/torture/nbt/wins.c
index 0ddaa8a05a1..571249f562d 100644
--- a/source4/torture/nbt/wins.c
+++ b/source4/torture/nbt/wins.c
@@ -65,9 +65,9 @@ static bool nbt_test_wins_name(struct torture_context *tctx, const char *address
struct interface *ifaces;
bool low_port = try_low_port;
- load_interfaces(tctx, lpcfg_interfaces(tctx->lp_ctx), &ifaces);
+ load_interface_list(tctx, tctx->lp_ctx, &ifaces);
- myaddress = talloc_strdup(tctx, iface_best_ip(ifaces, address));
+ myaddress = talloc_strdup(tctx, iface_list_best_ip(ifaces, address));
socket_address = socket_address_from_strings(tctx,
nbtsock->sock->backend_name,
diff --git a/source4/torture/nbt/winsbench.c b/source4/torture/nbt/winsbench.c
index aff620878c8..cb71d8755dd 100644
--- a/source4/torture/nbt/winsbench.c
+++ b/source4/torture/nbt/winsbench.c
@@ -246,8 +246,8 @@ static bool bench_wins(struct torture_context *tctx)
state->registered = talloc_zero_array(state, bool, state->num_names);
state->wins_server = address;
state->wins_port = lpcfg_nbt_port(tctx->lp_ctx);
- load_interfaces(tctx, lpcfg_interfaces(tctx->lp_ctx), &ifaces);
- state->my_ip = talloc_strdup(tctx, iface_best_ip(ifaces, address));
+ load_interface_list(tctx, tctx->lp_ctx, &ifaces);
+ state->my_ip = talloc_strdup(tctx, iface_list_best_ip(ifaces, address));
state->ttl = timelimit;
my_ip = socket_address_from_strings(nbtsock, nbtsock->sock->backend_name,
diff --git a/source4/torture/nbt/winsreplication.c b/source4/torture/nbt/winsreplication.c
index cf8db494cab..7165f10dbbb 100644
--- a/source4/torture/nbt/winsreplication.c
+++ b/source4/torture/nbt/winsreplication.c
@@ -615,14 +615,14 @@ static struct test_wrepl_conflict_conn *test_create_conflict_ctx(
ctx->nbtsock = nbt_name_socket_init(ctx, tctx->ev);
if (!ctx->nbtsock) return NULL;
- load_interfaces(tctx, lpcfg_interfaces(tctx->lp_ctx), &ifaces);
+ load_interface_list(tctx, tctx->lp_ctx, &ifaces);
- ctx->myaddr = socket_address_from_strings(tctx, ctx->nbtsock->sock->backend_name, iface_best_ip(ifaces, address), 0);
+ ctx->myaddr = socket_address_from_strings(tctx, ctx->nbtsock->sock->backend_name, iface_list_best_ip(ifaces, address), 0);
if (!ctx->myaddr) return NULL;
- for (i = 0; i < iface_count(ifaces); i++) {
- if (strcmp(ctx->myaddr->addr, iface_n_ip(ifaces, i)) == 0) continue;
- ctx->myaddr2 = socket_address_from_strings(tctx, ctx->nbtsock->sock->backend_name, iface_n_ip(ifaces, i), 0);
+ for (i = 0; i < iface_list_count(ifaces); i++) {
+ if (strcmp(ctx->myaddr->addr, iface_list_n_ip(ifaces, i)) == 0) continue;
+ ctx->myaddr2 = socket_address_from_strings(tctx, ctx->nbtsock->sock->backend_name, iface_list_n_ip(ifaces, i), 0);
if (!ctx->myaddr2) return NULL;
break;
}
@@ -679,12 +679,12 @@ static struct test_wrepl_conflict_conn *test_create_conflict_ctx(
ctx->addresses_best[0].owner = ctx->b.address;
ctx->addresses_best[0].ip = ctx->myaddr->addr;
- ctx->addresses_all_num = iface_count(ifaces);
+ ctx->addresses_all_num = iface_list_count(ifaces);
ctx->addresses_all = talloc_array(ctx, struct wrepl_ip, ctx->addresses_all_num);
if (!ctx->addresses_all) return NULL;
for (i=0; i < ctx->addresses_all_num; i++) {
ctx->addresses_all[i].owner = ctx->b.address;
- ctx->addresses_all[i].ip = talloc_strdup(ctx->addresses_all, iface_n_ip(ifaces, i));
+ ctx->addresses_all[i].ip = talloc_strdup(ctx->addresses_all, iface_list_n_ip(ifaces, i));
if (!ctx->addresses_all[i].ip) return NULL;
}
@@ -6701,6 +6701,7 @@ static bool test_conflict_owned_released_vs_replica(struct torture_context *tctx
}
struct test_conflict_owned_active_vs_replica_struct {
+ struct torture_context *tctx;
const char *line; /* just better debugging */
const char *section; /* just better debugging */
struct nbt_name name;
@@ -6760,6 +6761,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* unique,active vs. unique,active with same ip(s), unchecked
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_UA_UA_SI_U", 0x00, NULL),
.wins = {
@@ -6786,6 +6788,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* unique,active vs. unique,active with different ip(s), positive response
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_UA_UA_DI_P", 0x00, NULL),
.wins = {
@@ -6813,6 +6816,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* unique,active vs. unique,active with different ip(s), positive response other ips
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_UA_UA_DI_O", 0x00, NULL),
.wins = {
@@ -6842,6 +6846,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* unique,active vs. unique,active with different ip(s), negative response
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_UA_UA_DI_N", 0x00, NULL),
.wins = {
@@ -6869,6 +6874,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* unique,active vs. unique,tombstone with same ip(s), unchecked
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_UA_UT_SI_U", 0x00, NULL),
.wins = {
@@ -6895,6 +6901,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* unique,active vs. unique,tombstone with different ip(s), unchecked
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_UA_UT_DI_U", 0x00, NULL),
.wins = {
@@ -6924,6 +6931,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* unique,active vs. group,active with same ip(s), release expected
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_UA_GA_SI_R", 0x00, NULL),
.wins = {
@@ -6951,6 +6959,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* unique,active vs. group,active with different ip(s), release expected
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_UA_GA_DI_R", 0x00, NULL),
.wins = {
@@ -6978,6 +6987,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* unique,active vs. group,tombstone with same ip(s), unchecked
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_UA_GT_SI_U", 0x00, NULL),
.wins = {
@@ -7004,6 +7014,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* unique,active vs. group,tombstone with different ip(s), unchecked
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_UA_GT_DI_U", 0x00, NULL),
.wins = {
@@ -7033,6 +7044,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* unique,active vs. sgroup,active with same ip(s), release expected
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_UA_SA_SI_R", 0x00, NULL),
.wins = {
@@ -7060,6 +7072,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* unique,active vs. group,active with different ip(s), release expected
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_UA_SA_DI_R", 0x00, NULL),
.wins = {
@@ -7087,6 +7100,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* unique,active vs. sgroup,tombstone with same ip(s), unchecked
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_UA_ST_SI_U", 0x00, NULL),
.wins = {
@@ -7113,6 +7127,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* unique,active vs. sgroup,tombstone with different ip(s), unchecked
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_UA_ST_DI_U", 0x00, NULL),
.wins = {
@@ -7142,6 +7157,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* unique,active vs. mhomed,active with same ip(s), unchecked
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_UA_MA_SI_U", 0x00, NULL),
.wins = {
@@ -7168,6 +7184,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* unique,active vs. mhomed,active with superset ip(s), unchecked
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_UA_MA_SP_U", 0x00, NULL),
.wins = {
@@ -7194,6 +7211,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* unique,active vs. mhomed,active with different ip(s), positive response
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_UA_MA_DI_P", 0x00, NULL),
.wins = {
@@ -7221,6 +7239,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* unique,active vs. mhomed,active with different ip(s), positive response other ips
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_UA_MA_DI_O", 0x00, NULL),
.wins = {
@@ -7250,6 +7269,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* unique,active vs. mhomed,active with different ip(s), negative response
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_UA_MA_DI_N", 0x00, NULL),
.wins = {
@@ -7277,6 +7297,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* unique,active vs. mhomed,tombstone with same ip(s), unchecked
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_UA_MT_SI_U", 0x00, NULL),
.wins = {
@@ -7303,6 +7324,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* unique,active vs. mhomed,tombstone with different ip(s), unchecked
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_UA_MT_DI_U", 0x00, NULL),
.wins = {
@@ -7332,6 +7354,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* group,active vs. unique,active with same ip(s), unchecked
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_GA_UA_SI_U", 0x00, NULL),
.wins = {
@@ -7358,6 +7381,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* group,active vs. unique,active with different ip(s), unchecked
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_GA_UA_DI_U", 0x00, NULL),
.wins = {
@@ -7384,6 +7408,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* group,active vs. unique,tombstone with same ip(s), unchecked
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_GA_UT_SI_U", 0x00, NULL),
.wins = {
@@ -7410,6 +7435,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* group,active vs. unique,tombstone with different ip(s), unchecked
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_GA_UT_DI_U", 0x00, NULL),
.wins = {
@@ -7439,6 +7465,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* group,active vs. group,active with same ip(s), unchecked
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_GA_GA_SI_U", 0x00, NULL),
.wins = {
@@ -7465,6 +7492,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* group,active vs. group,active with different ip(s), unchecked
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_GA_GA_DI_U", 0x00, NULL),
.wins = {
@@ -7491,6 +7519,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* group,active vs. group,tombstone with same ip(s), unchecked
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_GA_GT_SI_U", 0x00, NULL),
.wins = {
@@ -7517,6 +7546,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* group,active vs. group,tombstone with different ip(s), unchecked
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_GA_GT_DI_U", 0x00, NULL),
.wins = {
@@ -7546,6 +7576,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* group,active vs. sgroup,active with same ip(s), unchecked
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_GA_SA_SI_U", 0x00, NULL),
.wins = {
@@ -7572,6 +7603,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* group,active vs. sgroup,active with different ip(s), unchecked
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_GA_SA_DI_U", 0x00, NULL),
.wins = {
@@ -7598,6 +7630,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* group,active vs. sgroup,tombstone with same ip(s), unchecked
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_GA_ST_SI_U", 0x00, NULL),
.wins = {
@@ -7624,6 +7657,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* group,active vs. sgroup,tombstone with different ip(s), unchecked
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_GA_ST_DI_U", 0x00, NULL),
.wins = {
@@ -7653,6 +7687,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* group,active vs. mhomed,active with same ip(s), unchecked
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_GA_MA_SI_U", 0x00, NULL),
.wins = {
@@ -7679,6 +7714,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* group,active vs. mhomed,active with different ip(s), unchecked
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_GA_MA_DI_U", 0x00, NULL),
.wins = {
@@ -7705,6 +7741,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* group,active vs. mhomed,tombstone with same ip(s), unchecked
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_GA_MT_SI_U", 0x00, NULL),
.wins = {
@@ -7731,6 +7768,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* group,active vs. mhomed,tombstone with different ip(s), unchecked
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_GA_MT_DI_U", 0x00, NULL),
.wins = {
@@ -7760,6 +7798,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* sgroup,active vs. unique,active with same ip(s), unchecked
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_SA_UA_SI_U", 0x1C, NULL),
.wins = {
@@ -7786,6 +7825,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* sgroup,active vs. unique,active with different ip(s), unchecked
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_SA_UA_DI_U", 0x1C, NULL),
.wins = {
@@ -7812,6 +7852,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* sgroup,active vs. unique,tombstone with same ip(s), unchecked
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_SA_UT_SI_U", 0x1C, NULL),
.wins = {
@@ -7838,6 +7879,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* sgroup,active vs. unique,tombstone with different ip(s), unchecked
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_SA_UT_DI_U", 0x1C, NULL),
.wins = {
@@ -7867,6 +7909,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* sgroup,active vs. group,active with same ip(s), unchecked
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_SA_GA_SI_U", 0x1C, NULL),
.wins = {
@@ -7893,6 +7936,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* sgroup,active vs. group,active with different ip(s), unchecked
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_SA_GA_DI_U", 0x1C, NULL),
.wins = {
@@ -7919,6 +7963,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* sgroup,active vs. group,tombstone with same ip(s), unchecked
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_SA_GT_SI_U", 0x1C, NULL),
.wins = {
@@ -7945,6 +7990,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* sgroup,active vs. group,tombstone with different ip(s), unchecked
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_SA_GT_DI_U", 0x1C, NULL),
.wins = {
@@ -7974,6 +8020,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* sgroup,active vs. mhomed,active with same ip(s), unchecked
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_SA_MA_SI_U", 0x1C, NULL),
.wins = {
@@ -8000,6 +8047,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* sgroup,active vs. mhomed,active with different ip(s), unchecked
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_SA_MA_DI_U", 0x1C, NULL),
.wins = {
@@ -8026,6 +8074,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* sgroup,active vs. mhomed,tombstone with same ip(s), unchecked
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_SA_MT_SI_U", 0x1C, NULL),
.wins = {
@@ -8052,6 +8101,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* sgroup,active vs. mhomed,tombstone with different ip(s), unchecked
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_SA_MT_DI_U", 0x1C, NULL),
.wins = {
@@ -8081,6 +8131,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* mhomed,active vs. unique,active with same ip(s), unchecked
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_MA_UA_SI_U", 0x00, NULL),
.wins = {
@@ -8107,6 +8158,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* mhomed,active vs. unique,active with different ip(s), positive response
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_MA_UA_DI_P", 0x00, NULL),
.wins = {
@@ -8134,6 +8186,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* mhomed,active vs. unique,active with different ip(s), positive response other ips
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_MA_UA_DI_O", 0x00, NULL),
.wins = {
@@ -8163,6 +8216,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* mhomed,active vs. unique,active with different ip(s), negative response
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_MA_UA_DI_N", 0x00, NULL),
.wins = {
@@ -8190,6 +8244,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* mhomed,active vs. unique,tombstone with same ip(s), unchecked
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_MA_UT_SI_U", 0x00, NULL),
.wins = {
@@ -8216,6 +8271,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* mhomed,active vs. unique,tombstone with different ip(s), unchecked
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_MA_UT_DI_U", 0x00, NULL),
.wins = {
@@ -8245,6 +8301,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* mhomed,active vs. group,active with same ip(s), release expected
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_MA_GA_SI_R", 0x00, NULL),
.wins = {
@@ -8272,6 +8329,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* mhomed,active vs. group,active with different ip(s), release expected
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_MA_GA_DI_R", 0x00, NULL),
.wins = {
@@ -8299,6 +8357,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* mhomed,active vs. group,tombstone with same ip(s), unchecked
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_MA_GT_SI_U", 0x00, NULL),
.wins = {
@@ -8325,6 +8384,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* mhomed,active vs. group,tombstone with different ip(s), unchecked
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_MA_GT_DI_U", 0x00, NULL),
.wins = {
@@ -8354,6 +8414,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* mhomed,active vs. sgroup,active with same ip(s), release expected
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_MA_SA_SI_R", 0x00, NULL),
.wins = {
@@ -8381,6 +8442,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* mhomed,active vs. group,active with different ip(s), release expected
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_MA_SA_DI_R", 0x00, NULL),
.wins = {
@@ -8408,6 +8470,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* mhomed,active vs. sgroup,tombstone with same ip(s), unchecked
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_MA_ST_SI_U", 0x00, NULL),
.wins = {
@@ -8434,6 +8497,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* mhomed,active vs. sgroup,tombstone with different ip(s), unchecked
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_MA_ST_DI_U", 0x00, NULL),
.wins = {
@@ -8463,6 +8527,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* mhomed,active vs. mhomed,active with same ip(s), unchecked
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_MA_MA_SI_U", 0x00, NULL),
.wins = {
@@ -8489,6 +8554,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* mhomed,active vs. mhomed,active with superset ip(s), unchecked
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_MA_MA_SP_U", 0x00, NULL),
.wins = {
@@ -8515,6 +8581,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* mhomed,active vs. mhomed,active with different ip(s), positive response
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_MA_MA_DI_P", 0x00, NULL),
.wins = {
@@ -8542,6 +8609,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* mhomed,active vs. mhomed,active with different ip(s), positive response other ips
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_MA_MA_DI_O", 0x00, NULL),
.wins = {
@@ -8571,6 +8639,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* mhomed,active vs. mhomed,active with different ip(s), negative response
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_MA_MA_DI_N", 0x00, NULL),
.wins = {
@@ -8598,6 +8667,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* mhomed,active vs. mhomed,tombstone with same ip(s), unchecked
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_MA_MT_SI_U", 0x00, NULL),
.wins = {
@@ -8624,6 +8694,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* mhomed,active vs. mhomed,tombstone with different ip(s), unchecked
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_MA_MT_DI_U", 0x00, NULL),
.wins = {
@@ -8653,6 +8724,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* mhomed,active vs. mhomed,active with superset ip(s), unchecked
*/
{
+ .tctx = tctx,
.line = __location__,
.section= "Test Replica vs. owned active: some more MHOMED combinations",
.name = _NBT_NAME("_MA_MA_SP_U", 0x00, NULL),
@@ -8682,6 +8754,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* mhomed,active vs. mhomed,active with same ips, unchecked
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_MA_MA_SM_U", 0x00, NULL),
.comment= "C:MHOMED vs. B:MHOMED => B:MHOMED",
@@ -8710,6 +8783,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* mhomed,active vs. mhomed,active with subset ip(s), positive response
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_MA_MA_SB_P", 0x00, NULL),
.comment= "C:MHOMED vs. B:BEST (C:MHOMED) => B:MHOMED",
@@ -8739,6 +8813,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* mhomed,active vs. mhomed,active with subset ip(s), positive response, with all addresses
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_MA_MA_SB_A", 0x00, NULL),
.comment= "C:MHOMED vs. B:BEST (C:ALL) => B:MHOMED",
@@ -8772,6 +8847,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* the release demand has no effect to the database record...
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_MA_MA_SB_PRA", 0x00, NULL),
.comment= "C:MHOMED vs. B:BEST (C:BEST) => C:MHOMED",
@@ -8804,6 +8880,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* mhomed,active vs. mhomed,active with subset ip(s), positive response, with other addresses
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_MA_MA_SB_O", 0x00, NULL),
.comment= "C:MHOMED vs. B:BEST (B:B_3_4) =>C:MHOMED",
@@ -8835,6 +8912,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* mhomed,active vs. mhomed,active with subset ip(s), negative response
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_MA_MA_SB_N", 0x00, NULL),
.comment= "C:MHOMED vs. B:BEST (NEGATIVE) => B:BEST",
@@ -8867,6 +8945,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* mhomed,active vs. unique,active with subset ip(s), positive response
*/
{
+ .tctx = tctx,
.line = __location__,
.section= "Test Replica vs. owned active: some more UNIQUE,MHOMED combinations",
.name = _NBT_NAME("_MA_UA_SB_P", 0x00, NULL),
@@ -8899,6 +8978,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* the release demand has no effect to the database record...
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_UA_UA_DI_PRA", 0x00, NULL),
.comment= "C:BEST vs. B:BEST2 (C:BEST2,LR:BEST2) => C:BEST",
@@ -8931,6 +9011,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* unique,active vs. unique,active with different ip(s), positive response, with all addresses
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_UA_UA_DI_A", 0x00, NULL),
.comment= "C:BEST vs. B:BEST2 (C:ALL) => B:MHOMED",
@@ -8962,6 +9043,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* unique,active vs. mhomed,active with different ip(s), positive response, with all addresses
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_UA_MA_DI_A", 0x00, NULL),
.comment= "C:BEST vs. B:BEST2 (C:ALL) => B:MHOMED",
@@ -8996,6 +9078,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* sgroup,active vs. sgroup,active with different ip(s)
*/
{
+ .tctx = tctx,
.line = __location__,
.section= "Test Replica vs. owned active: SGROUP vs. SGROUP tests",
.name = _NBT_NAME("_SA_SA_DI_U", 0x1C, NULL),
@@ -9024,6 +9107,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* sgroup,active vs. sgroup,active with same ip(s)
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_SA_SA_SI_U", 0x1C, NULL),
.skip = (ctx->addresses_all_num < 3),
@@ -9051,6 +9135,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* sgroup,active vs. sgroup,active with superset ip(s)
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_SA_SA_SP_U", 0x1C, NULL),
.skip = (ctx->addresses_all_num < 3),
@@ -9078,6 +9163,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* sgroup,active vs. sgroup,active with subset ip(s)
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_SA_SA_SB_U", 0x1C, NULL),
.skip = (ctx->addresses_all_num < 3),
@@ -9105,6 +9191,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* sgroup,active vs. sgroup,tombstone with different ip(s)
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_SA_ST_DI_U", 0x1C, NULL),
.skip = (ctx->addresses_all_num < 3),
@@ -9132,6 +9219,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* sgroup,active vs. sgroup,tombstone with same ip(s)
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_SA_ST_SI_U", 0x1C, NULL),
.skip = (ctx->addresses_all_num < 3),
@@ -9159,6 +9247,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* sgroup,active vs. sgroup,tombstone with superset ip(s)
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_SA_ST_SP_U", 0x1C, NULL),
.skip = (ctx->addresses_all_num < 3),
@@ -9186,6 +9275,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* sgroup,active vs. sgroup,tombstone with subset ip(s)
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_SA_ST_SB_U", 0x1C, NULL),
.skip = (ctx->addresses_all_num < 3),
@@ -9489,20 +9579,26 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
return ret;
}
+#define __NBT_LABEL_CAT1__(a,b) a##b
+#define __NBT_LABEL_CAT2__(a,b) __NBT_LABEL_CAT1__(a,b)
+#define _NBT_LABEL __NBT_LABEL_CAT2__(_label_, __LINE__)
+
#define _NBT_ASSERT(v, correct) do { \
- if ((v) != (correct)) { \
- printf("(%s) Incorrect value %s=%d - should be %s (%d)\n", \
- __location__, #v, v, #correct, correct); \
+ bool _ret = true; \
+ torture_assert_int_equal_goto(rec->tctx, v, correct, \
+ _ret, _NBT_LABEL, "Invalid int value"); \
+_NBT_LABEL: \
+ if (!_ret) { \
return; \
} \
} while (0)
#define _NBT_ASSERT_STRING(v, correct) do { \
- if ( ((!v) && (correct)) || \
- ((v) && (!correct)) || \
- ((v) && (correct) && strcmp(v,correct) != 0)) { \
- printf("(%s) Incorrect value %s=%s - should be %s\n", \
- __location__, #v, v, correct); \
+ bool _ret = true; \
+ torture_assert_str_equal_goto(rec->tctx, v, correct, \
+ _ret, _NBT_LABEL, "Invalid string value"); \
+_NBT_LABEL: \
+ if (!_ret) { \
return; \
} \
} while (0)
@@ -9522,8 +9618,8 @@ static void test_conflict_owned_active_vs_replica_handler_query(struct nbt_name_
name = &req_packet->questions[0].name;
- _NBT_ASSERT(name->type, rec->name.type);
_NBT_ASSERT_STRING(name->name, rec->name.name);
+ _NBT_ASSERT(name->type, rec->name.type);
_NBT_ASSERT_STRING(name->scope, rec->name.scope);
_NBT_ASSERT(rec->defend.expect_release, false);
@@ -9621,8 +9717,8 @@ static void test_conflict_owned_active_vs_replica_handler_release(
name = &req_packet->questions[0].name;
- _NBT_ASSERT(name->type, rec->name.type);
_NBT_ASSERT_STRING(name->name, rec->name.name);
+ _NBT_ASSERT(name->type, rec->name.type);
_NBT_ASSERT_STRING(name->scope, rec->name.scope);
_NBT_ASSERT(rec->defend.expect_release, true);
@@ -9668,6 +9764,17 @@ static void test_conflict_owned_active_vs_replica_handler(struct nbt_name_socket
{
struct test_conflict_owned_active_vs_replica_struct *rec =
(struct test_conflict_owned_active_vs_replica_struct *)nbtsock->incoming.private_data;
+ struct nbt_name *name = &req_packet->questions[0].name;
+
+ if (req_packet->operation & NBT_FLAG_BROADCAST) {
+ torture_comment(rec->tctx,
+ "%s: incoming packet name[%s] flags[0x%08X] from[%s]\n",
+ __location__,
+ nbt_name_string(rec->tctx, name),
+ req_packet->operation,
+ src->addr);
+ return;
+ }
rec->defend.ret = false;
@@ -9679,8 +9786,14 @@ static void test_conflict_owned_active_vs_replica_handler(struct nbt_name_socket
test_conflict_owned_active_vs_replica_handler_release(nbtsock, req_packet, src);
break;
default:
- printf("%s: unexpected incoming packet\n", __location__);
- return;
+ torture_comment(rec->tctx,
+ "%s: unexpected packet name[%s] flags[0x%08X] from[%s]\n",
+ __location__,
+ nbt_name_string(rec->tctx, name),
+ req_packet->operation,
+ src->addr);
+ _NBT_ASSERT((req_packet->operation & NBT_OPCODE), NBT_OPCODE_QUERY);
+ break;
}
}
diff --git a/source4/torture/ndr/dfsblob.c b/source4/torture/ndr/dfsblob.c
index 3c95928a5c0..27ad5e40bfa 100644
--- a/source4/torture/ndr/dfsblob.c
+++ b/source4/torture/ndr/dfsblob.c
@@ -63,7 +63,7 @@ static const uint8_t dfs_get_ref_out2[] = {
static bool dfs_referral_out_check(struct torture_context *tctx, struct dfs_referral_resp *r)
{
torture_assert_str_equal(tctx,
- r->referral_entries[0].referral.v3.data.referrals.r2.special_name,
+ r->referral_entries[0].referral.v3.referrals.r2.special_name,
"\\msw2k3.tst", "Special name");
ndr_push_struct_blob(&blob, tctx, r, (ndr_push_flags_fn_t)ndr_push_dfs_referral_resp);
torture_assert_int_equal(tctx, blob.data[blob.length-2], 0, "expanded names not null terminated");
diff --git a/source4/torture/ndr/ndr.c b/source4/torture/ndr/ndr.c
index 36b2b5540c0..6c564d3310a 100644
--- a/source4/torture/ndr/ndr.c
+++ b/source4/torture/ndr/ndr.c
@@ -355,6 +355,7 @@ struct torture_suite *torture_local_ndr(TALLOC_CTX *mem_ctx)
torture_suite_add_suite(suite, ndr_nbt_suite(suite));
torture_suite_add_suite(suite, ndr_ntlmssp_suite(suite));
torture_suite_add_suite(suite, ndr_backupkey_suite(suite));
+ torture_suite_add_suite(suite, ndr_string_suite(suite));
torture_suite_add_simple_test(suite, "string terminator",
test_check_string_terminator);
diff --git a/source4/torture/ndr/string.c b/source4/torture/ndr/string.c
new file mode 100644
index 00000000000..30ed1e4d1a0
--- /dev/null
+++ b/source4/torture/ndr/string.c
@@ -0,0 +1,198 @@
+#include "includes.h"
+#include "torture/ndr/ndr.h"
+#include "torture/ndr/proto.h"
+#include "../lib/util/dlinklist.h"
+#include "param/param.h"
+
+static const char const *ascii = "ascii";
+/* the following is equivalent to "kamelåså öäüÿéèóò" in latin1 */
+static const char const latin1[] = { 0x6b, 0x61, 0x6d, 0x65, 0x6c, 0xe5, 0x73,
+ 0xe5, 0x20, 0xF6, 0xE4, 0xFC, 0xFF, 0xE9,
+ 0xE8, 0xF3, 0xF2, 0x00 };
+/* the following is equivalent to "kamelåså ☺☺☺ öäüÿéèóò" in utf8 */
+static const char const utf8[] = { 0x6b, 0x61, 0x6d, 0x65, 0x6c, 0xc3, 0xa5,
+ 0x73, 0xc3, 0xa5, 0x20, 0xE2, 0x98, 0xBA,
+ 0xE2, 0x98, 0xBA, 0xE2, 0x98, 0xBA, 0x20,
+ 0xc3, 0xb6, 0xc3, 0xa4, 0xc3, 0xbc, 0xc3,
+ 0xbf, 0xc3, 0xa9, 0xc3, 0xa8, 0xc3, 0xb3,
+ 0xc3, 0xb2, 0x00 };
+
+/* purely for convenience */
+static int fl_ascii_null = LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_NULLTERM;
+static int fl_utf8_null = LIBNDR_FLAG_STR_UTF8|LIBNDR_FLAG_STR_NULLTERM;
+static int fl_raw8_null = LIBNDR_FLAG_STR_RAW8|LIBNDR_FLAG_STR_NULLTERM;
+
+static bool
+test_ndr_push_string (struct torture_context *tctx, const char *string,
+ int flags, enum ndr_err_code exp_ndr_err,
+ bool strcmp_pass)
+{
+ TALLOC_CTX *mem_ctx;
+ struct ndr_push *ndr;
+ enum ndr_err_code err;
+
+ torture_comment(tctx,
+ "test_ndr_push_string %s flags 0x%x expecting "
+ "err 0x%x and strcmp %s\n", string, flags, exp_ndr_err,
+ strcmp_pass?"pass":"fail");
+ if (exp_ndr_err != NDR_ERR_SUCCESS) {
+ torture_comment(tctx, "(ignore any Conversion error) ");
+ }
+
+ mem_ctx = talloc_named (NULL, 0, "test_ndr_push_string");
+ ndr = talloc_zero (mem_ctx, struct ndr_push);
+ ndr_set_flags (&ndr->flags, flags);
+
+ err = ndr_push_string (ndr, NDR_SCALARS, string);
+ torture_assert(tctx, err == exp_ndr_err,
+ "ndr_push_string: unexpected return code");
+
+ if (exp_ndr_err == NDR_ERR_SUCCESS) {
+ torture_assert(tctx, ndr->data != NULL,
+ "ndr_push_string: succeeded but NULL data");
+
+ torture_assert(tctx,
+ strcmp_pass == !strcmp(string, (char *)ndr->data),
+ "ndr_push_string: post-push strcmp");
+ }
+
+ talloc_free(mem_ctx);
+ return true;
+}
+
+static bool
+test_ndr_pull_string (struct torture_context *tctx, const char *string,
+ int flags, enum ndr_err_code exp_ndr_err,
+ bool strcmp_pass)
+{
+ TALLOC_CTX *mem_ctx;
+ DATA_BLOB blob;
+ struct ndr_pull *ndr;
+ enum ndr_err_code err;
+ const char *result = NULL;
+
+ torture_comment(tctx,
+ "test_ndr_pull_string '%s' flags 0x%x expecting "
+ "err 0x%x and strcmp %s\n", string, flags, exp_ndr_err,
+ strcmp_pass?"pass":"fail");
+ if (exp_ndr_err != NDR_ERR_SUCCESS) {
+ torture_comment(tctx, "(ignore any Conversion error) ");
+ }
+
+ mem_ctx = talloc_named (NULL, 0, "test_ndr_pull_string");
+
+ blob = data_blob_string_const(string);
+ ndr = ndr_pull_init_blob(&blob, mem_ctx);
+ ndr_set_flags (&ndr->flags, flags);
+
+ err = ndr_pull_string (ndr, NDR_SCALARS, &result);
+ torture_assert(tctx, err == exp_ndr_err,
+ "ndr_pull_string: unexpected return code");
+
+ if (exp_ndr_err == NDR_ERR_SUCCESS) {
+ torture_assert(tctx, result != NULL,
+ "ndr_pull_string: NULL data");
+ torture_assert(tctx, strcmp_pass == !strcmp(string, result),
+ "ndr_pull_string: post-pull strcmp");
+ torture_assert(tctx, result != NULL,
+ "ndr_pull_string succeeded but result NULL");
+ }
+
+ talloc_free(mem_ctx);
+ return true;
+}
+
+static bool
+torture_ndr_string(struct torture_context *torture)
+{
+ const char *saved_dos_cp = lpcfg_dos_charset(torture->lp_ctx);
+
+ torture_assert(torture,
+ test_ndr_push_string (torture, ascii, fl_ascii_null,
+ NDR_ERR_SUCCESS, true),
+ "test_ndr_push_string(ASCII, STR_ASCII|STR_NULL)");
+ torture_assert(torture,
+ test_ndr_push_string (torture, utf8, fl_utf8_null,
+ NDR_ERR_SUCCESS, true),
+ "test_ndr_push_string(UTF8, STR_UTF8|STR_NULL)");
+ torture_assert(torture,
+ test_ndr_push_string (torture, utf8, fl_raw8_null,
+ NDR_ERR_SUCCESS, true),
+ "test_ndr_push_string(UTF8, STR_RAW8|STR_NULL)");
+ torture_assert(torture,
+ test_ndr_push_string (torture, latin1, fl_raw8_null,
+ NDR_ERR_SUCCESS, true),
+ "test_ndr_push_string(LATIN1, STR_RAW8|STR_NULL)");
+ torture_assert(torture,
+ test_ndr_push_string (torture, utf8, fl_ascii_null,
+ NDR_ERR_CHARCNV, false),
+ "test_ndr_push_string(UTF8, STR_ASCII|STR_NULL)");
+ torture_assert(torture,
+ test_ndr_push_string (torture, latin1, fl_ascii_null,
+ NDR_ERR_CHARCNV, false),
+ "test_ndr_push_string(LATIN1, STR_ASCII|STR_NULL)");
+
+
+ torture_assert(torture,
+ test_ndr_pull_string (torture, ascii, fl_ascii_null,
+ NDR_ERR_SUCCESS, true),
+ "test_ndr_pull_string(ASCII, STR_ASCII|STR_NULL)");
+ torture_assert(torture,
+ test_ndr_pull_string (torture, utf8, fl_utf8_null,
+ NDR_ERR_SUCCESS, true),
+ "test_ndr_pull_string(UTF8, STR_UTF8|STR_NULL)");
+ torture_assert(torture,
+ test_ndr_pull_string (torture, utf8, fl_raw8_null,
+ NDR_ERR_SUCCESS, true),
+ "test_ndr_pull_string(UTF8, STR_RAW8|STR_NULL)");
+ torture_assert(torture,
+ test_ndr_pull_string (torture, latin1, fl_raw8_null,
+ NDR_ERR_SUCCESS, true),
+ "test_ndr_pull_string(LATIN1, STR_RAW8|STR_NULL)");
+
+ /* Depending on runtime config, the behavior of ndr_pull_string on
+ * incorrect combinations of strings and flags (latin1 with ASCII
+ * flags, for example) may differ; it may return NDR_ERR_CHARCNV, or
+ * it may return NDR_ERR_SUCCESS but with a string that has been
+ * mutilated, depending on the value of "dos charset". We test for
+ * both cases here. */
+
+ lpcfg_do_global_parameter(torture->lp_ctx, "dos charset", "ASCII");
+ reload_charcnv(torture->lp_ctx);
+
+ torture_assert(torture,
+ test_ndr_pull_string (torture, latin1, fl_ascii_null,
+ NDR_ERR_CHARCNV, false),
+ "test_ndr_pull_string(LATIN1, STR_ASCII|STR_NULL)");
+ torture_assert(torture,
+ test_ndr_pull_string (torture, utf8, fl_ascii_null,
+ NDR_ERR_CHARCNV, false),
+ "test_ndr_pull_string(UTF8, STR_ASCII|STR_NULL)");
+
+ lpcfg_do_global_parameter(torture->lp_ctx, "dos charset", "CP850");
+ reload_charcnv(torture->lp_ctx);
+
+ torture_assert(torture,
+ test_ndr_pull_string (torture, latin1, fl_ascii_null,
+ NDR_ERR_SUCCESS, false),
+ "test_ndr_pull_string(LATIN1, STR_ASCII|STR_NULL)");
+ torture_assert(torture,
+ test_ndr_pull_string (torture, utf8, fl_ascii_null,
+ NDR_ERR_SUCCESS, false),
+ "test_ndr_pull_string(UTF8, STR_ASCII|STR_NULL)");
+
+ lpcfg_do_global_parameter(torture->lp_ctx, "dos charset", saved_dos_cp);
+ reload_charcnv(torture->lp_ctx);
+
+ return true;
+}
+
+struct torture_suite *ndr_string_suite(TALLOC_CTX *ctx)
+{
+ struct torture_suite *suite = torture_suite_create(ctx, "ndr_string");
+
+ torture_suite_add_simple_test(suite, "ndr_string", torture_ndr_string);
+ suite->description = talloc_strdup(suite, "NDR - string-conversion focused push/pull tests");
+
+ return suite;
+}
diff --git a/source4/torture/rap/rap.c b/source4/torture/rap/rap.c
index 5c1c5e196c6..ee37158a431 100644
--- a/source4/torture/rap/rap.c
+++ b/source4/torture/rap/rap.c
@@ -206,6 +206,21 @@ static bool test_netsessiongetinfo(struct torture_context *tctx,
return true;
}
+static bool test_netremotetod(struct torture_context *tctx,
+ struct smbcli_state *cli)
+{
+ struct rap_NetRemoteTOD r;
+
+ r.in.bufsize = 8192;
+
+ torture_assert_ntstatus_ok(tctx,
+ smbcli_rap_netremotetod(cli->tree, tctx, &r),
+ "smbcli_rap_netremotetod failed");
+ torture_assert_werr_ok(tctx, W_ERROR(r.out.status),
+ "smbcli_rap_netremotetod failed");
+
+ return true;
+}
bool torture_rap_scan(struct torture_context *torture, struct smbcli_state *cli)
{
@@ -246,6 +261,8 @@ NTSTATUS torture_rap_init(void)
test_netsessionenum);
torture_suite_add_1smb_test(suite_basic, "netsessiongetinfo",
test_netsessiongetinfo);
+ torture_suite_add_1smb_test(suite_basic, "netremotetod",
+ test_netremotetod);
torture_suite_add_1smb_test(suite, "scan", torture_rap_scan);
diff --git a/source4/torture/raw/acls.c b/source4/torture/raw/acls.c
index 666d164c969..01ee8be6a9f 100644
--- a/source4/torture/raw/acls.c
+++ b/source4/torture/raw/acls.c
@@ -1846,6 +1846,7 @@ done:
return ret;
}
+#if 0
static bool test_inheritance_flags(struct torture_context *tctx,
struct smbcli_state *cli)
{
@@ -2073,6 +2074,7 @@ done:
smbcli_deltree(cli->tree, BASEDIR);
return ret;
}
+#endif
/*
test dynamic acl inheritance
@@ -2201,13 +2203,14 @@ static bool test_inheritance_dynamic(struct torture_context *tctx,
smbcli_unlink(cli->tree, fname1);
done:
- torture_comment(tctx, "put back original sd\n");
- set.set_secdesc.level = RAW_SFILEINFO_SEC_DESC;
- set.set_secdesc.in.file.fnum = fnum;
- set.set_secdesc.in.secinfo_flags = SECINFO_DACL;
- set.set_secdesc.in.sd = sd_orig;
- status = smb_raw_setfileinfo(cli->tree, &set);
-
+ if (sd_orig != NULL) {
+ torture_comment(tctx, "put back original sd\n");
+ set.set_secdesc.level = RAW_SFILEINFO_SEC_DESC;
+ set.set_secdesc.in.file.fnum = fnum;
+ set.set_secdesc.in.secinfo_flags = SECINFO_DACL;
+ set.set_secdesc.in.sd = sd_orig;
+ status = smb_raw_setfileinfo(cli->tree, &set);
+ }
smbcli_close(cli->tree, fnum);
smbcli_rmdir(cli->tree, dname);
smb_raw_exit(cli->session);
@@ -2244,6 +2247,8 @@ done:
CHECK_STATUS_FOR_BIT_ACTION(status, bits, do {} while (0)); \
} while (0)
+#if 0
+
/* test what access mask is needed for getting and setting security_descriptors
Test copied to smb2/acls.c for SMB2. */
static bool test_sd_get_set(struct torture_context *tctx,
@@ -2433,6 +2438,7 @@ done:
return ret;
}
+#endif
/*
basic testing of security descriptor calls
@@ -2450,11 +2456,14 @@ struct torture_suite *torture_raw_acls(TALLOC_CTX *mem_ctx)
torture_suite_add_1smb_test(suite, "owner", test_owner_bits);
torture_suite_add_1smb_test(suite, "inheritance", test_inheritance);
- /* torture_suite_add_1smb_test(suite, "INHERITFLAGS", test_inheritance_flags); */
+#if 0
+ torture_suite_add_1smb_test(suite, "INHERITFLAGS", test_inheritance_flags);
+#endif
torture_suite_add_1smb_test(suite, "dynamic", test_inheritance_dynamic);
- /* XXX This test does not work against XP or Vista.
+#if 0
+ /* XXX This test does not work against XP or Vista. */
torture_suite_add_1smb_test(suite, "GETSET", test_sd_get_set);
- */
+#endif
return suite;
}
diff --git a/source4/torture/raw/open.c b/source4/torture/raw/open.c
index 89042d77dc2..8a66a12cd57 100644
--- a/source4/torture/raw/open.c
+++ b/source4/torture/raw/open.c
@@ -130,7 +130,7 @@ static const char *rdwr_string(enum rdwr_mode m)
if ((v) != (finfo.all_info.out.field)) { \
torture_result(tctx, TORTURE_FAIL, \
"(%s) wrong value for field %s 0x%x - 0x%x\n", \
- __location__, #field, (int)v, (int)(finfo.all_info.out.field)); \
+ __location__, #field, (unsigned int)(v), (unsigned int)(finfo.all_info.out.field)); \
dump_all_info(tctx, &finfo); \
ret = false; \
}} while (0)
@@ -139,7 +139,7 @@ static const char *rdwr_string(enum rdwr_mode m)
if ((v) != (correct)) { \
torture_result(tctx, TORTURE_FAIL, \
"(%s) wrong value for %s 0x%x - should be 0x%x\n", \
- __location__, #v, (int)(v), (int)correct); \
+ __location__, #v, (unsigned int)(v), (unsigned int)(correct)); \
ret = false; \
}} while (0)
@@ -152,7 +152,7 @@ static const char *rdwr_string(enum rdwr_mode m)
status = smb_raw_setpathinfo(cli->tree, &sfinfo); \
if (!NT_STATUS_IS_OK(status)) { \
torture_warning(tctx, "(%s) Failed to set attrib 0x%x on %s\n", \
- __location__, sattrib, fname); \
+ __location__, (unsigned int)(sattrib), fname); \
}} while (0)
/*
@@ -337,7 +337,7 @@ static bool test_openx(struct torture_context *tctx, struct smbcli_state *cli)
__location__, nt_errstr(status),
nt_errstr(open_funcs[i].correct_status),
i, (int)open_funcs[i].with_file,
- (int)open_funcs[i].open_func);
+ open_funcs[i].open_func);
ret = false;
}
if (NT_STATUS_IS_OK(status)) {
@@ -602,7 +602,7 @@ static bool test_t2open(struct torture_context *tctx, struct smbcli_state *cli)
__location__, nt_errstr(status),
nt_errstr(open_funcs[i].correct_status),
i, (int)open_funcs[i].with_file,
- (int)open_funcs[i].open_func);
+ open_funcs[i].open_func);
ret = false;
}
if (NT_STATUS_IS_OK(status)) {
diff --git a/source4/torture/raw/qfileinfo.c b/source4/torture/raw/qfileinfo.c
index 414084080b9..ca5f66795e6 100644
--- a/source4/torture/raw/qfileinfo.c
+++ b/source4/torture/raw/qfileinfo.c
@@ -779,7 +779,7 @@ static bool torture_raw_qfileinfo_internals(struct torture_context *torture,
s1 = fnum_find("BASIC_INFO");
if (s1 && is_ipc) {
if (s1->basic_info.out.attrib != FILE_ATTRIBUTE_NORMAL) {
- printf("(%d) attrib basic_info/nlink incorrect - %d should be %d\n", __LINE__, s1->basic_info.out.attrib, FILE_ATTRIBUTE_NORMAL);
+ printf("(%d) attrib basic_info/nlink incorrect - %d should be %d\n", __LINE__, s1->basic_info.out.attrib, (int)FILE_ATTRIBUTE_NORMAL);
ret = false;
}
}
diff --git a/source4/torture/raw/streams.c b/source4/torture/raw/streams.c
index 5ce9b756efc..ae3bc2a7131 100644
--- a/source4/torture/raw/streams.c
+++ b/source4/torture/raw/streams.c
@@ -1629,6 +1629,7 @@ static bool test_stream_create_disposition(struct torture_context *tctx,
return ret;
}
+#if 0
/* Test streaminfo with enough streams on a file to fill up the buffer. */
static bool test_stream_large_streaminfo(struct torture_context *tctx,
struct smbcli_state *cli)
@@ -1674,6 +1675,7 @@ static bool test_stream_large_streaminfo(struct torture_context *tctx,
smbcli_deltree(cli->tree, BASEDIR);
return ret;
}
+#endif
/* Test the effect of setting attributes on a stream. */
static bool test_stream_attributes(struct torture_context *tctx,
@@ -1913,8 +1915,10 @@ struct torture_suite *torture_raw_streams(TALLOC_CTX *tctx)
torture_suite_add_1smb_test(suite, "attr", test_stream_attributes);
torture_suite_add_1smb_test(suite, "sumtab", test_stream_summary_tab);
- /* torture_suite_add_1smb_test(suite, "LARGESTREAMINFO", */
- /* test_stream_large_streaminfo); */
+#if 0
+ torture_suite_add_1smb_test(suite, "LARGESTREAMINFO",
+ test_stream_large_streaminfo);
+#endif
return suite;
}
diff --git a/source4/torture/rpc/dsgetinfo.c b/source4/torture/rpc/dsgetinfo.c
index 6122ff06037..a0360e84041 100644
--- a/source4/torture/rpc/dsgetinfo.c
+++ b/source4/torture/rpc/dsgetinfo.c
@@ -88,7 +88,7 @@ static const char *torture_get_ldap_base_dn(struct torture_context *tctx, struct
}
ldb_set_modules_dir(ldb,
- talloc_asprintf(ldb, "%s/ldb", lpcfg_modulesdir(tctx->lp_ctx)));
+ modules_path(ldb, "ldb"));
ret = ldb_connect(ldb, ldap_url, 0, NULL);
if (ret != LDB_SUCCESS) {
diff --git a/source4/torture/rpc/remote_pac.c b/source4/torture/rpc/remote_pac.c
index c4efabcebc2..70912781a82 100644
--- a/source4/torture/rpc/remote_pac.c
+++ b/source4/torture/rpc/remote_pac.c
@@ -476,8 +476,9 @@ static bool test_S2U4Self(struct torture_context *tctx,
/* Wipe out any existing ccache */
cli_credentials_invalidate_ccache(credentials, CRED_SPECIFIED);
- cli_credentials_set_target_service(credentials, talloc_asprintf(tmp_ctx, "host/%s", test_machine_name));
- cli_credentials_set_impersonate_principal(credentials, cli_credentials_get_principal(cmdline_credentials, tmp_ctx));
+ cli_credentials_set_impersonate_principal(credentials,
+ cli_credentials_get_principal(cmdline_credentials, tmp_ctx),
+ talloc_asprintf(tmp_ctx, "host/%s", test_machine_name));
status = gensec_client_start(tctx, &gensec_client_context, tctx->ev,
lpcfg_gensec_settings(tctx, tctx->lp_ctx));
@@ -525,7 +526,7 @@ static bool test_S2U4Self(struct torture_context *tctx,
/* Don't pollute the remaining tests with the changed credentials */
cli_credentials_invalidate_ccache(credentials, CRED_SPECIFIED);
cli_credentials_set_target_service(credentials, NULL);
- cli_credentials_set_impersonate_principal(credentials, NULL);
+ cli_credentials_set_impersonate_principal(credentials, NULL, NULL);
/* Extract the PAC using Samba's code */
diff --git a/source4/torture/rpc/rpc.c b/source4/torture/rpc/rpc.c
index 03936f22fff..01ce93f373e 100644
--- a/source4/torture/rpc/rpc.c
+++ b/source4/torture/rpc/rpc.c
@@ -75,7 +75,7 @@ _PUBLIC_ NTSTATUS torture_rpc_connection(struct torture_context *tctx,
NTSTATUS status;
struct dcerpc_binding *binding;
- dcerpc_init(tctx->lp_ctx);
+ dcerpc_init();
status = torture_rpc_binding(tctx, &binding);
if (NT_STATUS_IS_ERR(status))
diff --git a/source4/torture/rpc/spoolss_notify.c b/source4/torture/rpc/spoolss_notify.c
index ec29c3944fe..ea05d9bd1c3 100644
--- a/source4/torture/rpc/spoolss_notify.c
+++ b/source4/torture/rpc/spoolss_notify.c
@@ -247,20 +247,13 @@ static NTSTATUS spoolss__op_init_server(struct dcesrv_context *dce_ctx, const st
static bool test_OpenPrinter(struct torture_context *tctx,
struct dcerpc_pipe *p,
struct policy_handle *handle,
- const char *name)
+ const char *printername)
{
struct spoolss_OpenPrinter r;
- const char *printername;
struct dcerpc_binding_handle *b = p->binding_handle;
ZERO_STRUCT(r);
- if (name) {
- printername = talloc_asprintf(tctx, "\\\\%s\\%s", dcerpc_server_name(p), name);
- } else {
- printername = talloc_asprintf(tctx, "\\\\%s", dcerpc_server_name(p));
- }
-
r.in.printername = printername;
r.in.datatype = NULL;
r.in.devmode_ctr.devmode= NULL;
@@ -352,17 +345,17 @@ static bool test_RemoteFindFirstPrinterChangeNotifyEx(struct torture_context *tc
static bool test_RouterRefreshPrinterChangeNotify(struct torture_context *tctx,
struct dcerpc_binding_handle *b,
struct policy_handle *handle,
- struct spoolss_NotifyOption *options)
+ struct spoolss_NotifyOption *options,
+ struct spoolss_NotifyInfo **info)
{
struct spoolss_RouterRefreshPrinterChangeNotify r;
- struct spoolss_NotifyInfo *info;
torture_comment(tctx, "Testing RouterRefreshPrinterChangeNotify\n");
r.in.handle = handle;
r.in.change_low = 0;
r.in.options = options;
- r.out.info = &info;
+ r.out.info = info;
torture_assert_ntstatus_ok(tctx, dcerpc_spoolss_RouterRefreshPrinterChangeNotify_r(b, tctx, &r),
"RouterRefreshPrinterChangeNotify failed");
@@ -455,8 +448,8 @@ static bool test_start_dcerpc_server(struct torture_context *tctx,
lpcfg_set_cmdline(tctx->lp_ctx, "dcerpc endpoint servers", "spoolss");
- load_interfaces(tctx, lpcfg_interfaces(tctx->lp_ctx), &ifaces);
- address = iface_n_ip(ifaces, 0);
+ load_interface_list(tctx, tctx->lp_ctx, &ifaces);
+ address = iface_list_first_v4(ifaces);
torture_comment(tctx, "Listening for callbacks on %s\n", address);
@@ -503,31 +496,37 @@ static bool test_RFFPCNEx(struct torture_context *tctx,
struct spoolss_NotifyOption *printer_option = setup_printer_NotifyOption(tctx);
#endif
struct dcerpc_binding_handle *b = p->binding_handle;
+ const char *printername = NULL;
+ struct spoolss_NotifyInfo *info = NULL;
received_packets = NULL;
/* Start DCE/RPC server */
torture_assert(tctx, test_start_dcerpc_server(tctx, p->conn->event_ctx, &dce_ctx, &address), "");
- torture_assert(tctx, test_OpenPrinter(tctx, p, &handle, NULL), "");
+ printername = talloc_asprintf(tctx, "\\\\%s", dcerpc_server_name(p));
+
+ torture_assert(tctx, test_OpenPrinter(tctx, p, &handle, printername), "");
torture_assert(tctx, test_RemoteFindFirstPrinterChangeNotifyEx(tctx, b, &handle, address, server_option), "");
torture_assert(tctx, received_packets, "no packets received");
torture_assert_int_equal(tctx, received_packets->opnum, NDR_SPOOLSS_REPLYOPENPRINTER,
"no ReplyOpenPrinter packet after RemoteFindFirstPrinterChangeNotifyEx");
- torture_assert(tctx, test_RouterRefreshPrinterChangeNotify(tctx, b, &handle, NULL), "");
- torture_assert(tctx, test_RouterRefreshPrinterChangeNotify(tctx, b, &handle, server_option), "");
+ torture_assert(tctx, test_RouterRefreshPrinterChangeNotify(tctx, b, &handle, NULL, &info), "");
+ torture_assert(tctx, test_RouterRefreshPrinterChangeNotify(tctx, b, &handle, server_option, &info), "");
torture_assert(tctx, test_ClosePrinter(tctx, b, &handle), "");
tmp = last_packet(received_packets);
torture_assert_int_equal(tctx, tmp->opnum, NDR_SPOOLSS_REPLYCLOSEPRINTER,
"no ReplyClosePrinter packet after ClosePrinter");
#if 0
+ printername = talloc_asprintf(tctx, "\\\\%s\\%s", dcerpc_server_name(p), name);
+
torture_assert(tctx, test_OpenPrinter(tctx, p, &handle, "Epson AL-2600"), "");
torture_assert(tctx, test_RemoteFindFirstPrinterChangeNotifyEx(tctx, p, &handle, address, printer_option), "");
tmp = last_packet(received_packets);
torture_assert_int_equal(tctx, tmp->opnum, NDR_SPOOLSS_REPLYOPENPRINTER,
"no ReplyOpenPrinter packet after RemoteFindFirstPrinterChangeNotifyEx");
- torture_assert(tctx, test_RouterRefreshPrinterChangeNotify(tctx, p, &handle, NULL), "");
- torture_assert(tctx, test_RouterRefreshPrinterChangeNotify(tctx, p, &handle, printer_option), "");
+ torture_assert(tctx, test_RouterRefreshPrinterChangeNotify(tctx, p, &handle, NULL, &info), "");
+ torture_assert(tctx, test_RouterRefreshPrinterChangeNotify(tctx, p, &handle, printer_option, &info), "");
torture_assert(tctx, test_SetPrinter(tctx, p, &handle), "");
tmp = last_packet(received_packets);
torture_assert_int_equal(tctx, tmp->opnum, NDR_SPOOLSS_ROUTERREPLYPRINTEREX,
diff --git a/source4/torture/rpc/testjoin.c b/source4/torture/rpc/testjoin.c
index c4ab0e43ada..76344e0ddf0 100644
--- a/source4/torture/rpc/testjoin.c
+++ b/source4/torture/rpc/testjoin.c
@@ -583,14 +583,14 @@ static NTSTATUS torture_leave_ads_domain(struct torture_context *torture,
ldb_set_opaque(ldb_ctx, "loadparm", cmdline_lp_ctx);
rtn = ldb_connect(ldb_ctx, remote_ldb_url, 0, NULL);
- if (rtn != 0) {
+ if (rtn != LDB_SUCCESS) {
libnet_r->out.error_string = NULL;
talloc_free(tmp_ctx);
return NT_STATUS_UNSUCCESSFUL;
}
rtn = ldb_delete(ldb_ctx, server_dn);
- if (rtn != 0) {
+ if (rtn != LDB_SUCCESS) {
libnet_r->out.error_string = NULL;
talloc_free(tmp_ctx);
return NT_STATUS_UNSUCCESSFUL;
diff --git a/source4/torture/smb2/acls.c b/source4/torture/smb2/acls.c
index 3883ae5055f..fa6c002da7b 100644
--- a/source4/torture/smb2/acls.c
+++ b/source4/torture/smb2/acls.c
@@ -1662,6 +1662,7 @@ done:
CHECK_STATUS_FOR_BIT_ACTION(status, bits, do {} while (0)); \
} while (0)
+#if 0
/* test what access mask is needed for getting and setting security_descriptors */
/* Note: This test was copied from raw/acls.c. */
static bool test_sd_get_set(struct torture_context *tctx, struct smb2_tree *tree)
@@ -1849,6 +1850,7 @@ done:
return ret;
}
+#endif
/*
basic testing of SMB2 ACLs
@@ -1863,9 +1865,10 @@ struct torture_suite *torture_smb2_acls_init(void)
torture_suite_add_1smb2_test(suite, "INHERITANCE", test_inheritance);
torture_suite_add_1smb2_test(suite, "INHERITFLAGS", test_inheritance_flags);
torture_suite_add_1smb2_test(suite, "DYNAMIC", test_inheritance_dynamic);
- /* XXX This test does not work against XP or Vista.
+#if 0
+ /* XXX This test does not work against XP or Vista. */
torture_suite_add_1smb2_test(suite, "GETSET", test_sd_get_set);
- */
+#endif
suite->description = talloc_strdup(suite, "SMB2-ACLS tests");
diff --git a/source4/torture/smbtorture.c b/source4/torture/smbtorture.c
index 62cf0abfb70..83816e8be55 100644
--- a/source4/torture/smbtorture.c
+++ b/source4/torture/smbtorture.c
@@ -686,7 +686,7 @@ int main(int argc,char *argv[])
torture->lp_ctx = cmdline_lp_ctx;
- gensec_init(cmdline_lp_ctx);
+ gensec_init();
if (shell) {
/* In shell mode, just ignore any remaining test names. */
diff --git a/source4/torture/torture.c b/source4/torture/torture.c
index ffd884a38db..9b1719ed7d6 100644
--- a/source4/torture/torture.c
+++ b/source4/torture/torture.c
@@ -43,26 +43,12 @@ bool torture_register_suite(struct torture_suite *suite)
return torture_suite_add_suite(torture_root, suite);
}
-#ifndef ENABLE_LIBNETAPI
-NTSTATUS torture_libnetapi_init(void)
-{
- return NT_STATUS_OK;
-}
-#endif
-
-#ifndef ENABLE_LIBSMBCLIENT
-NTSTATUS torture_libsmbclient_init(void)
-{
- return NT_STATUS_OK;
-}
-#endif
-
_PUBLIC_ int torture_init(void)
{
#define _MODULE_PROTO(init) extern NTSTATUS init(void);
STATIC_smbtorture_MODULES_PROTO;
init_module_fn static_init[] = { STATIC_smbtorture_MODULES };
- init_module_fn *shared_init = load_samba_modules(NULL, cmdline_lp_ctx, "smbtorture");
+ init_module_fn *shared_init = load_samba_modules(NULL, "smbtorture");
run_init_functions(static_init);
run_init_functions(shared_init);
diff --git a/source4/torture/unix/whoami.c b/source4/torture/unix/whoami.c
index 45b2775646d..1e79d7eeb23 100644
--- a/source4/torture/unix/whoami.c
+++ b/source4/torture/unix/whoami.c
@@ -29,10 +29,6 @@
/* Size (in bytes) of the required fields in the SMBwhoami response. */
#define WHOAMI_REQUIRED_SIZE 40
-enum smb_whoami_flags {
- SMB_WHOAMI_GUEST = 0x1 /* Logged in as (or squashed to) guest */
-};
-
/*
SMBWhoami - Query the user mapping performed by the server for the
connected tree. This is a subcommand of the TRANS2_QFSINFO.
diff --git a/source4/torture/winbind/struct_based.c b/source4/torture/winbind/struct_based.c
index aeb81c972ce..2bab94088a3 100644
--- a/source4/torture/winbind/struct_based.c
+++ b/source4/torture/winbind/struct_based.c
@@ -914,7 +914,6 @@ static bool parse_domain_user(struct torture_context *torture,
fstrcpy(user, p+1);
fstrcpy(domain, domuser);
domain[PTR_DIFF(p, domuser)] = 0;
- strupper_m(domain);
return true;
}
diff --git a/source4/torture/wscript_build b/source4/torture/wscript_build
index 68ec4e62209..106cc64280c 100644
--- a/source4/torture/wscript_build
+++ b/source4/torture/wscript_build
@@ -33,7 +33,7 @@ bld.RECURSE('libnetapi')
bld.RECURSE('libsmbclient')
bld.SAMBA_SUBSYSTEM('TORTURE_NDR',
- source='ndr/ndr.c ndr/winreg.c ndr/atsvc.c ndr/lsa.c ndr/epmap.c ndr/dfs.c ndr/netlogon.c ndr/drsuapi.c ndr/spoolss.c ndr/samr.c ndr/dfsblob.c ndr/drsblobs.c ndr/nbt.c ndr/ntlmssp.c ndr/backupkey.c',
+ source='ndr/ndr.c ndr/winreg.c ndr/atsvc.c ndr/lsa.c ndr/epmap.c ndr/dfs.c ndr/netlogon.c ndr/drsuapi.c ndr/spoolss.c ndr/samr.c ndr/dfsblob.c ndr/drsblobs.c ndr/nbt.c ndr/ntlmssp.c ndr/backupkey.c ndr/string.c',
autoproto='ndr/proto.h',
deps='torture'
)