diff options
author | Seraphim Mellos <mellos@ceid.upatras.gr> | 2008-06-15 11:36:46 +0300 |
---|---|---|
committer | Seraphim Mellos <mellos@ceid.upatras.gr> | 2008-06-15 11:36:46 +0300 |
commit | 1bdbf53a2a3fda4108634267acf4b801867e50be (patch) | |
tree | b5e6e3722a1525cee464cb32b7b909f52c790ea1 | |
parent | Added log messages and restructured base dir organization (diff) | |
download | openpam-modules-1bdbf53a2a3fda4108634267acf4b801867e50be.tar.gz openpam-modules-1bdbf53a2a3fda4108634267acf4b801867e50be.tar.bz2 openpam-modules-1bdbf53a2a3fda4108634267acf4b801867e50be.zip |
Started work on Makefiles
-rw-r--r-- | Make.defs | 13 | ||||
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | modules/pam_nologin/pam_nologin.c (renamed from src/pam_nologin/pam_nologin.c) | 0 | ||||
-rw-r--r-- | modules/pam_rootok/pam_rootok.c (renamed from src/pam_rootok/pam_rootok.c) | 0 | ||||
-rw-r--r-- | modules/pam_securetty/pam_securetty.c (renamed from src/pam_securetty/pam_securetty.c) | 0 | ||||
-rw-r--r-- | modules/pam_shells/pam_shells.c (renamed from src/pam_shells/pam_shells.c) | 0 | ||||
-rw-r--r-- | modules/pam_unix/Makefile | 42 | ||||
-rw-r--r-- | modules/pam_unix/Makefile~ | 41 | ||||
-rw-r--r-- | modules/pam_unix/pam_unix.c (renamed from src/pam_unix/pam_unix.c~) | 26 | ||||
-rw-r--r-- | modules/pam_unix/pam_unix.c~ (renamed from src/pam_unix/pam_unix.c) | 0 | ||||
-rw-r--r-- | modules/pam_wheel/pam_wheel.c (renamed from src/pam_wheel/pam_wheel.c) | 0 |
11 files changed, 115 insertions, 9 deletions
diff --git a/Make.defs b/Make.defs new file mode 100644 index 0000000..cb36475 --- /dev/null +++ b/Make.defs @@ -0,0 +1,13 @@ +# +## Copyright (c) 2008 by Seraphim Mellos. See LICENSE. +# + +CC = gcc +LD = $(CC) +RM = rm -f +MKDIR = mkdir -p +INSTALL = install -c +CFLAGS = -Wall -c -g -fPIC -I../../include -I/opt/local/include -O2 +LDFLAGS = --shared -L/opt/local/lib -Wl,$(LINKEROPTS) +LINKEROPTS = +LDLIBS = -lpam -lcrypt diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..9b34d2b --- /dev/null +++ b/Makefile @@ -0,0 +1,2 @@ +all install clean: + $(MAKE) -C modules $@ diff --git a/src/pam_nologin/pam_nologin.c b/modules/pam_nologin/pam_nologin.c index e69de29..e69de29 100644 --- a/src/pam_nologin/pam_nologin.c +++ b/modules/pam_nologin/pam_nologin.c diff --git a/src/pam_rootok/pam_rootok.c b/modules/pam_rootok/pam_rootok.c index e69de29..e69de29 100644 --- a/src/pam_rootok/pam_rootok.c +++ b/modules/pam_rootok/pam_rootok.c diff --git a/src/pam_securetty/pam_securetty.c b/modules/pam_securetty/pam_securetty.c index e69de29..e69de29 100644 --- a/src/pam_securetty/pam_securetty.c +++ b/modules/pam_securetty/pam_securetty.c diff --git a/src/pam_shells/pam_shells.c b/modules/pam_shells/pam_shells.c index e69de29..e69de29 100644 --- a/src/pam_shells/pam_shells.c +++ b/modules/pam_shells/pam_shells.c diff --git a/modules/pam_unix/Makefile b/modules/pam_unix/Makefile new file mode 100644 index 0000000..314c0e0 --- /dev/null +++ b/modules/pam_unix/Makefile @@ -0,0 +1,42 @@ +# +## Copyright (c) 2008 by Seraphim Mellos. See LICENSE. +# + +include ../../Make.defs + +TITLE = pam_unix +PAM_SO_SUFFIX = +LIBSHARED = $(TITLE).so$(PAM_SO_SUFFIX) +SHLIBMODE = 755 +MAN8 = $(TITLE).8 +MANMODE = 644 +#SECUREDIR = /lib/security +#MANDIR = /usr/share/man +#DESTDIR = + + + +PROJ = $(LIBSHARED) +OBJS = pam_unix.c + +all: + case "`uname -s`" in \ + Linux) $(MAKE) -I$(INCDIR) CFLAGS="$(CFLAGS) -DHAVE_SHADOW" \ + -L$(LDDIR) LDFLAGS="$(LDFLAGS)" LDLIBS="$(LDLIBS)" \ + $(PROJ);;\ + FreeBSD) echo "Not yet supported.";;\ + *) echo "OS not supported.";;\ + esac + +$(LIBSHARED): $(OBJS) $(MAP) + $(LD) $(LDFLAGS) $(OBJS) $(LDLIBS) -o $(LIBSHARED) + +.c.o: + $(CC) $(CFLAGS) -c $*.c + + +clean: + $(RM) $(PROJ) *.o + + + diff --git a/modules/pam_unix/Makefile~ b/modules/pam_unix/Makefile~ new file mode 100644 index 0000000..1d449ed --- /dev/null +++ b/modules/pam_unix/Makefile~ @@ -0,0 +1,41 @@ +# +## Copyright (c) 2008 by Seraphim Mellos. See LICENSE. +# + +include ../../Makefile +TITLE = pam_unix +PAM_SO_SUFFIX = +LIBSHARED = $(TITLE).so$(PAM_SO_SUFFIX) +SHLIBMODE = 755 +MAN8 = $(TITLE).8 +MANMODE = 644 +#SECUREDIR = /lib/security +#MANDIR = /usr/share/man +#DESTDIR = + + + +PROJ = $(LIBSHARED) +OBJS = pam_unix.c + +all: + case "`uname -s`" in \ + Linux) $(MAKE) -I$(INCDIR) CFLAGS="$(CFLAGS) -DHAVE_SHADOW" \ + -L$(LDDIR) LDFLAGS="$(LDFLAGS)" LDLIBS="$(LDLIBS)" \ + $(PROJ);;\ + FreeBSD) echo "Not yet supported.";;\ + *) echo "OS not supported.";;\ + esac + +$(LIBSHARED): $(OBJS) $(MAP) + $(LD) $(LDFLAGS) $(OBJS) $(LDLIBS) -o $(LIBSHARED) + +.c.o: + $(CC) $(CFLAGS) -c $*.c + + +clean: + $(RM) $(PROJ) *.o + + + diff --git a/src/pam_unix/pam_unix.c~ b/modules/pam_unix/pam_unix.c index c5215b9..7a8aca3 100644 --- a/src/pam_unix/pam_unix.c~ +++ b/modules/pam_unix/pam_unix.c @@ -40,27 +40,30 @@ pam_sm_authenticate(pam_handle_t *pamh, int flags, /* identify user */ if (openpam_get_option(pamh, PAM_OPT_AUTH_AS_SELF)) { - puts("POULOS1"); - PAM_LOG("Authenticating as self"); + PAM_LOG("Authenticating as self."); pwd = getspnam(getlogin()); } else { if ((pam_err = pam_get_user(pamh, &user, NULL)) != PAM_SUCCESS) { - puts("POULOS2"); - PAM_LOG("Authenticating with uname failed"); + PAM_ERROR("Authenticating with uname %s failed.", user); return (pam_err); } pwd = getspnam(user); } - puts("POULOS3"); + + PAM_LOG("Authenticating user: %s", user); + /* get password */ if (pwd != NULL) { + PAM_LOG("Doing real authentication"); pass = pwd->sp_pwdp; if (pass[0] == '\0') { if (!(flags & PAM_DISALLOW_NULL_AUTHTOK) && - openpam_get_option(pamh, PAM_OPT_NULLOK)) + openpam_get_option(pamh, PAM_OPT_NULLOK)){ + PAM_ERROR("Authentication failed. Empty passwd not allowed."); return (PAM_SUCCESS); + } pass = "*"; } @@ -68,6 +71,7 @@ pam_sm_authenticate(pam_handle_t *pamh, int flags, lc = login_getpwclass(pwd); #endif } else { + PAM_LOG("Doing dummy authentication."); pass = "*"; #ifndef __linux__ lc = login_getpwclass(NULL); @@ -81,6 +85,7 @@ pam_sm_authenticate(pam_handle_t *pamh, int flags, #else pam_err = pam_get_authtok(pamh, PAM_AUTHTOK, (const char **) &pass, NULL); #endif + PAM_LOG("Got password for user %s", user); if (pam_err == PAM_CONV_ERR) return (pam_err); @@ -90,11 +95,14 @@ pam_sm_authenticate(pam_handle_t *pamh, int flags, /* check shadow */ crypt_pass = crypt(pass, pwd->sp_pwdp); - if ( strcmp(crypt_pass, pwd->sp_pwdp) != 0 ) + if ( strcmp(crypt_pass, pwd->sp_pwdp) != 0 ) { + PAM_ERROR("Wrong password. Authentication failed."); pam_err = PAM_AUTH_ERR; - else + } else { + PAM_LOG("Authentication completed succesfully."); pam_err = PAM_SUCCESS; - + } + return (pam_err); } diff --git a/src/pam_unix/pam_unix.c b/modules/pam_unix/pam_unix.c~ index c65ec10..c65ec10 100644 --- a/src/pam_unix/pam_unix.c +++ b/modules/pam_unix/pam_unix.c~ diff --git a/src/pam_wheel/pam_wheel.c b/modules/pam_wheel/pam_wheel.c index e69de29..e69de29 100644 --- a/src/pam_wheel/pam_wheel.c +++ b/modules/pam_wheel/pam_wheel.c |