[Raw Msg Headers][Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: 2.99.51-pre3 available
Article: <19990712105534Z46517-28628+1@nic.funet.fi>
Date: Mon, 12 Jul 1999 13:55:30 +0300
Author: Matti Aarnio <mea@nic.funet.fi>
> Some people have expressed interest to get shadow passwords
> and/or PAM support to smtp-auth, could the interested people
> do it ? If they want it before August, that is...
>
The attached patch is an *untested* zpwmatch() for shadow passwords. The
configure.in changes are only looking for /usr/include/shadow.h,
which is not enough and should be changed (we should probably check for
/etc/shadow, /etc/login.defs and libshadow, atleast on linux). Until
someone fixes this (i'm not familiar enought with autoconf), edit
config.h and smtpserver/Makefile (LIB = -lshadow or whatever your shadow
lib is).
Apply with: cd zmailer-2.99.51-pre3; 'patch -p1 < smtpauth-shadow'
Cheers,
Magnus.
--
Magnus Sjögren <dat98msj@student3.lu.se>
diff -ur zmailer-2.99.51-pre3/config.h.in patch/zmailer-2.99.51-pre3/config.h.in
--- zmailer-2.99.51-pre3/config.h.in Tue Jun 29 03:22:35 1999
+++ patch/zmailer-2.99.51-pre3/config.h.in Tue Jul 13 02:01:52 1999
@@ -545,6 +545,9 @@
/* Define if you have the <arpa/inet.h> header file. */
#undef HAVE_ARPA_INET_H
+/* Define if you have the shadow password suite. */
+#undef HAVE_SHADOW_H
+
/* Define if you have the <db.h> header file. */
#undef HAVE_DB_H
diff -ur zmailer-2.99.51-pre3/configure patch/zmailer-2.99.51-pre3/configure
--- zmailer-2.99.51-pre3/configure Tue Jun 29 03:21:20 1999
+++ patch/zmailer-2.99.51-pre3/configure Tue Jul 13 02:01:52 1999
@@ -4578,7 +4578,7 @@
fi
done
-for ac_hdr in sys/utsname.h maillock.h arpa/inet.h
+for ac_hdr in sys/utsname.h maillock.h arpa/inet.h shadow.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
diff -ur zmailer-2.99.51-pre3/configure.in patch/zmailer-2.99.51-pre3/configure.in
--- zmailer-2.99.51-pre3/configure.in Tue Jun 29 03:20:51 1999
+++ patch/zmailer-2.99.51-pre3/configure.in Tue Jul 13 02:01:52 1999
@@ -931,7 +931,7 @@
AC_CHECK_HEADERS(string.h fcntl.h limits.h errno.h unistd.h stdlib.h \
sys/param.h sys/statfs.h sys/fstyp.h mnttab.h mntent.h utime.h \
sys/statvfs.h sys/vfs.h sys/mount.h sys/filsys.h sys/fs_types.h)
-AC_CHECK_HEADERS(sys/utsname.h maillock.h arpa/inet.h)
+AC_CHECK_HEADERS(sys/utsname.h maillock.h arpa/inet.h shadow.h)
#
# Following set of tests is rather weird... Some people don't agree on
diff -ur zmailer-2.99.51-pre3/smtpserver/zpwmatch.c patch/zmailer-2.99.51-pre3/smtpserver/zpwmatch.c
--- zmailer-2.99.51-pre3/smtpserver/zpwmatch.c Thu May 6 00:39:31 1999
+++ patch/zmailer-2.99.51-pre3/smtpserver/zpwmatch.c Tue Jul 13 02:02:01 1999
@@ -14,10 +14,37 @@
#include "mailer.h"
#include <sys/types.h>
+
+#ifdef HAVE_SHADOW_H
+#include <shadow.h>
+#else
#include <pwd.h>
+#endif /* HAVE_SHADOW_H */
+
#include <unistd.h>
#include <string.h>
+#ifdef HAVE_SHADOW_H
+int zpwmatch(uname, password)
+ char *uname, *password;
+{
+ struct spwd *spw;
+ char *cr;
+
+ if (lckpwdf() == -1)
+ return 0; /* No lock acquired */
+ else
+ spw = getspnam(uname);
+ ulckpwdf(); /* Not much we can do here anyway if it fails */
+
+ if (!spw) return 0; /* No such user */
+ cr = crypt(password, spw->sp_pwdp);
+
+ return (strcmp(cr, spw->sp_pwdp) == 0);
+}
+
+#else
+
int zpwmatch(uname,password)
char *uname, *password;
{
@@ -29,3 +56,5 @@
return (strcmp(cr, pw->pw_passwd) == 0);
}
+#endif /* HAVE_SHADOW_H */
+