PDA

View Full Version : [REQ] Small Example On How Initialize And Using ioFTP Modules


Jog
10-13-2005, 09:15 AM
I search for a small example in c on how initialize and use ioftpd modules.
For example how load user module and how use GetProc for get the procedure "User2Uid".
with no 'LNK2019 ... "int __cdecl User2Uid(char *)" (?User2Uid@@YAHPAD@Z) ...' error during compilation.
I use Visual Studio 2003 for compiling.

Thanks a lot.

neoxed
10-13-2005, 03:47 PM
You have to resolve those functions yourself during module initialisation, using the GetProc function. There are four types of modules and each module has its own specific module structure and initialisation/deinitialisation functions. You have to export the appropriate initialisation functions (UserModuleInit, GroupModuleInit, EventInit, or MessageVariableInit), as well was as the appropriate deinitialisation function. ioFTPD will call the module initialisation function and will pass one of the following data structures:

USER_MODULE for user modules, store user files elsewhere (e.g. a SQL database backend).
GROUP_MODULE for group modules, store group files elsewhere (e.g. a SQL database backend).
EVENT_MODULE for event modules, triggered on events defined in ioFTPD.ini.
VARIABLE_MODULE for variable modules, add custom variables to message files.

Use the GetProc function (pointed to by the GetProc module structure member) to resolve the functions listed in ioFTPD’s headers. None of the functions in the ioFTPD’s headers are documented, although most are fairly self-explanatory. For more information see the following threads:

http://www.inicom.net/forum/showthread.php?t=11952
http://www.inicom.net/forum/showthread.php?t=11567
http://www.inicom.net/forum/showthread.php?t=11422

You should have a good understanding of C before writing an ioFTPD module; otherwise, you will probably be overwhelmed. Not that writing the module is complex, but it requires a fair bit of hacking (i.e. trial and error) and skill sets that beginners lack.

Jog
10-14-2005, 02:19 PM
very thanks for your reply, i try to export the user module initialization routine inserting :

__declspec(dllexport) BOOL User_StandardInit(LPUSER_MODULE);

in user.h and when try to call in main .cpp i recieve an error.

neoxed
10-14-2005, 02:44 PM
First off, the name of the module initialisation is wrong. It must be UserModuleInit for user modules, as I said in my first post (please read it). Secondly, I cannot read your screen or the code you've written, so I have no idea what this error message is.

_panic_
10-15-2005, 12:17 PM
jog,

i'm actually working on this exact thing, in order to provide a skeleton for people to use writing modules. i'm not ready to publish anything yet. (i haven't even tried to deal with dll export yet, which is what you are trying to figure out.)

if you want to post error messages and other specific issues, i'd be more than happy to try and lend a hand. i'll also try to speed up my own progress on this so i'm in a better position to help you with this particular issue.

Jog
02-20-2006, 11:44 AM
I have correctly initialized and used group, user and variable modules, but on user module and group module , the only function wich work over the internal ioftpd routine, is the function pointed from lpUserModule->Create and lpGroupModule->Create in LPUSER_MODULE and LPGROUP_MODULE structure; for example this funcs now output a debug string or put a message in a log with no problems. I don't find any way of overwrite the internal ioftpd user/group routines for open,write,read,rename,delete users/group.
The modules is initialized correctly, on initialize put a message in ioFTPD.log.....
I have ask to panic and neoxed but , yours tips do not resolve my Problem (very thanks for support). I use ioftpd 5.8.7r and lastest sources headers included with 5.8.0r. (I have tried with other oldest version but no changes).

I have exported UserModuleInit/GroupModuleInit and filled LPUSER_MODULE and LPGROUP_MODULE , in tszModuleName,DeInitialize,Create,Delete,Rename,Lo ck,Write,Open,Close,Unlock; basically all functions write only a debug log when called, but only the function pointed to lpModule->Create, print this debug log; all other functions works as the user/group module not exist.

I'm wait any tips! Very thanks to anyone can help me.

Jog
02-22-2006, 05:33 AM
Nobody can help me ?

_panic_
02-22-2006, 12:41 PM
Nobody can help me ?

i've still got some windows open looking into this, but nothing obvious is popping up yet. if i don't find anything, you might have to wait for me to catch up with you on module development.

so far, everything you're doing should work. i'm going to have to trace the code in the debugger to figure out why it isn't.

Jog
02-22-2006, 01:42 PM
You have pm with full test code, i try to do correctly working. Thanks for support.

_panic_
02-22-2006, 01:47 PM
You have pm with full test code, i try to do correctly working. Thanks for support.

got it! i'll plop it in the debugger and get back to you.