diff options
author | Andrew Tridgell <tridge@samba.org> | 2005-02-07 12:10:38 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:09:35 -0500 |
commit | b69a2c0d6bc0643b98ace2489cbcc2d40b99baeb (patch) | |
tree | ffa39f5dca42524ebc0e2002da56154b301321d7 /source4/libcli | |
parent | fcb78064bf760ab72d213b604cef9688edf42b92 (diff) | |
download | samba-b69a2c0d6bc0643b98ace2489cbcc2d40b99baeb.tar.gz samba-b69a2c0d6bc0643b98ace2489cbcc2d40b99baeb.tar.bz2 samba-b69a2c0d6bc0643b98ace2489cbcc2d40b99baeb.zip |
r5261: translate nbt rcode errors to NTSTATUS codes
(This used to be commit 554d1b70e73faeb1f5ecf88f31c5810d86d76200)
Diffstat (limited to 'source4/libcli')
-rw-r--r-- | source4/libcli/nbt/libnbt.h | 2 | ||||
-rw-r--r-- | source4/libcli/nbt/namequery.c | 2 | ||||
-rw-r--r-- | source4/libcli/nbt/nbtsocket.c | 26 |
3 files changed, 30 insertions, 0 deletions
diff --git a/source4/libcli/nbt/libnbt.h b/source4/libcli/nbt/libnbt.h index 7ccd6a51a4..c126f59280 100644 --- a/source4/libcli/nbt/libnbt.h +++ b/source4/libcli/nbt/libnbt.h @@ -132,6 +132,7 @@ struct nbt_name_query { struct nbt_name name; int16_t num_addrs; const char **reply_addrs; + uint8_t rcode; } out; }; @@ -147,6 +148,7 @@ struct nbt_name_status { const char *reply_from; struct nbt_name name; struct nbt_rdata_status status; + uint8_t rcode; } out; }; diff --git a/source4/libcli/nbt/namequery.c b/source4/libcli/nbt/namequery.c index ddef2a7d07..32fcad2052 100644 --- a/source4/libcli/nbt/namequery.c +++ b/source4/libcli/nbt/namequery.c @@ -91,6 +91,7 @@ NTSTATUS nbt_name_query_recv(struct nbt_name_request *req, return NT_STATUS_INVALID_NETWORK_RESPONSE; } + io->out.rcode = packet->operation & NBT_RCODE; io->out.name = packet->answers[0].name; io->out.num_addrs = packet->answers[0].rdata.netbios.length / 6; io->out.reply_addrs = talloc_array(mem_ctx, const char *, io->out.num_addrs); @@ -184,6 +185,7 @@ NTSTATUS nbt_name_status_recv(struct nbt_name_request *req, return NT_STATUS_INVALID_NETWORK_RESPONSE; } + io->out.rcode = packet->operation & NBT_RCODE; io->out.name = packet->answers[0].name; talloc_steal(mem_ctx, io->out.name.name); talloc_steal(mem_ctx, io->out.name.scope); diff --git a/source4/libcli/nbt/nbtsocket.c b/source4/libcli/nbt/nbtsocket.c index f6566e8a6e..38b356338c 100644 --- a/source4/libcli/nbt/nbtsocket.c +++ b/source4/libcli/nbt/nbtsocket.c @@ -484,3 +484,29 @@ NTSTATUS nbt_set_incoming_handler(struct nbt_name_socket *nbtsock, return NT_STATUS_OK; } + +/* + turn a NBT rcode into a NTSTATUS +*/ +NTSTATUS nbt_rcode_to_ntstatus(uint8_t rcode) +{ + int i; + struct { + enum nbt_rcode rcode; + NTSTATUS status; + } map[] = { + { NBT_RCODE_FMT, NT_STATUS_INVALID_PARAMETER }, + { NBT_RCODE_SVR, NT_STATUS_SERVER_DISABLED }, + { NBT_RCODE_NAM, NT_STATUS_OBJECT_NAME_NOT_FOUND }, + { NBT_RCODE_IMP, NT_STATUS_NOT_SUPPORTED }, + { NBT_RCODE_RFS, NT_STATUS_ACCESS_DENIED }, + { NBT_RCODE_ACT, NT_STATUS_ADDRESS_ALREADY_EXISTS }, + { NBT_RCODE_ACT, NT_STATUS_CONFLICTING_ADDRESSES } + }; + for (i=0;i<ARRAY_SIZE(map);i++) { + if (map[i].rcode == rcode) { + return map[i].status; + } + } + return NT_STATUS_UNSUCCESSFUL; +} |