17000 !*********************************************************************& ! & ! FNFILE.B2S - Detects file writes to other accounts by a & ! Non Privileged user & ! & !*********************************************************************& ! & ! FNFILE% (FILE$) & ! & ! FNFILE$ detects if a non-privileged user is attempting to & ! open a file for output in an account other than his own. & ! It returns a value of -1% (TRUE%) if the user is privileged, & ! or is opening the file in his own account. It displays & ! a message if the file spec is syntactically incorrect, or & ! if user is non privileged and attempts to specify a file & ! other than in his own account. & ! & ! Input: & ! & ! FILE$ File spec to be examined & ! M11.USER.PRIV% Flags if user is privileged & ! M11.USER.ACCT$ Contains users account & ! & ! Output: & ! & ! FNFILE% Flags if file spec is ok & ! & ! Local: & ! & ! ACCOUNT.SPECIFIED% Flags presence of [n,n] in file spec & ! USER.ACCOUNT$ Users' account & ! FILE.ACCOUNT$ Account as specified in file spec & ! JUNK% Used for "POS" Statements & ! JUNK.2% " " & ! JUNK.3% " " & ! & !*********************************************************************& 17010 DEF FNFILE% (FILE$) & \ FNFILE% = TRUE% & \ ACCOUNT.SPECIFIED% = POS (FILE$, "[", 1%) & \ GO TO 17090 IF ACCOUNT.SPECIFIED% = 0% & ! If no account is specified, then return (user's own account). & 17020 IF EDIT$(FILE$,6%) = "" OR SEG$(EDIT$(FILE$,6%),1%,1%) = "." & THEN GO TO 17047 & ! If the user has not specified a file name, or just the file & ! extension got through, then go yell at him. & 17030 JUNK% = POS (FILE$, "[", 1%) & \ JUNK.2% = POS(FILE$, "]", JUNK%) & \ GO TO 17050 IF JUNK.2% = 0% & \ FILE.ACCOUNT$ = SEG$ (FILE$, JUNK%, JUNK.2%) & \ JUNK.3% = POS (FILE.ACCOUNT$, ",", 1%) & \ GO TO 17050 IF JUNK.3% < 3% OR JUNK.3% > (LEN (FILE.ACCOUNT$) - 2%) & ! If right bracket is missing, then branch to error reporting. & ! If account specification is incorrect, then branch to error rept. & 17040 JUNK% = POS (M11.USER.ACCT$, "[", 1%) & \ JUNK.2% = POS (M11.USER.ACCT$, "]", JUNK%) & \ USER.ACCOUNT$ = SEG$ (M11.USER.ACCT$, JUNK%, JUNK.2%) & \ GO TO 17090 IF USER.ACCOUNT$ = FILE.ACCOUNT$ OR M11.USER.PRIV% & ! Check for device specification in user account. If present then & ! compare to file's device specification. Report error if they & ! do not match. Compare user account to file's account, and & ! report the error if they do not match. & 17045 M11.MSG$ = 'You may not create a file in an account other than' & + ' your own.' & \ GO TO 17055 & ! If the non privileged user specified a file other than his own, & ! then report the error, set FILE.OK% to not ok. & 17047 M11.MSG$ = 'A file name must be specified.' & \ GO TO 17055 & ! Tell user that he forgot the filename. & 17050 M11.MSG$ = "File name is invalid" & ! Tell user that file name given is wrong. & 17055 CALL M11SCW (M11.MSG$, 24%, 1%) & \ CALL M11SCW ("Press RETURN", 24%, 66%) & \ CALL M11SCR (WORK$, 24%, 79%, 1%, "", "a", F.END%) & \ FNFILE% = FALSE% & \ GO TO 17090 & ! If the file specifcation syntax is bad then report the error, & ! Display error message and wait for user to respond. & ! and set the FILE.OK% flag to not ok. & 17090 FNEND &