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

196 lines
12 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 ILE RPG code" />
<meta name="abstract" content="This is an example of a simple File Transfer Protocol (FTP) Server Logon exit program. It is written in ILE RPG." />
<meta name="description" content="This is an example of a simple File Transfer Protocol (FTP) Server Logon exit program. It is written in ILE RPG." />
<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="rzaiqexamplogonilerpg" />
<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 ILE RPG code</title>
</head>
<body id="rzaiqexamplogonilerpg"><a name="rzaiqexamplogonilerpg"><!-- --></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 ILE RPG code</h1>
<div><p>This is an example of a simple File Transfer Protocol (FTP) Server
Logon exit program. It is written in ILE RPG.</p>
<div class="section"><p> 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"> * Module Description ***********************************************
* *
********************************************************************
* *
* Note: This program is a sample only and has NOT undergone any *
* formal review or testing. *
* *
********************************************************************
* *
* PROGRAM FUNCTION *
* *
* This program demonstrates some of the abilities an FTP Server *
* Logon Exit Program can have. *
* *
********************************************************************
F/SPACE 3
********************************************************************
* *
* INDICATOR USAGE *
* *
* IND. DESCRIPTION *
* *
* LR - CLOSE FILES ON EXIT *
* *
********************************************************************
F/EJECT
********************************************************************
* DATA STRUCTURES USED BY THIS PROGRAM *
********************************************************************
*
* Define constants
*
1 D Anonym C CONST('ANONYMOUS ')
D Text1 C CONST('Anonymous (')
D Text2 C CONST(') FTP logon')
D InvalidNet C CONST('10.')
C/EJECT
********************************************************************
* VARIABLE DEFINITIONS AND LISTS USED BY THIS PROGRAM *
********************************************************************
C/SPACE 2
*
* Define binary parameters
*
D DS
D APPIDds 1 4B 0
D USRLENds 5 8B 0
D AUTLENds 9 12B 0
D IPLENds 13 16B 0
D RETCDds 17 20B 0
*
C *LIKE DEFINE APPIDds APPIDIN
C *LIKE DEFINE USRLENds USRLENIN
C *LIKE DEFINE AUTLENds AUTLENIN
C *LIKE DEFINE IPLENds IPLENIN
C *LIKE DEFINE RETCDds RETCDOUT
*
* Define parameter list
*
C *Entry PLIST
* Input parameters:
C PARM APPIDIN Application ID
* possible values: 1 = FTP Server Program
C PARM USRIN 999 User ID
C PARM USRLENIN Length of User ID
C PARM AUTIN 999 Authentication Strg
C PARM AUTLENIN Length of Auth. Strg
C PARM IPADDRIN 15 Client IP Address
C PARM IPLENIN Length of IP Address
* Return parameters:
C PARM RETCDOUT Return Code (Out)
* possible values: 0 = Reject Logon
* 1 = Continue Logon
* 2 = Continue Logon,
* override current
* library
* 3 = Continue Logon,
* override user prf,
* password
* 4 = Continue Logon,
* override user prf,
* password, current
* library
* 5 = Accept logon with
* user prf returned
* 6 = Accept logon with
* user prf returned,
* override current
* library
C PARM USRPRFOUT 10 User Profile (Out)
C PARM PASSWDOUT 10 Password (Out)
C PARM CURLIBOUT 10 Current Lib. (Out)
C/EJECT
********************************************************************
* THE MAIN PROGRAM *
********************************************************************
*
* Check for ANONYMOUS user
* 1
C USRLENIN SUBST(P) USRIN:1 User 10
C User IFEQ Anonym
C MOVEL Anonym USRPRFOUT
*
* Check if the user entered something as a e-mail address
*
C AUTLENIN IFGT *ZERO
E-mail addr. entered
*
* Check if the E-mail address is a valid one
*
C Z-ADD 0 i 3 0
C '@' SCAN AUTIN:1 i Valid E-mail address
* contains @ character
*
C i IFGT 0 Found a '@'
C AUTLENIN SUBST(P) AUTIN:1 Email 30
C Z-ADD 5 RETCDOUT Accept Logon
*
* Log Anonymous FTP Logon to message queue QSYSOPR
* (The logging should be done to a secure physical file!!!!!!!)
*
C Text1 CAT(p) Email:0 Message 43
C Message CAT(p) Text2:0 Message
C Message DSPLY 'QSYSOPR'
*
C ELSE Invalid E-mail addr
C Z-ADD 0 RETCDOUT Reject Logon attempt
C ENDIF
*
C ELSE No E-mail address
C Z-ADD 0 RETCDOUT Reject Logon attempt
C ENDIF
*
C ELSE
*
* Any Other User: Proceed with Normal Logon Processing, but the Client address must not belong
* to network 10.xxx.xxx.xxx
*
C 3 SUBST IPADDRIN:1 TheNet 3
C TheNet IFEQ InvalidNet Wrong Net
C Z-ADD 0 RETCDOUT Reject Logon attempt
C ELSE Right Net
C Z-ADD 1 RETCDOUT Continue with Logon
C ENDIF
*
C ENDIF
*
C EVAL *INLR = *ON
C RETURN </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>