void socks5_client_init(redsocks_client *client) { socks5_client *socks5 = (void*)(client + 1); const redsocks_config *config = &client->instance->config; client->state = socks5_new; socks5->do_password = socks5_is_valid_cred(config->login, config->password); }
void auto_socks5_client_init(redsocks_client *client) { socks5_client * socks5= (void*)(client + 1); const redsocks_config *config = &client->instance->config; client->state = socks5_pre_detect; socks5->got_data = 0; socks5->data_sent = 0; socks5->do_password = socks5_is_valid_cred(config->login, config->password); init_addr_cache(); }
static void socks5_instance_init(redsocks_instance *instance) { redsocks_config *config = &instance->config; if (config->login || config->password) { bool deauth = false; if (config->login && config->password) { deauth = ! socks5_is_valid_cred(config->login, config->password); } else { log_error(LOG_WARNING, "Socks5 needs either both login and password or none of them"); deauth = true; } if (deauth) { free(config->login); free(config->password); config->login = config->password = NULL; } } }