summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libcli/nbt/libnbt.h4
-rw-r--r--libcli/nbt/nbtsocket.c13
2 files changed, 17 insertions, 0 deletions
diff --git a/libcli/nbt/libnbt.h b/libcli/nbt/libnbt.h
index f5191656ed..87183c2c13 100644
--- a/libcli/nbt/libnbt.h
+++ b/libcli/nbt/libnbt.h
@@ -324,6 +324,10 @@ NTSTATUS nbt_set_incoming_handler(struct nbt_name_socket *nbtsock,
void (*handler)(struct nbt_name_socket *, struct nbt_name_packet *,
struct socket_address *),
void *private_data);
+NTSTATUS nbt_set_unexpected_handler(struct nbt_name_socket *nbtsock,
+ void (*handler)(struct nbt_name_socket *, struct nbt_name_packet *,
+ struct socket_address *),
+ void *private);
NTSTATUS nbt_name_reply_send(struct nbt_name_socket *nbtsock,
struct socket_address *dest,
struct nbt_name_packet *request);
diff --git a/libcli/nbt/nbtsocket.c b/libcli/nbt/nbtsocket.c
index 68c5d89db6..4816b816fe 100644
--- a/libcli/nbt/nbtsocket.c
+++ b/libcli/nbt/nbtsocket.c
@@ -509,6 +509,19 @@ _PUBLIC_ NTSTATUS nbt_set_incoming_handler(struct nbt_name_socket *nbtsock,
return NT_STATUS_OK;
}
+/*
+ setup a handler for unexpected requests
+*/
+NTSTATUS nbt_set_unexpected_handler(struct nbt_name_socket *nbtsock,
+ void (*handler)(struct nbt_name_socket *, struct nbt_name_packet *,
+ struct socket_address *),
+ void *private)
+{
+ nbtsock->unexpected.handler = handler;
+ nbtsock->unexpected.private_data = private;
+ EVENT_FD_READABLE(nbtsock->fde);
+ return NT_STATUS_OK;
+}
/*
turn a NBT rcode into a NTSTATUS