Commit b28ac7df authored by Per Cederqvist's avatar Per Cederqvist
Browse files

Added time-out in get_real_username.

parent 5438ee07
Wed Aug 12 01:38:22 1992 Per Cederqvist (ceder@robin)
* rfc931.c (get_real_username): Introduce 20-second timeout. Log
any ident queries that takes more than 3 seconds. New argument:
hostname (only used for the log).
* connections.c (login_request): Send the new argument.
* log.c (logv): Print the log message on a single line, with the
time in the first 20 columns. (Facilitate log browsing).
Wed Aug 12 00:33:55 1992 Inge Wallin (inge@lysator)
* simple-cache.c(save_one_text): Write texts to file as long as
* simple-cache.c (save_one_text): Write texts to file as long as
they are removed.
Thu Jun 11 16:28:39 1992 Per Cederqvist (ceder@lysator)
......
/*
* $Id: connections.c,v 0.19 1992/06/11 14:32:54 ceder Exp $
* $Id: connections.c,v 0.20 1992/08/12 04:12:53 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.19 1992/06/11 14:32:54 ceder Exp $";
static char *rcsid = "$Id: connections.c,v 0.20 1992/08/12 04:12:53 ceder Exp $";
#include <errno.h>
......@@ -781,7 +781,7 @@ login_request(IscEvent *event)
/* Get the real user name, as returned by the Ident protocol
(rfc 931). */
realuser = get_real_username(event->session);
realuser = get_real_username(event->session, hostname);
if (realuser != NULL)
s_crea_str(&cp->ident_user, realuser);
......
/*
* $Id: rfc931.c,v 1.2 1992/04/01 20:32:03 ceder Exp $
* $Id: rfc931.c,v 1.3 1992/08/12 04:12:57 ceder Exp $
* Copyright (C) 1991 Lysator Academic Computer Association.
*
* This file is part of the LysKOM server.
......@@ -36,22 +36,40 @@
#include <m-config.h>
#include "rfc931.h"
#include <authuser.h>
#include <errno.h>
#include "log.h"
#ifdef RFC_931
char *
get_real_username(IscSession *scb)
get_real_username(IscSession *scb,
char *hostname)
{
unsigned long inlocal;
unsigned long inremote;
unsigned short local;
unsigned short remote;
char *result;
time_t before, after;
if (auth_fd2(scb->fd, &inlocal, &inremote,
&local, &remote) == -1)
return NULL;
return auth_tcpuser2(inlocal, inremote, local, remote);
time(&before);
result = auth_tcpuser3(inlocal, inremote, local, remote, 20);
if (result == NULL && errno == ETIMEDOUT)
log ("Identd request to %s timed out.\n", hostname);
else
{
time(&after);
if (difftime(after, before) > 3)
log ("Identd request to %s yielded %s after %d seconds.\n",
hostname,
result == NULL ? "(null)" : result,
(int)difftime(after, before));
}
return result;
}
#endif
/*
* $Id: rfc931.h,v 1.1 1992/03/31 21:51:34 ceder Exp $
* $Id: rfc931.h,v 1.2 1992/08/12 04:13:01 ceder Exp $
* Copyright (C) 1991 Lysator Academic Computer Association.
*
* This file is part of the LysKOM server.
......@@ -23,4 +23,5 @@
* Please mail bug reports to bug-lyskom@lysator.liu.se.
*/
char *get_real_username(IscSession *scb);
char *get_real_username(IscSession *scb,
char *hostname);
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