*
* 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
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*
- * Copyright 2000 The FreeRADIUS server project
+ * Copyright 2000,2006 The FreeRADIUS server project
* Copyright 2000 Jeff Carneal <jeff@apex.net>
* Copyright 2000 Alan Curry <pacman@world.std.com>
*/
-static const char rcsid[] = "$Id$";
-#include "autoconf.h"
-#include "libradius.h"
+#include <freeradius-devel/ident.h>
+RCSID("$Id$")
+
+#include <freeradius-devel/radiusd.h>
-#include <stdlib.h>
-#include <string.h>
#include <grp.h>
#include <pwd.h>
-#include <sys/types.h>
#include <sys/stat.h>
#include "config.h"
# include <siad.h>
#endif
-#include "radiusd.h"
-#include "modules.h"
-#include "sysutmp.h"
+#include <freeradius-devel/modules.h>
+#include <freeradius-devel/sysutmp.h>
static char trans[64] =
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
/*
* The Group = handler.
*/
-static int groupcmp(void *instance, REQUEST *req, VALUE_PAIR *request,
+static int groupcmp(void *instance, UNUSED REQUEST *req, VALUE_PAIR *request,
VALUE_PAIR *check, VALUE_PAIR *check_pairs,
VALUE_PAIR **reply_pairs)
{
return -1;
}
}
- username = (char *)vp->strvalue;
+ username = (char *)vp->vp_strvalue;
pwd = getpwnam(username);
if (pwd == NULL)
return -1;
- grp = getgrnam((char *)check->strvalue);
+ grp = getgrnam((char *)check->vp_strvalue);
if (grp == NULL)
return -1;
/*
- * Done once when the module is loaded, and NOT on a per-instance
- * basis.
- */
-static int unix_init(void)
-{
- /* FIXME - delay these until a group file has been read so we know
- * groupcmp can actually do something */
- paircompare_register(PW_GROUP, PW_USER_NAME, groupcmp, NULL);
-#ifdef PW_GROUP_NAME /* compat */
- paircompare_register(PW_GROUP_NAME, PW_USER_NAME, groupcmp, NULL);
-#endif
- return 0;
-}
-
-
-/*
* Detach.
*/
static int unix_detach(void *instance)
{
#define inst ((struct unix_instance *)instance)
- if (inst->radwtmp)
- free(inst->radwtmp);
+
+ paircompare_unregister(PW_GROUP, groupcmp);
+#ifdef PW_GROUP_NAME
+ paircompare_unregister(PW_GROUP_NAME, groupcmp);
+#endif
#undef inst
free(instance);
return 0;
return -1;
}
-#undef inst
-
- return 0;
-}
-
+ /* FIXME - delay these until a group file has been read so we know
+ * groupcmp can actually do something */
+ paircompare_register(PW_GROUP, PW_USER_NAME, groupcmp, NULL);
+#ifdef PW_GROUP_NAME /* compat */
+ paircompare_register(PW_GROUP_NAME, PW_USER_NAME, groupcmp, NULL);
+#endif
+#undef inst
-static int unix_destroy(void)
-{
- paircompare_unregister(PW_GROUP, groupcmp);
-#ifdef PW_GROUP_NAME
- paircompare_unregister(PW_GROUP_NAME, groupcmp);
-#endif
return 0;
}
* Pull the users password from where-ever, and add it to
* the given vp list.
*/
-static int unix_getpw(void *instance, REQUEST *request, VALUE_PAIR **vp_list)
+static int unix_getpw(UNUSED void *instance, REQUEST *request,
+ VALUE_PAIR **vp_list)
{
const char *name;
const char *encrypted_pass;
return RLM_MODULE_NOOP;
}
- name = (char *)request->username->strvalue;
+ name = (char *)request->username->vp_strvalue;
encrypted_pass = NULL;
#ifdef OSFC2
/*
* 0 means "ok"
*/
- if (lrad_crypt_check((char *) request->password->strvalue,
- (char *) vp->strvalue) != 0) {
+ if (lrad_crypt_check((char *) request->password->vp_strvalue,
+ (char *) vp->vp_strvalue) != 0) {
radlog(L_AUTH, "rlm_unix: [%s]: invalid password",
- request->username->strvalue);
+ request->username->vp_strvalue);
return RLM_MODULE_REJECT;
}
#endif /* OSFFIA */
switch (vp->attribute) {
case PW_USER_NAME:
if (vp->length >= sizeof(ut.ut_name)) {
- memcpy(ut.ut_name, (char *)vp->strvalue, sizeof(ut.ut_name));
+ memcpy(ut.ut_name, (char *)vp->vp_strvalue, sizeof(ut.ut_name));
} else {
- strNcpy(ut.ut_name, (char *)vp->strvalue, sizeof(ut.ut_name));
+ strlcpy(ut.ut_name, (char *)vp->vp_strvalue, sizeof(ut.ut_name));
}
break;
case PW_LOGIN_IP_HOST:
RADCLIENT *cl;
nas_address = request->packet->src_ipaddr.ipaddr.ip4addr.s_addr;
- if ((cl = client_find(&request->packet->src_ipaddr)) != NULL)
+ if ((cl = client_find_old(&request->packet->src_ipaddr)) != NULL)
s = cl->shortname;
}
if (!s || s[0] == 0) s = uue(&(nas_address));
* and address so that the tty field is unique.
*/
sprintf(buf, "%03d:%s", nas_port, s);
- strNcpy(ut.ut_line, buf, sizeof(ut.ut_line));
+ strlcpy(ut.ut_line, buf, sizeof(ut.ut_line));
/*
* We store the dynamic IP address in the hostname field.
#ifdef UT_HOSTSIZE
if (framed_address) {
ip_ntoa(buf, framed_address);
- strncpy(ut.ut_host, buf, sizeof(ut.ut_host));
+ strlcpy(ut.ut_host, buf, sizeof(ut.ut_host));
}
#endif
#ifdef HAVE_UTMPX_H
/* globally exported name */
module_t rlm_unix = {
- "System",
- RLM_TYPE_THREAD_UNSAFE, /* type */
- unix_init, /* initialization */
- unix_instantiate, /* instantiation */
- {
- unix_authenticate, /* authentication */
- unix_authorize, /* authorization */
- NULL, /* preaccounting */
- unix_accounting, /* accounting */
- NULL, /* checksimul */
- NULL, /* pre-proxy */
- NULL, /* post-proxy */
- NULL /* post-auth */
- },
- unix_detach, /* detach */
- unix_destroy, /* destroy */
+ RLM_MODULE_INIT,
+ "System",
+ RLM_TYPE_THREAD_UNSAFE, /* type */
+ unix_instantiate, /* instantiation */
+ unix_detach, /* detach */
+ {
+ unix_authenticate, /* authentication */
+ unix_authorize, /* authorization */
+ NULL, /* preaccounting */
+ unix_accounting, /* accounting */
+ NULL, /* checksimul */
+ NULL, /* pre-proxy */
+ NULL, /* post-proxy */
+ NULL /* post-auth */
+ },
};