From 86352f2985e2794bbbddac91f8dfa1cd22a1fb93 Mon Sep 17 00:00:00 2001 From: vvaltman Date: Thu, 30 Apr 2015 16:24:07 +0300 Subject: [PATCH] updated tgl --- main.c | 8 +++++++- tgl | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/main.c b/main.c index 8f66e19..5ff11b7 100644 --- a/main.c +++ b/main.c @@ -477,6 +477,7 @@ void usage (void) { printf (" --disable-names/-I use user and chat IDs in updates instead of names\n"); printf (" --enable-ipv6/-6 use ipv6 (may be unstable)\n"); printf (" --help/-h prints this help\n"); + printf (" --accept-any-tcp accepts tcp connections from any src (only loopback by default)\n"); exit (1); } @@ -533,6 +534,7 @@ static void sighup_handler (const int sig) { char *set_user_name; char *set_group_name; +int accept_any_tcp; int change_user_group () { char *username = set_user_name; @@ -619,6 +621,7 @@ void args_parse (int argc, char **argv) { {"disable-names", no_argument, 0, 'I'}, {"enable-ipv6", no_argument, 0, '6'}, {"help", no_argument, 0, 'h'}, + {"accept-any-tcp", no_argument, 0, 1001}, {0, 0, 0, 0 } }; @@ -640,6 +643,9 @@ void args_parse (int argc, char **argv) { case 1000: tgl_allocator = &tgl_allocator_debug; break; + case 1001: + accept_any_tcp = 1; + break; case 'u': set_default_username (optarg); break; @@ -851,7 +857,7 @@ int main (int argc, char **argv) { memset (&serv_addr, 0, sizeof (serv_addr)); serv_addr.sin_family = AF_INET; - serv_addr.sin_addr.s_addr = htonl (0x7f000001); + serv_addr.sin_addr.s_addr = accept_any_tcp ? INADDR_ANY : htonl (0x7f000001); serv_addr.sin_port = htons (port); if (bind (sfd, (struct sockaddr *) &serv_addr, sizeof (serv_addr)) < 0) { diff --git a/tgl b/tgl index 03f46ae..c97540c 160000 --- a/tgl +++ b/tgl @@ -1 +1 @@ -Subproject commit 03f46aea574f8628ba869192505b7fe76cceccfc +Subproject commit c97540cd8e82e48d337f602b09f8ac3c7b52558c