~lefteris-nikoltsios/+junk/samba-lp1016895

« back to all changes in this revision

Viewing changes to source3/libsmb/nterr.c

  • Committer: Package Import Robot
  • Author(s): Chuck Short
  • Date: 2011-12-21 13:18:04 UTC
  • mfrom: (0.39.21 sid)
  • Revision ID: package-import@ubuntu.com-20111221131804-xtlr39wx6njehxxr
Tags: 2:3.6.1-3ubuntu1
* Merge from Debian testing.  Remaining changes:
  + debian/patches/VERSION.patch:
    - set SAMBA_VERSION_SUFFIX to Ubuntu.
  + debian/patches/error-trans.fix-276472:
    - Add the translation of Unix Error code -ENOTSUP to NT Error Code
    - NT_STATUS_NOT_SUPPORTED to prevent the Permission denied error.
  + debian/smb.conf:
    - add "(Samba, Ubuntu)" to server string.
    - comment out the default [homes] share, and add a comment about
      "valid users = %S" to show users how to restrict access to
      \\server\username to only username.
    - Set 'usershare allow guests', so that usershare admins are 
      allowed to create public shares in addition to authenticated
      ones.
    - add map to guest = Bad user, maps bad username to guest access.
  + debian/samba-common.config:
    - Do not change priority to high if dhclient3 is installed.
    - Use priority medium instead of high for the workgroup question.
  + debian/control:
    - Don't build against or suggest ctdb.
    - Add dependency on samba-common-bin to samba.
  + Add ufw integration:
    - Created debian/samba.ufw.profile
    - debian/rules, debian/samba.dirs, debian/samba.files: install
      profile
    - debian/control: have samba suggest ufw
  + Add apport hook:
    - Created debian/source_samba.py.
    - debian/rules, debian/samba.dirs, debian/samba-common-bin.files: install
  + Switch to upstart:
    - Add debian/samba.{nmbd,smbd}.upstart.
  + debian/samba.logrotate, debian/samba-common.dhcp, debian/samba.if-up:
    - Make them upstart compatible
  + debian/samba.postinst: 
    - Avoid scary pdbedit warnings on first import.
  + debian/samba-common.postinst: Add more informative error message for
    the case where smb.conf was manually deleted
  + debian/patches/fix-debuglevel-name-conflict.patch: don't use 'debug_level'
    as a global variable name in an NSS module 
  + Dropped:
    - debian/patches/error-trans.fix-276472
    - debian/patches/fix-debuglevel-name-conflict.patch

Show diffs side-by-side

added added

removed removed

Lines of Context:
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/>.
18
18
 */
20
20
/* NT error codes.  please read nterr.h */
21
21
 
22
22
#include "includes.h"
 
23
#include "smb_ldap.h"
 
24
#undef strcasecmp
 
25
 
 
26
#if !defined(N_)
 
27
#define N_(string) string
 
28
#endif
23
29
 
