Commit 9331efc6 authored by Per Cederqvist's avatar Per Cederqvist

(login_request): Disallow connections if param.authentication_level is

2 and the IDENT lookup fails.
parent 08963365
/*
* $Id: connections.c,v 0.31 1994/01/12 01:34:45 ceder Exp $
* $Id: connections.c,v 0.32 1994/02/27 15:45:42 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.31 1994/01/12 01:34:45 ceder Exp $";
static char *rcsid = "$Id: connections.c,v 0.32 1994/02/27 15:45:42 ceder Exp $";
#include "rcs.h"
USE(rcsid);
......@@ -778,6 +778,27 @@ login_request(IscEvent *event)
{
/* Client requesting connection */
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");
/* Get the real user name, as returned by the Ident protocol
(rfc 931). */
realuser = get_real_username(event->session, hostname);
if (realuser == NULL && param.authentication_level == 2)
{
log ("Connection from %s rejected - no IDENT available.\n",
hostname);
isc_printf(event->session, "%s",
"%% No IDENT server reachable at your site.\n");
isc_flush(event->session);
isc_destroy(kom_server_mcb, event->session);
return;
}
/*
** Create, and setup the MUX for the CLIENT case
*/
......@@ -786,28 +807,18 @@ login_request(IscEvent *event)
cp = new_client();
cp->mux = event->session->udg;
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). */
realuser = get_real_username(event->session, hostname);
if (realuser != NULL)
s_crea_str(&cp->ident_user, realuser);
mux_addclient(event->session->udg, 0, cp);
BUG(("\n[Client %lu from %s", cp->session_no,
isc_gethostname(event->session->info.tcp.raddr, NULL, 0)));
BUG((" is connecting]\n"));
BUG(("\n[Client %lu from %s is connecting]\n", cp->session_no,
hostname));
}
else
{
......
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