FTP client user exits

The FTP client uses user exits to provide security to enable the administrator to control the FTP commands that are sent to the server or to monitor replies that are sent from the FTP server. For example, an administrator can perform the following actions:
  • Protect some data sets, which a user has access to, from being transferred from the z/OS® host.
  • Inspect or modify the names of data sets that are specified on file transfer subcommands by end users.
  • End an FTP client address space, if that client is in the process of sending an unauthorized FTP command.
  • Inspect each reply from the FTP server and, if certain replies are received, end the client.
Restrictions:
  • User exit routines must be in a cataloged data set which is APF-authorized. The data set must be made available to the FTP client via standard z/OS load module search, such as adding the data set to the LNKLIST or via STEPLIB.
  • User exit routines must be reentrant.
  • User exit routines should be written in Assembler Language. Standard linkage conventions must be used. See z/OS MVS Programming: Assembler Services Guide for the linkage conventions.

    Restriction: User exit routines can be written in C, but C exit routines cannot return an exit reason code. If necessary, you can return a message in the optional message field to display the reason code.

  • User exit routines are invoked in TCB mode, program problem state, with AMODE(31). If the user exit routine changes a setting, it must restore it before returning to the caller.
  • User exit routines must communicate the result of their processing back to FTP client by setting a return code in register 15 and a reason code in register 0 (in case of a non-zero return code) before returning to the caller.
  • Start of changeFTP client user exits are not supported when the FTP client is invoked in an environment in which the FTP client cannot be executed as an authorized program or command. For example, FTP client user exits are not supported in the dynamic TSO environment that the IKJTSOEV service builds.End of change

The parameter list that is passed to the user exit routine is an array of pointers to values. The first word of the parameter list points to a word that contains the number of parameters that follow. This helps you to handle any future releases that might increase the number of parameters in these parameter lists. The FTP client passes the TCP connection ID to each user exit. The TCP connection ID parameter uniquely identifies a control connection, and remains the same for all user exit calls that are associated with a specific control connection. You can use the TCP connection ID to correlate user exit calls.

To install your user exit routines, associate them with the defined user exit by using either of these methods:
  • The EXIT statement of the PROGxx parmlib member. The EXIT statement allows an installation to add exit routines to an exit. At IPL, you can use PROG=xx to specify the particular PROGxx parmlib member that the system is to use. For example, you can specify:
    EXIT ADD EXITNAME(EZAFCCMD) MODNAME(CSFTPEX1)
  • The SETPROG EXIT operator command. This command performs the same functions as the EXIT statement of the PROGxx parmlib member. For example, you can specify:
    SETPROG EXIT, ADD, EXITNAME=EZAFCCMD, MODNAME=CSFTPEX1

For more information about user exits installation, see Exit Routines - Using Dynamic Exit Services in z/OS MVS Programming: Authorized Assembler Services Guide.

Dynamic exit services (DES) allows multiple exit routines to be run when a user exit is called. Multiple user exit routines mean that an exit routine called earlier in the sequence can end the client or the current command before the remaining exit routines are called. In that case, no remaining exit routines are called.

Multiple exit routines also mean that another exit routine might modify your output before the FTP client can apply it, and might modify the input from the FTP client before your exit routine receives it. Use caution when creating tokens or handles based on input parameters to avoid conflicts with other user exit routines.

Restriction: FTP cannot control the call sequence of the multiple exit routines. Do not assume your exit routine is called in any particular sequence, such as first or last.

See the detailed information about the following user exits: