IBM Support

Debugging FTP Exit Programs

Troubleshooting


Problem

This document provides the debugging procedure for an FTP exit program.

Resolving The Problem

This document deals with the debugging procedure for an FTP exit program. The purpose of the program is to perform validation on user ID, TCP/IP address, and so on, for incoming FTP requests. For this reason, the exit program must be registered to exit point QIBM_QTMF_SERVER_REQ; the exact interface parameters are described in Appendix E of OS/400 TCP/IP Configuration and Reference, SC41-5420-03. The parameters are:
 
1 Application identifier Input Binary(4)
2 Operation identifier Input Binary(4)
3 User profile Input Char(10)
4 Remote IP address Input Char(*)
5 Length of remote IP address Input Binary(4)
6 Operation-specific information Input Char(*)
7 Length of operation-specific information Input Binary(4)
8 Allow operation Output Binary(4)

The detailed steps are as follows:

Step 1: Compile exit program.

Compile exit program with debugging information.
 
Language Compiler Command / Parameters
OPM CL CRTCLPGM OPTION(*SRCDBG)
ILE CL CRTBNDCL DBGVIEW(*ALL)
OPM RPG CRTRPGPGM OPTION(*SRCDBG)
ILE RPG CRTBNDRPG DBGVIEW(*ALL)
ILE C CRTBNDC DBGVIEW(*ALL)

Step 2: Register program to exit point.

On the operating system command line, type the following:

WRKREGINF

Press the Enter key. Select Option 8 on the following:

QIBM_QTMF_SERVER_REQ

Specify Option 1, program name and library, and press the Enter key.

Press F3 to return to initial screen.

Step 3: Restart FTP server.

Restart the FTP server. This is necessary for the exit point registration to take effect. On the operating system command line, type the following:

ENDTCPSVR SERVER(*FTP)

Press the Enter key. Then, type the following:

CHGFTPA

Press F4 to prompt. Note the current value of NBRSVR (this is required in Step 11). Change NBRSVR to 1, and press the Enter key. Then, type the following:

STRTCPSVR SERVER(*FTP)

Step 4. Find qualified job name.

On the operating system command line, type the following:

WRKACTJOB

Press the Enter key. Look under subsystem QSYSWRK for a job named QTFTPxxxxx, where xxxxx is a 5-digit number. Select Option 5 on the job; note job name (QTFTPxxxxx), user (should be QTCP), 6-digit job number.

Step 5: Start service job.

On the operating system command line, type the following:

STRSRVJOB job_number/user_name/job_name

Press the Enter key.

Step 6: Place program in debug mode.

For OPM programs, on the operating system command line type the following:

STRDBG PGM(library_name/program_name) UPDPROD(*YES) OPMSRC(*YES)

For ILE programs, on the operating system command line type the following:

STRDBG PGM(library_name/program_name) UPDPROD(*YES) OPMSRC(*NO)

The program source will come up. Place breakpoints by pressing F6. At least one breakpoint must be placed in the source code or the program will run through to the end when invoked.

Press F12 to return to the command line.

Step 7: Program invocation.

To request an FTP session, go to a separate interactive session type the following:

FTP system_name

where system_name is the name of the machine on which the FTP server is running.

When the FTP server receives such a request, the server reaches exit point QIBM_QTMF_SERVER_REQ and invokes the exit program for request validation. At this stage, the operation identifier passed to the program (parameter 2 in the list) is 0. This identifier denotes a session initialization request. This phase takes place before the remote user receives a sign-on prompt from the FTP server.

At this time, the source code for the exit program appears on-screen in the first session and in debug mode. The usual debugger commands can be used to step through, display variables, and so on.

Step 8: Terminate debug mode.

When program execution has ended, to return to production mode on the operating system command line type the following:

ENDDBG

Press the Enter key.

Step 9: Terminate service job.

After ending debug and to end the service job previously started, on the operating system command line type the following:

ENDSRVJOB

Press the Enter key.

Step 10: Deregister exit program if needed.

On the operating system command line, type the following:

WRKREGINF

Press the Enter key. Select Option 8 on QIBM_QTMF_SERVER_REQ.

Select Option 4 on the exit program, and press the Enter key.

Press F3 to return to initial screen.

Step 11: Restart FTP server.

Restart the FTP server. This is necessary for the exit point deregistration to take effect.

ENDTCPSVR SERVER(*FTP)

Press the Enter key. Then, type the following:

CHGFTPA

Press F4 to prompt. Set NBRSVR to its original value (see Step 3), and press the Enter key. Then, type the following:

STRTCPSVR SERVER(*FTP)

Press the Enter key.

[{"Type":"MASTER","Line of Business":{"code":"LOB57","label":"Power"},"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Product":{"code":"SWG60","label":"IBM i"},"Platform":[{"code":"PF012","label":"IBM i"}],"Version":"6.1.0"}]

Historical Number

17954045

Document Information

More support for:
IBM i

Software version:
6.1.0

Operating system(s):
IBM i

Document number:
642009

Modified date:
18 December 2019

UID

nas8N1017917

Manage My Notification Subscriptions