<< Back


pfnAskChangePassword

Synopsis

BOOL (CALLBACK* pfnAskChangePassword) (FVSDK_CALLBACK_DATA pvData, LPCTSTR pszBuffer, int nBufferSize);

Description

Called when the FTP Voyager SDK needs to ask for a password to be changed while connecting to a server. Not many servers support this capability, however Serv-U does.

Parameters

pvAskChangePasswordData

The DWORD value set in the FVSDK_Session structure. The meaning of this value is application defined.

pszBuffer

If TRUE is returned, pszBuffer is a NULL terminated string containing the new password (usually entered by an end user). This string is initially all zeros.

nBufferSize

The maximum number of bytes allocated to pszBuffer. The maximum string length can only be nBufferSize because the caller allocates up to one extra byte for the NULL terminator.

Return Value

Return TRUE to continue with the connection attempt or FALSE to quit the connection.

Example

BOOL CALLBACK OnAskChangePassword(FVSDK_CALLBACK_DATA pvAskChangePasswordData, LPCTSTR pszBuffer, int nBufferSize)
{
    CAskPasswordDlg Dlg;
    BOOL            bRet;

    // ask the user for the new password
    if (Dlg.DoModal() == IDOK) {

        // copy over the user's new password
        strncpy(pszBuffer, Dlg.m_sNewPassword, nBufferSize);

        // yes, continue with the connection
        bRet = TRUE;
    } // if
    else
        bRet = FALSE;

    // return TRUE to continue the connection attempt, otherwise FALSE
    return (bRet);
} // OnAskPassword