求serv-U插件开发资料一份(100分)

  • 主题发起人 主题发起人 fenghuo
  • 开始时间 开始时间
F

fenghuo

Unregistered / Unconfirmed
GUEST, unregistred user!
我想做一个有关帐号自动管理的小工具哪位朋友能提供一份serv-U插件开发资料一份

fenghuo@hotmail.com
QQ:7469504(请认证时注明serv-u)
 
呼呼,具体可以参考 Serv-U 帮助 Add-on DLLs Overview

Serv-U can use an external DLL to verify client access and retrieve information such as a client's home directory etc. If one of more external DLLs are specified and Serv-U cannot find the appropriate information internally it will question each of the external DLL's in turn. This can be used to create an interface to external user databases, which can then control FTP server access. With the appropriate DLL, for example the NT build-in user database could be used, or a Novell user database.

Setup

To make Serv-U use external DLLs for client access verification the DLL names need to be added to the ServUDaemon.ini file. There is currently no interactive user setup to do this, so the INI file has to be edited directly with a text editor such as NotePad. There can be more than one DLL, and Serv-U will query them in the order specified until one of the DLLs signals that it had the required information.

The DLL names need to be added to a section named '[EXTERNAL]'. The format is as follows (using made-up DLL names):

[EXTERNAL]
ClientCheckDLL1=CHKNOVELL.DLL
ClientCheckDLL2=CHKNT.DLL

.
.

The file names can be either full path names, or file names only. If the full path is specified then Serv-U will look at that path only. If a file name is given with path information Serv-U will first look in the program directory, then the current directory, the entire PATH, and finally in the Windows directories.

DLL Specifications

Upon startup Serv-U looks for DLLs in the 慬EXTERNAL]?section of the ServUDaemon.ini file and tries to bind to a specific function in the DLLs. The DLL entry point for Serv-U needs to be the following function:

int __cdecl HandleClientEvent(RClientEventStr* pEventStruc)

Please note that the function name is case sensitive and uses the "C" calling convention. This is defined as "generate underbars, case sensitive, push parameters right to left, calling function cleans stack". For the Borland line of C/C++ compilers (and those were used to create Serv-U) this is the default calling convention, or it can be specified explicitly by using the 慱_cdecl?keyword. For other compilers you may have to use a different keyword. Check your compiler抯 documentation for a matching type. Using the wrong calling convention will likely result in a program crash immediately during or after the first time Serv-U tries to call the HandleClientEvent() function.

The function should return TRUE (=1) if it handled the event and does not want it to be passed on to the next DLL. It should return FALSE (=0) in case it did not handle the event.

The RClientEventStr structure is defined as follows:


struct RClientEventStr {
int Event; // event code
int Flag; // flag, meaning depends on event
char User[40]; // user name
char Aux[512]; // auxiliary area, usage depends on event
char HostIP[16]; // server domain IP address
unsigned long SessionID; // unique session ID
int DomainID; // unique ID for the domain the client connected to
int DomainPort; // server domain port number the client connected to
}

The 'Event' code determines the nature of the request and can have the following values:


#define SRVU_LoginMesFile 1 // get login message file
#define SRVU_HomeDir 2 // get home dir
#define SRVU_Password 3 // verify password
#define SRVU_IPAccess 4 // verify IP access
#define SRVU_WriteFile 5 // verify write access
#define SRVU_ReadFile 6 // verify read access
#define SRVU_ModifyFile 7 // verify mod./del. file access
#define SRVU_ExecProg 8 // verify execute access

#define SRVU_ListDir 9 // verify dir listing access
#define SRVU_ChangeDir 10 // verify dir change access
#define SRVU_DeleteDir 11 // verify dir delete access
#define SRVU_CreateDir 12 // verify dir create access
#define SRVU_HideHidden 13 // get setting for 'hide hidden files'
#define SRVU_RelPaths 14 // get setting for 'relative paths'
#define SRVU_RatioType 15 // get setting for type of ratios

#define SRVU_RatioDown 16 // get setting for download ratio
#define SRVU_RatioUp 17 // get setting for upload ratio
#define SRVU_RatioCredit 18 // get/adjust ratio credit setting
#define SRVU_RatioFree 19 // verify if file is free for ratios
#define SRVU_QuotaEnable 20 // verify if disk quota is enabled
#define SRVU_QuotaChange 21 // change in disk quota

