ibm-information-center/dist/eclipse/plugins/i5OS.ic.rzaiq_5.4.0.1/rzaiqexamplogoncl.htm

113 lines
7.2 KiB
HTML

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en-us" xml:lang="en-us">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="security" content="public" />
<meta name="Robots" content="index,follow" />
<meta http-equiv="PICS-Label" content='(PICS-1.1 "http://www.icra.org/ratingsv02.html" l gen true r (cz 1 lz 1 nz 1 oz 1 vz 1) "http://www.rsac.org/ratingsv01.html" l gen true r (n 0 s 0 v 0 l 0) "http://www.classify.org/safesurf/" l gen true r (SS~~000 1))' />
<meta name="DC.Type" content="reference" />
<meta name="DC.Title" content="Example: FTP server logon exit program in CL code" />
<meta name="abstract" content="This is an example of a simple File Transfer Protocol (FTP) Server Logon exit program. It is written in iSeries Command Language (CL)." />
<meta name="description" content="This is an example of a simple File Transfer Protocol (FTP) Server Logon exit program. It is written in iSeries Command Language (CL)." />
<meta name="DC.Relation" scheme="URI" content="rzaiqlepi.htm" />
<meta name="copyright" content="(C) Copyright IBM Corporation 2004, 2006" />
<meta name="DC.Rights.Owner" content="(C) Copyright IBM Corporation 2004, 2006" />
<meta name="DC.Format" content="XHTML" />
<meta name="DC.Identifier" content="rzaiqexamplogoncl" />
<meta name="DC.Language" content="en-us" />
<!-- All rights reserved. Licensed Materials Property of IBM -->
<!-- US Government Users Restricted Rights -->
<!-- Use, duplication or disclosure restricted by -->
<!-- GSA ADP Schedule Contract with IBM Corp. -->
<link rel="stylesheet" type="text/css" href="./ibmdita.css" />
<link rel="stylesheet" type="text/css" href="./ic.css" />
<title>Example: FTP server logon exit program in CL code</title>
</head>
<body id="rzaiqexamplogoncl"><a name="rzaiqexamplogoncl"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">Example: FTP server logon exit program in CL code</h1>
<div><p>This is an example of a simple File Transfer Protocol (FTP) Server
Logon exit program. It is written in iSeries™ Command Language (CL).</p>
<div class="section"><p>This is an example of a simple FTP Server Logon exit program.
It is written in iSeries Command
Language (CL). This code is not complete, but provides a starting point to
help you create your own program.</p>
<div class="note"><span class="notetitle">Note:</span> By using the code examples, you
agree to the terms of the <a href="codedisclaimer.htm">Code license and disclaimer information</a>.</div>
<p>(Pre
formatted text in the following example will flow outside the frame.)</p>
<pre class="screen">/******************************************************************************/
/* */
/* Sample FTP server logon exit program. */
/* Note: This program is a sample only and has not undergone any formal */
/* review or testing. */
/* */
/* Additional notes: */
/* 1. When the FTP server logon exit is called, the FTP server job is */
/* running under the QTCP user profile. */
/* 2. For the ANONYMOUS case, users can add logging capability (for */
/* example, write the E-mail address entered for the password and */
/* the client IP address to a log file). */
/* 3. IBM strongly recommends that you create the exit program in a library */
/* with *PUBLIC authority set to *EXCLUDE, and give the exit program */
/* itself a *PUBLIC authority of *EXCLUDE. The FTP server adopts */
/* authority when it is necessary to resolve and call the exit program. */
/* */
/******************************************************************************/
TSTLOGCL: PGM PARM(&amp;APPIDIN &amp;USRIN &amp;USRLENIN &amp;AUTIN &amp;AUTLENIN +
&amp;IPADDRIN &amp;IPLENIN &amp;RETCDOUT &amp;USRPRFOUT &amp;PASSWDOUT +
&amp;CURLIBOUT)
/* Declare input parameters */
DCL VAR(&amp;APPIDIN) TYPE(*CHAR) LEN(4) /* Application identifier */
DCL VAR(&amp;USRIN) TYPE(*CHAR) LEN(999)/* User ID */
DCL VAR(&amp;USRLENIN) TYPE(*CHAR) LEN(4) /* Length of user ID */
DCL VAR(&amp;AUTIN) TYPE(*CHAR) LEN(999)/* Authentication string */
DCL VAR(&amp;AUTLENIN) TYPE(*CHAR) LEN(4) /* Length of auth. string */
DCL VAR(&amp;IPADDRIN) TYPE(*CHAR) LEN(15) /* Client IP address */
DCL VAR(&amp;IPLENIN) TYPE(*CHAR) LEN(4) /* IP address length */
DCL VAR(&amp;RETCDOUT) TYPE(*CHAR) LEN(4) /* return code (out) */
DCL VAR(&amp;USRPRFOUT) TYPE(*CHAR) LEN(10) /* user profile (out) */
DCL VAR(&amp;PASSWDOUT) TYPE(*CHAR) LEN(10) /* password (out) */
DCL VAR(&amp;CURLIBOUT) TYPE(*CHAR) LEN(10) /* current library (out) */
/* Declare local copies of parameters (in format usable by CL) */
DCL VAR(&amp;APPID) TYPE(*DEC) LEN(1 0)
DCL VAR(&amp;USRLEN) TYPE(*DEC) LEN(5 0)
DCL VAR(&amp;AUTLEN) TYPE(*DEC) LEN(5 0)
DCL VAR(&amp;IPLEN) TYPE(*DEC) LEN(5 0)
/* Assign input parameters to local copies */
CHGVAR VAR(&amp;APPID) VALUE(%BINARY(&amp;APPIDIN))
CHGVAR VAR(&amp;USRLEN) VALUE(%BINARY(&amp;USRLENIN))
CHGVAR VAR(&amp;AUTLEN) VALUE(%BINARY(&amp;AUTLENIN))
CHGVAR VAR(&amp;IPLEN) VALUE(%BINARY(&amp;IPLENIN))
/* Check for ANONYMOUS user. Allow for ANONYMOUSA, etc. as "regular" */
/* user profile. */
IF COND(&amp;USRLEN = 9) THEN(DO)
IF COND(%SST(&amp;USRIN 1 9) = 'ANONYMOUS')
THEN(DO)
/* For anonymous user: want to force user profile ANONYMOUS current library to PUBLIC. */
CHGVAR VAR(%BINARY(&amp;RETCDOUT)) VALUE(6)
CHGVAR VAR(&amp;USRPRFOUT) VALUE('ANONYMOUS ')
CHGVAR VAR(&amp;CURLIBOUT) VALUE('PUBLIC ')
ENDDO
/* Any other user: proceed with normal logon processing. */
ELSE CMD(CHGVAR VAR(%BINARY(&amp;RETCDOUT)) VALUE(1))
ENDDO
ELSE CMD(CHGVAR VAR(%BINARY(&amp;RETCDOUT)) VALUE(1))
END: ENDPGM</pre>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="rzaiqlepi.htm" title="You can control the authentication of users to a TCP/IP application server with the TCP/IP Application Server Logon exit point.">Server logon exit point</a></div>
</div>
</div>
</body>
</html>