Security subroutines

Security Subroutines

Top  Previous  Next

 

An R-type or V-type VOC entry can optionally include the name of a catalogued security subroutine in field 4 (R-type) or field 5 (V-type). This subroutine can be used to determine whether the user is to be allowed to execute the command.

 

The security subroutine is written using QMBasic. A simple subroutine that prompts for a password is shown below.

 

SUBROUTINE SECURITY(OK, VERB, REMOTE.FILE, REMOTE.ID)

  PROMPT ''

  DISPLAY 'Enter security password: ' :

  FOR I = 1 TO 3

     ECHO OFF

     INPUT PASSWORD

     ECHO ON

     IF PASSWORD = 'FSKJJ' THEN RETURN @TRUE

  NEXT I

 

  RETURN @FALSE

END

 

The arguments to this subroutine are:

OKUsed to return the result of the validation. This should be set to True if the command is to be allowed, False if it is to be rejected.
VERBThe name of the R-type VOC entry being processed.
REMOTE.FILEThe name of the file containing the remote item to be executed. This is a null string for a security subroutine referenced from a V-type VOC record.
REMOTE.ID The record of the remote item to be executed. This is a null string for a security subroutine referenced from a V-type VOC record.

 

 

If the validation fails or the subroutine cannot be found in the catalogue a message is displayed:

This command is restricted (verb)

 

The security subroutine mechanism can also be used for other purposes such as auditing use of specific commands, diagnostic traps, etc.