Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

0 lines
27 KiB

  1. // =========================================================================== // UAMMain.cp � 1997-2001 Microsoft Corp. All rights reserved. // =========================================================================== // Main unit for Microsoft User Authentication Method. // // Notes: // -------------------------------------------------------------------------- // // Version History: // =========================================================================== // Version 5.0.8: // 04.26.01 MJC - Code cleanup. Combined UAMNetwork and UAMDSNetwork into // one file (UAMNetwork.c & UAMNetwork.h) // - UAM_ChangePasswordV2(): Now check for zero length old // and new passwords before upper casing. // - Now use common LM hash code for login and changepassword v2. // - Zero password buffers when done with them (security fix). // - Now clear password field when login error occurs. // 05.01.01 - Fixed bug where over-long user names could be pasted // into username field. // - Can now tab out of user name field when name is max length. // - Now clear password when failure occurs in UAM_LoginMSUAM(). // 07.02.01 - Fixed bug where password was being cleared in UAM_LoginContinue() // before I saved it to the keychain. // 10.18.01 - Completed MacOS X v1.0 UAM. // - Support added for NTLMv2 auth and change password. // Version 1.0.1: // 01.21.02 - Fix: Keychain passwords couldn't exceed 8 bytes. // - Fix: Close session after attempted login w/bad password. // - Fix: Now conform to Apple's Aqua UI guidelines. // - Now check buffer length for all string copies. // Version 1.0.2: // 02.18.02 - User can now choose to allow only strong authentication. // - Added preference file support for above change. // - Finally moved OSX builds to CodeWarrior! // 03.01.02 - Many changes for security push // // Version 1.0.3: // 05.31.02 - Fixed bug where we weren't dealing with all the new // AFP URL type (eg. afp://username:password@server/share). // =========================================================================== #include "UAMMain.h" #include "UAMDebug.h" #include "UAMUtils.h" #include "UAMDialogs.h" #include "UAMNetwork.h" #include "UAMDLOGUtils.h" #include "UAMKeychain.h" #include "UAMPswdField.h" #include "UAMPrefs.h" // //Global variables are declared here // Str32 gServerName; Str64 gUserName; Boolean gContextInited; Boolean gGuestLogon; Boolean gSupportsChngPwd; DialogPtr gDialog; Str32 gAFPVersion; long gSupportedUAMs; ModalFilterUPP gPwdDialogFilter; UserItemUPP gLineItem; Str32 gUAMVersionString; Str32 gZoneName; UInt32 gExpirationTime = 0; struct sockaddr* gServerAddress = NULL; EventCallbackPtr gEventCallbackUPP = NULL; Boolean gTriedKeychain = false; extern UAM_PREFERENCES gUAMPreferences; #pragma export on // --------------------------------------------------------------------------- // � main() // --------------------------------------------------------------------------- // This is the main entry point for our UAM. This function is passed a // pointer to a UAMArgs struct. This struct contains the function selector, // call-backs, and many other things we need to do our stuff. EXTERN_API( OSStatus ) UAMMain(UAMArgs *inUAMArgs) { OSStatus theResult = noErr; switch(inUAMArgs->command) { case kUAMOpen: theResult = MS_UAMOpen(inUAMArgs); break; case kUAMClose: MS_UAMClose(); break; case kUAMPWDlog: theResult = MS_UAMPwdDialog(inUAMArgs); break; case kUAMLogin: theResult = UAM_UAMLogin(inUAMArgs); break; case kUAMVSDlog: break; case kUAMChgPass: case kUAMChgPassDlg: DbgPrint_((DBGBUFF, "Change password dialog must be implemented")); theResult = kNotForUs; break;