/*
 * Function: ftpp_ui_config_reset_ftp_client(FTP_CLIENT_PROTO_CONF *ClientConf,
 *                                  int first)
 *
 * Purpose: This function resets a ftp client construct.
 *
 * Arguments: ClientConf    => pointer to the FTP_CLIENT_PROTO_CONF structure
 *            first         => indicator whether this is a new conf
 *
 *
 * Returns: int => return code indicating error or success
 *
 */
int ftpp_ui_config_reset_ftp_client(FTP_CLIENT_PROTO_CONF *ClientConf,
                                    int first)
{
    int iRet;
    FTP_BOUNCE_TO *NextBounceTo = NULL;

    if (!first)
    {
        do
        {
            NextBounceTo = ftp_bounce_lookup_first(ClientConf->bounce_lookup,
                                                   &iRet);

            if (NextBounceTo)
            {
                free(NextBounceTo);
            }

            NextBounceTo = ftp_bounce_lookup_next(ClientConf->bounce_lookup,
                                                  &iRet);
        }
        while ((NextBounceTo != NULL) && (iRet == FTPP_SUCCESS));

        ftp_bounce_lookup_cleanup(&ClientConf->bounce_lookup);
    }

    memset(ClientConf, 0x00, sizeof(FTP_CLIENT_PROTO_CONF));

    ftp_bounce_lookup_init(&ClientConf->bounce_lookup);

    ClientConf->max_resp_len = FTPP_UI_CONFIG_FTP_DEF_RESP_MSG_MAX;

    return FTPP_SUCCESS;
}
Exemple #2
0
/*
 * Function: ftpp_ui_config_reset_ftp_client(FTP_CLIENT_PROTO_CONF *ClientConf,
 *                                  char first)
 *
 * Purpose: This function resets a ftp client construct.
 *
 * Arguments: ClientConf    => pointer to the FTP_CLIENT_PROTO_CONF structure
 *            first         => indicator whether this is a new conf
 *
 *
 * Returns: int => return code indicating error or success
 *
 */
int ftpp_ui_config_reset_ftp_client(FTP_CLIENT_PROTO_CONF *ClientConf,
                                    char first)
{
    int iRet = FTPP_SUCCESS;
    //FTP_BOUNCE_TO *NextBounceTo = NULL;

    if (first == 0)
    {
        ftp_bounce_lookup_cleanup(&ClientConf->bounce_lookup);
    }
    if (ClientConf->clientAddr)
    {
        free(ClientConf->clientAddr);
    }

    memset(ClientConf, 0x00, sizeof(FTP_CLIENT_PROTO_CONF));

    ftp_bounce_lookup_init(&ClientConf->bounce_lookup);

    ClientConf->max_resp_len = (unsigned int)FTPP_UI_CONFIG_FTP_DEF_RESP_MSG_MAX;

    return iRet;
}