Skip to content

Commit

Permalink
torture: Fix winbind.wbclient.ResolveWinsByIp test
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reviewed-by: Andreas Schneider <[email protected]>
Reviewed-by: Stefan Metzmacher <[email protected]>
  • Loading branch information
obnoxxx committed Jan 11, 2016
1 parent fcb1ca8 commit 71ffd3b
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion nsswitch/libwbclient/tests/wbclient.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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);

Expand Down

0 comments on commit 71ffd3b

Please sign in to comment.