libipauth_guest.c

Go to the documentation of this file.
00001 /*
00002  ** Copyright(C) 2006-2008 INL
00003  ** written by Eric Leblond <regit@inl.fr>
00004  **
00005  ** $Id: libipauth_guest.c 5330 2008-11-25 15:19:00Z pollux $
00006  **
00007  ** This program is free software; you can redistribute it and/or modify
00008  ** it under the terms of the GNU General Public License as published by
00009  ** the Free Software Foundation, version 3 of the License.
00010  **
00011  ** This program is distributed in the hope that it will be useful,
00012  ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  ** GNU General Public License for more details.
00015  **
00016  ** You should have received a copy of the GNU General Public License
00017  ** along with this program; if not, write to the Free Software
00018  ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00019  */
00020 #include <auth_srv.h>
00021 
00022 #include "nuauthconf.h"
00023 
00028 #define IP_AUTH_GUEST_USERNAME "guest"
00029 
00030 struct ipauth_guest_params {
00031         gchar *username;
00032 };
00033 
00034 /*
00035  * Returns version of nuauth API
00036  */
00037 G_MODULE_EXPORT uint32_t get_api_version()
00038 {
00039         return NUAUTH_API_VERSION;
00040 }
00041 
00042 
00043 G_MODULE_EXPORT gchar *unload_module_with_params(gpointer params_p)
00044 {
00045         struct ipauth_guest_params *params =
00046             (struct ipauth_guest_params *) params_p;
00047 
00048         g_free(params->username);
00049         g_free(params);
00050 
00051         return NULL;
00052 }
00053 
00054 G_MODULE_EXPORT gboolean init_module_from_conf(module_t * module)
00055 {
00056         struct ipauth_guest_params *params =
00057             g_new0(struct ipauth_guest_params, 1);
00058 
00059         log_message(VERBOSE_DEBUG, DEBUG_AREA_MAIN,
00060                     "Ipauth_guest module ($Revision: 5330 $)");
00061 
00062         params->username = nuauth_config_table_get_or_default("ipauth_guest_username", IP_AUTH_GUEST_USERNAME);
00063 
00064         module->params = (gpointer) params;
00065         return TRUE;
00066 }
00067 
00071 G_MODULE_EXPORT gchar *ip_authentication(tracking_t * header,
00072                                          struct ipauth_guest_params *
00073                                          params)
00074 {
00075         if (params->username) {
00076                 return g_strdup(params->username);
00077         } else {
00078                 return NULL;
00079         }
00080 }
00081 

Generated on Wed Jan 7 04:00:40 2009 for NuFW by  doxygen 1.4.7