summaryrefslogtreecommitdiff
path: root/source4/nbt_server/register.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2005-02-12 01:00:15 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:09:45 -0500
commit7b8f58c37c7a975b93e20bd40b5195960fe22c6f (patch)
tree2fdb8f527feb2498dbb3551706ec9d17d3b41b89 /source4/nbt_server/register.c
parent49568fab37d3a8fc3727ec5972cecdaf35e904b5 (diff)
downloadsamba-7b8f58c37c7a975b93e20bd40b5195960fe22c6f.tar.gz
samba-7b8f58c37c7a975b93e20bd40b5195960fe22c6f.tar.bz2
samba-7b8f58c37c7a975b93e20bd40b5195960fe22c6f.zip
r5352: added a function nbt_name_string() that formats a nbt_name structure
as a human readable string. The format is designed to be able to be used as the DN for the WINS database as well, while coping with arbitrary bytes in the name (except nul bytes) (This used to be commit aac3090e3504ba07124a9d480322a98efb97175e)
Diffstat (limited to 'source4/nbt_server/register.c')
-rw-r--r--source4/nbt_server/register.c26
1 files changed, 16 insertions, 10 deletions
diff --git a/source4/nbt_server/register.c b/source4/nbt_server/register.c
index c28ba0764c..bec316cdea 100644
--- a/source4/nbt_server/register.c
+++ b/source4/nbt_server/register.c
@@ -44,8 +44,9 @@ static void refresh_completion_handler(struct nbt_name_request *req)
status = nbt_name_refresh_recv(req, tmp_ctx, &io);
if (NT_STATUS_EQUAL(status, NT_STATUS_IO_TIMEOUT)) {
- DEBUG(4,("Refreshed name %s<%02x> on %s\n",
- iname->name.name, iname->name.type, iname->iface->ip_address));
+ DEBUG(4,("Refreshed name %s on %s\n",
+ nbt_name_string(tmp_ctx, &iname->name),
+ iname->iface->ip_address));
iname->registration_time = timeval_current();
nbtd_start_refresh_timer(iname);
talloc_free(tmp_ctx);
@@ -56,13 +57,14 @@ static void refresh_completion_handler(struct nbt_name_request *req)
iname->nb_flags &= ~NBT_NM_ACTIVE;
if (NT_STATUS_IS_OK(status)) {
- DEBUG(1,("Name conflict from %s refreshing name %s<%02x> on %s - %s\n",
- io.out.reply_addr, iname->name.name, iname->name.type,
+ DEBUG(1,("Name conflict from %s refreshing name %s on %s - %s\n",
+ io.out.reply_addr, nbt_name_string(tmp_ctx, &iname->name),
iname->iface->ip_address,
nt_errstr(nbt_rcode_to_ntstatus(io.out.rcode))));
} else {
- DEBUG(1,("Error refreshing name %s<%02x> on %s - %s\n",
- iname->name.name, iname->name.type, iname->iface->ip_address,
+ DEBUG(1,("Error refreshing name %s on %s - %s\n",
+ nbt_name_string(tmp_ctx, &iname->name),
+ iname->iface->ip_address,
nt_errstr(status)));
}
@@ -130,14 +132,17 @@ static void nbtd_register_handler(struct composite_context *req)
struct nbtd_iface_name *iname = talloc_get_type(req->async.private,
struct nbtd_iface_name);
NTSTATUS status;
+ TALLOC_CTX *tmp_ctx = talloc_new(iname);
status = nbt_name_register_bcast_recv(req);
if (NT_STATUS_IS_OK(status)) {
/* good - nobody complained about our registration */
iname->nb_flags |= NBT_NM_ACTIVE;
- DEBUG(3,("Registered %s<%02x> on interface %s\n",
- iname->name.name, iname->name.type, iname->iface->bcast_address));
+ DEBUG(3,("Registered %s on interface %s\n",
+ nbt_name_string(tmp_ctx, &iname->name),
+ iname->iface->bcast_address));
iname->registration_time = timeval_current();
+ talloc_free(tmp_ctx);
nbtd_start_refresh_timer(iname);
return;
}
@@ -145,9 +150,10 @@ static void nbtd_register_handler(struct composite_context *req)
/* someone must have replied with an objection! */
iname->nb_flags |= NBT_NM_CONFLICT;
- DEBUG(1,("Error registering %s<%02x> on interface %s - %s\n",
- iname->name.name, iname->name.type, iname->iface->bcast_address,
+ DEBUG(1,("Error registering %s on interface %s - %s\n",
+ nbt_name_string(tmp_ctx, &iname->name), iname->iface->bcast_address,
nt_errstr(status)));
+ talloc_free(tmp_ctx);
}