diff options
author | Stefan Metzmacher <metze@samba.org> | 2006-01-14 10:11:04 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:51:11 -0500 |
commit | b71075e836ff3488dd60c54ce9702264fcee6d2f (patch) | |
tree | 3f92e10d409bc67eebe7373b5535e0a3ad3a317b | |
parent | f6c0c820462868df6e222dbb75b370bd7e646edb (diff) | |
download | samba-b71075e836ff3488dd60c54ce9702264fcee6d2f.tar.gz samba-b71075e836ff3488dd60c54ce9702264fcee6d2f.tar.bz2 samba-b71075e836ff3488dd60c54ce9702264fcee6d2f.zip |
r12934: do somemore debugging of the received browse packets,
(so I may learn about the protocol, while watching the debug output)
metze
(This used to be commit 40d7033a1472e5f6b7760984b7d2b6b7db2db860)
-rw-r--r-- | source4/nbt_server/dgram/browse.c | 48 |
1 files changed, 46 insertions, 2 deletions
diff --git a/source4/nbt_server/dgram/browse.c b/source4/nbt_server/dgram/browse.c index 2486354052..5a93cb91d3 100644 --- a/source4/nbt_server/dgram/browse.c +++ b/source4/nbt_server/dgram/browse.c @@ -24,6 +24,26 @@ #include "nbt_server/nbt_server.h" #include "lib/socket/socket.h" +static const char *nbt_browse_opcode_string(enum nbt_browse_opcode r) +{ + const char *val = NULL; + + switch (r) { + case HostAnnouncement: val = "HostAnnouncement"; break; + case AnnouncementRequest: val = "AnnouncementRequest"; break; + case Election: val = "Election"; break; + case GetBackupListReq: val = "GetBackupListReq"; break; + case GetBackupListResp: val = "GetBackupListResp"; break; + case BecomeBackup: val = "BecomeBackup"; break; + case DomainAnnouncement: val = "DomainAnnouncement"; break; + case MasterAnnouncement: val = "MasterAnnouncement"; break; + case ResetBrowserState: val = "ResetBrowserState"; break; + case LocalMasterAnnouncement: val = "LocalMasterAnnouncement"; break; + } + + return val; +} + /* handle incoming browse mailslot requests */ @@ -31,6 +51,30 @@ void nbtd_mailslot_browse_handler(struct dgram_mailslot_handler *dgmslot, struct nbt_dgram_packet *packet, struct socket_address *src) { - DEBUG(2,("Browse request on '%s' from %s:%d\n", - dgmslot->mailslot_name, src->addr, src->port)); + struct nbt_browse_packet *browse = talloc(dgmslot, struct nbt_browse_packet); + struct nbt_name *name = &packet->data.msg.dest_name; + NTSTATUS status; + + if (browse == NULL) goto failed; + + status = dgram_mailslot_browse_parse(dgmslot, browse, packet, browse); + if (!NT_STATUS_IS_OK(status)) goto failed; + + DEBUG(2,("Browse %s (Op %d) on '%s' '%s' from %s:%d\n", + nbt_browse_opcode_string(browse->opcode), browse->opcode, + nbt_name_string(browse, name), dgmslot->mailslot_name, + src->addr, src->port)); + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_DEBUG(nbt_browse_packet, browse); + } + + talloc_free(browse); + return; + +failed: + DEBUG(2,("nbtd browse handler failed from %s:%d - %s\n", + src->addr, src->port, nt_errstr(status))); + talloc_free(browse); + } |