diff options
author | Andrew Tridgell <tridge@samba.org> | 2005-02-12 11:33:42 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:09:45 -0500 |
commit | e199f4cef2bac3b244d08d445421975313229283 (patch) | |
tree | acc368908e18aef24c8093cf7a28044e61754ee3 /source4/nbt_server/packet.c | |
parent | ff4797a9e4b01fe8cc9421e911371677433d070c (diff) | |
download | samba-e199f4cef2bac3b244d08d445421975313229283.tar.gz samba-e199f4cef2bac3b244d08d445421975313229283.tar.bz2 samba-e199f4cef2bac3b244d08d445421975313229283.zip |
r5358: - added initial WINS server code. It passes most of the NBT-WINS test, but doesn't yet
do secure server WACK responses
- added a ldap_string_to_time() function, for converting a LDAP
formatted time to a time_t
(This used to be commit 9aa3313b3f93e47e3f93028e072f6a23b3c22385)
Diffstat (limited to 'source4/nbt_server/packet.c')
-rw-r--r-- | source4/nbt_server/packet.c | 58 |
1 files changed, 51 insertions, 7 deletions
diff --git a/source4/nbt_server/packet.c b/source4/nbt_server/packet.c index e6eec27fdc..6383909149 100644 --- a/source4/nbt_server/packet.c +++ b/source4/nbt_server/packet.c @@ -178,11 +178,12 @@ failed: } /* - send a name defense reply + send a name registration reply */ -void nbtd_negative_name_registration_reply(struct nbt_name_socket *nbtsock, - struct nbt_name_packet *request_packet, - const char *src_address, int src_port) +void nbtd_name_registration_reply(struct nbt_name_socket *nbtsock, + struct nbt_name_packet *request_packet, + const char *src_address, int src_port, + uint8_t rcode) { struct nbt_name_packet *packet; struct nbt_name *name = &request_packet->questions[0].name; @@ -198,7 +199,7 @@ void nbtd_negative_name_registration_reply(struct nbt_name_socket *nbtsock, NBT_FLAG_AUTHORITIVE | NBT_FLAG_RECURSION_DESIRED | NBT_FLAG_RECURSION_AVAIL | - NBT_RCODE_ACT; + rcode; packet->answers = talloc_array(packet, struct nbt_res_rec, 1); if (packet->answers == NULL) goto failed; @@ -206,10 +207,53 @@ void nbtd_negative_name_registration_reply(struct nbt_name_socket *nbtsock, packet->answers[0].name = *name; packet->answers[0].rr_type = NBT_QTYPE_NETBIOS; packet->answers[0].rr_class = NBT_QCLASS_IP; - packet->answers[0].ttl = 0; + packet->answers[0].ttl = request_packet->additional[0].ttl; packet->answers[0].rdata = request_packet->additional[0].rdata; - DEBUG(7,("Sending negative name registration reply for %s to %s:%d\n", + DEBUG(7,("Sending %s name registration reply for %s to %s:%d\n", + rcode==0?"positive":"negative", + nbt_name_string(packet, name), src_address, src_port)); + + nbt_name_reply_send(nbtsock, src_address, src_port, packet); + +failed: + talloc_free(packet); +} + + +/* + send a name release reply +*/ +void nbtd_name_release_reply(struct nbt_name_socket *nbtsock, + struct nbt_name_packet *request_packet, + const char *src_address, int src_port, + uint8_t rcode) +{ + struct nbt_name_packet *packet; + struct nbt_name *name = &request_packet->questions[0].name; + + packet = talloc_zero(nbtsock, struct nbt_name_packet); + if (packet == NULL) return; + + packet->name_trn_id = request_packet->name_trn_id; + packet->ancount = 1; + packet->operation = + NBT_FLAG_REPLY | + NBT_OPCODE_RELEASE | + NBT_FLAG_AUTHORITIVE | + rcode; + + packet->answers = talloc_array(packet, struct nbt_res_rec, 1); + if (packet->answers == NULL) goto failed; + + packet->answers[0].name = *name; + packet->answers[0].rr_type = NBT_QTYPE_NETBIOS; + packet->answers[0].rr_class = NBT_QCLASS_IP; + packet->answers[0].ttl = request_packet->additional[0].ttl; + packet->answers[0].rdata = request_packet->additional[0].rdata; + + DEBUG(7,("Sending %s name release reply for %s to %s:%d\n", + rcode==0?"positive":"negative", nbt_name_string(packet, name), src_address, src_port)); nbt_name_reply_send(nbtsock, src_address, src_port, packet); |