/* * 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; }
/* * Function: ftpp_ui_config_reset_global(FTPTELNET_GLOBAL_CONF *GlobalConf) * * Purpose: This function resets the global parameters. * THIS IS NOT THE GLOBAL FTP CLIENT CONFIGURATION. * * Arguments: GlobalConf => pointer to the global configuration structure * * Returns: int => return code indicating error or success * */ int ftpp_ui_config_reset_global(FTPTELNET_GLOBAL_CONF *GlobalConf) { int iRet; /* Clean these up before mem setting */ ftp_bounce_lookup_cleanup(&GlobalConf->default_ftp_client->bounce_lookup); ftp_cmd_lookup_cleanup(&(GlobalConf->default_ftp_server->cmd_lookup)); ftpp_ui_client_lookup_cleanup(&GlobalConf->client_lookup); ftpp_ui_server_lookup_cleanup(&GlobalConf->server_lookup); memset(GlobalConf, 0x00, sizeof(FTPTELNET_GLOBAL_CONF)); iRet = ftpp_ui_client_lookup_init(&GlobalConf->client_lookup); if (iRet) { return iRet; } iRet = ftpp_ui_server_lookup_init(&GlobalConf->server_lookup); if (iRet) { return iRet; } return FTPP_SUCCESS; }
/* * 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; }