Added shadow password support
authorRichard Basch <probe@mit.edu>
Fri, 15 Mar 1996 06:28:23 +0000 (06:28 +0000)
committerRichard Basch <probe@mit.edu>
Fri, 15 Mar 1996 06:28:23 +0000 (06:28 +0000)
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@7640 dc483132-0cff-0310-8789-dd5450dbe970

src/appl/gssftp/ftpd/ChangeLog
src/appl/gssftp/ftpd/configure.in
src/appl/gssftp/ftpd/ftpd.c

index 010009f4b7e80b1953a1ac624602e17aab6e793a..1759aa7765c826adf4fb6da0da6bf9f8c4315d27 100644 (file)
@@ -1,3 +1,7 @@
+Fri Mar 15 01:24:39 1996  Richard Basch  <basch@lehman.com>
+
+        * configure.in, ftpd.c: Added shadow password support.
+
 Fri Feb 16 15:51:59 1996  Mark Eichin  <eichin@cygnus.com>
 
        * ftpcmd.y (yylex): error handling changes from kbalk@hp.com.
index 2f60d9081ce5397b58125c962cc80dd8600326ff..f7e4c8739e807c2f50a9896512b0fa78e3e229aa 100644 (file)
@@ -27,6 +27,19 @@ SETENVOBJ=setenv.o
 AC_SUBST([SETENVSRC])
 AC_SUBST([SETENVOBJ])
 fi
+AC_MSG_CHECKING([shadow password support])
+AC_CACHE_VAL(krb5_cv_shadow_pwd,
+[AC_TRY_LINK(
+[#include <sys/types.h>
+#include <pwd.h>
+#include <shadow.h>],
+[struct spwd *sp = getspnam("root")],
+krb5_cv_shadow_pwd=yes, krb5_cv_shadow_pwd=no)])
+AC_MSG_RESULT($krb5_cv_shadow_pwd)
+if test $krb5_cv_shadow_pwd = yes; then
+AC_DEFINE(HAVE_SHADOW)
+fi
+dnl
 dnl
 USE_ANAME
 KRB5_LIBRARIES
index cb531ce823b481c94d3281b385e7d90e9f80632d..6f3e9cf06bbe4fb1c03bb430b00649aafd0ddab5 100644 (file)
@@ -65,6 +65,9 @@ static char sccsid[] = "@(#)ftpd.c    5.40 (Berkeley) 7/2/91";
 #include <fcntl.h>
 #include <time.h>
 #include <pwd.h>
+#ifdef HAVE_SHADOW
+#include <shadow.h>
+#endif
 #include <setjmp.h>
 #include <netdb.h>
 #include <errno.h>
@@ -468,6 +471,9 @@ sgetpwnam(name)
 {
        static struct passwd save;
        register struct passwd *p;
+#ifdef HAVE_SHADOW
+       register struct spwd *sp;
+#endif
        char *sgetsave();
 
        if ((p = getpwnam(name)) == NULL)
@@ -481,7 +487,14 @@ sgetpwnam(name)
        }
        save = *p;
        save.pw_name = sgetsave(p->pw_name);
+#ifdef HAVE_SHADOW
+       if ((sp = getspnam(name)) == NULL)
+           save.pw_passwd = sgetsave(p->pw_passwd);
+       else
+           save.pw_passwd = sgetsave(sp->sp_pwdp);
+#else
        save.pw_passwd = sgetsave(p->pw_passwd);
+#endif
        save.pw_gecos = sgetsave(p->pw_gecos);
        save.pw_dir = sgetsave(p->pw_dir);
        save.pw_shell = sgetsave(p->pw_shell);