Q : How do I retrieve/set the file level ownership attributes of a file/dir inside RaidenFTPD virtual file system?

target audience : RaidenFTPD script software authors / programmer

A : The RaidenFTPD FTP server can handle file level ownership which can not be found easily on other FTPD products for Windows , however it was not easy to get these information externally by 3rd party scripts , and now we are glad to offer this RaidenModeX Active-X control to FTP scripts authors for FREE !

Step1 : download the RaidenModeX Active-X control from here

Step2 : Installation

Extract ModeX.zip into a dir (better be your project dir with a fixed location) , and register the component , type

regsvr32 RaidenModeX.ocx

in the command prompt

Step3 : Open your project , insert this active-x into your project

Example for Microsoft Visual C++

1.Open your project file

2.Pick any dialog resource and click the right mouse button->insert activex control

3.Find RaidenModeX Control and click OK

4.Under the same dialog resource , clicl right mouse button and launch Class wizard

5.Click the member variables tab , find the control id IDC_RAIDENMODEXCTRL1 , and click Add variable button

6.Now the MSVC will ask you if you want to generate a C++ Wrapper class for it , click YES

7.When the Add Member Variable dialog box appears , enter a proper name for it , such as m_modex

8.Now goto the .CPP source file and include the generated RaidenModeX.h header file

9.Supposing you have exported this control name as m_modex (well this is your job)

10.If you have file called xxx.zip , under e:\temp , and it was uploaded via RaidenFTPD system , there should be a .raidenftpd.acl file under e:\temp

11.To get the information of this file , simply use the component's method 'SetFilePath'

BOOL CRaidenModeX::SetFilePath(LPCTSTR fullpath)

parameter :

LPCTSTR fullpath : full path name of the file you want the active-x to get information for you , String type

return value :

TRUE if the active-x can find an entry in the .raidenftpd.acl file for the specified file , FALSE if not

ex:

m_modex.SetFilePath("i:\\temp\\xxx.zip");

 

12.After you call this method , the following properties become available

file owner , file group , file mode , free file , complete file

however you will need to use the following method to retrieve them

GetOwner(); // get the owner name of the file
GetGroup(); // get the group name of the file
GetMode(); // get the permission mode of the file (000-777)
GetFree(); // 0=count credit file , 1=free file
GetComplete(); // 0=not complete or unknown , 1=complete file (passed sfv or zip checking)
GetErrormsg(); // get error message

note : all return values are string type

13.To set the information of a file/dir , simply use the component's method 'Chmod'

long Chmod(LPCTSTR mode, LPCTSTR uname, LPCTSTR gname, LPCTSTR fullpath, short complete, short free)

parameter :

LPCTSTR mode : 000-777 , refer to this page for more info

LPCTSTR uname : 1-10 characters , the username , should not contain space character

LPCTSTR gname : 1-10 characters , the group name , should not contain space character

LPCTSTR fullpath : full path name of the file you want the active-x to set information for you , String type , wildcard in filename is allowed

short complete : 0 or 1 , if the file is tagged as complete or good file

short free : 0 or 1 , if this file will be freely downloadable by everyone without credit

return value :

always 0

ex:

m_modex.Chmod("755","john","admin","c:\temp\*.zip",1,1);

 

14.Note to the Visual Basic Users

1. Attach OCX as a component and place on form.

2. Initiate SetFilePath(path\file) method.

3. If returns TRUE, the owner, group, complete, free, mode, and errormsg properties are already updated (no need to initiate another GETXXX() method).

Calling that second methods were what I was confused about. It seems there is no need in VB to do that since the properties are auto filled if TRUE. Thanks.

Warning : License Agreements

Licensing the RaidenModeX ActiveX control for distribution
=============================================================================

The RaidenModeX ActiveX control

The RaidenModeX ActiveX control package allows you to include RaidenModeX.ocx in your 32-bit Windows applications, and to distribute these applications royalty-free if the following requirements are satistifed .

1:You can only distribute it with any software packages that supports RaidenFTPD , not including FTP server packages

2.You must notify RaidenFTPD team before you distribute this activex control

3.You must put a copyright notice for this component in your readme file or software's about page

copyright owner : (C) RaidenFTPD team , 2002-2005

4.Absolutely no warranty , if you use it or distribute it with your software package , you agree to use it with your own risk

 

Copyright © RaidenFTPD TEAM , ALL RIGHTS RESERVED

REVISION 2.4 , 2004/01/28