#define SRVU_QuotaMax 22 // maximum disk quota
#define SRVU_AlwaysLogin 23 // always allow login
#define SRVU_OneLoginPerIP 24 // allow one login per user/IP pair
#define SRVU_LogClientIP 25 // log client from this IP address
#define SRVU_SpeedLimit 26 // maximum transfer speed
#define SRVU_PassChange 27 // change user's password
#define SRVU_TimeOut 28 // get user time-out value

#define SRVU_MaxUsers 29 // max. no. of users for account
#define SRVU_PassChallenge 30 // get password challenge if needed
#define SRVU_Connect 31 // information only: client connected
#define SRVU_Close 32 // information only: client disconnected
#define SRVU_MaxLoginPerIP 33 // max. no. of logins from same IP for user
#define SRVU_VerifyPasswd 34 // verify old password before changing it

#define SRVU_AppendFile 35 // verify append file access
#define SRVU_SignOnMes 36 // get signon message file
#define SRVU_SignOffMes 37 // get signoff message file

#define SRVU_Maintenance 38 // switch to maintenance mode
#define SRVU_SessionTimeOut 39 // session time-out
#define SRVU_SecureOnly 40 // only allow login over secure connection

Be sure to read the section on access verification events before implementing a DLL!

Serv-U Help - Copyright ?1995-2003 Cat-Soft, All Rights Reserved
 
呵呵,这个问题好。[:D]
 
(*
Description : Serv-U FTP Server (v2.5a, 32-bit) DLL includes/defines
for client access verification.

Copyright (c) 1999 ASI/EDI, Inc. All rights reserved.
WES 08/03/99 Initial Version
*)

unit ServUCli;

interface

uses
Windows;

type
// HandleClientEvent parameter

TPRClientEventStr = ^TRClientEventStr;

// Client event structure

TRClientEventStr = record
Event : DWORD; // event code
Flag : DWORD; // meaning of flag depends on event
User : Array[0..40-1] of Char; // user name
Aux : Array[0..512-1] of Char; // auxiliary area, depends on event
HostIP : Array[0..16-1] of Char; // server IP home
SessionID : DWORD; // unique ID of the FTP session
end; { record TRClientEventStr }

const
// Return values for HandleClientEvent
CLIENT_EVENT_HANDLED : LongBool = True;
CLIENT_EVENT_NOT_HANDLED : LongBool = False;

// Flag values in TRClientEventStr for SRVU_Password event
FLAG_ALLOW_LOGIN : DWORD = 1;
FLAG_DENY_LOGIN : DWORD = 0;

// Flag values in TRClientEventStr for SRVU_HomeDir event
FLAG_FOUND_HOMEDIR : DWORD = 1;
FLAG_NO_HOMEDIR : DWORD = 0;

// Serv-U client event codes
SRVU_LoginMesFile = 1; // get login message file
SRVU_HomeDir = 2; // get home dir
SRVU_Password = 3; // verify password
SRVU_IPAccess = 4; // verify IP access
SRVU_WriteFile = 5; // verify write access
SRVU_ReadFile = 6; // verify read access
SRVU_ModifyFile = 7; // verify mod./del. file access
SRVU_ExecProg = 8; // verify execute access
SRVU_ListDir = 9; // verify dir listing access
SRVU_ChangeDir = 10; // verify dir change access
SRVU_DeleteDir = 11; // verify dir delete access
SRVU_CreateDir = 12; // verify dir create access
SRVU_HideHidden = 13; // get setting for 'hide hidden files'
SRVU_RelPaths = 14; // get setting for 'relative paths'
SRVU_RatioType = 15; // get setting for type of ratios
SRVU_RatioDown = 16; // get setting for download ratio
SRVU_RatioUp = 17; // get setting for upload ratio
SRVU_RatioCredit = 18; // get/adjust ratio credit setting
SRVU_RatioFree = 19; // verify if file is free for ratios
SRVU_QuotaEnable = 20; // verify if disk quota is enabled
SRVU_QuotaChange = 21; // change in disk quota
SRVU_QuotaMax = 22; // maximum disk quota
SRVU_AlwaysLogin = 23; // always allow login
SRVU_OneLoginPerIP = 24; // allow one login per user/IP pair
SRVU_LogClientIP = 25; // log client from this IP address
SRVU_SpeedLimit = 26; // maximum transfer speed
SRVU_PassChange = 27; // change user's password
SRVU_TimeOut = 28; // get user time-out value
SRVU_MaxUsers = 29; // max. no. of users for account
SRVU_PassChallenge = 30; // get password challenge if needed
SRVU_Connect = 31; // information only: client connected
SRVU_Close = 32; // information only: client disconnected
SRVU_MaxLoginPerIP = 33; // max. no. of logins from same IP for user
SRVU_VerifyPasswd = 34; // verify old password before changing it
SRVU_AppendFile = 35; // verify append file access
SRVU_SignOnMes = 36; // get signon message file
SRVU_SignOffMes = 37; // get signoff message file
SRVU_Maintenance = 39; // switch to maintenance mode
implementation

