Changeset 740 for vendor/current/source4/libcli/util
- Timestamp:
- Nov 14, 2012, 12:59:34 PM (13 years ago)
- Location:
- vendor/current/source4/libcli/util
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
vendor/current/source4/libcli/util/clilsa.c
r414 r740 80 80 lsa->ipc_tree->tid = tcon.tconx.out.tid; 81 81 82 lsa->pipe = dcerpc_pipe_init(lsa, cli->transport->socket->event.ctx, 83 cli->transport->iconv_convenience); 82 lsa->pipe = dcerpc_pipe_init(lsa, cli->transport->socket->event.ctx); 84 83 if (lsa->pipe == NULL) { 85 84 talloc_free(lsa); … … 120 119 r.out.handle = &lsa->handle; 121 120 122 status = dcerpc_lsa_OpenPolicy(lsa->pipe, lsa, &r); 123 if (!NT_STATUS_IS_OK(status)) { 124 talloc_free(lsa); 125 return status; 121 status = dcerpc_lsa_OpenPolicy_r(lsa->pipe->binding_handle, lsa, &r); 122 if (!NT_STATUS_IS_OK(status)) { 123 talloc_free(lsa); 124 return status; 125 } 126 127 if (!NT_STATUS_IS_OK(r.out.result)) { 128 talloc_free(lsa); 129 return r.out.result; 126 130 } 127 131 … … 151 155 r.out.rights = rights; 152 156 153 return dcerpc_lsa_EnumAccountRights(cli->lsa->pipe, mem_ctx, &r); 157 status = dcerpc_lsa_EnumAccountRights_r(cli->lsa->pipe->binding_handle, mem_ctx, &r); 158 if (!NT_STATUS_IS_OK(status)) { 159 return status; 160 } 161 162 return r.out.result; 154 163 } 155 164 … … 235 244 r.out.domains = &domains; 236 245 237 status = dcerpc_lsa_LookupSids(cli->lsa->pipe, mem_ctx2, &r); 238 if (!NT_STATUS_IS_OK(status)) { 239 talloc_free(mem_ctx2); 240 return status; 246 status = dcerpc_lsa_LookupSids_r(cli->lsa->pipe->binding_handle, mem_ctx2, &r); 247 if (!NT_STATUS_IS_OK(status)) { 248 talloc_free(mem_ctx2); 249 return status; 250 } 251 if (!NT_STATUS_IS_OK(r.out.result)) { 252 talloc_free(mem_ctx2); 253 return r.out.result; 241 254 } 242 255 if (names.count != 1) { … … 292 305 r.out.domains = &domains; 293 306 294 status = dcerpc_lsa_LookupNames(cli->lsa->pipe, mem_ctx2, &r); 295 if (!NT_STATUS_IS_OK(status)) { 296 talloc_free(mem_ctx2); 297 return status; 307 status = dcerpc_lsa_LookupNames_r(cli->lsa->pipe->binding_handle, mem_ctx2, &r); 308 if (!NT_STATUS_IS_OK(status)) { 309 talloc_free(mem_ctx2); 310 return status; 311 } 312 if (!NT_STATUS_IS_OK(r.out.result)) { 313 talloc_free(mem_ctx2); 314 return r.out.result; 298 315 } 299 316 if (sids.count != 1) { … … 333 350 r.in.rights = rights; 334 351 335 return dcerpc_lsa_AddAccountRights(cli->lsa->pipe, mem_ctx, &r); 352 status = dcerpc_lsa_AddAccountRights_r(cli->lsa->pipe->binding_handle, mem_ctx, &r); 353 if (!NT_STATUS_IS_OK(status)) { 354 return status; 355 } 356 357 return r.out.result; 336 358 } 337 359 … … 356 378 r.in.rights = rights; 357 379 358 return dcerpc_lsa_RemoveAccountRights(cli->lsa->pipe, mem_ctx, &r); 359 } 380 status = dcerpc_lsa_RemoveAccountRights_r(cli->lsa->pipe->binding_handle, mem_ctx, &r); 381 if (!NT_STATUS_IS_OK(status)) { 382 return status; 383 } 384 385 return r.out.result; 386 } -
vendor/current/source4/libcli/util/errormap.c
r414 r740 21 21 22 22 #include "includes.h" 23 #include "librpc/ndr/libndr.h"24 23 25 24 /* This map was extracted by the ERRMAPEXTRACT smbtorture command. … … 180 179 */ 181 180 {ERRSRV, ERRbadpw, NT_STATUS_WRONG_PASSWORD}, 181 {ERRSRV, ERRbaduid, NT_STATUS_USER_SESSION_DELETED}, 182 182 {ERRHRD, ERRgeneral, NT_STATUS_ILL_FORMED_PASSWORD}, 183 183 {ERRHRD, ERRgeneral, NT_STATUS_PASSWORD_RESTRICTION}, … … 1322 1322 #endif 1323 1323 #ifdef EDQUOT 1324 { EDQUOT, NT_STATUS_ QUOTA_EXCEEDED },1324 { EDQUOT, NT_STATUS_DISK_FULL }, /* Windows does NOT return NT_STATUS_QUOTA_EXCEEDED */ 1325 1325 #endif 1326 1326 #ifdef ENOTEMPTY … … 1383 1383 } 1384 1384 1385 NTSTATUS ndr_map_error2ntstatus(enum ndr_err_code ndr_err) 1385 /* Convert a Unix error code to WERROR */ 1386 WERROR unix_to_werror(int unix_error) 1386 1387 { 1387 switch (ndr_err) { 1388 case NDR_ERR_SUCCESS: 1389 return NT_STATUS_OK; 1390 case NDR_ERR_BUFSIZE: 1391 return NT_STATUS_BUFFER_TOO_SMALL; 1392 case NDR_ERR_TOKEN: 1393 return NT_STATUS_INTERNAL_ERROR; 1394 case NDR_ERR_ALLOC: 1395 return NT_STATUS_NO_MEMORY; 1396 case NDR_ERR_ARRAY_SIZE: 1397 return NT_STATUS_ARRAY_BOUNDS_EXCEEDED; 1398 case NDR_ERR_INVALID_POINTER: 1399 return NT_STATUS_INVALID_PARAMETER_MIX; 1400 case NDR_ERR_UNREAD_BYTES: 1401 return NT_STATUS_PORT_MESSAGE_TOO_LONG; 1402 default: 1403 break; 1404 } 1405 1406 /* we should map all error codes to different status codes */ 1407 return NT_STATUS_INVALID_PARAMETER; 1388 return ntstatus_to_werror(map_nt_error_from_unix(unix_error)); 1408 1389 } -
vendor/current/source4/libcli/util/nterr.c
r414 r740 1 /* 1 /* 2 2 * Unix SMB/CIFS implementation. 3 3 * RPC Pipe client / server routines 4 4 * Copyright (C) Luke Kenneth Casson Leighton 1997-2001. 5 * 5 * 6 6 * This program is free software; you can redistribute it and/or modify 7 7 * it under the terms of the GNU General Public License as published by 8 8 * the Free Software Foundation; either version 3 of the License, or 9 9 * (at your option) any later version. 10 * 10 * 11 11 * This program is distributed in the hope that it will be useful, 12 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 14 * GNU General Public License for more details. 15 * 15 * 16 16 * You should have received a copy of the GNU General Public License 17 17 * along with this program; if not, see <http://www.gnu.org/licenses/>. … … 23 23 #include "../libcli/ldap/ldap_errors.h" 24 24 #undef strcasecmp 25 26 #if !defined(N_) 27 #define N_(string) string 28 #endif 25 29 26 30 typedef struct … … 544 548 { "NT_STATUS_FILE_IS_OFFLINE", NT_STATUS_FILE_IS_OFFLINE }, 545 549 { "NT_STATUS_DS_NO_MORE_RIDS", NT_STATUS_DS_NO_MORE_RIDS }, 546 { "NT_STATUS_NO_MORE_ENTRIES", NT_STATUS_NO_MORE_ENTRIES }, 550 { "NT_STATUS_NOT_A_REPARSE_POINT", NT_STATUS_NOT_A_REPARSE_POINT }, 551 { "NT_STATUS_NO_MORE_ENTRIES", NT_STATUS_NO_MORE_ENTRIES }, 547 552 { "NT_STATUS_RPC_PROTSEQ_NOT_SUPPORTED", NT_STATUS_RPC_PROTSEQ_NOT_SUPPORTED }, 548 553 { "NT_STATUS_RPC_UNSUPPORTED_NAME_SYNTAX", NT_STATUS_RPC_UNSUPPORTED_NAME_SYNTAX }, 554 { "NT_STATUS_RPC_UNKNOWN_IF", NT_STATUS_RPC_UNKNOWN_IF }, 555 { "NT_STATUS_RPC_CALL_FAILED", NT_STATUS_RPC_CALL_FAILED }, 556 { "NT_STATUS_RPC_PROTOCOL_ERROR", NT_STATUS_RPC_PROTOCOL_ERROR }, 557 { "NT_STATUS_RPC_PROCNUM_OUT_OF_RANGE", NT_STATUS_RPC_PROCNUM_OUT_OF_RANGE }, 558 { "NT_STATUS_RPC_CANNOT_SUPPORT", NT_STATUS_RPC_CANNOT_SUPPORT }, 559 { "NT_STATUS_RPC_SEC_PKG_ERROR", NT_STATUS_RPC_SEC_PKG_ERROR }, 560 { "NT_STATUS_RPC_SS_CONTEXT_MISMATCH", NT_STATUS_RPC_SS_CONTEXT_MISMATCH }, 561 { "NT_STATUS_RPC_ENUM_VALUE_OUT_OF_RANGE", NT_STATUS_RPC_ENUM_VALUE_OUT_OF_RANGE }, 562 { "NT_STATUS_RPC_BAD_STUB_DATA", NT_STATUS_RPC_BAD_STUB_DATA }, 563 { "NT_STATUS_RPC_INVALID_PIPE_OBJECT", NT_STATUS_RPC_INVALID_PIPE_OBJECT }, 564 { "NT_STATUS_RPC_INVALID_PIPE_OPERATION", NT_STATUS_RPC_INVALID_PIPE_OPERATION }, 565 { "NT_STATUS_RPC_WRONG_PIPE_VERSION", NT_STATUS_RPC_WRONG_PIPE_VERSION }, 566 { "NT_STATUS_RPC_PIPE_CLOSED", NT_STATUS_RPC_PIPE_CLOSED }, 567 { "NT_STATUS_RPC_PIPE_DISCIPLINE_ERROR", NT_STATUS_RPC_PIPE_DISCIPLINE_ERROR }, 568 { "NT_STATUS_RPC_PIPE_EMPTY", NT_STATUS_RPC_PIPE_EMPTY }, 549 569 { "NT_STATUS_CURRENT_DOMAIN_NOT_ALLOWED", NT_STATUS_CURRENT_DOMAIN_NOT_ALLOWED }, 550 570 { "NT_STATUS_OBJECTID_NOT_FOUND", NT_STATUS_OBJECTID_NOT_FOUND }, 551 571 { "NT_STATUS_DOWNGRADE_DETECTED", NT_STATUS_DOWNGRADE_DETECTED }, 572 { "NT_STATUS_NO_S4U_PROT_SUPPORT", NT_STATUS_NO_S4U_PROT_SUPPORT }, 573 { "NT_STATUS_CROSSREALM_DELEGATION_FAILURE", NT_STATUS_CROSSREALM_DELEGATION_FAILURE }, 552 574 { "NT_STATUS_INVALID_LOCK_RANGE", NT_STATUS_INVALID_LOCK_RANGE }, 553 575 { "NT_STATUS_ERROR_DS_OBJ_STRING_NAME_EXISTS", NT_STATUS_ERROR_DS_OBJ_STRING_NAME_EXISTS }, … … 722 744 }; 723 745 746 /* These need sorting..... */ 747 724 748 static const nt_err_code_struct nt_err_desc[] = 725 749 { 726 { "Success", NT_STATUS_OK }, 727 { "Undetermined error", NT_STATUS_UNSUCCESSFUL }, 728 { "Access denied", NT_STATUS_ACCESS_DENIED }, 729 { "Account locked out", NT_STATUS_ACCOUNT_LOCKED_OUT }, 730 { "Must change password", NT_STATUS_PASSWORD_MUST_CHANGE }, 731 { "Password is too short", NT_STATUS_PWD_TOO_SHORT }, 732 { "Password is too recent", NT_STATUS_PWD_TOO_RECENT }, 733 { "Password history conflict", NT_STATUS_PWD_HISTORY_CONFLICT }, 734 { "No logon servers", NT_STATUS_NO_LOGON_SERVERS }, 735 { "Improperly formed account name", NT_STATUS_INVALID_ACCOUNT_NAME }, 736 { "User exists", NT_STATUS_USER_EXISTS }, 737 { "No such user", NT_STATUS_NO_SUCH_USER }, 738 { "Group exists", NT_STATUS_GROUP_EXISTS }, 739 { "No such group", NT_STATUS_NO_SUCH_GROUP }, 740 { "Member not in group", NT_STATUS_MEMBER_NOT_IN_GROUP }, 741 { "Wrong Password", NT_STATUS_WRONG_PASSWORD }, 742 { "Ill formed password", NT_STATUS_ILL_FORMED_PASSWORD }, 743 { "Password restriction", NT_STATUS_PASSWORD_RESTRICTION }, 744 { "Logon failure", NT_STATUS_LOGON_FAILURE }, 745 { "Account restriction", NT_STATUS_ACCOUNT_RESTRICTION }, 746 { "Invalid logon hours", NT_STATUS_INVALID_LOGON_HOURS }, 747 { "Invalid workstation", NT_STATUS_INVALID_WORKSTATION }, 748 { "Password expired", NT_STATUS_PASSWORD_EXPIRED }, 749 { "Account disabled", NT_STATUS_ACCOUNT_DISABLED }, 750 { "Unexpected information received", NT_STATUS_INVALID_PARAMETER }, 751 { "Memory allocation error", NT_STATUS_NO_MEMORY }, 752 { "No domain controllers located", NT_STATUS_DOMAIN_CONTROLLER_NOT_FOUND }, 753 { "Account locked out", NT_STATUS_ACCOUNT_LOCKED_OUT }, 754 { "Named pipe not available", NT_STATUS_PIPE_NOT_AVAILABLE }, 755 { "Not implemented", NT_STATUS_NOT_IMPLEMENTED }, 756 { "Invalid information class", NT_STATUS_INVALID_INFO_CLASS }, 757 { "Information length mismatch", NT_STATUS_INFO_LENGTH_MISMATCH }, 758 { "Access violation", NT_STATUS_ACCESS_VIOLATION }, 759 { "Invalid handle", NT_STATUS_INVALID_HANDLE }, 760 { "Invalid parameter", NT_STATUS_INVALID_PARAMETER }, 761 { "No memory", NT_STATUS_NO_MEMORY }, 762 { "Buffer too small", NT_STATUS_BUFFER_TOO_SMALL }, 763 { "Revision mismatch", NT_STATUS_REVISION_MISMATCH }, 764 { "No logon servers", NT_STATUS_NO_LOGON_SERVERS }, 765 { "No such logon session", NT_STATUS_NO_SUCH_LOGON_SESSION }, 766 { "No such privilege", NT_STATUS_NO_SUCH_PRIVILEGE }, 767 { "Procedure not found", NT_STATUS_PROCEDURE_NOT_FOUND }, 768 { "Server disabled", NT_STATUS_SERVER_DISABLED }, 769 { "Invalid pipe state", NT_STATUS_INVALID_PIPE_STATE }, 770 { "Named pipe busy", NT_STATUS_PIPE_BUSY }, 771 { "Illegal function", NT_STATUS_ILLEGAL_FUNCTION }, 772 { "Named pipe dicconnected", NT_STATUS_PIPE_DISCONNECTED }, 773 { "Named pipe closing", NT_STATUS_PIPE_CLOSING }, 774 { "Remote host not listening", NT_STATUS_REMOTE_NOT_LISTENING }, 775 { "Duplicate name on network", NT_STATUS_DUPLICATE_NAME }, 776 { "Print queue is full", NT_STATUS_PRINT_QUEUE_FULL }, 777 { "No print spool space available", NT_STATUS_NO_SPOOL_SPACE }, 778 { "Too many names", NT_STATUS_TOO_MANY_NAMES }, 779 { "Too many sessions", NT_STATUS_TOO_MANY_SESSIONS }, 780 { "Invalid server state", NT_STATUS_INVALID_SERVER_STATE }, 781 { "Invalid domain state", NT_STATUS_INVALID_DOMAIN_STATE }, 782 { "Invalid domain role", NT_STATUS_INVALID_DOMAIN_ROLE }, 783 { "No such domain", NT_STATUS_NO_SUCH_DOMAIN }, 784 { "Domain exists", NT_STATUS_DOMAIN_EXISTS }, 785 { "Domain limit exceeded", NT_STATUS_DOMAIN_LIMIT_EXCEEDED }, 786 { "Bad logon session state", NT_STATUS_BAD_LOGON_SESSION_STATE }, 787 { "Logon session collision", NT_STATUS_LOGON_SESSION_COLLISION }, 788 { "Invalid logon type", NT_STATUS_INVALID_LOGON_TYPE }, 789 { "Cancelled", NT_STATUS_CANCELLED }, 790 { "Invalid computer name", NT_STATUS_INVALID_COMPUTER_NAME }, 791 { "Logon server conflict", NT_STATUS_LOGON_SERVER_CONFLICT }, 792 { "Time difference at domain controller", NT_STATUS_TIME_DIFFERENCE_AT_DC }, 793 { "Pipe broken", NT_STATUS_PIPE_BROKEN }, 794 { "Registry corrupt", NT_STATUS_REGISTRY_CORRUPT }, 795 { "Too many secrets", NT_STATUS_TOO_MANY_SECRETS }, 796 { "Too many SIDs", NT_STATUS_TOO_MANY_SIDS }, 797 { "Lanmanager cross encryption required", NT_STATUS_LM_CROSS_ENCRYPTION_REQUIRED }, 798 { "Log file full", NT_STATUS_LOG_FILE_FULL }, 799 { "No trusted LSA secret", NT_STATUS_NO_TRUST_LSA_SECRET }, 800 { "No trusted SAM account", NT_STATUS_NO_TRUST_SAM_ACCOUNT }, 801 { "Trusted domain failure", NT_STATUS_TRUSTED_DOMAIN_FAILURE }, 802 { "Trust relationship failure", NT_STATUS_TRUSTED_RELATIONSHIP_FAILURE }, 803 { "Trust failure", NT_STATUS_TRUST_FAILURE }, 804 { "Netlogon service not started", NT_STATUS_NETLOGON_NOT_STARTED }, 805 { "Account expired", NT_STATUS_ACCOUNT_EXPIRED }, 806 { "Network credential conflict", NT_STATUS_NETWORK_CREDENTIAL_CONFLICT }, 807 { "Remote session limit", NT_STATUS_REMOTE_SESSION_LIMIT }, 808 { "No logon interdomain trust account", NT_STATUS_NOLOGON_INTERDOMAIN_TRUST_ACCOUNT }, 809 { "No logon workstation trust account", NT_STATUS_NOLOGON_WORKSTATION_TRUST_ACCOUNT }, 810 { "No logon server trust account", NT_STATUS_NOLOGON_SERVER_TRUST_ACCOUNT }, 811 { "Domain trust inconsistent", NT_STATUS_DOMAIN_TRUST_INCONSISTENT }, 812 { "No user session key available", NT_STATUS_NO_USER_SESSION_KEY }, 813 { "User session deleted", NT_STATUS_USER_SESSION_DELETED }, 814 { "Insufficient server resources", NT_STATUS_INSUFF_SERVER_RESOURCES }, 815 { "Insufficient logon information", NT_STATUS_INSUFFICIENT_LOGON_INFO }, 816 817 { "License quota exceeded", NT_STATUS_LICENSE_QUOTA_EXCEEDED }, 750 { N_("Success"), NT_STATUS_OK }, 751 { N_("Undetermined error"), NT_STATUS_UNSUCCESSFUL }, 752 { N_("Access denied"), NT_STATUS_ACCESS_DENIED }, 753 { N_("Account locked out"), NT_STATUS_ACCOUNT_LOCKED_OUT }, 754 { N_("Must change password"), NT_STATUS_PASSWORD_MUST_CHANGE }, 755 { N_("Password is too short"), NT_STATUS_PWD_TOO_SHORT }, 756 { N_("Password is too recent"), NT_STATUS_PWD_TOO_RECENT }, 757 { N_("Password history conflict"), NT_STATUS_PWD_HISTORY_CONFLICT }, 758 { N_("No logon servers"), NT_STATUS_NO_LOGON_SERVERS }, 759 { N_("Improperly formed account name"), NT_STATUS_INVALID_ACCOUNT_NAME }, 760 { N_("User exists"), NT_STATUS_USER_EXISTS }, 761 { N_("No such user"), NT_STATUS_NO_SUCH_USER }, 762 { N_("Group exists"), NT_STATUS_GROUP_EXISTS }, 763 { N_("No such group"), NT_STATUS_NO_SUCH_GROUP }, 764 { N_("Member not in group"), NT_STATUS_MEMBER_NOT_IN_GROUP }, 765 { N_("Wrong Password"), NT_STATUS_WRONG_PASSWORD }, 766 { N_("Ill formed password"), NT_STATUS_ILL_FORMED_PASSWORD }, 767 { N_("Password restriction"), NT_STATUS_PASSWORD_RESTRICTION }, 768 { N_("Logon failure"), NT_STATUS_LOGON_FAILURE }, 769 { N_("Account restriction"), NT_STATUS_ACCOUNT_RESTRICTION }, 770 { N_("Invalid logon hours"), NT_STATUS_INVALID_LOGON_HOURS }, 771 { N_("Invalid workstation"), NT_STATUS_INVALID_WORKSTATION }, 772 { N_("Password expired"), NT_STATUS_PASSWORD_EXPIRED }, 773 { N_("Account disabled"), NT_STATUS_ACCOUNT_DISABLED }, 774 { N_("Unexpected information received"), NT_STATUS_INVALID_PARAMETER }, 775 { N_("Memory allocation error"), NT_STATUS_NO_MEMORY }, 776 { N_("No domain controllers located"), NT_STATUS_DOMAIN_CONTROLLER_NOT_FOUND }, 777 { N_("Account locked out"), NT_STATUS_ACCOUNT_LOCKED_OUT }, 778 { N_("Named pipe not available"), NT_STATUS_PIPE_NOT_AVAILABLE }, 779 { N_("Not implemented"), NT_STATUS_NOT_IMPLEMENTED }, 780 { N_("Invalid information class"), NT_STATUS_INVALID_INFO_CLASS }, 781 { N_("Information length mismatch"), NT_STATUS_INFO_LENGTH_MISMATCH }, 782 { N_("Access violation"), NT_STATUS_ACCESS_VIOLATION }, 783 { N_("Invalid handle"), NT_STATUS_INVALID_HANDLE }, 784 { N_("Invalid parameter"), NT_STATUS_INVALID_PARAMETER }, 785 { N_("No memory"), NT_STATUS_NO_MEMORY }, 786 { N_("Buffer too small"), NT_STATUS_BUFFER_TOO_SMALL }, 787 { N_("Revision mismatch"), NT_STATUS_REVISION_MISMATCH }, 788 { N_("No logon servers"), NT_STATUS_NO_LOGON_SERVERS }, 789 { N_("No such logon session"), NT_STATUS_NO_SUCH_LOGON_SESSION }, 790 { N_("No such privilege"), NT_STATUS_NO_SUCH_PRIVILEGE }, 791 { N_("Procedure not found"), NT_STATUS_PROCEDURE_NOT_FOUND }, 792 { N_("Server disabled"), NT_STATUS_SERVER_DISABLED }, 793 { N_("Invalid pipe state"), NT_STATUS_INVALID_PIPE_STATE }, 794 { N_("Named pipe busy"), NT_STATUS_PIPE_BUSY }, 795 { N_("Illegal function"), NT_STATUS_ILLEGAL_FUNCTION }, 796 { N_("Named pipe disconnected"), NT_STATUS_PIPE_DISCONNECTED }, 797 { N_("Named pipe closing"), NT_STATUS_PIPE_CLOSING }, 798 { N_("Remote host not listening"), NT_STATUS_REMOTE_NOT_LISTENING }, 799 { N_("Duplicate name on network"), NT_STATUS_DUPLICATE_NAME }, 800 { N_("Print queue is full"), NT_STATUS_PRINT_QUEUE_FULL }, 801 { N_("No print spool space available"), NT_STATUS_NO_SPOOL_SPACE }, 802 { N_("The network name cannot be found"), NT_STATUS_BAD_NETWORK_NAME }, 803 { N_("The connection was refused"), NT_STATUS_CONNECTION_REFUSED }, 804 { N_("Too many names"), NT_STATUS_TOO_MANY_NAMES }, 805 { N_("Too many sessions"), NT_STATUS_TOO_MANY_SESSIONS }, 806 { N_("Invalid server state"), NT_STATUS_INVALID_SERVER_STATE }, 807 { N_("Invalid domain state"), NT_STATUS_INVALID_DOMAIN_STATE }, 808 { N_("Invalid domain role"), NT_STATUS_INVALID_DOMAIN_ROLE }, 809 { N_("No such domain"), NT_STATUS_NO_SUCH_DOMAIN }, 810 { N_("Domain exists"), NT_STATUS_DOMAIN_EXISTS }, 811 { N_("Domain limit exceeded"), NT_STATUS_DOMAIN_LIMIT_EXCEEDED }, 812 { N_("Bad logon session state"), NT_STATUS_BAD_LOGON_SESSION_STATE }, 813 { N_("Logon session collision"), NT_STATUS_LOGON_SESSION_COLLISION }, 814 { N_("Invalid logon type"), NT_STATUS_INVALID_LOGON_TYPE }, 815 { N_("Cancelled"), NT_STATUS_CANCELLED }, 816 { N_("Invalid computer name"), NT_STATUS_INVALID_COMPUTER_NAME }, 817 { N_("Logon server conflict"), NT_STATUS_LOGON_SERVER_CONFLICT }, 818 { N_("Time difference at domain controller"), NT_STATUS_TIME_DIFFERENCE_AT_DC }, 819 { N_("Pipe broken"), NT_STATUS_PIPE_BROKEN }, 820 { N_("Registry corrupt"), NT_STATUS_REGISTRY_CORRUPT }, 821 { N_("Too many secrets"), NT_STATUS_TOO_MANY_SECRETS }, 822 { N_("Too many SIDs"), NT_STATUS_TOO_MANY_SIDS }, 823 { N_("Lanmanager cross encryption required"), NT_STATUS_LM_CROSS_ENCRYPTION_REQUIRED }, 824 { N_("Log file full"), NT_STATUS_LOG_FILE_FULL }, 825 { N_("No trusted LSA secret"), NT_STATUS_NO_TRUST_LSA_SECRET }, 826 { N_("No trusted SAM account"), NT_STATUS_NO_TRUST_SAM_ACCOUNT }, 827 { N_("Trusted domain failure"), NT_STATUS_TRUSTED_DOMAIN_FAILURE }, 828 { N_("Trust relationship failure"), NT_STATUS_TRUSTED_RELATIONSHIP_FAILURE }, 829 { N_("Trust failure"), NT_STATUS_TRUST_FAILURE }, 830 { N_("Netlogon service not started"), NT_STATUS_NETLOGON_NOT_STARTED }, 831 { N_("Account expired"), NT_STATUS_ACCOUNT_EXPIRED }, 832 { N_("Network credential conflict"), NT_STATUS_NETWORK_CREDENTIAL_CONFLICT }, 833 { N_("Remote session limit"), NT_STATUS_REMOTE_SESSION_LIMIT }, 834 { N_("No logon interdomain trust account"), NT_STATUS_NOLOGON_INTERDOMAIN_TRUST_ACCOUNT }, 835 { N_("No logon workstation trust account"), NT_STATUS_NOLOGON_WORKSTATION_TRUST_ACCOUNT }, 836 { N_("No logon server trust account"), NT_STATUS_NOLOGON_SERVER_TRUST_ACCOUNT }, 837 { N_("Domain trust inconsistent"), NT_STATUS_DOMAIN_TRUST_INCONSISTENT }, 838 { N_("No user session key available"), NT_STATUS_NO_USER_SESSION_KEY }, 839 { N_("User session deleted"), NT_STATUS_USER_SESSION_DELETED }, 840 { N_("Insufficient server resources"), NT_STATUS_INSUFF_SERVER_RESOURCES }, 841 { N_("Insufficient logon information"), NT_STATUS_INSUFFICIENT_LOGON_INFO }, 842 843 { N_("License quota exceeded"), NT_STATUS_LICENSE_QUOTA_EXCEEDED }, 844 { N_("No more files"), STATUS_NO_MORE_FILES }, 818 845 819 846 { NULL, NT_STATUS(0) } … … 821 848 822 849 /***************************************************************************** 823 returns an NT error message. not amazingly helpful, but better than a number.850 Returns an NT error message. not amazingly helpful, but better than a number. 824 851 *****************************************************************************/ 852 825 853 const char *nt_errstr(NTSTATUS nt_code) 826 854 { 827 828 855 static char msg[40]; 856 int idx = 0; 829 857 830 858 while (nt_errs[idx].nt_errstr != NULL) { 831 if (NT_STATUS_V(nt_errs[idx].nt_errcode) == 832 833 859 if (NT_STATUS_V(nt_errs[idx].nt_errcode) == 860 NT_STATUS_V(nt_code)) { 861 return nt_errs[idx].nt_errstr; 834 862 } 835 863 idx++; … … 843 871 slprintf(msg, sizeof(msg), "NT code 0x%08x", NT_STATUS_V(nt_code)); 844 872 845 873 return msg; 846 874 } 847 875 … … 849 877 Print friendler version fo NT error code 850 878 ***********************************************************************/ 879 851 880 const char *get_friendly_nt_error_msg(NTSTATUS nt_code) 852 881 { 853 882 int idx = 0; 854 883 855 884 while (nt_err_desc[idx].nt_errstr != NULL) { 856 885 if (NT_STATUS_V(nt_err_desc[idx].nt_errcode) == NT_STATUS_V(nt_code)) { 857 886 return nt_err_desc[idx].nt_errstr; 858 887 } 859 888 idx++; 860 889 } 861 890 862 891 /* fall back to NT_STATUS_XXX string */ 892 863 893 return nt_errstr(nt_code); 864 894 } 865 895 866 896 /***************************************************************************** 867 returns an NT_STATUS constant as a string for inclusion in autogen C code897 Returns an NT_STATUS constant as a string for inclusion in autogen C code. 868 898 *****************************************************************************/ 899 869 900 const char *get_nt_error_c_code(NTSTATUS nt_code) 870 901 { 871 872 902 static char out[40]; 903 int idx = 0; 873 904 874 905 while (nt_errs[idx].nt_errstr != NULL) { 875 if (NT_STATUS_V(nt_errs[idx].nt_errcode) == 876 877 906 if (NT_STATUS_V(nt_errs[idx].nt_errcode) == 907 NT_STATUS_V(nt_code)) { 908 return nt_errs[idx].nt_errstr; 878 909 } 879 910 idx++; … … 882 913 slprintf(out, sizeof(out), "NT_STATUS(0x%08x)", NT_STATUS_V(nt_code)); 883 914 884 915 return out; 885 916 } 886 917 887 918 /***************************************************************************** 888 returns the NT_STATUS constant matching the string supplied (as an NTSTATUS)919 Returns the NT_STATUS constant matching the string supplied (as an NTSTATUS) 889 920 *****************************************************************************/ 921 890 922 NTSTATUS nt_status_string_to_code(const char *nt_status_str) 891 923 { 892 924 int idx = 0; 893 925 894 926 while (nt_errs[idx].nt_errstr != NULL) { 895 927 if (strcasecmp(nt_errs[idx].nt_errstr, nt_status_str) == 0) { 896 928 return nt_errs[idx].nt_errcode; 897 929 } 898 930 idx++; … … 900 932 return NT_STATUS_UNSUCCESSFUL; 901 933 } 934 935 /** 936 * Squash an NT_STATUS in line with security requirements. 937 * In an attempt to avoid giving the whole game away when users 938 * are authenticating, NT replaces both NT_STATUS_NO_SUCH_USER and 939 * NT_STATUS_WRONG_PASSWORD with NT_STATUS_LOGON_FAILURE in certain situations 940 * (session setups in particular). 941 * 942 * @param nt_status NTSTATUS input for squashing. 943 * @return the 'squashed' nt_status 944 **/ 945 946 NTSTATUS nt_status_squash(NTSTATUS nt_status) 947 { 948 if NT_STATUS_IS_OK(nt_status) { 949 return nt_status; 950 } else if NT_STATUS_EQUAL(nt_status, NT_STATUS_NO_SUCH_USER) { 951 /* Match WinXP and don't give the game away */ 952 return NT_STATUS_LOGON_FAILURE; 953 954 } else if NT_STATUS_EQUAL(nt_status, NT_STATUS_WRONG_PASSWORD) { 955 /* Match WinXP and don't give the game away */ 956 return NT_STATUS_LOGON_FAILURE; 957 } else { 958 return nt_status; 959 } 960 } -
vendor/current/source4/libcli/util/pyerrors.h
r414 r740 25 25 #define PyErr_FromNTSTATUS(status) Py_BuildValue("(i,s)", NT_STATUS_V(status), discard_const_p(char, get_friendly_nt_error_msg(status))) 26 26 27 #define PyErr_FromString(str) Py_BuildValue("(s)", discard_const_p(char, str)) 28 27 29 #define PyErr_SetWERROR(err) \ 28 30 PyErr_SetObject(PyExc_RuntimeError, PyErr_FromWERROR(err))
Note:
See TracChangeset
for help on using the changeset viewer.