mirror of
https://github.com/Tha14/toxic.git
synced 2024-11-23 09:43:02 +01:00
don't allow DNS lookups when using a proxy + forced TCP & fix arg parsing
This commit is contained in:
parent
1d6ccf56a8
commit
68ec484a58
@ -377,6 +377,11 @@ void *dns3_lookup_thread(void *data)
|
|||||||
/* creates new thread for dns3 lookup. Only allows one lookup at a time. */
|
/* creates new thread for dns3 lookup. Only allows one lookup at a time. */
|
||||||
void dns3_lookup(ToxWindow *self, Tox *m, const char *id_bin, const char *addr, const char *msg)
|
void dns3_lookup(ToxWindow *self, Tox *m, const char *id_bin, const char *addr, const char *msg)
|
||||||
{
|
{
|
||||||
|
if (arg_opts.use_proxy && arg_opts.force_tcp) {
|
||||||
|
line_info_add(self, NULL, NULL, NULL, SYS_MSG, 0, 0, "DNS lookups are disabled.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (t_data.busy) {
|
if (t_data.busy) {
|
||||||
const char *err = "Please wait for previous user lookup to finish.";
|
const char *err = "Please wait for previous user lookup to finish.";
|
||||||
line_info_add(self, NULL, NULL, NULL, SYS_MSG, 0, 0, err);
|
line_info_add(self, NULL, NULL, NULL, SYS_MSG, 0, 0, err);
|
||||||
|
16
src/toxic.c
16
src/toxic.c
@ -203,7 +203,7 @@ static Tox *init_tox(void)
|
|||||||
fprintf(stderr, "UDP disabled\n");
|
fprintf(stderr, "UDP disabled\n");
|
||||||
|
|
||||||
if (tox_opts.proxy_enabled && m == NULL)
|
if (tox_opts.proxy_enabled && m == NULL)
|
||||||
exit_toxic_err("Proxy failed to connect", FATALERR_PROXY);
|
exit_toxic_err("Proxy error", FATALERR_PROXY);
|
||||||
|
|
||||||
if (m == NULL)
|
if (m == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -599,7 +599,11 @@ static void parse_args(int argc, char *argv[])
|
|||||||
case 'p':
|
case 'p':
|
||||||
arg_opts.use_proxy = 1;
|
arg_opts.use_proxy = 1;
|
||||||
snprintf(arg_opts.proxy_address, sizeof(arg_opts.proxy_address), "%s", optarg);
|
snprintf(arg_opts.proxy_address, sizeof(arg_opts.proxy_address), "%s", optarg);
|
||||||
arg_opts.proxy_port = (uint16_t) atoi(argv[optind++]);
|
|
||||||
|
if (++optind > argc || argv[optind-1][0] == '-')
|
||||||
|
exit_toxic_err("Proxy error", FATALERR_PROXY);
|
||||||
|
|
||||||
|
arg_opts.proxy_port = (uint16_t) atoi(argv[optind-1]);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'r':
|
case 'r':
|
||||||
@ -750,10 +754,10 @@ int main(int argc, char *argv[])
|
|||||||
line_info_add(prompt, NULL, NULL, NULL, SYS_MSG, 0, 0, "Failed to load user settings");
|
line_info_add(prompt, NULL, NULL, NULL, SYS_MSG, 0, 0, "Failed to load user settings");
|
||||||
|
|
||||||
if (arg_opts.use_proxy && !arg_opts.force_tcp) {
|
if (arg_opts.use_proxy && !arg_opts.force_tcp) {
|
||||||
msg = "WARNING: Using a proxy without disabling UDP may leak your real IP address.";
|
msg = "* WARNING: Using a proxy without disabling UDP may leak your real IP address.";
|
||||||
line_info_add(prompt, NULL, NULL, NULL, SYS_MSG, 0, 0, "%s", msg);
|
line_info_add(prompt, NULL, NULL, NULL, SYS_MSG, 0, RED, "%s", msg);
|
||||||
msg = "Use the -t option to disable UDP";
|
msg = " Use the -t option to disable UDP.";
|
||||||
line_info_add(prompt, NULL, NULL, NULL, SYS_MSG, 0, 0, "%s", msg);
|
line_info_add(prompt, NULL, NULL, NULL, SYS_MSG, 0, RED, "%s", msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t last_save = (uint64_t) time(NULL);
|
uint64_t last_save = (uint64_t) time(NULL);
|
||||||
|
Loading…
Reference in New Issue
Block a user