This commit is contained in:
Viktor Szakats 2024-09-22 17:48:17 +02:00
parent d4b6613910
commit 052a48ac2d
No known key found for this signature in database
GPG Key ID: B5ABD165E2AEF201
3 changed files with 18 additions and 17 deletions

View File

@ -110,7 +110,7 @@ static char loglockfile[256];
static bool use_ipv6 = FALSE;
#endif
static const char *ipv_inuse = "IPv4";
static unsigned short port = DEFAULT_PORT;
static unsigned short my_port = DEFAULT_PORT;
static void resetdefaults(void)
{
@ -994,7 +994,7 @@ int main(int argc, char *argv[])
argv[arg]);
return 0;
}
port = util_ultous(ulnum);
my_port = util_ultous(ulnum);
arg++;
}
}
@ -1044,7 +1044,7 @@ int main(int argc, char *argv[])
{
/* passive daemon style */
sock = sockdaemon(sock, &port);
sock = sockdaemon(sock, &my_port);
if(CURL_SOCKET_BAD == sock) {
goto mqttd_cleanup;
}
@ -1052,14 +1052,14 @@ int main(int argc, char *argv[])
}
logmsg("Running %s version", ipv_inuse);
logmsg("Listening on port %hu", port);
logmsg("Listening on port %hu", my_port);
wrotepidfile = write_pidfile(pidname);
if(!wrotepidfile) {
goto mqttd_cleanup;
}
wroteportfile = write_portfile(portname, port);
wroteportfile = write_portfile(portname, my_port);
if(!wroteportfile) {
goto mqttd_cleanup;
}

View File

@ -141,7 +141,7 @@ static bool bind_only = FALSE;
static bool use_ipv6 = FALSE;
#endif
static const char *ipv_inuse = "IPv4";
static unsigned short port = DEFAULT_PORT;
static unsigned short my_port = DEFAULT_PORT;
static unsigned short connectport = 0; /* if non-zero, we activate this mode */
enum sockmode {
@ -1141,7 +1141,8 @@ static bool juggle(curl_socket_t *sockfdp,
else if(!memcmp("PORT", buffer, 4)) {
/* Question asking us what PORT number we are listening to.
Replies to PORT with "IPv[num]/[port]" */
msnprintf((char *)buffer, sizeof(buffer), "%s/%hu\n", ipv_inuse, port);
msnprintf((char *)buffer, sizeof(buffer), "%s/%hu\n",
ipv_inuse, my_port);
buffer_len = (ssize_t)strlen((char *)buffer);
msnprintf(data, sizeof(data), "PORT\n%04zx\n", buffer_len);
if(!write_stdout(data, 10))
@ -1458,7 +1459,7 @@ int main(int argc, char *argv[])
if(argc > arg) {
char *endptr;
unsigned long ulnum = strtoul(argv[arg], &endptr, 10);
port = util_ultous(ulnum);
my_port = util_ultous(ulnum);
arg++;
}
}
@ -1571,7 +1572,7 @@ int main(int argc, char *argv[])
}
else {
/* passive daemon style */
sock = sockdaemon(sock, &port);
sock = sockdaemon(sock, &my_port);
if(CURL_SOCKET_BAD == sock) {
write_stdout("FAIL\n", 5);
goto sockfilt_cleanup;
@ -1584,9 +1585,9 @@ int main(int argc, char *argv[])
if(connectport)
logmsg("Connected to port %hu", connectport);
else if(bind_only)
logmsg("Bound without listening on port %hu", port);
logmsg("Bound without listening on port %hu", my_port);
else
logmsg("Listening on port %hu", port);
logmsg("Listening on port %hu", my_port);
wrotepidfile = write_pidfile(pidname);
if(!wrotepidfile) {
@ -1594,7 +1595,7 @@ int main(int argc, char *argv[])
goto sockfilt_cleanup;
}
if(portname) {
wroteportfile = write_portfile(portname, port);
wroteportfile = write_portfile(portname, my_port);
if(!wroteportfile) {
write_stdout("FAIL\n", 5);
goto sockfilt_cleanup;

View File

@ -138,7 +138,7 @@ static const char *reqlogfile = DEFAULT_REQFILE;
static const char *configfile = DEFAULT_CONFIG;
static const char *socket_type = "IPv4";
static unsigned short port = DEFAULT_PORT;
static unsigned short my_port = DEFAULT_PORT;
static void resetdefaults(void)
{
@ -1061,7 +1061,7 @@ int main(int argc, char *argv[])
if(argc > arg) {
char *endptr;
unsigned long ulnum = strtoul(argv[arg], &endptr, 10);
port = util_ultous(ulnum);
my_port = util_ultous(ulnum);
arg++;
}
}
@ -1106,7 +1106,7 @@ int main(int argc, char *argv[])
{
/* passive daemon style */
sock = sockdaemon(sock, &port
sock = sockdaemon(sock, &my_port
#ifdef USE_UNIX_SOCKETS
, unix_socket
#endif
@ -1127,7 +1127,7 @@ int main(int argc, char *argv[])
logmsg("Listening on Unix socket %s", unix_socket);
else
#endif
logmsg("Listening on port %hu", port);
logmsg("Listening on port %hu", my_port);
wrotepidfile = write_pidfile(pidname);
if(!wrotepidfile) {
@ -1135,7 +1135,7 @@ int main(int argc, char *argv[])
}
if(portname) {
wroteportfile = write_portfile(portname, port);
wroteportfile = write_portfile(portname, my_port);
if(!wroteportfile) {
goto socks5_cleanup;
}