s4-smbtorture: Make test names lowercase and dot-separated.
[sfrench/samba-autobuild/.git] / source4 / torture / nbt / dgram.c
index eac2b1fe30951169663a50f66ba1edefb6848408..36914bdcc36a87c3a7e8942c34264918313332b2 100644 (file)
 
 #include "includes.h"
 #include "libcli/dgram/libdgram.h"
-#include "librpc/gen_ndr/samr.h"
-#include "librpc/gen_ndr/ndr_nbt.h"
-#include "librpc/gen_ndr/ndr_netlogon.h"
 #include "lib/socket/socket.h"
 #include "lib/events/events.h"
-#include "torture/rpc/rpc.h"
+#include "torture/rpc/torture_rpc.h"
 #include "libcli/resolve/resolve.h"
 #include "system/network.h"
 #include "lib/socket/netif.h"
@@ -42,11 +39,11 @@ static void netlogon_handler(struct dgram_mailslot_handler *dgmslot,
                             struct socket_address *src)
 {
        NTSTATUS status;
-       struct nbt_netlogon_response *netlogon = dgmslot->private;
+       struct nbt_netlogon_response *netlogon = dgmslot->private_data;
 
-       dgmslot->private = netlogon = talloc(dgmslot, struct nbt_netlogon_response);
+       dgmslot->private_data = netlogon = talloc(dgmslot, struct nbt_netlogon_response);
 
-       if (!dgmslot->private) {
+       if (!dgmslot->private_data) {
                return;
        }
        
@@ -67,8 +64,7 @@ static void netlogon_handler(struct dgram_mailslot_handler *dgmslot,
 static bool nbt_test_netlogon(struct torture_context *tctx)
 {
        struct dgram_mailslot_handler *dgmslot;
-       struct nbt_dgram_socket *dgmsock = nbt_dgram_socket_init(tctx, tctx->ev, 
-                                                                lp_iconv_convenience(tctx->lp_ctx));
+       struct nbt_dgram_socket *dgmsock = nbt_dgram_socket_init(tctx, tctx->ev);
        struct socket_address *dest;
        const char *myaddress;
        struct nbt_netlogon_packet logon;
@@ -84,21 +80,21 @@ static bool nbt_test_netlogon(struct torture_context *tctx)
 
        struct interface *ifaces;
 
-       name.name = lp_workgroup(tctx->lp_ctx);
+       name.name = lpcfg_workgroup(tctx->lp_ctx);
        name.type = NBT_NAME_LOGON;
        name.scope = NULL;
 
        /* do an initial name resolution to find its IP */
        torture_assert_ntstatus_ok(tctx, 
-                                  resolve_name(lp_resolve_context(tctx->lp_ctx), &name, tctx, &address, tctx->ev),
+                                  resolve_name(lpcfg_resolve_context(tctx->lp_ctx), &name, tctx, &address, tctx->ev),
                                   talloc_asprintf(tctx, "Failed to resolve %s", name.name));
 
-       load_interfaces(tctx, lp_interfaces(tctx->lp_ctx), &ifaces);
+       load_interfaces(tctx, lpcfg_interfaces(tctx->lp_ctx), &ifaces);
        myaddress = talloc_strdup(dgmsock, iface_best_ip(ifaces, address));
 
 
        socket_address = socket_address_from_strings(dgmsock, dgmsock->sock->backend_name,
-                                                    myaddress, lp_dgram_port(tctx->lp_ctx));
+                                                    myaddress, lpcfg_dgram_port(tctx->lp_ctx));
        torture_assert(tctx, socket_address != NULL, "Error getting address");
 
        /* try receiving replies on port 138 first, which will only
@@ -118,6 +114,7 @@ static bool nbt_test_netlogon(struct torture_context *tctx)
        /* setup a temporary mailslot listener for replies */
        dgmslot = dgram_mailslot_temp(dgmsock, NBT_MAILSLOT_GETDC,
                                      netlogon_handler, NULL);
+       torture_assert(tctx, dgmslot != NULL, "Error temporary mailslot for GetDC");
 
        ZERO_STRUCT(logon);
        logon.command = LOGON_PRIMARY_QUERY;
@@ -131,7 +128,7 @@ static bool nbt_test_netlogon(struct torture_context *tctx)
        make_nbt_name_client(&myname, TEST_NAME);
 
        dest = socket_address_from_strings(dgmsock, dgmsock->sock->backend_name, 
-                                          address, lp_dgram_port(tctx->lp_ctx));
+                                          address, lpcfg_dgram_port(tctx->lp_ctx));
        torture_assert(tctx, dest != NULL, "Error getting address");
 
        status = dgram_mailslot_netlogon_send(dgmsock, &name, dest,
@@ -139,16 +136,16 @@ static bool nbt_test_netlogon(struct torture_context *tctx)
                                              &myname, &logon);
        torture_assert_ntstatus_ok(tctx, status, "Failed to send netlogon request");
 
-       while (timeval_elapsed(&tv) < 5 && !dgmslot->private) {
+       while (timeval_elapsed(&tv) < 5 && !dgmslot->private_data) {
                event_loop_once(dgmsock->event_ctx);
        }
 
-       response = talloc_get_type(dgmslot->private, struct nbt_netlogon_response);
+       response = talloc_get_type(dgmslot->private_data, struct nbt_netlogon_response);
 
        torture_assert(tctx, response != NULL, "Failed to receive a netlogon reply packet");
 
        torture_assert(tctx, response->response_type == NETLOGON_GET_PDC, "Got incorrect type of netlogon response");
-       torture_assert(tctx, response->get_pdc.command == NETLOGON_RESPONSE_FROM_PDC, "Got incorrect netlogon response command");
+       torture_assert(tctx, response->data.get_pdc.command == NETLOGON_RESPONSE_FROM_PDC, "Got incorrect netlogon response command");
 
        return true;
 }
@@ -158,8 +155,7 @@ static bool nbt_test_netlogon(struct torture_context *tctx)
 static bool nbt_test_netlogon2(struct torture_context *tctx)
 {
        struct dgram_mailslot_handler *dgmslot;
-       struct nbt_dgram_socket *dgmsock = nbt_dgram_socket_init(tctx, tctx->ev,
-                                                                lp_iconv_convenience(tctx->lp_ctx));
+       struct nbt_dgram_socket *dgmsock = nbt_dgram_socket_init(tctx, tctx->ev);
        struct socket_address *dest;
        const char *myaddress;
        struct nbt_netlogon_packet logon;
@@ -178,20 +174,20 @@ static bool nbt_test_netlogon2(struct torture_context *tctx)
        struct cli_credentials *machine_credentials;
        const struct dom_sid *dom_sid;
        
-       name.name = lp_workgroup(tctx->lp_ctx);
+       name.name = lpcfg_workgroup(tctx->lp_ctx);
        name.type = NBT_NAME_LOGON;
        name.scope = NULL;
 
        /* do an initial name resolution to find its IP */
        torture_assert_ntstatus_ok(tctx, 
-                                  resolve_name(lp_resolve_context(tctx->lp_ctx), &name, tctx, &address, tctx->ev),
+                                  resolve_name(lpcfg_resolve_context(tctx->lp_ctx), &name, tctx, &address, tctx->ev),
                                   talloc_asprintf(tctx, "Failed to resolve %s", name.name));
 
-       load_interfaces(tctx, lp_interfaces(tctx->lp_ctx), &ifaces);
+       load_interfaces(tctx, lpcfg_interfaces(tctx->lp_ctx), &ifaces);
        myaddress = talloc_strdup(dgmsock, iface_best_ip(ifaces, address));
 
        socket_address = socket_address_from_strings(dgmsock, dgmsock->sock->backend_name,
-                                                    myaddress, lp_dgram_port(tctx->lp_ctx));
+                                                    myaddress, lpcfg_dgram_port(tctx->lp_ctx));
        torture_assert(tctx, socket_address != NULL, "Error getting address");
 
        /* try receiving replies on port 138 first, which will only
@@ -211,7 +207,7 @@ static bool nbt_test_netlogon2(struct torture_context *tctx)
        /* setup a temporary mailslot listener for replies */
        dgmslot = dgram_mailslot_temp(dgmsock, NBT_MAILSLOT_GETDC,
                                      netlogon_handler, NULL);
-       
+       torture_assert(tctx, dgmslot != NULL, "Error temporary mailslot for GetDC");
 
        ZERO_STRUCT(logon);
        logon.command = LOGON_SAM_LOGON_REQUEST;
@@ -226,7 +222,7 @@ static bool nbt_test_netlogon2(struct torture_context *tctx)
        make_nbt_name_client(&myname, TEST_NAME);
 
        dest = socket_address_from_strings(dgmsock, dgmsock->sock->backend_name, 
-                                          address, lp_dgram_port(tctx->lp_ctx));
+                                          address, lpcfg_dgram_port(tctx->lp_ctx));
 
        torture_assert(tctx, dest != NULL, "Error getting address");
        status = dgram_mailslot_netlogon_send(dgmsock, &name, dest,
@@ -234,23 +230,24 @@ static bool nbt_test_netlogon2(struct torture_context *tctx)
                                              &myname, &logon);
        torture_assert_ntstatus_ok(tctx, status, "Failed to send netlogon request");
 
-       while (timeval_elapsed(&tv) < 5 && dgmslot->private == NULL) {
+       while (timeval_elapsed(&tv) < 5 && dgmslot->private_data == NULL) {
                event_loop_once(dgmsock->event_ctx);
        }
 
-       response = talloc_get_type(dgmslot->private, struct nbt_netlogon_response);
+       response = talloc_get_type(dgmslot->private_data, struct nbt_netlogon_response);
 
        torture_assert(tctx, response != NULL, "Failed to receive a netlogon reply packet");
 
        torture_assert_int_equal(tctx, response->response_type, NETLOGON_SAMLOGON, "Got incorrect type of netlogon response");
-       map_netlogon_samlogon_response(&response->samlogon);
+       map_netlogon_samlogon_response(&response->data.samlogon);
 
-       torture_assert_int_equal(tctx, response->samlogon.nt5_ex.command, LOGON_SAM_LOGON_RESPONSE_EX, "Got incorrect netlogon response command");
-       torture_assert_int_equal(tctx, response->samlogon.nt5_ex.nt_version, NETLOGON_NT_VERSION_5EX_WITH_IP|NETLOGON_NT_VERSION_5EX|NETLOGON_NT_VERSION_1, "Got incorrect netlogon response command");
+       torture_assert_int_equal(tctx, response->data.samlogon.data.nt5_ex.command, LOGON_SAM_LOGON_RESPONSE_EX, "Got incorrect netlogon response command");
+       torture_assert_int_equal(tctx, response->data.samlogon.data.nt5_ex.nt_version, NETLOGON_NT_VERSION_5EX_WITH_IP|NETLOGON_NT_VERSION_5EX|NETLOGON_NT_VERSION_1, "Got incorrect netlogon response command");
 
        /* setup (another) temporary mailslot listener for replies */
        dgmslot = dgram_mailslot_temp(dgmsock, NBT_MAILSLOT_GETDC,
                                      netlogon_handler, NULL);
+       torture_assert(tctx, dgmslot != NULL, "Error temporary mailslot for GetDC");
        
        ZERO_STRUCT(logon);
        logon.command = LOGON_SAM_LOGON_REQUEST;
@@ -265,7 +262,7 @@ static bool nbt_test_netlogon2(struct torture_context *tctx)
        make_nbt_name_client(&myname, TEST_NAME);
 
        dest = socket_address_from_strings(dgmsock, dgmsock->sock->backend_name, 
-                                          address, lp_dgram_port(tctx->lp_ctx));
+                                          address, lpcfg_dgram_port(tctx->lp_ctx));
 
        torture_assert(tctx, dest != NULL, "Error getting address");
        status = dgram_mailslot_netlogon_send(dgmsock, &name, dest,
@@ -273,33 +270,34 @@ static bool nbt_test_netlogon2(struct torture_context *tctx)
                                              &myname, &logon);
        torture_assert_ntstatus_ok(tctx, status, "Failed to send netlogon request");
 
-       while (timeval_elapsed(&tv) < 5 && dgmslot->private == NULL) {
+       while (timeval_elapsed(&tv) < 5 && dgmslot->private_data == NULL) {
                event_loop_once(dgmsock->event_ctx);
        }
 
-       response = talloc_get_type(dgmslot->private, struct nbt_netlogon_response);
+       response = talloc_get_type(dgmslot->private_data, struct nbt_netlogon_response);
 
        torture_assert(tctx, response != NULL, "Failed to receive a netlogon reply packet");
 
        torture_assert_int_equal(tctx, response->response_type, NETLOGON_SAMLOGON, "Got incorrect type of netlogon response");
-       map_netlogon_samlogon_response(&response->samlogon);
+       map_netlogon_samlogon_response(&response->data.samlogon);
 
-       torture_assert_int_equal(tctx, response->samlogon.nt5_ex.command, LOGON_SAM_LOGON_USER_UNKNOWN, "Got incorrect netlogon response command");
+       torture_assert_int_equal(tctx, response->data.samlogon.data.nt5_ex.command, LOGON_SAM_LOGON_USER_UNKNOWN, "Got incorrect netlogon response command");
 
-       torture_assert_str_equal(tctx, response->samlogon.nt5_ex.user_name, TEST_NAME"$", "Got incorrect user in netlogon response");
+       torture_assert_str_equal(tctx, response->data.samlogon.data.nt5_ex.user_name, TEST_NAME"$", "Got incorrect user in netlogon response");
 
        join_ctx = torture_join_domain(tctx, TEST_NAME, 
                                       ACB_WSTRUST, &machine_credentials);
 
        torture_assert(tctx, join_ctx != NULL,
                       talloc_asprintf(tctx, "Failed to join domain %s as %s\n",
-                                      lp_workgroup(tctx->lp_ctx), TEST_NAME));
+                                      lpcfg_workgroup(tctx->lp_ctx), TEST_NAME));
 
        dom_sid = torture_join_sid(join_ctx);
 
        /* setup (another) temporary mailslot listener for replies */
        dgmslot = dgram_mailslot_temp(dgmsock, NBT_MAILSLOT_GETDC,
                                      netlogon_handler, NULL);
