summaryrefslogtreecommitdiff
path: root/nsswitch
diff options
context:
space:
mode:
authorMichael Adam <obnox@samba.org>2015-12-18 19:11:43 +0100
committerMichael Adam <obnox@samba.org>2016-01-11 12:25:26 +0100
commit71ffd3b90b5c19ba8596dee86ed49881a22371cc (patch)
tree7c6ef22257b20cc6295fec9d85008f01d841e27c /nsswitch
parentfcb1ca86542831f226de4a8a0b8e51d6831d8895 (diff)
downloadsamba-71ffd3b90b5c19ba8596dee86ed49881a22371cc.tar.gz
torture: Fix winbind.wbclient.ResolveWinsByIp test
The test gets handed a name, so we first need to resolve the name to an IP before we can pass that on to ResolveWinsByIp. Bug uncovered by the new nss_wrapper code (1.1.2). Signed-off-by: Michael Adam <obnox@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
Diffstat (limited to 'nsswitch')
-rw-r--r--nsswitch/libwbclient/tests/wbclient.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/nsswitch/libwbclient/tests/wbclient.c b/nsswitch/libwbclient/tests/wbclient.c
index 5bce0aead88..d482ed216a5 100644
--- a/nsswitch/libwbclient/tests/wbclient.c
+++ b/nsswitch/libwbclient/tests/wbclient.c
@@ -22,6 +22,7 @@
#include "libcli/util/werror.h"
#include "lib/util/data_blob.h"
#include "lib/util/time.h"
+#include "libcli/resolve/resolve.h"
#include "nsswitch/libwbclient/wbclient.h"
#include "torture/smbtorture.h"
#include "torture/winbind/proto.h"
@@ -418,10 +419,21 @@ static bool test_wbc_resolve_winsbyname(struct torture_context *tctx)
static bool test_wbc_resolve_winsbyip(struct torture_context *tctx)
{
const char *ip;
+ const char *host;
+ struct nbt_name nbt_name;
char *name;
wbcErr ret;
+ NTSTATUS status;
- ip = torture_setting_string(tctx, "host", NULL);
+ host = torture_setting_string(tctx, "host", NULL);
+
+ make_nbt_name_server(&nbt_name, host);
+
+ status = resolve_name_ex(lpcfg_resolve_context(tctx->lp_ctx),
+ 0, 0, &nbt_name, tctx, &ip, tctx->ev);
+ torture_assert_ntstatus_ok(tctx, status,
+ talloc_asprintf(tctx,"Failed to resolve %s: %s",
+ nbt_name.name, nt_errstr(status)));
ret = wbcResolveWinsByIP(ip, &name);