Question & Answer
Question
How is the IBM i HTTP Server CGI job's library list constructed if the CGI program is in an IASP versus *SYSBAS on the IBM i OS?
Cause
When CGI programs reside in an IASP, the CGI job current user's job description initial library list will be used. The default CGI current user is QTMHHTP1 with a default job description QGPL/QDFTJOBD, but can be changed using the ServerUserID directive. This change was implemented in 2011 beginning with IBM i 7.1 OS.
Refer to IBM APAR SE48201 for more information.
Problem description:
Users who want to set an IASP group and library list in the HTTP job description, can get msgCPF4101 if they don't have the SETENV in their Apache httpd.conf.
Resolution:
This PTF changes the QZSRCGI program from SETASPGRP ASPGRP(IASP1) to SETASPGRP ASPGRP(IASP1) CURLIB(*CURUSR) USRLIBL(*CURUSR) for users who want to set IASP group and library list in the job description
IBM recommends clients DO NOT change the default user's (QTMHHTP1 or QTMHHTTP) job description library list!!!
If you wish to set a library list in an IBM i user profile's job description, we recommend you set the "ServerUserID <user>" directive and then specify "UseUserJobdLibraryList on" in your IBM HTTP Server's configuration.
If you wish to set a library list in an IBM i user profile's job description, we recommend you set the "ServerUserID <user>" directive and then specify "UseUserJobdLibraryList on" in your IBM HTTP Server's configuration.
SETASPGRP ASPGRP(IASP1) CURLIB(*CURUSR) USRLIBL(*CURUSR), will change the CGI job's initial library list to the current user's job description initial library list. This will occur when a new CGI job (Function PGM-QZSRCGI) is created. As a result, the CGI job's initial library list is *SYSVAL in *SYSBAS and is *CURUSR in IASP.
When the "UseUserJobdLibraryList on" HTTP directive is configured, the IBM HTTP Server checks the current user's job description when the request arrives. Then, the HTTP server will eventually pass the content to the CGI job via "Setenv QIBM_MERGE_CGI_USER_LIBRARY_LIST". The CGI job uses the value of the QIBM_MERGE_CGI_USER_LIBRARY_LIST environment variable to decide whether to change the library list before CGI program executes. When the default user QTMHHTP1 or QTMHHTTP is encountered, the program will not use the user's job description initial library list. so the HTTP Server will pass NULL to CGI job. For the CGI job, it will not change to current user's job description initial library list and continue to use the job's original library list. This is documented in the IBM i Documentation, http://www.ibm.com/docs/en/i/7.4?topic=ssw_ibm_i_74/rzaie/rzaiemod_cgi.htm#useuserjobdlibrarylist.
Notes when UseUserJobdLibraryList directive is implemented:
- The job description library list of HTTP server default user profiles QTMHHTTP and QTMHHTP1 will be not used for CGI programs.
- The user profile's job description library list must have a explicit library list set in order to make HTTP server to pick it up for CGI programs.
- If both "SetEnv QIBM_CGI_LIBRARY_LIST" and "UseUserJobdLibraryList on" are configured, the two library lists will be merged first before changing the library list of CGI programs.
Some conclusions and suggestions:
1. IBM does not recommend modifying the library list of the default HTTP Server users, QTMHHTTP and QTMHHTP1. If you want to use "UseUserJobdLibraryList on", please include the "ServerUserID <profile>" directive in your IBM HTTP Server configuration.
2. You can retrieve the value for the environment variable, QIBM_MERGE_CGI_USER_LIBRARY_LIST, from your CGI program to see the current library list.
3. If you don't specify the ServerUserID directive, the default CGI user profile, QTMHHTP1, will be used to execute your CGI program. The QTMHHTP1 users' job description library list will only be passed to CGI program when the CGI program resides in an *IASP and "UseUserJobdLibraryList" is not specified or set to "off". The QTMHHTP1 users' job description library list will not be used if the CGI program resides in *SYSBAS in any case.
4. IBM recommends you use the following HTTP Server configuration if you want to use the initial library list defined in an IBM i user profile's job description.
1. IBM does not recommend modifying the library list of the default HTTP Server users, QTMHHTTP and QTMHHTP1. If you want to use "UseUserJobdLibraryList on", please include the "ServerUserID <profile>" directive in your IBM HTTP Server configuration.
2. You can retrieve the value for the environment variable, QIBM_MERGE_CGI_USER_LIBRARY_LIST, from your CGI program to see the current library list.
3. If you don't specify the ServerUserID directive, the default CGI user profile, QTMHHTP1, will be used to execute your CGI program. The QTMHHTP1 users' job description library list will only be passed to CGI program when the CGI program resides in an *IASP and "UseUserJobdLibraryList" is not specified or set to "off". The QTMHHTP1 users' job description library list will not be used if the CGI program resides in *SYSBAS in any case.
4. IBM recommends you use the following HTTP Server configuration if you want to use the initial library list defined in an IBM i user profile's job description.
You only need to set the initial library list in User1's job description. From the CGI program, you can get the value of the environment variable, QIBM_MERGE_CGI_USER_LIBRARY_LIST, to see the CGI program's library list.
Example IBM HTTP Server configuration to define the CGI user profile as User1 and tell the HTTP Server to use the User1's job description initial library list.
<Directory /QSYS.LIB/svrbrokr.LIB/>
Options all
Require all granted
SetHandler cgi-script
ServerUserID User1
UseUserJobdLibraryList on
</Directory>
In conclusion, when the CGI program resides in an *IASP, the current CGI user's job description initial library list is used, even when the current CGI user is QTMHHTP1. When the CGI program resides in *SYSBAS, the current CGI user's job description initial library list is NOT used unless the "UseUserJobdLibraryList on" and "ServerUserID <user>" HTTP directives are configured. NOTE: When the "UseUserJobdLibraryList on" HTTP directive is configured in the IBM HTTP Server instance and the "ServerUserID" directive is NOT set, the job description initial library list of HTTP server default user profiles QTMHHTTP and QTMHHTP1 will NOT be used for CGI programs.
Related Information
[{"Type":"MASTER","Line of Business":{"code":"LOB57","label":"Power"},"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Product":{"code":"SWG60","label":"IBM i"},"ARM Category":[{"code":"a8m0z0000000CJVAA2","label":"IBM i HTTP Server-\u003ECGI"}],"ARM Case Number":"TS009380645","Platform":[{"code":"PF012","label":"IBM i"}],"Version":"7.1.0;7.2.0;7.3.0;7.4.0;7.5.0;and future releases"}]
Was this topic helpful?
Document Information
More support for:
IBM i
Component:
IBM i HTTP Server->CGI
Software version:
7.1.0, 7.2.0, 7.3.0, 7.4.0, 7.5.0 and future releases
Operating system(s):
IBM i
Document number:
6606371
Modified date:
17 August 2022
UID
ibm16606371
Manage My Notification Subscriptions