/* * (POP3Lite) ConnectLog - 3lite POP3 Daemon (Connection logging) * Copyright (C) 2000, 2001 Gergely Nagy <8@free.bsd.hu> * * This file is part of POP3Lite. * * POP3Lite 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. * * POP3Lite 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 this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifdef HAVE_CONFIG_H # include #endif #include #include #include #include static const char rcsid[]="$Id: connectlog.c,v 1.4 2001/01/12 15:58:59 algernon Exp $"; int connectlog_LTX_module_done ( P3LControl *control ); int connectlog_LTX_module_init ( P3LControl *control ); static CommandResponse *connectlog_greeting ( P3LControl *control ); static P3LControl_greeting B_connectlog_greeting; /** * connectlog_greeting: Greeting override a'la ConnectLog * @control: the usual control struct * * Logs the connecting client, then executes the original * greeting. * * Returns: the required CommandResponse. **/ static CommandResponse * connectlog_greeting ( P3LControl *control ) { #ifdef DEBUG control->system->log ( control, LOG_DEBUG, "%s:%d: Greeting", __FILE__, __LINE__ ); #endif control->system->log ( control, LOG_NOTICE, "Connected from: %s\n", p3l_get_peer_name () ); return (*B_connectlog_greeting) ( control ); } int connectlog_LTX_module_init ( P3LControl *control ) { #ifdef DEBUG control->system->log ( control, LOG_DEBUG, "%s:%d: init mod-ConnectLog", __FILE__, __LINE__ ); #endif /* * Replace greeting */ if ( control->greeting != NULL ) { B_connectlog_greeting = control->greeting; control->greeting = connectlog_greeting; } else return -1; return 0; } int connectlog_LTX_module_done ( P3LControl *control ) { #ifdef DEBUG control->system->log ( control, LOG_DEBUG, "%s:%d done mod-ConnectLog", __FILE__, __LINE__ ); #endif control->greeting = B_connectlog_greeting; return 0; }