/* * Function: FTPFreeSession(void *preproc_session) * * Purpose: This function frees the data that is associated with a session. * * Arguments: preproc_session => pointer to the session to free * * Returns: None */ static void FTPFreeSession(void *preproc_session) { FTP_SESSION *ssn = (FTP_SESSION *)preproc_session; FTPTELNET_GLOBAL_CONF *pPolicyConfig = NULL; if (ssn == NULL) return; pPolicyConfig = (FTPTELNET_GLOBAL_CONF *)sfPolicyUserDataGet(ssn->global_conf, ssn->policy_id); if (pPolicyConfig != NULL) { pPolicyConfig->ref_count--; if ((pPolicyConfig->ref_count == 0) && (ssn->global_conf != ftp_telnet_config)) { sfPolicyUserDataClear (ssn->global_conf, ssn->policy_id); FTPTelnetFreeConfig(pPolicyConfig); if (sfPolicyUserPolicyGetActive(ssn->global_conf) == 0) FTPTelnetFreeConfigs(ssn->global_conf); } } if (ssn->filename) { free(ssn->filename); } free(ssn); }
/* * Function: FTPFreeSession(void *preproc_session) * * Purpose: This function frees the data that is associated with a session. * * Arguments: preproc_session => pointer to the session to free * * Returns: None */ static void FTPFreeSession(void *preproc_session) { FTP_SESSION *ssn = (FTP_SESSION *)preproc_session; FTPTELNET_GLOBAL_CONF *pPolicyConfig = NULL; ssl_callback_interface_t *ssl_cb = (ssl_callback_interface_t *)_dpd.getSSLCallback(); if (ssn == NULL) return; pPolicyConfig = (FTPTELNET_GLOBAL_CONF *)sfPolicyUserDataGet(ssn->global_conf, ssn->policy_id); if (pPolicyConfig != NULL) { pPolicyConfig->ref_count--; if ((pPolicyConfig->ref_count == 0) && (ssn->global_conf != ftp_telnet_config)) { sfPolicyUserDataClear (ssn->global_conf, ssn->policy_id); FTPTelnetFreeConfig(pPolicyConfig); if (sfPolicyUserPolicyGetActive(ssn->global_conf) == 0) FTPTelnetFreeConfigs(ssn->global_conf); } } if (ssn->filename) { free(ssn->filename); } if ( ssl_cb ) ssl_cb->session_free(ssn->flow_id); free(ssn); }