mirror of
https://github.com/Tha14/toxic.git
synced 2025-07-03 12:16:44 +02:00
Replace DNS-based username lookups with HTTPS & drop utox.org support
This commit is contained in:
28
src/toxic.c
28
src/toxic.c
@ -58,6 +58,7 @@
|
||||
#include "message_queue.h"
|
||||
#include "execute.h"
|
||||
#include "term_mplex.h"
|
||||
#include "name_lookup.h"
|
||||
|
||||
#ifdef X11
|
||||
#include "xtra.h"
|
||||
@ -155,6 +156,7 @@ void exit_toxic_success(Tox *m)
|
||||
free_global_data();
|
||||
tox_kill(m);
|
||||
endwin();
|
||||
name_lookup_cleanup();
|
||||
|
||||
#ifdef X11
|
||||
/* We have to terminate xtra last coz reasons
|
||||
@ -904,7 +906,7 @@ static void print_usage(void)
|
||||
fprintf(stderr, " -o, --noconnect Do not connect to the DHT network\n");
|
||||
fprintf(stderr, " -p, --SOCKS5-proxy Use SOCKS5 proxy: Requires [IP] [port]\n");
|
||||
fprintf(stderr, " -P, --HTTP-proxy Use HTTP proxy: Requires [IP] [port]\n");
|
||||
fprintf(stderr, " -r, --dnslist Use specified DNSservers file\n");
|
||||
fprintf(stderr, " -r, --namelist Use specified name lookup server list\n");
|
||||
fprintf(stderr, " -t, --force-tcp Force toxic to use a TCP connection (use with proxies)\n");
|
||||
fprintf(stderr, " -T, --tcp-server Act as a TCP relay server: Requires [port]\n");
|
||||
fprintf(stderr, " -u, --unencrypt-data Unencrypt an encrypted data file\n");
|
||||
@ -932,7 +934,7 @@ static void parse_args(int argc, char *argv[])
|
||||
{"nodes", required_argument, 0, 'n'},
|
||||
{"help", no_argument, 0, 'h'},
|
||||
{"noconnect", no_argument, 0, 'o'},
|
||||
{"dnslist", required_argument, 0, 'r'},
|
||||
{"namelist", required_argument, 0, 'r'},
|
||||
{"force-tcp", no_argument, 0, 't'},
|
||||
{"tcp-server", required_argument, 0, 'T'},
|
||||
{"SOCKS5-proxy", required_argument, 0, 'p'},
|
||||
@ -1044,10 +1046,10 @@ static void parse_args(int argc, char *argv[])
|
||||
break;
|
||||
|
||||
case 'r':
|
||||
snprintf(arg_opts.dns_path, sizeof(arg_opts.dns_path), "%s", optarg);
|
||||
snprintf(arg_opts.nameserver_path, sizeof(arg_opts.nameserver_path), "%s", optarg);
|
||||
|
||||
if (!file_exists(arg_opts.dns_path))
|
||||
queue_init_message("DNSservers file not found");
|
||||
if (!file_exists(arg_opts.nameserver_path))
|
||||
queue_init_message("nameserver list not found");
|
||||
|
||||
break;
|
||||
|
||||
@ -1222,7 +1224,18 @@ int main(int argc, char **argv)
|
||||
exit_toxic_err("failed in main", FATALERR_MEMORY);
|
||||
|
||||
const char *p = arg_opts.config_path[0] ? arg_opts.config_path : NULL;
|
||||
int settings_err = settings_load(user_settings, p);
|
||||
|
||||
if (settings_load(user_settings, p) == -1)
|
||||
queue_init_message("Failed to load user settings");
|
||||
|
||||
int nameserver_ret = name_lookup_init();
|
||||
|
||||
if (nameserver_ret == -1)
|
||||
queue_init_message("curl failed to initialize; name lookup service is disabled.");
|
||||
else if (nameserver_ret == -2)
|
||||
queue_init_message("Name lookup server list could not be found.");
|
||||
else if (nameserver_ret == -3)
|
||||
queue_init_message("Name lookup server list does not contain any valid entries.");
|
||||
|
||||
#ifdef X11
|
||||
if (init_xtra(DnD_callback) == -1)
|
||||
@ -1271,9 +1284,6 @@ int main(int argc, char **argv)
|
||||
|
||||
init_notify(60, 3000);
|
||||
|
||||
if (settings_err == -1)
|
||||
queue_init_message("Failed to load user settings");
|
||||
|
||||
/* screen/tmux auto-away timer */
|
||||
if (init_mplex_away_timer(m) == -1)
|
||||
queue_init_message("Failed to init mplex auto-away.");
|
||||
|
Reference in New Issue
Block a user