static void handle_client_connect_cmd(CLIENT_REC *client, const char *cmd, const char *args) { const char *password; password = settings_get_str("irssiproxy_password"); if (password != NULL && g_strcmp0(cmd, "PASS") == 0) { if (g_strcmp0(password, args) == 0) client->pass_sent = TRUE; else { /* wrong password! */ remove_client(client); return; } } else if (g_strcmp0(cmd, "NICK") == 0) { g_free_not_null(client->nick); client->nick = g_strdup(args); } else if (g_strcmp0(cmd, "USER") == 0) { client->user_sent = TRUE; } if (client->nick != NULL && client->user_sent) { if (*password != '\0' && !client->pass_sent) { /* client didn't send us PASS, kill it */ remove_client(client); } else { client->connected = TRUE; proxy_dump_data(client); } } }
static void handle_client_connect_cmd(CLIENT_REC *client, const char *cmd, const char *args) { const char *password; password = settings_get_str("irssiproxy_password"); if (password != NULL && g_strcmp0(cmd, "PASS") == 0) { if (g_strcmp0(password, args) == 0) client->pass_sent = TRUE; else { /* wrong password! */ remove_client(client); return; } } else if (g_strcmp0(cmd, "NICK") == 0) { g_free_not_null(client->nick); client->nick = g_strdup(args); } else if (g_strcmp0(cmd, "USER") == 0) { client->user_sent = TRUE; } if (client->nick != NULL && client->user_sent) { if (*password != '\0' && !client->pass_sent) { /* client didn't send us PASS, kill it */ remove_client(client); } else { signal_emit("proxy client connected", 1, client); printtext(client->server, NULL, MSGLEVEL_CLIENTNOTICE, "Proxy: Client %s:%d connected", client->host, client->port); client->connected = TRUE; proxy_dump_data(client); } } }