end.
------------------------------------------------------------------
(*
Description : Serv-U FTP Server (v2.5a, 32-bit) DLL includes/defines
for event notification and hooking.

Copyright (c) 1999 ASI/EDI, Inc. All rights reserved.
WES 07/15/99 Initial Version
*)

unit ServUEvt;

interface

uses
Windows;

type
// HandleEventHook parameter

TPRFTPEventStr = ^TRFTPEventStr;

// Event notification structure

TRFTPEventStr = record
// event info
Event: DWORD; // event code
SubEvent: DWORD; // sub-event code
// user info
SessionID: DWORD; // unique ID of the FTP session
User: Array[0..40-1] of Char; // user name
ClientIP: Array[0..16-1] of Char; // IP number of client
LocalIP: Array[0..16-1] of Char; // IP number the client connected to
// event attributes
Duration: DWORD; // duration of events (in seconds)
Size: DWORD; // size of object (i.e. file)
// hook info
hWindow: HWND; // window handle to post decision to
Message: UINT; // message to post
pReplyText: PChar; // pointer to text to send to user
// scratch pad area
AuxOne: Array[0..512-1] of Char; // auxiliary area one
AuxTwo: Array[0..512-1] of Char; // auxiliary area two
end; { record RFTPEventStr }

const
// HandleEventHook return codes
REVNT_None = 0; // nothing
REVNT_Proceed = 1; // let event pass
REVNT_Abort = 2; // stop event
REVNT_Suspend = 3; // suspend event until decision is made

// Serv-U notification event codes
EVNT_None = 0; // none
EVNT_IPName = 1; // symbolic IP name available
EVNT_Connect = 2; // connection was made
EVNT_Close = 3; // closed connection
EVNT_BouncedIP = 4; // bounced client because of IP address
EVNT_TooMany = 5; // bounced user because there are too many
EVNT_WrongPass = 6; // too many times wrong password
EVNT_TimeOut = 7; // connection timed out
EVNT_Login = 8; // user logged in
EVNT_StartUp = 9; // start upload of file
EVNT_EndUp = 10; // successful upload of file
EVNT_StartDown = 11; // start of download of file
EVNT_EndDown = 12; // successful download of file
EVNT_AbortUp = 13; // aborted upload
EVNT_AbortDown = 14; // aborted download
EVNT_Rename = 15; // renamed file/dir
EVNT_DelFile = 16; // deleted file
EVNT_DelDir = 17; // deleted dir
EVNT_ChgDir = 18; // changed working directory
EVNT_MakeDir = 19; // created directory
EVNT_ProgUp = 20; // progress of upload
EVNT_ProgDown = 21; // progress of download

// Serv-U hook event codes
EVNT_HookDown = 100; // hook for file downloads
EVNT_HookUp = 101; // hook for file uploads
EVNT_HookAppend = 102; // hook for append file upload
EVNT_HookUnique = 103; // hook for unique name upload
EVNT_HookRename = 104; // hook for rename file/dir
EVNT_HookDelFile = 105; // hook for delete file
EVNT_HookDelDir = 106; // hook for delete dir
EVNT_HookMkd = 107; // hook for make directory
EVNT_HookSite = 108; // hook for the SITE command
EVNT_HookChgDir = 109; // hook for change dir command

// Serv-U sub-event codes
SEVNT_None = 0; // no sub-event
SEVNT_ErrWrite = 1; // problem writing to disk
SEVNT_ErrRead = 2; // problem reading from disk
SEVNT_ErrQuota = 3; // insufficient disk quota
SEVNT_ErrTOut = 4; // packet timed out
SEVNT_ErrAbort = 5; // user aborted transfer
SEVNT_ErrUnknown = 6; // unknown error
SEVNT_ErrClose = 7; // data connection closed unexpectedly

implementation

end.
-----------------------------
你到官方网站找就有delphi的例子。
 
谢谢各位兄弟,我已经找到了.
 
贴个地址出来吧,我也想看看
 
后退
顶部