comparison svr-main.c @ 158:364a75cfebab

Log the IP along with auth success/fail attempts
author Matt Johnston <matt@ucc.asn.au>
date Thu, 23 Dec 2004 17:00:15 +0000
parents 8c2b3506f112
children 0cfba3034be5
comparison
equal deleted inserted replaced
156:8c2b3506f112 158:364a75cfebab
92 } 92 }
93 93
94 /* In case our inetd was lax in logging source addresses */ 94 /* In case our inetd was lax in logging source addresses */
95 addrstring = getaddrstring(&remoteaddr, 1); 95 addrstring = getaddrstring(&remoteaddr, 1);
96 dropbear_log(LOG_INFO, "Child connection from %s", addrstring); 96 dropbear_log(LOG_INFO, "Child connection from %s", addrstring);
97 m_free(addrstring);
98 97
99 /* Don't check the return value - it may just fail since inetd has 98 /* Don't check the return value - it may just fail since inetd has
100 * already done setsid() after forking (xinetd on Darwin appears to do 99 * already done setsid() after forking (xinetd on Darwin appears to do
101 * this */ 100 * this */
102 setsid(); 101 setsid();
103 102
104 /* Start service program 103 /* Start service program
105 * -1 is a dummy childpipe, just something we can close() without 104 * -1 is a dummy childpipe, just something we can close() without
106 * mattering. */ 105 * mattering. */
107 svr_session(0, -1, getaddrhostname(&remoteaddr)); 106 svr_session(0, -1, getaddrhostname(&remoteaddr), addrstring);
108 107
109 /* notreached */ 108 /* notreached */
110 } 109 }
111 #endif /* INETD_MODE */ 110 #endif /* INETD_MODE */
112 111
262 monstartup((u_long)&_start, (u_long)&etext); 261 monstartup((u_long)&_start, (u_long)&etext);
263 #endif /* DEBUG_FORKGPROF */ 262 #endif /* DEBUG_FORKGPROF */
264 263
265 addrstring = getaddrstring(&remoteaddr, 1); 264 addrstring = getaddrstring(&remoteaddr, 1);
266 dropbear_log(LOG_INFO, "Child connection from %s", addrstring); 265 dropbear_log(LOG_INFO, "Child connection from %s", addrstring);
267 m_free(addrstring);
268 266
269 if (setsid() < 0) { 267 if (setsid() < 0) {
270 dropbear_exit("setsid: %s", strerror(errno)); 268 dropbear_exit("setsid: %s", strerror(errno));
271 } 269 }
272 270
281 dropbear_exit("Couldn't close socket"); 279 dropbear_exit("Couldn't close socket");
282 } 280 }
283 281
284 /* start the session */ 282 /* start the session */
285 svr_session(childsock, childpipe[1], 283 svr_session(childsock, childpipe[1],
286 getaddrhostname(&remoteaddr)); 284 getaddrhostname(&remoteaddr),
285 addrstring);
287 /* don't return */ 286 /* don't return */
288 assert(0); 287 assert(0);
289 } 288 }
290 289
291 /* parent */ 290 /* parent */