/* * ProFTPD: mod_log_login * * Copyright (c) 2014 Manuel Mausz * * This program 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. * * This program 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. */ #define MOD_LOG_LOGIN_VERSION "mod_log_login/0.1.0" #include "conf.h" #include "privs.h" module log_login_module; MODRET log_login_do(cmd_rec *cmd) { pr_log_auth(PR_LOG_NOTICE, "Login: user=<%s>, rip=%s, proto=%s", session.user, pr_netaddr_get_ipstr(pr_netaddr_get_sess_remote_addr()), pr_session_get_protocol(0)); return PR_DECLINED(cmd); } #if defined(PR_SHARED_MODULE) static void log_login_mod_unload_ev(const void *event_data, void *user_data) { if (strcmp("mod_log_login.c", (const char *)event_data) == 0) pr_event_unregister(&log_login_module, NULL, NULL); } #endif static int log_login_init(void) { #if defined(PR_SHARED_MODULE) pr_event_register(&log_login_module, "core.module-unload", log_login_mod_unload_ev, NULL); #endif return 0; } static cmdtable log_login_cmdtab[] = { { LOG_CMD, C_PASS, G_NONE, log_login_do, FALSE, FALSE }, { 0, NULL } }; module log_login_module = { /* always NULL */ NULL, NULL, /* module api version 2.0 */ 0x20, /* module name */ "log_login", /* module configuration handler table */ NULL, /* module command handler table */ log_login_cmdtab, /* module authentication handler table */ NULL, /* module initialization function */ log_login_init, /* module session initialization function */ NULL, /* module version */ MOD_LOG_LOGIN_VERSION };