24
30
typedef struct
25
31
{
30
36
static const nt_err_code_struct nt_errs[] =
31
37
{
32
38
        { "NT_STATUS_OK", NT_STATUS_OK },
 
39
        { "STATUS_NO_MORE_FILES", STATUS_NO_MORE_FILES },
 
40
        { "STATUS_NO_MORE_EAS", STATUS_NO_MORE_EAS },
 
41
        { "STATUS_INVALID_EA_NAME", STATUS_INVALID_EA_NAME },
 
42
        { "STATUS_EA_LIST_INCONSISTENT", STATUS_EA_LIST_INCONSISTENT },
 
43
        { "STATUS_INVALID_EA_FLAG", STATUS_INVALID_EA_FLAG },
33
44
        { "NT_STATUS_UNSUCCESSFUL", NT_STATUS_UNSUCCESSFUL },
34
45
        { "NT_STATUS_NOT_IMPLEMENTED", NT_STATUS_NOT_IMPLEMENTED },
35
46
        { "NT_STATUS_INVALID_INFO_CLASS", NT_STATUS_INVALID_INFO_CLASS },
534
545
        { "NT_STATUS_FILE_IS_OFFLINE", NT_STATUS_FILE_IS_OFFLINE },
535
546
        { "NT_STATUS_DS_NO_MORE_RIDS", NT_STATUS_DS_NO_MORE_RIDS },
536
547
        { "NT_STATUS_NOT_A_REPARSE_POINT", NT_STATUS_NOT_A_REPARSE_POINT },
 
548
        { "NT_STATUS_NO_MORE_ENTRIES", NT_STATUS_NO_MORE_ENTRIES },
 
549
        { "NT_STATUS_RPC_PROTSEQ_NOT_SUPPORTED", NT_STATUS_RPC_PROTSEQ_NOT_SUPPORTED },
 
550
        { "NT_STATUS_RPC_UNSUPPORTED_NAME_SYNTAX", NT_STATUS_RPC_UNSUPPORTED_NAME_SYNTAX },
 
551
        { "NT_STATUS_RPC_UNKNOWN_IF", NT_STATUS_RPC_UNKNOWN_IF },
 
552
        { "NT_STATUS_RPC_CALL_FAILED", NT_STATUS_RPC_CALL_FAILED },
 
553
        { "NT_STATUS_RPC_PROTOCOL_ERROR", NT_STATUS_RPC_PROTOCOL_ERROR },
 
554
        { "NT_STATUS_RPC_PROCNUM_OUT_OF_RANGE", NT_STATUS_RPC_PROCNUM_OUT_OF_RANGE },
 
555
        { "NT_STATUS_RPC_CANNOT_SUPPORT", NT_STATUS_RPC_CANNOT_SUPPORT },
 
556
        { "NT_STATUS_RPC_SEC_PKG_ERROR", NT_STATUS_RPC_SEC_PKG_ERROR },
 
557
        { "NT_STATUS_RPC_SS_CONTEXT_MISMATCH", NT_STATUS_RPC_SS_CONTEXT_MISMATCH },
 
558
        { "NT_STATUS_RPC_ENUM_VALUE_OUT_OF_RANGE", NT_STATUS_RPC_ENUM_VALUE_OUT_OF_RANGE },
 
559
        { "NT_STATUS_RPC_BAD_STUB_DATA", NT_STATUS_RPC_BAD_STUB_DATA },
 
560
        { "NT_STATUS_RPC_INVALID_PIPE_OBJECT", NT_STATUS_RPC_INVALID_PIPE_OBJECT },
 
561
        { "NT_STATUS_RPC_INVALID_PIPE_OPERATION", NT_STATUS_RPC_INVALID_PIPE_OPERATION },
 
562
        { "NT_STATUS_RPC_WRONG_PIPE_VERSION", NT_STATUS_RPC_WRONG_PIPE_VERSION },
 
563
        { "NT_STATUS_RPC_PIPE_CLOSED", NT_STATUS_RPC_PIPE_CLOSED },
 
564
        { "NT_STATUS_RPC_PIPE_DISCIPLINE_ERROR", NT_STATUS_RPC_PIPE_DISCIPLINE_ERROR },
 
565
        { "NT_STATUS_RPC_PIPE_EMPTY", NT_STATUS_RPC_PIPE_EMPTY },
 
566
        { "NT_STATUS_CURRENT_DOMAIN_NOT_ALLOWED", NT_STATUS_CURRENT_DOMAIN_NOT_ALLOWED },
 
567
        { "NT_STATUS_OBJECTID_NOT_FOUND", NT_STATUS_OBJECTID_NOT_FOUND },
537
568
        { "NT_STATUS_DOWNGRADE_DETECTED", NT_STATUS_DOWNGRADE_DETECTED },
538
 
        { "NT_STATUS_NO_MORE_ENTRIES", NT_STATUS_NO_MORE_ENTRIES },
 
569
        { "NT_STATUS_NO_S4U_PROT_SUPPORT", NT_STATUS_NO_S4U_PROT_SUPPORT },
 
570
        { "NT_STATUS_CROSSREALM_DELEGATION_FAILURE", NT_STATUS_CROSSREALM_DELEGATION_FAILURE },
 
571
        { "NT_STATUS_INVALID_LOCK_RANGE", NT_STATUS_INVALID_LOCK_RANGE },
 
572
        { "NT_STATUS_ERROR_DS_OBJ_STRING_NAME_EXISTS", NT_STATUS_ERROR_DS_OBJ_STRING_NAME_EXISTS },
 
573
        { "NT_STATUS_ERROR_DS_INCOMPATIBLE_VERSION", NT_STATUS_ERROR_DS_INCOMPATIBLE_VERSION },
539
574
        { "STATUS_MORE_ENTRIES", STATUS_MORE_ENTRIES },
540
575
        { "STATUS_SOME_UNMAPPED", STATUS_SOME_UNMAPPED },
541
 
        { "STATUS_NO_MORE_FILES", STATUS_NO_MORE_FILES },
542
 
        { "NT_STATUS_RPC_CANNOT_SUPPORT", NT_STATUS_RPC_CANNOT_SUPPORT },
543
 
        { "NT_STATUS_RPC_NT_CALL_FAILED", NT_STATUS_RPC_NT_CALL_FAILED },
544
 
        { "NT_STATUS_RPC_NT_PROTOCOL_ERROR", NT_STATUS_RPC_NT_PROTOCOL_ERROR },
545
 
        { "NT_STATUS_RPC_NT_PROCNUM_OUT_OF_RANGE", NT_STATUS_RPC_NT_PROCNUM_OUT_OF_RANGE },
546
 
        { "NT_STATUS_RPC_PROTSEQ_NOT_SUPPORTED", NT_STATUS_RPC_PROTSEQ_NOT_SUPPORTED },
 
576
        { "STATUS_NOTIFY_CLEANUP", STATUS_NOTIFY_CLEANUP },
 
577
        { "STATUS_NOTIFY_ENUM_DIR", STATUS_NOTIFY_ENUM_DIR },
 
578
 
547
579
        { NULL, NT_STATUS(0) }
548
580
};
549
581
 
550
582
/* These need sorting..... */
551
583
 
552
 
nt_err_code_struct nt_err_desc[] =
 
584
static const nt_err_code_struct nt_err_desc[] =
553
585
{
554
 
        { "Success",                            NT_STATUS_OK },
555
 
        { "Undetermined error",                 NT_STATUS_UNSUCCESSFUL },
556
 
        { "Access denied",                      NT_STATUS_ACCESS_DENIED },
557
 
        { "Account locked out",                 NT_STATUS_ACCOUNT_LOCKED_OUT },
558
 
        { "Must change password",               NT_STATUS_PASSWORD_MUST_CHANGE },
559
 
        { "Password is too short",              NT_STATUS_PWD_TOO_SHORT },
560
 
        { "Password is too recent",             NT_STATUS_PWD_TOO_RECENT },
561
 
        { "Password history conflict",          NT_STATUS_PWD_HISTORY_CONFLICT },
562
 
        { "No logon servers",                   NT_STATUS_NO_LOGON_SERVERS },
563
 
        { "Improperly formed account name",     NT_STATUS_INVALID_ACCOUNT_NAME },
564
 
        { "User exists",                        NT_STATUS_USER_EXISTS },
565
 
        { "No such user",                       NT_STATUS_NO_SUCH_USER },
566
 
        { "Group exists",                       NT_STATUS_GROUP_EXISTS },
567
 
        { "No such group",                      NT_STATUS_NO_SUCH_GROUP },
568
 
        { "Member not in group",                NT_STATUS_MEMBER_NOT_IN_GROUP },
569
 
        { "Wrong Password",                     NT_STATUS_WRONG_PASSWORD },
570
 
        { "Ill formed password",                NT_STATUS_ILL_FORMED_PASSWORD },
571
 
        { "Password restriction",               NT_STATUS_PASSWORD_RESTRICTION },
572
 
        { "Logon failure",                      NT_STATUS_LOGON_FAILURE },
573
 
        { "Account restriction",                NT_STATUS_ACCOUNT_RESTRICTION },
574
 
        { "Invalid logon hours",                NT_STATUS_INVALID_LOGON_HOURS },
575
 
        { "Invalid workstation",                NT_STATUS_INVALID_WORKSTATION },
576
 
        { "Password expired",                   NT_STATUS_PASSWORD_EXPIRED },
577
 
        { "Account disabled",                   NT_STATUS_ACCOUNT_DISABLED },
578
 
        { "Memory allocation error",            NT_STATUS_NO_MEMORY },
579
 
        { "No domain controllers located",      NT_STATUS_DOMAIN_CONTROLLER_NOT_FOUND },
580
 
        { "Named pipe not available",           NT_STATUS_PIPE_NOT_AVAILABLE },
581
 
        { "Not implemented",                    NT_STATUS_NOT_IMPLEMENTED },
582
 
        { "Invalid information class",          NT_STATUS_INVALID_INFO_CLASS },
583
 
        { "Information length mismatch",        NT_STATUS_INFO_LENGTH_MISMATCH },
584
 
        { "Access violation",                   NT_STATUS_ACCESS_VIOLATION },
585
 
        { "Invalid handle",                     NT_STATUS_INVALID_HANDLE },
586
 
        { "Invalid parameter",                  NT_STATUS_INVALID_PARAMETER },
587
 
        { "No memory",                          NT_STATUS_NO_MEMORY },
588
 
        { "Buffer too small",                   NT_STATUS_BUFFER_TOO_SMALL },
589
 
        { "Revision mismatch",                  NT_STATUS_REVISION_MISMATCH },
590
 
        { "No such logon session",              NT_STATUS_NO_SUCH_LOGON_SESSION },
591
 
        { "No such privilege",                  NT_STATUS_NO_SUCH_PRIVILEGE },
592
 
        { "Procedure not found",                NT_STATUS_PROCEDURE_NOT_FOUND },
593
 
        { "Server disabled",                    NT_STATUS_SERVER_DISABLED },
594
 
        { "Invalid pipe state",                 NT_STATUS_INVALID_PIPE_STATE },
595
 
        { "Named pipe busy",                    NT_STATUS_PIPE_BUSY },
596
 
        { "Illegal function",                   NT_STATUS_ILLEGAL_FUNCTION },
597
 
        { "Named pipe dicconnected",            NT_STATUS_PIPE_DISCONNECTED },
598
 
        { "Named pipe closing",                 NT_STATUS_PIPE_CLOSING },
599
 
        { "Remote host not listening",          NT_STATUS_REMOTE_NOT_LISTENING },
600
 
        { "Duplicate name on network",          NT_STATUS_DUPLICATE_NAME },
601
 
        { "Print queue is full",                NT_STATUS_PRINT_QUEUE_FULL },
602
 
        { "No print spool space available",     NT_STATUS_NO_SPOOL_SPACE },
603
 
        { "The network name cannot be found",   NT_STATUS_BAD_NETWORK_NAME },
604
 
        { "The connection was refused",         NT_STATUS_CONNECTION_REFUSED },
605
 
        { "Too many names",                     NT_STATUS_TOO_MANY_NAMES },
606
 
        { "Too many sessions",                  NT_STATUS_TOO_MANY_SESSIONS },
607
 
        { "Invalid server state",               NT_STATUS_INVALID_SERVER_STATE },
608
 
        { "Invalid domain state",               NT_STATUS_INVALID_DOMAIN_STATE },
609
 
        { "Invalid domain role",                NT_STATUS_INVALID_DOMAIN_ROLE },
610
 
        { "No such domain",                     NT_STATUS_NO_SUCH_DOMAIN },
611
 
        { "Domain exists",                      NT_STATUS_DOMAIN_EXISTS },
612
 
        { "Domain limit exceeded",              NT_STATUS_DOMAIN_LIMIT_EXCEEDED },
613
 
        { "Bad logon session state",            NT_STATUS_BAD_LOGON_SESSION_STATE },
614
 
        { "Logon session collision",            NT_STATUS_LOGON_SESSION_COLLISION },
615
 
        { "Invalid logon type",                 NT_STATUS_INVALID_LOGON_TYPE },
616
 
        { "Cancelled",                          NT_STATUS_CANCELLED },
617
 
        { "Invalid computer name",              NT_STATUS_INVALID_COMPUTER_NAME },      
618
 
        { "Logon server conflict",              NT_STATUS_LOGON_SERVER_CONFLICT },
619
 
        { "Time difference at domain controller", NT_STATUS_TIME_DIFFERENCE_AT_DC },
620
 
        { "Pipe broken",                        NT_STATUS_PIPE_BROKEN },
621
 
        { "Registry corrupt",                   NT_STATUS_REGISTRY_CORRUPT },
622
 
        { "Too many secrets",                   NT_STATUS_TOO_MANY_SECRETS },
623
 
        { "Too many SIDs",                      NT_STATUS_TOO_MANY_SIDS },
624
 
        { "Lanmanager cross encryption required", NT_STATUS_LM_CROSS_ENCRYPTION_REQUIRED },
625
 
        { "Log file full",                      NT_STATUS_LOG_FILE_FULL },
626
 
        { "No trusted LSA secret",              NT_STATUS_NO_TRUST_LSA_SECRET },
627
 
        { "No trusted SAM account",             NT_STATUS_NO_TRUST_SAM_ACCOUNT },
628
 
        { "Trusted domain failure",             NT_STATUS_TRUSTED_DOMAIN_FAILURE },
629
 
        { "Trust relationship failure",         NT_STATUS_TRUSTED_RELATIONSHIP_FAILURE },
630
 
        { "Trust failure",                      NT_STATUS_TRUST_FAILURE },
631
 
        { "Netlogon service not started",       NT_STATUS_NETLOGON_NOT_STARTED },
632
 
        { "Account expired",                    NT_STATUS_ACCOUNT_EXPIRED },
633
 
        { "Network credential conflict",        NT_STATUS_NETWORK_CREDENTIAL_CONFLICT },
634
 
        { "Remote session limit",               NT_STATUS_REMOTE_SESSION_LIMIT },
635
 
        { "No logon interdomain trust account", NT_STATUS_NOLOGON_INTERDOMAIN_TRUST_ACCOUNT },
636
 
        { "No logon workstation trust account", NT_STATUS_NOLOGON_WORKSTATION_TRUST_ACCOUNT },
637
 
        { "No logon server trust account",      NT_STATUS_NOLOGON_SERVER_TRUST_ACCOUNT },
638
 
        { "Domain trust inconsistent",          NT_STATUS_DOMAIN_TRUST_INCONSISTENT },
639
 
        { "No user session key available",      NT_STATUS_NO_USER_SESSION_KEY },
640
 
        { "User session deleted",               NT_STATUS_USER_SESSION_DELETED },
641
 
        { "Insufficient server resources",      NT_STATUS_INSUFF_SERVER_RESOURCES },
642
 
        { "Insufficient logon information",     NT_STATUS_INSUFFICIENT_LOGON_INFO },
643
 
        
644
 
        { "License quota exceeded",             NT_STATUS_LICENSE_QUOTA_EXCEEDED },
645
 
        { "No more files",                      STATUS_NO_MORE_FILES },
 
586
        { N_("Success"),                                NT_STATUS_OK },
 
587
        { N_("Undetermined error"),             NT_STATUS_UNSUCCESSFUL },
 
588
        { N_("Access denied"),                  NT_STATUS_ACCESS_DENIED },
 
589
        { N_("Account locked out"),             NT_STATUS_ACCOUNT_LOCKED_OUT },
 
590
        { N_("Must change password"),           NT_STATUS_PASSWORD_MUST_CHANGE },
 
591
        { N_("Password is too short"),          NT_STATUS_PWD_TOO_SHORT },
 
592
        { N_("Password is too recent"),                 NT_STATUS_PWD_TOO_RECENT },
 
593
        { N_("Password history conflict"),              NT_STATUS_PWD_HISTORY_CONFLICT },
 
594
        { N_("No logon servers"),                       NT_STATUS_NO_LOGON_SERVERS },
 
595
        { N_("Improperly formed account name"),         NT_STATUS_INVALID_ACCOUNT_NAME },
 
596
        { N_("User exists"),                    NT_STATUS_USER_EXISTS },
 
597
        { N_("No such user"),                   NT_STATUS_NO_SUCH_USER },
 
598
        { N_("Group exists"),                   NT_STATUS_GROUP_EXISTS },
 
599
        { N_("No such group"),                  NT_STATUS_NO_SUCH_GROUP },
 
600
        { N_("Member not in group"),            NT_STATUS_MEMBER_NOT_IN_GROUP },
 
601
        { N_("Wrong Password"),                         NT_STATUS_WRONG_PASSWORD },
 
602
        { N_("Ill formed password"),            NT_STATUS_ILL_FORMED_PASSWORD },
 
603
        { N_("Password restriction"),           NT_STATUS_PASSWORD_RESTRICTION },
 
604
        { N_("Logon failure"),                  NT_STATUS_LOGON_FAILURE },
 
605
        { N_("Account restriction"),            NT_STATUS_ACCOUNT_RESTRICTION },
 
606
        { N_("Invalid logon hours"),            NT_STATUS_INVALID_LOGON_HOURS },
 
607
        { N_("Invalid workstation"),            NT_STATUS_INVALID_WORKSTATION },
 
608
        { N_("Password expired"),                       NT_STATUS_PASSWORD_EXPIRED },
 
609
        { N_("Account disabled"),                       NT_STATUS_ACCOUNT_DISABLED },
 
610
        { N_("Unexpected information received"),        NT_STATUS_INVALID_PARAMETER },
 
611
        { N_("Memory allocation error"),                NT_STATUS_NO_MEMORY },
 
612
        { N_("No domain controllers located"),  NT_STATUS_DOMAIN_CONTROLLER_NOT_FOUND },
 
613
        { N_("Account locked out"),             NT_STATUS_ACCOUNT_LOCKED_OUT },
 
614
        { N_("Named pipe not available"),               NT_STATUS_PIPE_NOT_AVAILABLE },
 
615
        { N_("Not implemented"),                        NT_STATUS_NOT_IMPLEMENTED },
 
616
        { N_("Invalid information class"),              NT_STATUS_INVALID_INFO_CLASS },
 
617
        { N_("Information length mismatch"),    NT_STATUS_INFO_LENGTH_MISMATCH },
 
618
        { N_("Access violation"),                       NT_STATUS_ACCESS_VIOLATION },
 
619
        { N_("Invalid handle"),                         NT_STATUS_INVALID_HANDLE },
 
620
        { N_("Invalid parameter"),                      NT_STATUS_INVALID_PARAMETER },
 
621
        { N_("No memory"),                              NT_STATUS_NO_MEMORY },
 
622
        { N_("Buffer too small"),                       NT_STATUS_BUFFER_TOO_SMALL },
 
623
        { N_("Revision mismatch"),                      NT_STATUS_REVISION_MISMATCH },
 
624
        { N_("No logon servers"),                       NT_STATUS_NO_LOGON_SERVERS },
 
625
        { N_("No such logon session"),          NT_STATUS_NO_SUCH_LOGON_SESSION },
 
626
        { N_("No such privilege"),                      NT_STATUS_NO_SUCH_PRIVILEGE },
 
627
        { N_("Procedure not found"),            NT_STATUS_PROCEDURE_NOT_FOUND },
 
628
        { N_("Server disabled"),                        NT_STATUS_SERVER_DISABLED },
 
629
        { N_("Invalid pipe state"),             NT_STATUS_INVALID_PIPE_STATE },
 
630
        { N_("Named pipe busy"),                        NT_STATUS_PIPE_BUSY },
 
631
        { N_("Illegal function"),                       NT_STATUS_ILLEGAL_FUNCTION },
 
632
        { N_("Named pipe disconnected"),                NT_STATUS_PIPE_DISCONNECTED },
 
633
        { N_("Named pipe closing"),             NT_STATUS_PIPE_CLOSING },
 
634
        { N_("Remote host not listening"),              NT_STATUS_REMOTE_NOT_LISTENING },
 
635
        { N_("Duplicate name on network"),              NT_STATUS_DUPLICATE_NAME },
 
636
        { N_("Print queue is full"),            NT_STATUS_PRINT_QUEUE_FULL },
 
637
        { N_("No print spool space available"),         NT_STATUS_NO_SPOOL_SPACE },
 
638
        { N_("The network name cannot be found"),   NT_STATUS_BAD_NETWORK_NAME },
 
639
        { N_("The connection was refused"),         NT_STATUS_CONNECTION_REFUSED },
 
640
        { N_("Too many names"),                         NT_STATUS_TOO_MANY_NAMES },
 
641
        { N_("Too many sessions"),                      NT_STATUS_TOO_MANY_SESSIONS },
 
642
        { N_("Invalid server state"),           NT_STATUS_INVALID_SERVER_STATE },
 
643
        { N_("Invalid domain state"),           NT_STATUS_INVALID_DOMAIN_STATE },
 
644
        { N_("Invalid domain role"),            NT_STATUS_INVALID_DOMAIN_ROLE },
 
645
        { N_("No such domain"),                         NT_STATUS_NO_SUCH_DOMAIN },
 
646
        { N_("Domain exists"),                  NT_STATUS_DOMAIN_EXISTS },
 
647
        { N_("Domain limit exceeded"),          NT_STATUS_DOMAIN_LIMIT_EXCEEDED },
 
648
        { N_("Bad logon session state"),                NT_STATUS_BAD_LOGON_SESSION_STATE },
 
649
        { N_("Logon session collision"),                NT_STATUS_LOGON_SESSION_COLLISION },
 
650
        { N_("Invalid logon type"),             NT_STATUS_INVALID_LOGON_TYPE },
 
651
        { N_("Cancelled"),                              NT_STATUS_CANCELLED },
 
652
        { N_("Invalid computer name"),          NT_STATUS_INVALID_COMPUTER_NAME },
 
653
        { N_("Logon server conflict"),          NT_STATUS_LOGON_SERVER_CONFLICT },
 
654
        { N_("Time difference at domain controller"), NT_STATUS_TIME_DIFFERENCE_AT_DC },
 
655
        { N_("Pipe broken"),                    NT_STATUS_PIPE_BROKEN },
 
656
        { N_("Registry corrupt"),                       NT_STATUS_REGISTRY_CORRUPT },
 
657
        { N_("Too many secrets"),                       NT_STATUS_TOO_MANY_SECRETS },
 
658
        { N_("Too many SIDs"),                  NT_STATUS_TOO_MANY_SIDS },
 
659
        { N_("Lanmanager cross encryption required"), NT_STATUS_LM_CROSS_ENCRYPTION_REQUIRED },
 
660
        { N_("Log file full"),                  NT_STATUS_LOG_FILE_FULL },
 
661
        { N_("No trusted LSA secret"),          NT_STATUS_NO_TRUST_LSA_SECRET },
 
662
        { N_("No trusted SAM account"),                 NT_STATUS_NO_TRUST_SAM_ACCOUNT },
 
663
        { N_("Trusted domain failure"),                 NT_STATUS_TRUSTED_DOMAIN_FAILURE },
 
664
        { N_("Trust relationship failure"),     NT_STATUS_TRUSTED_RELATIONSHIP_FAILURE },
 
665
        { N_("Trust failure"),                  NT_STATUS_TRUST_FAILURE },
 
666
        { N_("Netlogon service not started"),   NT_STATUS_NETLOGON_NOT_STARTED },
 
667
        { N_("Account expired"),                        NT_STATUS_ACCOUNT_EXPIRED },
 
668
        { N_("Network credential conflict"),    NT_STATUS_NETWORK_CREDENTIAL_CONFLICT },
 
669
        { N_("Remote session limit"),           NT_STATUS_REMOTE_SESSION_LIMIT },
 
670
        { N_("No logon interdomain trust account"), NT_STATUS_NOLOGON_INTERDOMAIN_TRUST_ACCOUNT },
 
671
        { N_("No logon workstation trust account"), NT_STATUS_NOLOGON_WORKSTATION_TRUST_ACCOUNT },
 
672
        { N_("No logon server trust account"),  NT_STATUS_NOLOGON_SERVER_TRUST_ACCOUNT },
 
673
        { N_("Domain trust inconsistent"),              NT_STATUS_DOMAIN_TRUST_INCONSISTENT },
 
674
        { N_("No user session key available"),  NT_STATUS_NO_USER_SESSION_KEY },
 
675
        { N_("User session deleted"),           NT_STATUS_USER_SESSION_DELETED },
 
676
        { N_("Insufficient server resources"),  NT_STATUS_INSUFF_SERVER_RESOURCES },
 
677
        { N_("Insufficient logon information"),         NT_STATUS_INSUFFICIENT_LOGON_INFO },
 
678
 
 
679
        { N_("License quota exceeded"),                 NT_STATUS_LICENSE_QUOTA_EXCEEDED },
 
680
        { N_("No more files"),                  STATUS_NO_MORE_FILES },
646
681
 
647
682
        { NULL, NT_STATUS(0) }
648
683
};
653
688
 
654
689
const char *nt_errstr(NTSTATUS nt_code)
655
690
{
656
 
        int idx = 0;
 
691
        int idx = 0;
657
692
        char *result;
658
693
 
659
694
#ifdef HAVE_LDAP
660
 
        if (NT_STATUS_IS_LDAP(nt_code)) {
661
 
                return ldap_err2string(NT_STATUS_LDAP_CODE(nt_code));
 
695
        if (NT_STATUS_IS_LDAP(nt_code)) {
 
696
                return ldap_err2string(NT_STATUS_LDAP_CODE(nt_code));
662
697
        }
663
698
#endif
664
699
 
668
703
        }
669
704
 
670
705
        while (nt_errs[idx].nt_errstr != NULL) {
671
 
                if (NT_STATUS_EQUAL(nt_errs[idx].nt_errcode, nt_code)) {
672
 
                        return nt_errs[idx].nt_errstr;
 
706
                if (NT_STATUS_V(nt_errs[idx].nt_errcode) ==
 
707
                    NT_STATUS_V(nt_code)) {
 
708
                        return nt_errs[idx].nt_errstr;
673
709
                }
674
710
                idx++;
675
711
        }
683
719
/************************************************************************
684
720
 Print friendler version fo NT error code
685
721
 ***********************************************************************/
686
 
 
 
722
 
687
723
const char *get_friendly_nt_error_msg(NTSTATUS nt_code)
688
724
{
689
 
        int idx = 0;
 
725
        int idx = 0;
690
726
 
691
727
        while (nt_err_desc[idx].nt_errstr != NULL) {
692
728
                if (NT_STATUS_V(nt_err_desc[idx].nt_errcode) == NT_STATUS_V(nt_code)) {
693
 
                        return nt_err_desc[idx].nt_errstr;
 
729
                        return nt_err_desc[idx].nt_errstr;
694
730
                }
695
731
                idx++;
696
732
        }
697
 
        
 
733
 
698
734
        /* fall back to NT_STATUS_XXX string */
699
 
        
 
735
 
700
736
        return nt_errstr(nt_code);
701
737
}
702
738
 
707
743
const char *get_nt_error_c_code(NTSTATUS nt_code)
708
744
{
709
745
        char *result;
710
 
        int idx = 0;
 
746
        int idx = 0;
711
747
 
712
748
        while (nt_errs[idx].nt_errstr != NULL) {
713
 
                if (NT_STATUS_V(nt_errs[idx].nt_errcode) == 
714
 
                    NT_STATUS_V(nt_code)) {
715
 
                        return nt_errs[idx].nt_errstr;
 
749
                if (NT_STATUS_V(nt_errs[idx].nt_errcode) ==
 
750
                    NT_STATUS_V(nt_code)) {
 
751
                        return nt_errs[idx].nt_errstr;
716
752
                }
717
753
                idx++;
718
754
        }
729
765
 
730
766
NTSTATUS nt_status_string_to_code(const char *nt_status_str)
731
767
{
732
 
        int idx = 0;
 
768
        int idx = 0;
733
769
 
734
770
        while (nt_errs[idx].nt_errstr != NULL) {
735
 
                if (strcmp(nt_errs[idx].nt_errstr, nt_status_str) == 0) {
736
 
                        return nt_errs[idx].nt_errcode;
 
771
                if (strcasecmp(nt_errs[idx].nt_errstr, nt_status_str) == 0) {
 
772
                        return nt_errs[idx].nt_errcode;
737
773
                }
738
774
                idx++;
739
775
        }
743
779
/**
744
780
 * Squash an NT_STATUS in line with security requirements.
745
781
 * In an attempt to avoid giving the whole game away when users
746
 
 * are authenticating, NT replaces both NT_STATUS_NO_SUCH_USER and 
747
 
 * NT_STATUS_WRONG_PASSWORD with NT_STATUS_LOGON_FAILURE in certain situations 
 
782
 * are authenticating, NT replaces both NT_STATUS_NO_SUCH_USER and
 
783
 * NT_STATUS_WRONG_PASSWORD with NT_STATUS_LOGON_FAILURE in certain situations
748
784
 * (session setups in particular).
749
785
 *
750
786
 * @param nt_status NTSTATUS input for squashing.
754
790
NTSTATUS nt_status_squash(NTSTATUS nt_status)
755
791
{
756
792
        if NT_STATUS_IS_OK(nt_status) {
757
 
                return nt_status;               
 
793
                return nt_status;
758
794
        } else if NT_STATUS_EQUAL(nt_status, NT_STATUS_NO_SUCH_USER) {
759
795
                /* Match WinXP and don't give the game away */
760
796
                return NT_STATUS_LOGON_FAILURE;
761
 
                
 
797
 
762
798
        } else if NT_STATUS_EQUAL(nt_status, NT_STATUS_WRONG_PASSWORD) {
763
799
                /* Match WinXP and don't give the game away */
764
800
                return NT_STATUS_LOGON_FAILURE;
765
801
        } else {
766
802
                return nt_status;
767
 
        }  
 
803
        }
768
804
}