29.12.2012 Views

The Programmer's Guide to TRSDOS Version 6 - Tim Mann's Home ...

The Programmer's Guide to TRSDOS Version 6 - Tim Mann's Home ...

The Programmer's Guide to TRSDOS Version 6 - Tim Mann's Home ...

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

will only permit the opener <strong>to</strong> read the file, not <strong>to</strong> write <strong>to</strong> it. Any SuperVisor Call<br />

request for updating, writing, renaming, or removing will return the "Attempt <strong>to</strong> access<br />

protected file" error. If the OWNER password is part of the filespec when the file is<br />

opened, the system will permit all levels of access regardless of any USER password or<br />

protection level.<br />

Prot Effect<br />

NONE You cannot access the file. This PROT is used for system files.<br />

EXEC You can only run the program file.<br />

READ You can read the file.<br />

UPDATE You can write <strong>to</strong> an existing file without extending it.<br />

WRITE You can write <strong>to</strong> and extend the file.<br />

RENAME You can change the name/extension of the file.<br />

REMOVE You can delete the file from the disk.<br />

FULL You can change the protection level and passwords of the file.<br />

Note: Each level grants the access listed above it.<br />

Figure 6-1 Access protection levels<br />

Passwords are assigned <strong>to</strong> files in one of two ways. If a password is part of the filespec<br />

when the file is first created with the @INIT SuperVisor Call function, then that<br />

password will become both the OWNER and USER passwords. <strong>The</strong> protection level will be FULL<br />

but since both password fields are in use, the password must be entered for any access <strong>to</strong><br />

the file. <strong>The</strong> second method of applying password protection is <strong>to</strong> use the ATTRIB library<br />

command. This command allows you <strong>to</strong> change both passwords and protection level - assuming<br />

you have the access authority based on the file's existing protection.<br />

A password can be composed of nothing but blanks. This is in effect, no password at all<br />

since the entry of NOTHING is interpreted as a blank field and thus will grant access<br />

according <strong>to</strong> the level associated with the password field. For instance, if the OWNER<br />

password field is blank, the file has no protection whatsoever even if the USER password<br />

field is non-blank because a filespec without a password entry will match the blank OWNER<br />

password thus granting full access. It is important for the OWNER password <strong>to</strong> be nonblank<br />

if the file is <strong>to</strong> be protected in any manner.<br />

A common situation is <strong>to</strong> find the OWNER password kept private <strong>to</strong> those individual(s)<br />

either maintaining the application or responsible for the integrity of the file contents<br />

while providing a blank USER password with a protection level set <strong>to</strong> the minimum level of<br />

access needed by the user. For instance, if the user only needs <strong>to</strong> read a file, set the<br />

protection level <strong>to</strong> READ. This user can then read the file without having <strong>to</strong> bother with<br />

a password but that user cannot write <strong>to</strong> the file, cannot remove it from the disk, cannot<br />

rename the file, nor can the user change the protection level of the file. However, the<br />

maintainer can step in <strong>to</strong> deal with file maintenance at a higher level of access given<br />

the OWNER password.<br />

Where use of a file needs <strong>to</strong> be restricted <strong>to</strong> an individual out of a group of<br />

individuals, then the USER password field should have a non-blank password that is<br />

distinct from the OWNER password. <strong>The</strong> access protection level is still kept <strong>to</strong> the<br />

minimum necessary for the user. This scenario will then permit that individual the<br />

minimum access <strong>to</strong> the file while excluding all others (unless, of course, the user shares<br />

his knowledge of the password with others).<br />

It may be practical for any given installation <strong>to</strong> consider protecting all files <strong>to</strong> the<br />

minimum access level expected of them. Thus any file whose primary access is READ only<br />

would be protected accordingly. <strong>The</strong>re will be less chance <strong>to</strong> inadvertently remove the<br />

file by mistake or mistakenly write <strong>to</strong> it - a common error when dealing with applications<br />

that frequently prompt the user for the entry of file specifications.<br />

6-5

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!