diff options
author | Andrew Bartlett <abartlet@samba.org> | 2011-05-04 16:51:23 +1000 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2011-05-06 07:51:24 +0200 |
commit | 2b0de5b5ca1196a39379dcd86a25b6e73c52cf3c (patch) | |
tree | 1263cacf68f7a6e90630885b1d8146d69f4b90fb /source4/libcli/util | |
parent | 865a93767159be087ec78f56687c4d3ba24a3756 (diff) | |
download | samba-2b0de5b5ca1196a39379dcd86a25b6e73c52cf3c.tar.gz samba-2b0de5b5ca1196a39379dcd86a25b6e73c52cf3c.tar.bz2 samba-2b0de5b5ca1196a39379dcd86a25b6e73c52cf3c.zip |
errors: Merge source3/ werror_to_ntstatus() code to source4/
Diffstat (limited to 'source4/libcli/util')
-rw-r--r-- | source4/libcli/util/errormap.c | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/source4/libcli/util/errormap.c b/source4/libcli/util/errormap.c index ef0d482388..68a8e5e0ea 100644 --- a/source4/libcli/util/errormap.c +++ b/source4/libcli/util/errormap.c @@ -621,11 +621,6 @@ static const struct { NTSTATUS ntstatus; WERROR werror; } ntstatus_to_werror_map[] = { - /* - * we add this manualy here, so that W_ERROR(0x5) - * gets mapped to NTSTATUS_ACCESS_DENIED - */ - {NT_STATUS_ACCESS_DENIED, WERR_ACCESS_DENIED}, {NT_STATUS(0x103), W_ERROR(0x3e5)}, {NT_STATUS(0x105), W_ERROR(0xea)}, {NT_STATUS(0x106), W_ERROR(0x514)}, @@ -1160,7 +1155,14 @@ static const struct { {NT_STATUS(0x80000025), W_ERROR(0x962)}, {NT_STATUS(0x80000288), W_ERROR(0x48d)}, {NT_STATUS(0x80000289), W_ERROR(0x48e)}, - {NT_STATUS_OK, WERR_OK} + {NT_STATUS_OK, WERR_OK}}; + +static const struct { + WERROR werror; + NTSTATUS ntstatus; +} werror_to_ntstatus_map[] = { + { W_ERROR(0x5), NT_STATUS_ACCESS_DENIED }, + { WERR_OK, NT_STATUS_OK } }; bool ntstatus_check_dos_mapping = true; @@ -1234,6 +1236,14 @@ NTSTATUS werror_to_ntstatus(WERROR error) { int i; if (W_ERROR_IS_OK(error)) return NT_STATUS_OK; + + for (i=0; !W_ERROR_IS_OK(werror_to_ntstatus_map[i].werror); i++) { + if (W_ERROR_V(error) == + W_ERROR_V(werror_to_ntstatus_map[i].werror)) { + return werror_to_ntstatus_map[i].ntstatus; + } + } + for (i=0; NT_STATUS_V(ntstatus_to_werror_map[i].ntstatus); i++) { if (W_ERROR_V(error) == W_ERROR_V(ntstatus_to_werror_map[i].werror)) { |