+       torture_assert(tctx, dgmslot != NULL, "Error temporary mailslot for GetDC");
        
        ZERO_STRUCT(logon);
        logon.command = LOGON_SAM_LOGON_REQUEST;
@@ -315,7 +313,7 @@ static bool nbt_test_netlogon2(struct torture_context *tctx)
        make_nbt_name_client(&myname, TEST_NAME);
 
        dest = socket_address_from_strings(dgmsock, dgmsock->sock->backend_name, 
-                                          address, lp_dgram_port(tctx->lp_ctx));
+                                          address, lpcfg_dgram_port(tctx->lp_ctx));
 
        torture_assert(tctx, dest != NULL, "Error getting address");
        status = dgram_mailslot_netlogon_send(dgmsock, &name, dest,
@@ -324,23 +322,24 @@ static bool nbt_test_netlogon2(struct torture_context *tctx)
        torture_assert_ntstatus_ok(tctx, status, "Failed to send netlogon request");
 
 
-       while (timeval_elapsed(&tv) < 5 && dgmslot->private == NULL) {
+       while (timeval_elapsed(&tv) < 5 && dgmslot->private_data == NULL) {
                event_loop_once(dgmsock->event_ctx);
        }
 
-       response = talloc_get_type(dgmslot->private, struct nbt_netlogon_response);
+       response = talloc_get_type(dgmslot->private_data, struct nbt_netlogon_response);
 
        torture_assert(tctx, response != NULL, "Failed to receive a netlogon reply packet");
 
        torture_assert_int_equal(tctx, response->response_type, NETLOGON_SAMLOGON, "Got incorrect type of netlogon response");
-       map_netlogon_samlogon_response(&response->samlogon);
+       map_netlogon_samlogon_response(&response->data.samlogon);
 
-       torture_assert_int_equal(tctx, response->samlogon.nt5_ex.command, LOGON_SAM_LOGON_USER_UNKNOWN, "Got incorrect netlogon response command");
+       torture_assert_int_equal(tctx, response->data.samlogon.data.nt5_ex.command, LOGON_SAM_LOGON_USER_UNKNOWN, "Got incorrect netlogon response command");
 
        /* setup (another) temporary mailslot listener for replies */
        dgmslot = dgram_mailslot_temp(dgmsock, NBT_MAILSLOT_GETDC,
                                      netlogon_handler, NULL);
-       
+       torture_assert(tctx, dgmslot != NULL, "Error getting a Mailslot for GetDC reply");
+
        ZERO_STRUCT(logon);
        logon.command = LOGON_SAM_LOGON_REQUEST;
        logon.req.logon.request_count = 0;
@@ -356,7 +355,7 @@ static bool nbt_test_netlogon2(struct torture_context *tctx)
        make_nbt_name_client(&myname, TEST_NAME);
 
        dest = socket_address_from_strings(dgmsock, dgmsock->sock->backend_name, 
-                                          address, lp_dgram_port(tctx->lp_ctx));
+                                          address, lpcfg_dgram_port(tctx->lp_ctx));
 
        torture_assert(tctx, dest != NULL, "Error getting address");
        status = dgram_mailslot_netlogon_send(dgmsock, &name, dest,
@@ -365,20 +364,20 @@ static bool nbt_test_netlogon2(struct torture_context *tctx)
        torture_assert_ntstatus_ok(tctx, status, "Failed to send netlogon request");
 
 
-       while (timeval_elapsed(&tv) < 5 && dgmslot->private == NULL) {
+       while (timeval_elapsed(&tv) < 5 && dgmslot->private_data == NULL) {
                event_loop_once(dgmsock->event_ctx);
        }
 
-       response = talloc_get_type(dgmslot->private, struct nbt_netlogon_response);
+       response = talloc_get_type(dgmslot->private_data, struct nbt_netlogon_response);
 
        torture_assert(tctx, response != NULL, "Failed to receive a netlogon reply packet");
 
        torture_assert_int_equal(tctx, response->response_type, NETLOGON_SAMLOGON, "Got incorrect type of netlogon response");
-       map_netlogon_samlogon_response(&response->samlogon);
+       map_netlogon_samlogon_response(&response->data.samlogon);
 
-       torture_assert_int_equal(tctx, response->samlogon.nt5_ex.command, LOGON_SAM_LOGON_RESPONSE, "Got incorrect netlogon response command");
+       torture_assert_int_equal(tctx, response->data.samlogon.data.nt5_ex.command, LOGON_SAM_LOGON_RESPONSE, "Got incorrect netlogon response command");
 
-       dgmslot->private = NULL;
+       dgmslot->private_data = NULL;
 
        ZERO_STRUCT(logon);
        logon.command = LOGON_SAM_LOGON_REQUEST;
@@ -395,7 +394,7 @@ static bool nbt_test_netlogon2(struct torture_context *tctx)
        make_nbt_name_client(&myname, TEST_NAME);
 
        dest = socket_address_from_strings(dgmsock, dgmsock->sock->backend_name, 
-                                          address, lp_dgram_port(tctx->lp_ctx));
+                                          address, lpcfg_dgram_port(tctx->lp_ctx));
 
        torture_assert(tctx, dest != NULL, "Error getting address");
        status = dgram_mailslot_netlogon_send(dgmsock, &name, dest,
@@ -404,18 +403,18 @@ static bool nbt_test_netlogon2(struct torture_context *tctx)
        torture_assert_ntstatus_ok(tctx, status, "Failed to send netlogon request");
 
 
-       while (timeval_elapsed(&tv) < 5 && dgmslot->private == NULL) {
+       while (timeval_elapsed(&tv) < 5 && dgmslot->private_data == NULL) {
                event_loop_once(dgmsock->event_ctx);
        }
 
-       response = talloc_get_type(dgmslot->private, struct nbt_netlogon_response);
+       response = talloc_get_type(dgmslot->private_data, struct nbt_netlogon_response);
 
        torture_assert(tctx, response != NULL, "Failed to receive a netlogon reply packet");
 
        torture_assert_int_equal(tctx, response->response_type, NETLOGON_SAMLOGON, "Got incorrect type of netlogon response");
-       map_netlogon_samlogon_response(&response->samlogon);
+       map_netlogon_samlogon_response(&response->data.samlogon);
 
-       torture_assert_int_equal(tctx, response->samlogon.nt5_ex.command, LOGON_SAM_LOGON_USER_UNKNOWN, "Got incorrect netlogon response command");
+       torture_assert_int_equal(tctx, response->data.samlogon.data.nt5_ex.command, LOGON_SAM_LOGON_USER_UNKNOWN, "Got incorrect netlogon response command");
 
        torture_leave_domain(tctx, join_ctx);
        return true;
@@ -426,8 +425,7 @@ static bool nbt_test_netlogon2(struct torture_context *tctx)
 static bool nbt_test_ntlogon(struct torture_context *tctx)
 {
        struct dgram_mailslot_handler *dgmslot;
-       struct nbt_dgram_socket *dgmsock = nbt_dgram_socket_init(tctx, tctx->ev,
-                                                                lp_iconv_convenience(tctx->lp_ctx));
+       struct nbt_dgram_socket *dgmsock = nbt_dgram_socket_init(tctx, tctx->ev);
        struct socket_address *dest;
        struct test_join *join_ctx;
        const struct dom_sid *dom_sid;
@@ -446,20 +444,20 @@ static bool nbt_test_ntlogon(struct torture_context *tctx)
 
        struct interface *ifaces;
        
-       name.name = lp_workgroup(tctx->lp_ctx);
+       name.name = lpcfg_workgroup(tctx->lp_ctx);
        name.type = NBT_NAME_LOGON;
        name.scope = NULL;
 
        /* do an initial name resolution to find its IP */
        torture_assert_ntstatus_ok(tctx, 
-                                  resolve_name(lp_resolve_context(tctx->lp_ctx), &name, tctx, &address, tctx->ev),
+                                  resolve_name(lpcfg_resolve_context(tctx->lp_ctx), &name, tctx, &address, tctx->ev),
                                   talloc_asprintf(tctx, "Failed to resolve %s", name.name));
 
-       load_interfaces(tctx, lp_interfaces(tctx->lp_ctx), &ifaces);
+       load_interfaces(tctx, lpcfg_interfaces(tctx->lp_ctx), &ifaces);
        myaddress = talloc_strdup(dgmsock, iface_best_ip(ifaces, address));
 
        socket_address = socket_address_from_strings(dgmsock, dgmsock->sock->backend_name,
-                                                    myaddress, lp_dgram_port(tctx->lp_ctx));
+                                                    myaddress, lpcfg_dgram_port(tctx->lp_ctx));
        torture_assert(tctx, socket_address != NULL, "Error getting address");
 
        /* try receiving replies on port 138 first, which will only
@@ -482,12 +480,12 @@ static bool nbt_test_ntlogon(struct torture_context *tctx)
 
        torture_assert(tctx, join_ctx != NULL,
                       talloc_asprintf(tctx, "Failed to join domain %s as %s\n",
-                                      lp_workgroup(tctx->lp_ctx), TEST_NAME));
+                                      lpcfg_workgroup(tctx->lp_ctx), TEST_NAME));
 
        /* setup a temporary mailslot listener for replies */
        dgmslot = dgram_mailslot_temp(dgmsock, NBT_MAILSLOT_GETDC,
                                      netlogon_handler, NULL);
-       
+       torture_assert(tctx, dgmslot != NULL, "Error temporary mailslot for GetDC");
 
        ZERO_STRUCT(logon);
        logon.command = LOGON_SAM_LOGON_REQUEST;
@@ -505,7 +503,7 @@ static bool nbt_test_ntlogon(struct torture_context *tctx)
        make_nbt_name_client(&myname, TEST_NAME);
 
        dest = socket_address_from_strings(dgmsock, dgmsock->sock->backend_name, 
-                                          address, lp_dgram_port(tctx->lp_ctx));
+                                          address, lpcfg_dgram_port(tctx->lp_ctx));
        torture_assert(tctx, dest != NULL, "Error getting address");
        status = dgram_mailslot_netlogon_send(dgmsock, 
                                              &name, dest, 
@@ -513,26 +511,26 @@ static bool nbt_test_ntlogon(struct torture_context *tctx)
                                              &myname, &logon);
        torture_assert_ntstatus_ok(tctx, status, "Failed to send ntlogon request");
 
-       while (timeval_elapsed(&tv) < 5 && dgmslot->private == NULL) {
+       while (timeval_elapsed(&tv) < 5 && dgmslot->private_data == NULL) {
                event_loop_once(dgmsock->event_ctx);
        }
 
-       response = talloc_get_type(dgmslot->private, struct nbt_netlogon_response);
+       response = talloc_get_type(dgmslot->private_data, struct nbt_netlogon_response);
 
        torture_assert(tctx, response != NULL, "Failed to receive a netlogon reply packet");
 
        torture_assert_int_equal(tctx, response->response_type, NETLOGON_SAMLOGON, "Got incorrect type of netlogon response");
-       map_netlogon_samlogon_response(&response->samlogon);
+       map_netlogon_samlogon_response(&response->data.samlogon);
 
-       torture_assert_int_equal(tctx, response->samlogon.nt5_ex.command, LOGON_SAM_LOGON_RESPONSE, "Got incorrect netlogon response command");
+       torture_assert_int_equal(tctx, response->data.samlogon.data.nt5_ex.command, LOGON_SAM_LOGON_RESPONSE, "Got incorrect netlogon response command");
 
-       torture_assert_str_equal(tctx, response->samlogon.nt5_ex.user_name, TEST_NAME"$", "Got incorrect user in netlogon response");
+       torture_assert_str_equal(tctx, response->data.samlogon.data.nt5_ex.user_name, TEST_NAME"$", "Got incorrect user in netlogon response");
 
 
        /* setup a temporary mailslot listener for replies */
        dgmslot = dgram_mailslot_temp(dgmsock, NBT_MAILSLOT_GETDC,
                                      netlogon_handler, NULL);
-       
+       torture_assert(tctx, dgmslot != NULL, "Error temporary mailslot for GetDC");
 
        ZERO_STRUCT(logon);
        logon.command = LOGON_SAM_LOGON_REQUEST;
@@ -549,7 +547,7 @@ static bool nbt_test_ntlogon(struct torture_context *tctx)
        make_nbt_name_client(&myname, TEST_NAME);
 
        dest = socket_address_from_strings(dgmsock, dgmsock->sock->backend_name, 
-                                          address, lp_dgram_port(tctx->lp_ctx));
+                                          address, lpcfg_dgram_port(tctx->lp_ctx));
        torture_assert(tctx, dest != NULL, "Error getting address");
        status = dgram_mailslot_netlogon_send(dgmsock, 
                                              &name, dest, 
@@ -557,25 +555,26 @@ static bool nbt_test_ntlogon(struct torture_context *tctx)
                                              &myname, &logon);
        torture_assert_ntstatus_ok(tctx, status, "Failed to send ntlogon request");
 
-       while (timeval_elapsed(&tv) < 5 && dgmslot->private == NULL) {
+       while (timeval_elapsed(&tv) < 5 && dgmslot->private_data == NULL) {
                event_loop_once(dgmsock->event_ctx);
        }
 
-       response = talloc_get_type(dgmslot->private, struct nbt_netlogon_response);
+       response = talloc_get_type(dgmslot->private_data, struct nbt_netlogon_response);
 
        torture_assert(tctx, response != NULL, "Failed to receive a netlogon reply packet");
 
        torture_assert_int_equal(tctx, response->response_type, NETLOGON_SAMLOGON, "Got incorrect type of netlogon response");
-       map_netlogon_samlogon_response(&response->samlogon);
+       map_netlogon_samlogon_response(&response->data.samlogon);
 
-       torture_assert_int_equal(tctx, response->samlogon.nt5_ex.command, LOGON_SAM_LOGON_RESPONSE, "Got incorrect netlogon response command");
+       torture_assert_int_equal(tctx, response->data.samlogon.data.nt5_ex.command, LOGON_SAM_LOGON_RESPONSE, "Got incorrect netlogon response command");
 
-       torture_assert_str_equal(tctx, response->samlogon.nt5_ex.user_name, TEST_NAME"$", "Got incorrect user in netlogon response");
+       torture_assert_str_equal(tctx, response->data.samlogon.data.nt5_ex.user_name, TEST_NAME"$", "Got incorrect user in netlogon response");
 
 
        /* setup (another) temporary mailslot listener for replies */
        dgmslot = dgram_mailslot_temp(dgmsock, NBT_MAILSLOT_GETDC,
                                      netlogon_handler, NULL);
+       torture_assert(tctx, dgmslot != NULL, "Error temporary mailslot for GetDC");
        
        ZERO_STRUCT(logon);
        logon.command = LOGON_PRIMARY_QUERY;
@@ -589,7 +588,7 @@ static bool nbt_test_ntlogon(struct torture_context *tctx)
        make_nbt_name_client(&myname, TEST_NAME);
 
        dest = socket_address_from_strings(dgmsock, dgmsock->sock->backend_name, 
-                                          address, lp_dgram_port(tctx->lp_ctx));
+                                          address, lpcfg_dgram_port(tctx->lp_ctx));
        torture_assert(tctx, dest != NULL, "Error getting address");
        status = dgram_mailslot_netlogon_send(dgmsock, 
                                              &name, dest, 
@@ -597,22 +596,23 @@ static bool nbt_test_ntlogon(struct torture_context *tctx)
                                              &myname, &logon);
        torture_assert_ntstatus_ok(tctx, status, "Failed to send ntlogon request");
 
-       while (timeval_elapsed(&tv) < 5 && !dgmslot->private) {
+       while (timeval_elapsed(&tv) < 5 && !dgmslot->private_data) {
                event_loop_once(dgmsock->event_ctx);
        }
 
-       response = talloc_get_type(dgmslot->private, struct nbt_netlogon_response);
+       response = talloc_get_type(dgmslot->private_data, struct nbt_netlogon_response);
 
        torture_assert(tctx, response != NULL, "Failed to receive a netlogon reply packet");
 
        torture_assert_int_equal(tctx, response->response_type, NETLOGON_GET_PDC, "Got incorrect type of ntlogon response");
-       torture_assert_int_equal(tctx, response->get_pdc.command, NETLOGON_RESPONSE_FROM_PDC, "Got incorrect ntlogon response command");
+       torture_assert_int_equal(tctx, response->data.get_pdc.command, NETLOGON_RESPONSE_FROM_PDC, "Got incorrect ntlogon response command");
 
        torture_leave_domain(tctx, join_ctx);
 
        /* setup (another) temporary mailslot listener for replies */
        dgmslot = dgram_mailslot_temp(dgmsock, NBT_MAILSLOT_GETDC,
                                      netlogon_handler, NULL);
+       torture_assert(tctx, dgmslot != NULL, "Error temporary mailslot for GetDC");
        
        ZERO_STRUCT(logon);
        logon.command = LOGON_PRIMARY_QUERY;
@@ -626,7 +626,7 @@ static bool nbt_test_ntlogon(struct torture_context *tctx)
        make_nbt_name_client(&myname, TEST_NAME);
 
        dest = socket_address_from_strings(dgmsock, dgmsock->sock->backend_name, 
-                                          address, lp_dgram_port(tctx->lp_ctx));
+                                          address, lpcfg_dgram_port(tctx->lp_ctx));
        torture_assert(tctx, dest != NULL, "Error getting address");
        status = dgram_mailslot_netlogon_send(dgmsock, 
                                              &name, dest, 
@@ -634,16 +634,16 @@ static bool nbt_test_ntlogon(struct torture_context *tctx)
                                              &myname, &logon);
        torture_assert_ntstatus_ok(tctx, status, "Failed to send ntlogon request");
 
-       while (timeval_elapsed(&tv) < 5 && !dgmslot->private) {
+       while (timeval_elapsed(&tv) < 5 && !dgmslot->private_data) {
                event_loop_once(dgmsock->event_ctx);
        }
 
-       response = talloc_get_type(dgmslot->private, struct nbt_netlogon_response);
+       response = talloc_get_type(dgmslot->private_data, struct nbt_netlogon_response);
 
        torture_assert(tctx, response != NULL, "Failed to receive a netlogon reply packet");
 
        torture_assert_int_equal(tctx, response->response_type, NETLOGON_GET_PDC, "Got incorrect type of ntlogon response");
-       torture_assert_int_equal(tctx, response->get_pdc.command, NETLOGON_RESPONSE_FROM_PDC, "Got incorrect ntlogon response command");
+       torture_assert_int_equal(tctx, response->data.get_pdc.command, NETLOGON_RESPONSE_FROM_PDC, "Got incorrect ntlogon response command");
 
 
        return true;
@@ -655,7 +655,7 @@ static bool nbt_test_ntlogon(struct torture_context *tctx)
 */
 struct torture_suite *torture_nbt_dgram(TALLOC_CTX *mem_ctx)
 {
-       struct torture_suite *suite = torture_suite_create(mem_ctx, "DGRAM");
+       struct torture_suite *suite = torture_suite_create(mem_ctx, "dgram");
 
        torture_suite_add_simple_test(suite, "netlogon", nbt_test_netlogon);
        torture_suite_add_simple_test(suite, "netlogon2", nbt_test_netlogon2);