/*
 * (POP3Lite) nullauth - 3lite POP3 Daemon (null-auth module)
 * 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 <config.h>
#endif

#include <pop3lite.h>
#include <stdlib.h>
#include <glib.h>
#include <syslog.h>

static const char rcsid[]="$Id: nullauth.c,v 1.1.2.1 2001/05/10 08:33:55 algernon Exp $";

static AuthResult nullauth_sys_authenticate ( P3LControl *control,
					      const char *user,
					      const char *pass );

int nullauth_LTX_module_init ( P3LControl *control );
int nullauth_LTX_module_done ( P3LControl *control );

static P3LSysCon_authenticate B_nullauth_sys_authenticate;

/**
 * nullauth_sys_authenticate: do user authentication
 * @control: the control struct
 * @name: username
 * @pass: password
 *
 * Authenticates the user, in all cases.
 *
 * Returns: success
 **/

static AuthResult
nullauth_sys_authenticate ( P3LControl *control,
			    const char *user, const char *pass )
{
#ifdef DEBUG
	control->system->log ( control, LOG_DEBUG, "%s:%d: Authenticating user: %s",
			       __FILE__, __LINE__, user );
#endif
	return AUTH_RESULT_OK;
}

int
nullauth_LTX_module_init ( P3LControl *control )
{
#ifdef DEBUG
	control->system->log ( control, LOG_DEBUG, "%s:%d: init mod-NullAuth",
			       __FILE__, __LINE__ );
#endif
	B_nullauth_sys_authenticate = control->system->authenticate;
	control->system->authenticate = nullauth_sys_authenticate;

	return 0;
}

int
nullauth_LTX_module_done ( P3LControl *control )
{

#ifdef DEBUG
	control->system->log ( control, LOG_DEBUG, "%s:%d: done mod-NullAuth",
			       __FILE__, __LINE__ );
#endif

	control->system->authenticate = B_nullauth_sys_authenticate;

	return 0;
}


syntax highlighted by Code2HTML, v. 0.9.1