2 * $Id: local.c,v 1.1 2002/01/22 16:03:04 dfs Exp $
4 * Copyright (C) 1996 Lars Fenneberg
6 * See the file COPYRIGHT for the respective terms and conditions.
7 * If the file is missing contact me at lf@elemental.net
8 * and I'll send you a copy.
14 #include <radiusclient.h>
20 LFUNC auth_local(char *username, char *passwd)
24 #ifdef SHADOW_PASSWORD
28 if ((pw = getpwnam(username)) == NULL) {
30 rc_log(LOG_NOTICE, "authentication FAILED, type local, username %s", username);
31 printf(SC_LOCAL_FAILED);
36 #ifdef SHADOW_PASSWORD
37 if((spw = getspnam(pw->pw_name)) == NULL) {
39 rc_log(LOG_NOTICE, "authentication FAILED, type local, username %s", username);
40 printf(SC_LOCAL_FAILED);
45 pw->pw_passwd = spw->sp_pwdp;
48 #endif /* SHADOW_PASSWORD */
50 xpasswd = crypt(passwd, pw->pw_passwd);
52 if (*pw->pw_passwd == '\0' || strcmp(xpasswd, pw->pw_passwd)) {
53 rc_log(LOG_NOTICE, "authentication FAILED, type local, username %s", username);
54 printf(SC_LOCAL_FAILED);
58 rc_log(LOG_NOTICE, "authentication OK, type local, username %s", username);
65 local_login(char *username)
67 char *login_local = rc_conf_str("login_local");
69 /* login should spot this... but who knows what old /bin/logins
72 if (*username == '-') {
73 rc_log(LOG_WARNING, "username can't start with a dash");
76 /* the new shadow login seems to require either a -r or a -h
77 * flag for -f to work (so source code, lmain.c) so we supply
78 * it here. shouldn't hurt on other systems, -lf, 03/13/96
80 execle(login_local, login_local, "-h", "localhost", "-f", username, NULL, env->env);
81 rc_log(LOG_ERR, "couldn't execute %s: %s", login_local, strerror(errno));
82 sleep(1); /* give the user time to read */