Little bugglet should be htons(port) instead htonl(port) it was
so obvious that it took me 2 hours to find, sigh ...
Showing
1 changed file
with
7 additions
and
7 deletions
1 | /* GNU mailutils - a suite of utilities for electronic mail | 1 | /* GNU mailutils - a suite of utilities for electronic mail |
2 | Copyright (C) 1999 Free Software Foundation, Inc. | 2 | Copyright (C) 1999, 2000 Free Software Foundation, Inc. |
3 | 3 | ||
4 | This program is free software; you can redistribute it and/or modify | 4 | This program is free software; you can redistribute it and/or modify |
5 | it under the terms of the GNU General Public License as published by | 5 | it under the terms of the GNU General Public License as published by |
... | @@ -146,7 +146,7 @@ pop3_daemon_init (void) | ... | @@ -146,7 +146,7 @@ pop3_daemon_init (void) |
146 | } | 146 | } |
147 | else if (pid > 0) | 147 | else if (pid > 0) |
148 | exit (0); /* parent exits */ | 148 | exit (0); /* parent exits */ |
149 | 149 | ||
150 | setsid (); /* become session leader */ | 150 | setsid (); /* become session leader */ |
151 | 151 | ||
152 | signal (SIGHUP, SIG_IGN); /* ignore SIGHUP */ | 152 | signal (SIGHUP, SIG_IGN); /* ignore SIGHUP */ |
... | @@ -159,7 +159,7 @@ pop3_daemon_init (void) | ... | @@ -159,7 +159,7 @@ pop3_daemon_init (void) |
159 | } | 159 | } |
160 | else if (pid > 0) | 160 | else if (pid > 0) |
161 | exit (0); /* parent exits */ | 161 | exit (0); /* parent exits */ |
162 | 162 | ||
163 | /* close inherited file descriptors */ | 163 | /* close inherited file descriptors */ |
164 | for (i = 0; i < MAXFD; ++i) | 164 | for (i = 0; i < MAXFD; ++i) |
165 | close(i); | 165 | close(i); |
... | @@ -282,7 +282,7 @@ pop3_mainloop (int infile, int outfile) | ... | @@ -282,7 +282,7 @@ pop3_mainloop (int infile, int outfile) |
282 | return OK; | 282 | return OK; |
283 | } | 283 | } |
284 | 284 | ||
285 | /* Runs GNU POP3 in standalone daemon mode. This opens and binds to a port | 285 | /* Runs GNU POP3 in standalone daemon mode. This opens and binds to a port |
286 | (default 110) then executes a pop3_mainloop() upon accepting a connection. | 286 | (default 110) then executes a pop3_mainloop() upon accepting a connection. |
287 | It starts maxchildren child processes to listen to and accept socket | 287 | It starts maxchildren child processes to listen to and accept socket |
288 | connections */ | 288 | connections */ |
... | @@ -301,12 +301,12 @@ pop3_daemon (unsigned int maxchildren) | ... | @@ -301,12 +301,12 @@ pop3_daemon (unsigned int maxchildren) |
301 | exit (-1); | 301 | exit (-1); |
302 | } | 302 | } |
303 | size = 1; /* use size here to avoid making a new variable */ | 303 | size = 1; /* use size here to avoid making a new variable */ |
304 | setsockopt(listenfd, SOL_SOCKET, SO_REUSEADDR, &size, sizeof(size)); | 304 | setsockopt(listenfd, SOL_SOCKET, SO_REUSEADDR, &size, sizeof(size)); |
305 | size = sizeof(server); | 305 | size = sizeof(server); |
306 | memset (&server, 0, size); | 306 | memset (&server, 0, size); |
307 | server.sin_family = AF_INET; | 307 | server.sin_family = AF_INET; |
308 | server.sin_addr.s_addr = htonl (INADDR_ANY); | 308 | server.sin_addr.s_addr = htonl (INADDR_ANY); |
309 | server.sin_port = htonl (port); | 309 | server.sin_port = htons (port); |
310 | 310 | ||
311 | if (bind(listenfd, (SA *) &server, size) == -1 ) | 311 | if (bind(listenfd, (SA *) &server, size) == -1 ) |
312 | { | 312 | { |
... | @@ -319,7 +319,7 @@ pop3_daemon (unsigned int maxchildren) | ... | @@ -319,7 +319,7 @@ pop3_daemon (unsigned int maxchildren) |
319 | syslog(LOG_ERR, "listen: %s", strerror(errno)); | 319 | syslog(LOG_ERR, "listen: %s", strerror(errno)); |
320 | exit(-1); | 320 | exit(-1); |
321 | } | 321 | } |
322 | 322 | ||
323 | for ( ; ; ) | 323 | for ( ; ; ) |
324 | { | 324 | { |
325 | if (children > maxchildren) | 325 | if (children > maxchildren) | ... | ... |
-
Please register or sign in to post a comment