PMDF System Manager's Guide


Previous Next Contents Index

24.1.5 An Example on OpenVMS

The following are examples of

These examples are derived from PMDF_ROOT:[DOC.EXAMPLES]VIRUS_SCAN.DCL.

Example 24-1 Sample CONVERSIONS Mapping

! 
! CONVERSIONS mapping table 
! A Yes enables the conversion channel, a No disables it. 
! 
! This example enables the conversion channel for internet mail destined for 
! local VMS MAIL and MessageStore users, and other internel network users. 
! 
CONVERSIONS 
 
  IN-CHAN=tcp_local;OUT-CHAN=l;CONVERT              Yes 
  IN-CHAN=tcp_local;OUT-CHAN=msgstore;CONVERT       Yes 
  IN-CHAN=tcp_local;OUT-CHAN=tcp_internal;CONVERT   Yes 
  IN-CHAN=*;OUT-CHAN=*;CONVERT                      No 

Example 24-2 Sample Conversion Rule

! 
! Perform virus scanning action on all APPLICATION/* message parts. 
!      
in-channel=tcp_local; in-type=application; in-subtype=*; 
  parameter-symbol-0=NAME; parameter-copy-0=*; 
  dparameter-copy-0=*; message-header-file=2; 
  original-header-file=1; override-header-file=1; 
  command="@pmdf_com:virus-scan.com" 

Example 24-3 Sample Conversion Command Procedure

$!----- 
$! Main Processing 
$!----- 
$! 
$! Generate unique filename 
$ run PMDF_EXE:UNIQUE_ID 
$ REFERENCE_ID = unique_id 
$ RECORD_DIR = "put-the-path-to-the-record-dir-here" 
$ RECORD_FILE = "''RECORD_DIR'" + "''REFERENCE_ID'" 
$! 
$! Run the virus scanner 
$ call LAUNCH your-chosen-method 
$! 
$ if RED_FLAG .eq. 1 
$ then 
$     ! Virus detected, choose one of: 
$     !#!call SUBSTITUTE_PART       ! Substitute a text part for the original 
$     !#!call FORCE_HOLD            ! Force message to become .HELD 
$     !#!call FORCE_BOUNCE          ! Force message to be bounced 
$     !#!call FORCE_DELETE          ! Force offending part to be deleted 
$     !#!call FORCE_DISCARD         ! Force the entire message to be deleted 
$ else 
$     ! No virus, just pass it on 
$     copy 'INPUT_FILE' 'OUTPUT_FILE' 
$ endif 
$! 
$ EXIT 
$! 
$!----- 
$! LAUNCH subroutine 
$! 
$! Usage: $ call LAUNCH METHOD_NAME 
$! Returns: The symbol RED_FLAG with a value of either 0 or 1 
$!----- 
$! 
$ LAUNCH: subroutine 
$! 
$ SCAN_METHOD = "''P1'" 
$ RED_FLAG == 0         ! Setup a global signalling flag 
$! 
$! VSWEEP virus scanner method 
$ if SCAN_METHOD .eqs. "RUN_VSWEEP" 
$ then 
$    CONVERTER_COMMAND :== "command-to-invoke-VSWEEP-here" 
$    CONVERTER_COMMAND 'INPUT_FILE'/ff/ns/il/output='RECORD_FILE'.scan 
$    if SWEEP$_STATUS .eqs. "SWEEP$_VIRUS" then RED_FLAG == 1 
$ endif         
$! 
$! Template for other methods 
$ if SCAN_METHOD .eqs. "RUN_METHOD_X" 
$ then 
$     CONVERTER_COMMAND :== "command-to-invoke-Method-X" 
$     CONVERTER_COMMAND 'INPUT_FILE'/output='RECORD_FILE'.scan 
$     if METHOD_X_STATUS .eqs. "some-status-YY" then RED_FLAG == 1 
$! 
$ endif         
$! 
$ endsubroutine ! end of LAUNCH 
$! 
$!----- 
$! Subroutines to set the completion status 
$!----- 
$! 
$!-- 
$! Force the message to be held 
$!-- 
$ FORCE_HOLD:  subroutine 
$! 
$ exit %x0A9C86AA   ! PMDF__FORCEHOLD from pmdf_com:pmdf_err.h 
$! 
$ endsubroutine 
$! 
$!-- 
$! Force the message part to be deleted 
$!-- 
$! 
$ FORCE_DELETE: subroutine 
$! 
$ exit %x0A9C8662   ! PMDF__FORCEDELETE from pmdf_com:pmdf_err.h 
$! 
$ endsubroutine 
$! 
$!-- 
$! Force the entire message to be deleted 
$!-- 
$! 
$ FORCE_DISCARD: subroutine 
$! 
$ exit %x0A9C86B3   ! PMDF__FORCEDISCARD from pmdf_com:pmdf_err.h 
$! 
$!-- 
$! Force a bounce. 
$! parameter can be SWAP_PAYLOAD or SWAP_PAYLOAD_FULL 
$!-- 
$! 
$ FORCE_BOUNCE: subroutine 
$! 
$ if "''P1'" .eqs. "SWAP_PAYLOAD_FULL" 
$ then 
$     exit %x0A9C8579       ! PMDF__FORCEBOUNCE - 1 
$ else if "''P1'" .eqs. "SWAP_PAYLOAD" 
$ then 
$     exit %x0A9C857B       ! PMDF__FORCEBOUNCE + 1 
$ else 
$     exit %x0A9C857A       ! PMDF__FORCEBOUNCE from pmdf_com:pmdf_err.h 
$ endif 
$ endif 
$! 
$ endsubroutine 
$! 
$!----- 
$! Generate some text to substitute for the part before delivering it. 
$!----- 
$! 
$ SUBSTITUTE_PART: subroutine 
$! 
$! Insert a note saying that there has been a substitution. 
$  open/write q_fh 'OUTPUT_FILE 
$  write q_fh "" 
$  write q_fh " The original document has been removed from this message" 
$  write q_fh " The document was removed because .... " 
$  write q_fh " The name of the original document was ''NAME'." 
$  write q_fh "" 
$  write q_fh "                         Enterprise Messaging Team" 
$  write q_fh "                         Example.com Mail Services." 
$  write q_fh "" 
$  close q_fh 
$! 
$! Change the output mode to TEXT and the output encoding to NONE 
$  define/job OUTPUT_MODE TEXT 
$  define/job OUTPUT_ENCODING NONE 
$! 
$! Change the MIME information of this current message part to 
$! TEXT/PLAIN and change the document name  references. 
$  open/write fh 'OUTPUT_HEADERS 
$  write fh "Content-type: TEXT/PLAIN; NAME=Substitute.txt" 
$  write fh "Content-description: Alert about possible virus" 
$  write fh "Content-disposition: attachment; filename=Substitute.txt" 
$  write fh "Content-transfer-encoding: 7bit " 
$  write fh "" 
$  close fh 
$! 
$ endsubroutine 
$! 


Previous Next Contents Index