X-Git-Url: https://git.distorted.org.uk/~mdw/fwd/blobdiff_plain/16dfe536b74d2c3d647eff0a6d2858b198707766..096c89c34505cadba1fc6e7a5367273d5c5bea47:/identify.c diff --git a/identify.c b/identify.c index 4b22043..dd37a6a 100644 --- a/identify.c +++ b/identify.c @@ -1,83 +1,30 @@ /* -*-c-*- * - * $Id: identify.c,v 1.5 1999/10/10 16:45:34 mdw Exp $ - * * Identifies and logs the client of a connection * * (c) 1999 Straylight/Edgeware */ -/*----- Licensing notice --------------------------------------------------* +/*----- Licensing notice --------------------------------------------------* * - * This file is part of the `fw' port forwarder. + * This file is part of the `fwd' port forwarder. * - * `fw' is free software; you can redistribute it and/or modify + * `fwd' is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * - * `fw' is distributed in the hope that it will be useful, + * + * `fwd' is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License - * along with `fw'; if not, write to the Free Software Foundation, + * along with `fwd'; if not, write to the Free Software Foundation, * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/*----- Revision history --------------------------------------------------* - * - * $Log: identify.c,v $ - * Revision 1.5 1999/10/10 16:45:34 mdw - * Modified to use new mLib resolver and ident client. - * - * Revision 1.4 1999/07/27 18:30:53 mdw - * Various minor portability fixes. - * - * Revision 1.3 1999/07/26 23:26:21 mdw - * Minor modifications for new design. - * - * Revision 1.2 1999/07/03 13:56:59 mdw - * Log connections to syslog or stderr as appropriate. - * - * Revision 1.1.1.1 1999/07/01 08:56:23 mdw - * Initial revision. - * - */ - -/*----- Header files ------------------------------------------------------*/ - -#include "config.h" - -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "fw.h" -#include "identify.h" +#include "fwd.h" /*----- Magic numbers -----------------------------------------------------*/ @@ -95,8 +42,8 @@ typedef struct id { sel_timer t; /* Timeout selector */ bres_client r; /* Backgd resolver client block */ ident_request i; /* Ident client block */ - char host[64]; /* Resolved hostname */ - char user[32]; /* Authenticated client user */ + char host[128]; /* Resolved hostname */ + char user[64]; /* Authenticated client user */ } id; #define S_HOST 1u /* Read the hostname from resolver */ @@ -127,14 +74,15 @@ static void id_done(id *i) /* --- Report the final result --- */ - fw_log(i->when, "[%s] %s from %s@%s [%s]", + fw_log(i->when, "[%s] %s from %s@%s [%s:%u]", i->q.desc, i->q.act, - i->user, i->host, inet_ntoa(i->q.rsin.sin_addr)); + i->user, i->host, + inet_ntoa(i->q.rsin.sin_addr), (unsigned)ntohs(i->q.rsin.sin_port)); /* --- Dispose of the block --- */ REFFD_DEC(i->q.r); - free(i); + xfree(i); } /* --- @id_res@ --- * @@ -196,6 +144,7 @@ static void id_ident(ident_reply *ir, void *vp) static void id_timer(struct timeval *tv, void *vp) { id *i = vp; + i->state |= S_TIMER; id_done(i); }