// =========================================================================== // UAMNetwork.h © 1998-2001 Microsoft Corp. All rights reserved. // =========================================================================== #ifdef UAM_TARGET_CARBON #include "ClientUAM.h" #endif #include "UAMEncrypt.h" #define afpChangePwd 36 #define kDDPPacketLength 576 //The size of one packet #define kAFPIconSize 128 //Black & white icons are 128 bytes // //Pascal style strings used to determine supported UAMs. // #define PSTR_NT_MACHINE_TYPE "\pWindows NT" #define PSTR_AFPVersion30 "\pAFP3.0" #define PSTR_AFPVersion22 "\pAFP2.2" #define PSTR_AFPVersion20 "\pAFPVersion 2.0" #define PSTR_AFPVersion21 "\pAFPVersion 2.1" #define PSTR_AFPVersionOfChoice "\pAFPVersion 2.1" #define PSTR_ClearTextLogin "\pCleartxt Passwrd" #define PSTR_GuestLogin "\pNo User Authent" #define PSTR_EncryptedLogin1_0 "\pMicrosoft V1.0" #define PSTR_EncryptedLogin2_0 "\pMS2.0" #define PSTR_EncryptedLogin3_0 "\pMS3.0" // //NOTE: We say we support AFP version than we do so we //can leave a little room for AFP 3.0 in the future. // #define MAXNUM_AFP_VERSIONS_SUPPORTED 4 // //NT4 supported AFPVersion 2.0 and 2.1 // #define MINNUM_AFP_VERSIONS_SUPPORTED 2 // //Mac's time is based from January 1, 1904 while a server's is based on the //year 2000. Below is the difference between the two for conversion and a //macro to make life easier. // #define NUM_SECS_FROM_1904_TO_2000 3029529600 #define LOCAL_TIME(serverTime) (NUM_SECS_FROM_1904_TO_2000 + serverTime) typedef unsigned char PassWord[8]; //FPGetSrvrInfo() server flags bit values typedef enum { kSupportsCopyFile = 0x1, kSupportsChngPswd = 0x2, //kDontAllowSavePwd = 0x4, kSupportsSrvrMsgs = 0x8, kSupportsSrvrSig = 0x10, kSupportsTCPIP = 0x20, kSupportsSrvrNotification = 0x40 }ServerStatusReplyFlags; enum { kFPLogin = 18, kFPLoginCont = 19 }; // //The reply block returned when using MSUAM. // typedef struct _MSUAMLoginReplyBlock { char serverChallenge[kServerChallengeMaxLen]; char serverExtCharMapTable[kServerChallengeExtCharMapTableSize]; }MSUAMLoginReplyBlock; // //This is the structure the MS UAM uses for the FPLogin command. // typedef struct { Byte command; char pad; char UAMInfo[sizeof(LM_RESPONSE)]; }UAMLogin, *PUAMLogin; typedef struct { Byte command; char pad; char UAMInfo[sizeof(MSV1_0_LMV2_RESPONSE)]; }UAMLogin2, *PUAMLogin2; // //The following defines and types are used for change password when doing //Microsoft AFP Authentication v3.0. // #define SFM_CHANGE_PASSWORD_SIGNATURE "ChP" #define SFM_CHANGE_PASSWORD_VERSION 1 typedef struct { unsigned char Signature[sizeof(SFM_CHANGE_PASSWORD_SIGNATURE)]; UInt32 cbMessage; UInt32 Version; SAMPR_ENCRYPTED_USER_PASSWORD NewPasswordEncryptedWithOldNt; ENCRYPTED_NT_OWF_PASSWORD OldNtOwfPasswordEncryptedWithNewNt; }SFM_PASSWORD_CHANGE_MESSAGE, *PSFM_PASSWORD_CHANGE_MESSAGE; typedef struct { unsigned char Signature[sizeof(SFM_CHANGE_PASSWORD_SIGNATURE)]; UInt32 cbMessage; UInt32 Version; unsigned char NewPasswordEncryptedWithOldNt[sizeof(SAMPR_ENCRYPTED_USER_PASSWORD)/2]; ENCRYPTED_NT_OWF_PASSWORD OldNtOwfPasswordEncryptedWithNewNt; }SFM_PASSWORD_CHANGE_MESSAGE_SHORT, *PSFM_PASSWORD_CHANGE_MESSAGE_SHORT; // //Prototypes for UAMNetwork live here. // Boolean UAM_MapCharactersIntoHostSet(char *szTarg, char *mappingTbl); #define StringPush_(s, p) do { \ UAM_PStrCopy(s, (StringPtr)p); \ p += s[0] + 1; \ }while(false) #define DataPush_(d, s, p) do { \ memcpy(p, d, s); \ p += s; \ }while(false) OSStatus UAM_UAMLogin(UAMArgs *inUAMArgs); OSStatus UAM_CloseSession(UAMArgs *inUAMArgs); OSStatus UAM_OpenSession( UAMArgs *inUAMArgs, UAMMessage *inMessage, unsigned char *inCmdBuffer, UInt32 inCmdBufferSize, unsigned char *inReplyBuffer, UInt32 inReplyBufferSize ); OSStatus UAM_LoginGuest(UAMArgs *inUAMArgs); OSStatus UAM_LoginMSUAM(UAMArgs *inUAMArgs); void UAM_PascalStringToCString( const Str255 inPascal, BOOL inUpcase, char* outCStyle, Size inCBufferSize ); OSStatus UAM_LoginContinueMS20( UAMArgs* inUAMArgs, char* inUserName, char* inDomainName, char* inWorkstationName ); OSStatus UAM_SendAFPRequestToServer( UAMArgs* inUAMArgs, unsigned char* inChallengeResponseBuffer, SInt16 inChallengeResponseBufferSize, UInt8* ioReplyBuffer, SInt16 inReplyBufferSize ); OSStatus UAM_LoginContinueMS10( UAMArgs* inUAMArgs ); OSStatus UAM_ChangePasswordForMS10( UAMArgs* inUAMArgs, const StringPtr inNewPwd ); OSStatus UAM_ChangePasswordForMS20( UAMArgs* inUAMArgs, const StringPtr inNewPwd ); OSStatus UAM_ChangePasswordForMS30( UAMArgs* inUAMArgs, const StringPtr inNewPwd );