home *** CD-ROM | disk | FTP | other *** search
Text File | 1997-01-31 | 5.6 KB | 225 lines | [TEXT/CWIE] |
- { }
- { Created: Sunday, December 9, 1991 at 9:55 PM }
- { Modified: Saturday, January 18, 1992 at 9:44 PM }
- { UGLibrary.p }
- { Pascal Interface to UGLibrary.o }
- { The library to manipulate the Users & Groups Data File }
- { }
- { Copyright Apple Computer, Inc. 1991 }
- { All rights reserved }
- { }
-
- unit UGLibrary;
-
- interface
-
- uses
- OSUtils;
-
- {$PUSH}
- {$ALIGN MAC68K}
-
- const
- { error codes for the UGLibrary }
- ugUserAlreadyExists = 1;
- ugGroupAlreadyExists = 2;
- ugULInfoRecNotCreated = 3;
- ugNoMoreUGs = 4;
- ugUserNotFound = 5;
- ugGroupNotFound = 6;
- ugNotAUser = 7;
- ugNotAGroup = 8;
- ugTooManyGroups = 9;
- ugNotaMember = 10;
- ugNoMoreUsers = 11;
- ugNoMoreGroups = 12;
- ugBadParamErr = 13;
- ugUserAlreadyAMember = 14;
- ugAPrmryGroupExists = 15;
- ugServerRunning = 16;
- ugAdminRunning = 17;
- ugNotBtree = 18;
- ugBadKey = 19;
- ugDskFull = 20;
- ugBadUID = 21;
- ugInvalidPasswd = 22;
- ugEOF = 23;
- ugBOF = 24;
- ugDefNameErr = 98;
- ugFatalError = 99;
-
- { ugUserFlags for UGNewUser, UGGetUserInfo, and UGSetUserInfo }
- IACEnabled = $0001;
- LoginEnabled = $0100;
- SuperUser = $0200;
- NoChangePwd = $0400;
- GetNewPwd = $1000;
-
- { ugSrvrFlags[0] for UGGetULInfo and UGSetULInfo }
- Apple2 = 1;
- NoGuests = 2;
- IACGuestEnabled = 16;
- IACGlobalEnabled = 32;
-
- { ugSrvrFlags[1] for UGGetULInfo and UGSetULInfo }
- DontSavePwd = 1;
-
- { ugChngFlags codes for UGSetUserInfo }
- ChngUserFlags = 1;
- ChngUserPasswd = 2;
- ChngUAll = 3;
-
- { ugChngFlags codes for UGSetULInfo }
- ChngSrvrFlags = 1;
- ChngAdmnKey = 2;
- ChngMinPwdLen = 4;
- ChngMaxBadLogins = 8;
- ChngPwdExpDate = 16;
- ChngULAll = 31;
-
- { server version as returned by UGGetULInfo }
- Sys7SrvrVer = 3;
- AS3SrvrVer = 4;
-
- type
- Str199 = string[199];
- Str8 = string[8];
-
- { These are the Param Blocks for the interface calls: }
-
- { Use UGFilePB for UGOpenFile, UGCloseFile and UGCreateFile }
- UGFilePB = record
- qLink: QElemPtr;
- qType: INTEGER;
- ugTrap: INTEGER;
- ugCmdAddr: Ptr;
- ugCompletion: ProcPtr;
- ugResult: OSErr;
- ugNamePtr: StringPtr;
- ugVRefNum: INTEGER;
- ugRefNum: INTEGER;
- ugDirID: LONGINT;
- ugAccessID: LONGINT;
- ugUserID: LONGINT;
- ugGroupID: LONGINT;
- ugAdminKey: StringPtr;
- end;
-
- { Use UGUserPB for UGNewUser, UGDeleteUser, UGRenameUser, UGGetUserInfo, }
- { UGSetUserInfo, and UGAuthenticateUser }
- UGUserPB = record
- qLink: QElemPtr;
- qType: INTEGER;
- ugTrap: INTEGER;
- ugCmdAddr: Ptr;
- ugCompletion: ProcPtr;
- ugResult: OSErr;
- ugNamePtr: StringPtr;
- ugVRefNum: INTEGER;
- ugRefNum: INTEGER;
- ugDirID: LONGINT;
- ugAccessID: LONGINT;
- ugUserID: LONGINT;
- ugGroupID: LONGINT;
- ugPosOffset: INTEGER;
- ugMisc: StringPtr;
- ugChngFlags: INTEGER;
- ugPassword: StringPtr;
- ugUserFlags: LONGINT;
- ugNumBadLogins: INTEGER;
- ugPwdDate: LONGINT;
- ugNumGroups: INTEGER;
- ugGroups: array[0..41] of LONGINT;
- end;
-
- { Use UGGroupPB for UGNewGroup, UGDeleteGroup, UGRenameGroup, UGGetGroupInfo, }
- { UGAssignUserToGroup, and UGDeleteUserFromGroup }
- UGGroupPB = record
- qLink: QElemPtr;
- qType: INTEGER;
- ugTrap: INTEGER;
- ugCmdAddr: Ptr;
- ugCompletion: ProcPtr;
- ugResult: OSErr;
- ugNamePtr: StringPtr;
- ugVRefNum: INTEGER;
- ugRefNum: INTEGER;
- ugDirID: LONGINT;
- ugAccessID: LONGINT;
- ugUserID: LONGINT;
- ugGroupID: LONGINT;
- ugPosOffset: INTEGER;
- ugMisc: StringPtr;
- ugPrimaryFlag: Boolean;
- end;
-
- { Use UGServerPB for UGGetULInfo and UGSetULInfo }
- UGServerPB = record
- qLink: QElemPtr;
- qType: INTEGER;
- ugTrap: INTEGER;
- ugCmdAddr: Ptr;
- ugCompletion: ProcPtr;
- ugResult: OSErr;
- ugNamePtr: StringPtr;
- ugVRefNum: INTEGER;
- ugRefNum: INTEGER;
- ugDirID: LONGINT;
- ugAccessID: LONGINT;
- ugUserID: LONGINT;
- ugGroupID: LONGINT;
- ugAdminKey: StringPtr;
- ugSrvrVersion: INTEGER;
- ugChngFlags: INTEGER;
- ugSrvrFlags: array[0..1] of LONGINT;
- ugMinPwdLen: SignedByte;
- filler1: SignedByte;
- ugMaxBadLogins: INTEGER;
- ugPwdExpDate: LONGINT;
- end;
-
- UserGroupPBPtr = ^UGParamBlockRec;
- UGParamBlockRec = record
- case Integer of
- 0: (
- ugFileParam: UGFilePB
- );
- 1: (
- ugUserParam: UGUserPB
- );
- 2: (
- ugGroupParam: UGGroupPB
- );
- 3: (
- ugServerParam: UGServerPB
- );
- end;
-
- { Declaration of functions }
-
- function UGOpenFile (thePB: UserGroupPBPtr; async: BOOLEAN): OSErr;
- function UGCloseFile (thePB: UserGroupPBPtr; async: BOOLEAN): OSErr;
- function UGCreateFile (thePB: UserGroupPBPtr; async: BOOLEAN): OSErr;
-
- function UGNewUser (thePB: UserGroupPBPtr; async: BOOLEAN): OSErr;
- function UGDeleteUser (thePB: UserGroupPBPtr; async: BOOLEAN): OSErr;
- function UGRenameUser (thePB: UserGroupPBPtr; async: BOOLEAN): OSErr;
- function UGGetUserInfo (thePB: UserGroupPBPtr; async: BOOLEAN): OSErr;
- function UGSetUserInfo (thePB: UserGroupPBPtr; async: BOOLEAN): OSErr;
- function UGAuthenticateUser (thePB: UserGroupPBPtr; async: BOOLEAN): OSErr;
-
- function UGNewGroup (thePB: UserGroupPBPtr; async: BOOLEAN): OSErr;
- function UGDeleteGroup (thePB: UserGroupPBPtr; async: BOOLEAN): OSErr;
- function UGRenameGroup (thePB: UserGroupPBPtr; async: BOOLEAN): OSErr;
- function UGGetGroupInfo (thePB: UserGroupPBPtr; async: BOOLEAN): OSErr;
-
- function UGAssignUserToGroup (thePB: UserGroupPBPtr; async: BOOLEAN): OSErr;
- function UGDeleteUserFromGroup (thePB: UserGroupPBPtr; async: BOOLEAN): OSErr;
-
- function UGGetULInfo (thePB: UserGroupPBPtr; async: BOOLEAN): OSErr;
- function UGSetULInfo (thePB: UserGroupPBPtr; async: BOOLEAN): OSErr;
-
- {$ALIGN RESET}
- {$POP}
-
- end.