midrange.com code scratchpad |
Name:
FTPEXIT
|
Scriptlanguage:
Plain Text
|
Tabwidth:
4
|
Date:
03/10/2011 02:23:13 pm
|
IP:
Logged
|
|
Description:
restrict FTP subcommands from Exit point: QIBM_QTMF_SERVER_REQ Format: VLRQ0100
This program prevents basic users from leaving their home directories & allows developers to change name formats, etc.
|
Code:
- hoption(*nodebugio:*srcstmt) dftactgrp(*no) actgrp(*caller)
-
- dFTPExit pr
- d ApplicationID 10i 0
- d OperationID 10i 0
- d UserProfile 10a
- d IPAddress 15a
- d IPAddressLen 10i 0
- d OperationInfo 999a Options(*VarSize)
- d OperationLen 10i 0
- d AllowOperation 10i 0
-
- dFTPExit pi
- d ApplicationID 10i 0
- d OperationID 10i 0
- d UserProfile 10a
- d IPAddress 15a
- d IPAddressLen 10i 0
- d OperationInfo 999a Options(*VarSize)
- d OperationLen 10i 0
- d AllowOperation 10i 0
-
- dHomeDir s 999a Varying
-
- dLower c Const('abcdefghijklmnopqrstuvwxyz')
- dUpper c Const('ABCDEFGHIJKLMNOPQRSTUVWXYZ')
-
- dNeverAllow c Const(-1)
- dDontAllow c Const(0)
- dAllow c Const(1)
- dAlwaysAllow c Const(2)
-
- dStartFTP c Const(0)
- dCreateDir c Const(1)
- dDeleteDir c Const(2)
- dChangeDir c Const(3)
- dListDir c Const(4)
- dDeleteFile c Const(5)
- dPutFile c Const(6)
- dGetFile c Const(7)
- dRenameFile c Const(8)
- dCLCmd c Const(9)
-
- /free
-
- Select;
- When ApplicationID = 0;
- ExSR ClientRequest;
-
- When ApplicationID = 1;
- If OperationID = StartFTP;
- AllowOperation = Allow;
- *InLR = *On;
- Return;
- EndIf;
- ExSR ServerRequest;
- EndSl;
-
- *InLR = *On;
- Return;
-
- BegSR ClientRequest;
- EndSR;
-
- BegSR ServerRequest;
- Select;
- When %Subst(UserProfile:1:1) = 'Q';
- AllowOperation = AlwaysAllow;
-
- Other;
- If UserProfile = 'XXXXXXTWH'
- Or UserProfile = 'XXXXXXJDS'
- Or UserProfile = 'XXXXXXDBJ'
- Or UserProfile = 'XXXXXXBOB'
- Or UserProfile = 'XXXXXXREM'
- Or UserProfile = 'XXXXXXMLS'
- Or UserProfile = 'XXXXXXCAT'
- Or UserProfile = 'XXXXXXJEN';
- AllowOperation = AlwaysAllow;
- Else;
- If OperationID = ChangeDir;
- HomeDir = '/home/' + %Trim(UserProfile);
- If %Scan(HomeDir:OperationInfo) = 0;
- AllowOperation = DontAllow;
- Else;
- AllowOperation = Allow;
- EndIf;
- Else;
- AllowOperation = Allow;
- EndIf;
- EndIf;
- EndSl;
- EndSR;
-
|
|
|