diff options
| author | Sam Varshavchik | 2019-09-05 21:40:19 -0400 | 
|---|---|---|
| committer | Sam Varshavchik | 2019-09-05 21:40:19 -0400 | 
| commit | 8a4656aa96994919045ee63fe479b55fa12ca320 (patch) | |
| tree | 064e487e84cdf4fa8961d77c612ad8a7f96018c2 /imap/pop3login.c | |
| parent | cf4938d245043ae81cce060e39c71f0da5ef5eb7 (diff) | |
| download | courier-libs-8a4656aa96994919045ee63fe479b55fa12ca320.tar.bz2 | |
Log remote port numbers.
Diffstat (limited to 'imap/pop3login.c')
| -rw-r--r-- | imap/pop3login.c | 29 | 
1 files changed, 18 insertions, 11 deletions
| diff --git a/imap/pop3login.c b/imap/pop3login.c index be96d0e..1b43df2 100644 --- a/imap/pop3login.c +++ b/imap/pop3login.c @@ -249,7 +249,9 @@ char	*p;  char	buf[BUFSIZ];  int	c;  const	char *ip=getenv("TCPREMOTEIP"); -char authservice[40]; +const	char *port=getenv("TCPREMOTEPORT"); + + char authservice[40];  char *q ;  #ifdef HAVE_SETVBUF_IOLBF @@ -261,6 +263,9 @@ char *q ;  		ip="127.0.0.1";  	} +	if (!port || !*port) +		port="N/A"; +  	if (argc != 3)  	{  		printf("-ERR pop3login requires exactly two arguments.\r\n"); @@ -273,7 +278,7 @@ char *q ;  	courier_authdebug_login_init(); -	fprintf(stderr, "DEBUG: Connection, ip=[%s]\n", ip); +	fprintf(stderr, "DEBUG: Connection, ip=[%s], port=[%s]\n", ip, port);  	printf("+OK Hello there.\r\n");  	fflush(stdout); @@ -303,8 +308,8 @@ char *q ;  			if ( strcmp(p, "QUIT") == 0)  			{ -				fprintf(stderr, "INFO: LOGOUT, ip=[%s]\n", -					ip); +				fprintf(stderr, "INFO: LOGOUT, ip=[%s], port=[%s]\n", +					ip, port);  				fflush(stderr);  				printf("+OK Better luck next time.\r\n");  				fflush(stdout); @@ -407,9 +412,10 @@ char *q ;  						free(authdata);  					} -					courier_safe_printf("INFO: LOGIN " -						"FAILED, method=%s, ip=[%s]", -						method, ip); +					courier_safe_printf +						("INFO: LOGIN " +						 "FAILED, method=%s, ip=[%s], port=[%s]", +						 method, ip, port);  					if (rc == AUTHSASL_ABORTED)  					    printf("-ERR Authentication aborted.\r\n");  					else if (rc > 0) @@ -447,9 +453,10 @@ char *q ;  					q="pop3";  				rc=auth_login(q, user, p, login_callback, NULL); -				courier_safe_printf("INFO: LOGIN " -					"FAILED, user=%s, ip=[%s]", -					user, ip); +				courier_safe_printf +					("INFO: LOGIN " +					 "FAILED, user=%s, ip=[%s], port=[%s]", +					 user, ip, port);  				if (rc > 0)  				{  					perror("ERR: authentication error"); @@ -466,7 +473,7 @@ char *q ;  		printf("-ERR Invalid command.\r\n");  		fflush(stdout);  	} -	fprintf(stderr, "DEBUG: Disconnected, ip=[%s]\n", ip); +	fprintf(stderr, "DEBUG: Disconnected, ip=[%s], port=[%s]\n", ip, port);  	exit(0);  	return (0);  } | 
