summaryrefslogtreecommitdiff
path: root/source4/torture
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2005-10-14 12:22:15 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:39:52 -0500
commitfccbbf354634b31c9c3cb2bca15843f13e3b77f9 (patch)
tree6678adb19a88171fce5569d2183e212d08753aba /source4/torture
parent0b0c38d899db75e6954af2618e7f063dbfc09fd6 (diff)
downloadsamba-fccbbf354634b31c9c3cb2bca15843f13e3b77f9.tar.gz
samba-fccbbf354634b31c9c3cb2bca15843f13e3b77f9.tar.bz2
samba-fccbbf354634b31c9c3cb2bca15843f13e3b77f9.zip
r10997: r11980@SERNOX (orig r10037): metze | 2005-09-05 14:21:40 +0200
add struct nbt_peer_socket and use it instead of passing const char *addr, uint16 port everyhwere (tridge: can you review this please, (make test works) metze (This used to be commit a599d7a4ae881c94be2c2d908a398838549942bb)
Diffstat (limited to 'source4/torture')
-rw-r--r--source4/torture/nbt/dgram.c36
1 files changed, 21 insertions, 15 deletions
diff --git a/source4/torture/nbt/dgram.c b/source4/torture/nbt/dgram.c
index ded2b49ea8..f63ada51ae 100644
--- a/source4/torture/nbt/dgram.c
+++ b/source4/torture/nbt/dgram.c
@@ -35,18 +35,18 @@
*/
static void netlogon_handler(struct dgram_mailslot_handler *dgmslot,
struct nbt_dgram_packet *packet,
- const char *src_address, int src_port)
+ const struct nbt_peer_socket *src)
{
NTSTATUS status;
struct nbt_netlogon_packet netlogon;
int *replies = dgmslot->private;
- printf("netlogon reply from %s:%d\n", src_address, src_port);
+ printf("netlogon reply from %s:%d\n", src->addr, src->port);
status = dgram_mailslot_netlogon_parse(dgmslot, dgmslot, packet, &netlogon);
if (!NT_STATUS_IS_OK(status)) {
printf("Failed to parse netlogon packet from %s:%d\n",
- src_address, src_port);
+ src->addr, src->port);
return;
}
@@ -62,6 +62,7 @@ static BOOL nbt_test_netlogon(TALLOC_CTX *mem_ctx,
{
struct dgram_mailslot_handler *dgmslot;
struct nbt_dgram_socket *dgmsock = nbt_dgram_socket_init(mem_ctx, NULL);
+ struct nbt_peer_socket dest;
const char *myaddress = talloc_strdup(dgmsock, iface_best_ip(address));
struct nbt_netlogon_packet logon;
struct nbt_name myname;
@@ -81,7 +82,6 @@ static BOOL nbt_test_netlogon(TALLOC_CTX *mem_ctx,
/* setup a temporary mailslot listener for replies */
dgmslot = dgram_mailslot_temp(dgmsock, NBT_MAILSLOT_GETDC,
netlogon_handler, &replies);
-
ZERO_STRUCT(logon);
logon.command = NETLOGON_QUERY_FOR_PDC;
@@ -94,14 +94,15 @@ static BOOL nbt_test_netlogon(TALLOC_CTX *mem_ctx,
make_nbt_name_client(&myname, TEST_NAME);
- status = dgram_mailslot_netlogon_send(dgmsock, &name, address,
- 0, &myname, &logon);
+ dest.port = 0;
+ dest.addr = address;
+ status = dgram_mailslot_netlogon_send(dgmsock, &name, &dest,
+ &myname, &logon);
if (!NT_STATUS_IS_OK(status)) {
printf("Failed to send netlogon request - %s\n", nt_errstr(status));
goto failed;
}
-
while (timeval_elapsed(&tv) < 5 && replies == 0) {
event_loop_once(dgmsock->event_ctx);
}
@@ -121,6 +122,7 @@ static BOOL nbt_test_netlogon2(TALLOC_CTX *mem_ctx,
{
struct dgram_mailslot_handler *dgmslot;
struct nbt_dgram_socket *dgmsock = nbt_dgram_socket_init(mem_ctx, NULL);
+ struct nbt_peer_socket dest;
const char *myaddress = talloc_strdup(dgmsock, iface_best_ip(address));
struct nbt_netlogon_packet logon;
struct nbt_name myname;
@@ -154,8 +156,10 @@ static BOOL nbt_test_netlogon2(TALLOC_CTX *mem_ctx,
make_nbt_name_client(&myname, TEST_NAME);
- status = dgram_mailslot_netlogon_send(dgmsock, &name, address,
- 0, &myname, &logon);
+ dest.port = 0;
+ dest.addr = address;
+ status = dgram_mailslot_netlogon_send(dgmsock, &name, &dest,
+ &myname, &logon);
if (!NT_STATUS_IS_OK(status)) {
printf("Failed to send netlogon request - %s\n", nt_errstr(status));
goto failed;
@@ -180,18 +184,18 @@ failed:
*/
static void ntlogon_handler(struct dgram_mailslot_handler *dgmslot,
struct nbt_dgram_packet *packet,
- const char *src_address, int src_port)
+ const struct nbt_peer_socket *src)
{
NTSTATUS status;
struct nbt_ntlogon_packet ntlogon;
int *replies = dgmslot->private;
- printf("ntlogon reply from %s:%d\n", src_address, src_port);
+ printf("ntlogon reply from %s:%d\n", src->addr, src->port);
status = dgram_mailslot_ntlogon_parse(dgmslot, dgmslot, packet, &ntlogon);
if (!NT_STATUS_IS_OK(status)) {
printf("Failed to parse ntlogon packet from %s:%d\n",
- src_address, src_port);
+ src->addr, src->port);
return;
}
@@ -207,6 +211,7 @@ static BOOL nbt_test_ntlogon(TALLOC_CTX *mem_ctx,
{
struct dgram_mailslot_handler *dgmslot;
struct nbt_dgram_socket *dgmsock = nbt_dgram_socket_init(mem_ctx, NULL);
+ struct nbt_peer_socket dest;
const char *myaddress = talloc_strdup(dgmsock, iface_best_ip(address));
struct nbt_ntlogon_packet logon;
struct nbt_name myname;
@@ -255,9 +260,10 @@ static BOOL nbt_test_ntlogon(TALLOC_CTX *mem_ctx,
make_nbt_name_client(&myname, TEST_NAME);
- status = dgram_mailslot_ntlogon_send(dgmsock, DGRAM_DIRECT_UNIQUE,
- &name, address,
- 0, &myname, &logon);
+ dest.port = 0;
+ dest.addr = address;
+ status = dgram_mailslot_ntlogon_send(dgmsock, &name, &dest,
+ &myname, &logon);
if (!NT_STATUS_IS_OK(status)) {
printf("Failed to send ntlogon request - %s\n", nt_errstr(status));
goto failed;