Commit 4be32f85 authored by Per Cederqvist's avatar Per Cederqvist
Browse files

Don't dump core when isc_gethostname return NULL.

parent fa59e786
Thu Jun 11 16:28:39 1992 Per Cederqvist (ceder@lysator)
* connections.c (login_request): Don't dump core when we can't get
the name of the originating host.
Wed Jun 10 03:36:30 1992 Per Cederqvist (ceder@robin)
* ramkomd.c (main): Log version number and pid when starting a new
......
/*
* $Id: connections.c,v 0.18 1992/05/25 21:13:27 ceder Exp $
* $Id: connections.c,v 0.19 1992/06/11 14:32:54 ceder Exp $
* Copyright (C) 1991 Lysator Academic Computer Association.
*
* This file is part of the LysKOM server.
......@@ -30,7 +30,7 @@
* Created by Willf|r 31/3-90. Mostly written by ceder.
*/
static char *rcsid = "$Id: connections.c,v 0.18 1992/05/25 21:13:27 ceder Exp $";
static char *rcsid = "$Id: connections.c,v 0.19 1992/06/11 14:32:54 ceder Exp $";
#include <errno.h>
......@@ -710,6 +710,7 @@ login_request(IscEvent *event)
char *realuser;
int localport;
IscAddress *isc_adr;
char *hostname = NULL;
if (isc_sessions(kom_server_mcb) >= MAX_NO_OF_CONNECTIONS)
{
......@@ -767,9 +768,16 @@ login_request(IscEvent *event)
cp = new_client();
cp->mux = event->session->udg;
s_crea_str(&cp->hostname,
isc_gethostname(event->session->info.tcp.raddr,
NULL, 0));
hostname = isc_gethostname(event->session->info.tcp.raddr, NULL, 0);
if (hostname == NULL)
hostname = isc_getipnum(event->session->info.tcp.raddr, NULL, 0);
if (hostname == NULL)
{
log("WNG: login_request(): unknown hostid.\n");
s_crea_str(&cp->hostname, "unknown");
}
else
s_crea_str(&cp->hostname, hostname);
/* Get the real user name, as returned by the Ident protocol
(rfc 931). */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment