int FtpInsertTreeEntry ( FtpConnection hConn , const char *pName , const char *pPath , int iReadOnly = 0 , FtpFileCheckerCB pCheckCb = 0 , void *pParam = 0 )
hConn | Handle of the connection. |
pName | Is the name of the share. Use "" for a default share with the base path
"". Only one default share is allowed. |
pPath | Is the path of the share. (i.e
"C:\MyDir" or
"C:\MyDir\") |
iReadOnly | Is the share in the read only mode. |
pCheckCb | Is the
callback for single file access checking, on this
share. Use NULL if no callback is needed. The callback must return this values: 0 = all allowed 1 = read only access 2 = no allowed but file will be listed 3 = the user can't see this file |
iReadOnly | Is the
user parameter for the access
checking callback. |
Returns 0 if the share was inserted or an erro code:
FTP_ERR_NONE | 0 | no error |
FTP_ERR_DOMUCHSHARES | 8 | too much shares defined |
FTP_ERR_WRONGNAME | 9 | wrong share name |
FTP_ERR_DOUBLENAME | 11 | the share name already exists |
For the user anonymous only the base path of FtpDaemon is used for the root folder:
/root |-- . files and folders of the default path |-- xxx |-- yyy |-- ...
For the user smith two folders are in the root folder:
/root |-- . |-- Data tree entry "C:/Users/Smith" \-- ReadOnly tree entry "C:/Users/Smith"
For the user adams two folders and all of "C:/Temp" are in the root folder:
/root |-- . tree entry "C:/Temp" |-- Data tree entry "C:/Users/Adams" |-- ReadOnly tree entry "C:/Users/Adams" |-- xxx files and folders of "C:/Temp" |-- yyy |-- ...
// Is called for every file access and directory enumeration // hConn : handle of the connection. // pPath : pointer to the filepath (i.e. "C:\Temp" ) // pName : pointer to the filename (i.e. "Test.txt") // pParam : is the user parameter of the callback // iShare : is the number of the used share // Returns the access right for this file // 0 = all allowed // 1 = read only access // 2 = no allowed but file will be listed // 3 = the user can't see this file int MyFileCheckerCallback(FtpConnection hConn,const char *pPath,const char *pName,void *pParam,int iShare) { const char *pUser; int iLen; iLen = strlen(pName); if(iLen>4 && !strcmp(pName+iLen-4,".obj")) // hide files which ends with ".obj" { return 3; } if(iShare==0 && !strcmp(pName,"Debug")) // no acces to the debug directory { return 2; } return 0; }
see also:
AzFtp Overview |
FtpDaemon |
FtpStopDaemon