r12608: Remove some unused #include lines.
[sfrench/samba-autobuild/.git] / source4 / torture / nbt / wins.c
index f92a23f7324abab9be421ed27b0bf21e49b0b2bd..76f26ac1c03cf3b3ebbd0778859cdd752a5128cc 100644 (file)
@@ -21,8 +21,6 @@
 */
 
 #include "includes.h"
-#include "libcli/nbt/libnbt.h"
-#include "librpc/gen_ndr/ndr_nbt.h"
 #include "lib/socket/socket.h"
 
 #define CHECK_VALUE(v, correct) do { \
@@ -34,7 +32,7 @@
 
 #define CHECK_STRING(v, correct) do { \
        if ((v) != (correct) && \
-           ((v)==NULL || (correct)==NULL || StrCaseCmp(v, correct) != 0)) { \
+           ((v)==NULL || (correct)==NULL || strcasecmp_m(v, correct) != 0)) { \
                printf("(%s) Incorrect value %s='%s' - should be '%s'\n", \
                       __location__, #v, v, correct); \
                ret = False; \
@@ -111,8 +109,9 @@ static BOOL nbt_test_wins_name(TALLOC_CTX *mem_ctx, const char *address,
        CHECK_STRING(io.out.wins_server, address);
        CHECK_VALUE(io.out.rcode, 0);
 
-       if (name->type != NBT_NAME_MASTER && 
+       if (name->type != NBT_NAME_MASTER &&
            name->type != NBT_NAME_LOGON && 
+           name->type != NBT_NAME_BROWSER && 
            (nb_flags & NBT_NM_GROUP)) {
                printf("Try to register as non-group\n");
                io.in.nb_flags &= ~NBT_NM_GROUP;
@@ -291,7 +290,7 @@ static BOOL nbt_test_wins(TALLOC_CTX *mem_ctx, const char *address)
 {
        struct nbt_name name;
        BOOL ret = True;
-       uint32_t r = (unsigned)(random() % (100000));
+       uint32_t r = (uint32_t)(random() % (100000));
 
        name.name = talloc_asprintf(mem_ctx, "_TORTURE-%5u", r);
                                    
@@ -307,6 +306,9 @@ static BOOL nbt_test_wins(TALLOC_CTX *mem_ctx, const char *address)
        name.type = NBT_NAME_LOGON;
        ret &= nbt_test_wins_name(mem_ctx, address, &name, NBT_NODE_H | NBT_NM_GROUP);
 
+       name.type = NBT_NAME_BROWSER;
+       ret &= nbt_test_wins_name(mem_ctx, address, &name, NBT_NODE_H | NBT_NM_GROUP);
+
        name.scope = "example";
        name.type = 0x72;
        ret &= nbt_test_wins_name(mem_ctx, address, &name, NBT_NODE_H);
@@ -345,12 +347,10 @@ BOOL torture_nbt_wins(void)
        NTSTATUS status;
        BOOL ret = True;
        
-       name.name = lp_parm_string(-1, "torture", "host");
-       name.type = NBT_NAME_SERVER;
-       name.scope = NULL;
+       make_nbt_name_server(&name, lp_parm_string(-1, "torture", "host"));
 
        /* do an initial name resolution to find its IP */
-       status = resolve_name(&name, mem_ctx, &address);
+       status = resolve_name(&name, mem_ctx, &address, NULL);
        if (!NT_STATUS_IS_OK(status)) {
                printf("Failed to resolve %s - %s\n",
                       name.name, nt_errstr(status));