//**** START OF SPECIFICATIONS *****************************************00010000 //* *00020000 //* MODULE NAME = APSUC07Z *00030000 //* *00040000 //* $MOD (APSUC07Z) COMP(APS) PROD(PSF) : VERSION 3.3.0 *00050000 //* *00060000 //* DESCRIPTIVE NAME = RESOURCE EXIT - SAMPLE 3 *00070000 //* *00080000 //* STATUS = VERSION 3, RELEASE 3, LEVEL 0 *00090000 //* *00100000 //* FUNCTION = *00110000 //* This is sample installation exit APSUX07Z written in C. *00120000 //* *00130000 //* DEMONSTRATE POSSIBLE USES OF THE RESOURCE EXIT *00140000 //* - SET EXIT INVOLVEMENT BASED ON THE PRINTER *00150000 //* - AUTHORIZATION CHECK BASED ON THE PRINTER *00160000 //* - TERMINATE TH JOB IF SENT TO CAPTIVE PRINTER *00170000 //* - TERMINATE THE JOB IF UNAUTHORIZED USE OF RESOURCE *00180000 //* *00190000 //* OPERATION = *00200000 //* *00210000 //* *00220000 //* NOTES = *00230000 //* DEPENDENCIES = NONE *00240000 //* RESTRICTIONS = NONE *00250000 //* REGISTER CONVENTIONS = NONE *00260000 //* *00270000 //* MODULE TYPE = PROCEDURE *00280000 //* PROCESSOR = C *00290000 //* ATTRIBUTES = REENTRANT *00300000 //* AMODE 31 *00310000 //* RMODE ANY *00320000 //* *00330000 //* ENTRY POINT = APSUC07 *00340000 //* LINKAGE = *00350000 //* One parameter - the address of APSGEXTP *00360000 //* *00370000 //* INPUT = *00380000 //* APSGEXTC - PSF INSTALLATION EXIT PARAMETER AREA *00390000 //* *00400000 //* OUTPUT = NONE *00410000 //* *00420000 //* EXIT NORMAL = RETURN TO CALLER *00430000 //* *00440000 //* EXIT ERROR = NONE *00450000 //* *00460000 //* EXTERNAL REFERENCES = *00470000 //* ROUTINES = NONE *00480000 //* DATA AREAS = *00490000 //* APSGEXTC - PSF INSTALLATION EXIT PARAMETER AREA *00500000 //* APSUECAC - PSF EXIT COMMUNICATIONS AREA *00510000 //* APSURLSC - PSF EXIT RESOURCE LIST AREA *00520000 //* APSUJSPC - JES SEPARATOR PAGE AREA *00530000 //* INCLUDES = NONE *00540000 //* *00550000 //* MACROS = NONE *00560000 //* *00570000 //* MESSAGES = NONE *00580000 //* *00590000 //* CHANGE ACTIVITY = *00600000 //* $B0=LAPS0008, HPRF320, 990930, BDKURLD: Initial Version @B0A*00610000 //* $EV=LAPS0009,HPRF330,010530,BUQ4RLB: Version 3.3.0 @EVA*00620000 //* *00630000 //**** END OF SPECIFICATIONS *******************************************00640000 00650000 #pragma comment(date) 00660000 #pragma csect(CODE,"$APSUC07") 00670000 #pragma csect(STATIC,"#APSUC07") 00680000 #pragma linkage(APSUC07,OS) 00690000 #pragma runopts(TRAP(OFF)) 00700000 #pragma map(apsuc07,"APSUC07") 00710000 00720000 /*--------------------------------------------------------------------- 00730000 #include these header files for structure & function definitions: 00740000 ---------------------------------------------------------------------*/ 00750000 00760000 #include "apsgextc.h" 00770000 #include "apsurlsc.h" 00780000 #include "apsuecac.h" 00790000 #include "apsujspc.h" 00800000 00810000 /*--------------------------------------------------------------------- 00820000 Constants 00830000 ---------------------------------------------------------------------*/ 00840000 00850000 #define DWRFMSGL 0x2F // Length of dwarf printer message 00860000 #define PSEGMSGL 0x2D // Length of secure segment message 00870000 #define DWARFPRT "PRT80 " // Dwarf printer 00880000 #define SIGNATUR "S110IBMS" // Security page segment 00890000 #define NEWFDEF "F1HA0Y " // New formdef 00900000 #define TOTDWARF 8 // Number of dwarfs 00910000 #define SECURITY "OIXUC98 " // Authorized programmer 00920000 // name 00930000 /*--------------------------------------------------------------------- 00940000 Declarations 00950000 ---------------------------------------------------------------------*/ 00960000 00970000 int len2 = 20; // Length of dwarfs name 00980000 int match = 0; // No match of programmer name 00990000 int loopind; // Loop index 01000000 char * dwarfmsg = "DATA SET HAS BEEN PLACED ON THE JES HOLD QUEUE."; 01010000 char * psegmsg = "UNAUTHORIZED ATTEMPT TO USE SECURED RESOURCE."; 01020000 char * dwarfs ÝTOTDWARF¨ = {"SNOW WHITE ", 01030000 "GRUMPY ", 01040000 "DOPEY ", 01050000 "SLEEPY ", 01060000 "DOC ", 01070000 "SLEEZY ", 01080000 "BASHFULL ", 01090000 "HAPPY "}; // Authorized 01100000 // users for the dwarf printers 01110000 01120000 01130000 void apsuc07(APSGEXTP * xtpptr) 01140000 { 01150000 01160000 /*--------------------------------------------------------------------- 01170000 Determine what type of call is being made to the exit 01180000 ---------------------------------------------------------------------*/ 01190000 01200000 switch (xtpptr->XTPRECP.XTPRECP7->XTP7ETYP) // Select on the 01210000 // type of call 01220000 { 01230000 case XTP7INIT: // Initialization call 01240000 01250000 /*-------------------------------------------------------------- 01260000 INITIALIZATION ROUTINE 01270000 01280000 - Request control at access time for formdefs on all printers 01290000 - Request control at load time for page segments on all 01300000 printers 01310000 - Request control at beginning of each data set on the 01320000 Dwarf's printer only 01330000 --------------------------------------------------------------*/ 01340000 01350000 xtpptr->XTPRECP.XTPRECP7->XTP7NOTY.XTP7NLD = XTP7LPS; 01360000 // Request control at load 01370000 // time for page segments 01380000 // (all printers) 01390000 01400000 xtpptr->XTPRECP.XTPRECP7->XTP7NOTY.XTP7NACC = XTP7AFD; 01410000 // Request control at access 01420000 // time for formdefs 01430000 // (all printers) 01440000 01450000 if ( !(memcmp(xtpptr->XTPRECP.XTPRECP7->XTP7PINF.XTP7PNAM, 01460000 DWARFPRT, strlen(DWARFPRT)))) // If this is the 01470000 // dwarfs printer 01480000 01490000 xtpptr->XTPRECP.XTPRECP7->XTP7NOTY.XTP7MISC = XTP7EBDS; 01500000 // Request control at beginning 01510000 // of data set (Dwarf's printer 01520000 // only) 01530000 01540000 break; // Exit from the init call 01550000 01560000 case XTP7BDS: // Beginning of data set call 01570000 01580000 /*-------------------------------------------------------------- 01590000 BEGINNING OF DATA SET ROUTINE: 01600000 01610000 - This code checks an authorization list and terminates the 01620000 job if the correct string is not in the list. 01630000 01640000 NOTES: 01650000 - This BDS routine is active only for the Dwarf's printer 01660000 --------------------------------------------------------------*/ 01670000 01680000 for (loopind = 0; loopind < TOTDWARF; loopind++) 01690000 { // Loop for total number of 01700000 // dwarfs 01710000 if ( !(memcmp(xtpptr->XTPJSPAP->JSPJPNAM, dwarfsÝloopind¨, 01720000 len2))) // Is this an authorized user 01730000 { // Yes, allow this job to run 01740000 match = 1; // Set match field 01750000 break; // Exit from for loop 01760000 } // End is this an authorized 01770000 // user 01780000 } // End for loop 01790000 01800000 if (match == 0) // Not an authorized user 01810000 { 01820000 xtpptr->XTPRECP.XTPRECP7->XTP7RFLG |= XTP7TDS; 01830000 // Set the terminate data 01840000 // set flag 01850000 xtpptr->XTPRECP.XTPRECP7->XTP7RFLG |= XTP7HQUE; 01860000 // Send data set to hold queue 01870000 xtpptr->XTPRECP.XTPRECP7->XTP7MSGP = dwarfmsg; 01880000 // Put the address of the 01890000 // message text into the 01900000 // message pointer 01910000 xtpptr->XTPRECP.XTPRECP7->XTP7MSGL = DWRFMSGL; 01920000 // Store length of message 01930000 // insert 01940000 } // End of not an authorized 01950000 // user 01960000 01970000 break; // End of beginning of data 01980000 // set call 01990000 02000000 case XTP7ACC: // Resource access call 02010000 02020000 /*---------------------------------------------------------------02030000 ACCESS ROUTINE: 02040000 02050000 - Pagedefs(& Formdefs) never have more than 1 RLST entry 02060000 at access time 02070000 - Page segments, overlays, fonts, and object containers 02080000 may have more than 1 RLST entry in the chain at access 02090000 time 02100000 - If RLSTMSGP or RLSTMSGL are left at 0 when a substitution 02110000 message is requested, the message insert will not be 02120000 added to the message 02130000 ---------------------------------------------------------------*/02140000 02150000 if (xtpptr->XTPRECP.XTPRECP7->XTP7RTYP & XTP7FD) 02160000 // Check if this is a call for 02170000 // formdefs 02180000 { // Call is for formdefs 02190000 02200000 /*-------------------------------------------------------------- 02210000 ACCESS ROUTINE FOR FORMDEFS: 02220000 - Replace (substitute for) the job header formdef for the 02230000 entire FSA session. Resources for auxiliary datasets are 02240000 processed only once per session so the formdef access 02250000 flag may be turned off to eliminate unnecesary calls. 02260000 ---------------------------------------------------------------*/02270000 02280000 if (xtpptr->XTPRECP.XTPRECP7->XTP7DSTY & XTP7AUX) 02290000 // Check if this is a call for 02300000 // auxiliary processing 02310000 { // Call is for auxiliary 02320000 // processing 02330000 if (xtpptr->XTPRECP.XTPRECP7->XTP7DSAT & XTP7PJHD) 02340000 // Check if this is a call for 02350000 // for the job header 02360000 { // Call is for job header 02370000 memcpy(xtpptr->XTPRECP.XTPRECP7->XTP7RLST. 02380000 XTP7LSTP->RLSTRID.RLSTNAME, NEWFDEF, 02390000 strlen(NEWFDEF)); 02400000 // Replace with new formdef 02410000 xtpptr->XTPRECP.XTPRECP7->XTP7NOTY.XTP7NACC &= 02420000 (~XTP7AFD); 02430000 // Turn off formdef access 02440000 // flag by anding with its 02450000 // complement 02460000 } // Call is for job header 02470000 } // Call is for auxiliary 02480000 // processing 02490000 } // Call is for formdefs 02500000 02510000 break; // End of resource access call 02520000 02530000 case XTP7LDB: // Load begin call 02540000 /*-------------------------------------------------------------- 02550000 LOAD BEGIN ROUTINE: 02560000 02570000 --------------------------------------------------------------*/ 02580000 02590000 if (xtpptr->XTPRECP.XTPRECP7->XTP7RTYP & XTP7PS) 02600000 // Check if this is a call for 02610000 // page segments 02620000 { // Call is for page segments 02630000 /*------------------------------------------------------------- 02640000 BEGIN LOAD PAGE SEGMENT ROUTINE 02650000 02660000 - This code checks the page segment about to be loaded. 02670000 If it is a segment that requires authorization to be 02680000 used, the user must have put an authorized string in the 02690000 programmers name field of his job card. If this string 02700000 is not found in the authorization list, the segment 02710000 is not loaded and the data set is terminated. 02720000 NOTES: 02730000 - Load calls (begin and end) always have one and only one 02740000 RLST entry. 02750000 - The integrity of this authorization check depends on the 02760000 segment being loaded for each job that tries to use it. 02770000 To ensure this, the segment must always be deleted from 02780000 the printer at job boundaries. 02790000 -------------------------------------------------------------*/ 02800000 02810000 if ( !(memcmp(xtpptr->XTPRECP.XTPRECP7->XTP7RLST. 02820000 XTP7LSTP->RLSTRID.RLSTNAME, SIGNATUR, 02830000 strlen(SIGNATUR)))) 02840000 // Is this the security 02850000 // segment 02860000 { // This is security segment 02870000 02880000 /*---------------------------------------------------------- 02890000 Attempting to load a secured page segment. This job 02900000 must have filled in the programmers name field with 02910000 the correct string. 02920000 ----------------------------------------------------------*/ 02930000 02940000 if ( memcmp(xtpptr->XTPJSPAP->JSPJPNAM, SECURITY, 02950000 strlen(SECURITY))) 02960000 // Is this an authorized 02970000 // user 02980000 { // This user is not an 02990000 // authorized user 03000000 xtpptr->XTPRECP.XTPRECP7->XTP7RFLG |= XTP7TDS; 03010000 // Terminate the job 03020000 xtpptr->XTPRECP.XTPRECP7->XTP7MSGP = psegmsg; 03030000 // Put the address of the 03040000 // message text into the 03050000 // message pointer 03060000 xtpptr->XTPRECP.XTPRECP7->XTP7MSGL = PSEGMSGL; 03070000 // Store length of message 03080000 // insert 03090000 } // This user is not an 03100000 // authorized user 03110000 } // This is security segment 03120000 } // Call is for page segments 03130000 03140000 break; // End of load begin call 03150000 03160000 case XTP7LDE: // Load end call 03170000 /*-------------------------------------------------------------- 03180000 LOAD END ROUTINE: 03190000 - Insert code here for resource load end calls 03200000 --------------------------------------------------------------*/ 03210000 03220000 break; // End of load end call 03230000 03240000 default: // No match found - error 03250000 break; // Exit from default 03260000 } // End of select on the 03270000 // type of call 03280000 return; // Return with no error 03290000 } // End of main routine 03300000