CFtpServer::SetClientAccess Method  
 
BOOL SetClientAccess(
  UINT nClientId,  
  DWORD dwUserAccess  
);

Change the access rights associated with the specified client session.

Parameters

nClientId
An unsigned integer which uniquely identifies the client session.
dwUserAccess
An unsigned integer which specifies one or more user access rights. For a list of user access rights that can be granted to the client, see User Access Constants.

Return Value

If the method succeeds, the return value is non-zero. If the client ID does not specify a valid client session, the method will return zero. This method can only be used with authenticated clients. If the client session has not been authenticated, the return value will be zero.

Remarks

The SetClientAccess method can change the access rights for an authenticated client session. This method can only be used after the AuthenticateClient method has been used to grant the initial set of access rights to the client. The EnableClientAccess method can be used to grant or revoke a specific permission for the client session.

The dwUserAccess parameter has a value of FTP_ACCESS_DEFAULT, then default permissions will be granted to the client session. A normal client cannot be changed to a restricted or anonymous client using this method. If the FTP_ACCESS_RESTRICTED or FTP_ACCESS_ANONYMOUS access flags are specified, this method will fail.

This method cannot be used to change the access rights for a restricted or anonymous user. Those rights are granted when the client session is authenticated and will persist until the client disconnects from the server. This restriction is designed to prevent the inadvertent granting of rights to an untrusted client that could compromise the security of the server.

Example

DWORD dwUserAccess = 0;

// Allow the client to execute programs using SITE EXEC
if (pFtpServer->GetClientAccess(nClientId, dwUserAccess))
{
    if (! (dwUserAccess & FTP_ACCESS_ANONYMOUS))
        pFtpServer->SetClientAccess(nClientId, dwUserAccess | FTP_ACCESS_EXECUTE);
}

Requirements

Minimum Desktop Platform: Windows 7 (Service Pack 1)
Minimum Server Platform: Windows Server 2008 R2 (Service Pack 1)
Header File: cstools10.h
Import Library: csftsv10.lib

See Also

AuthenticateClient, EnableClientAccess, GetClientAccess