]> granicus.if.org Git - sudo/commitdiff
updated AFS support
authorTodd C. Miller <Todd.Miller@courtesan.com>
Mon, 8 Jul 1996 20:08:33 +0000 (20:08 +0000)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Mon, 8 Jul 1996 20:08:33 +0000 (20:08 +0000)
check.c
configure.in

diff --git a/check.c b/check.c
index f05d933d33cc7fc9f30094e914bf547e894741c1..4cd435297565540e2a7afefe4e7949891b68012a 100644 (file)
--- a/check.c
+++ b/check.c
@@ -74,7 +74,7 @@ static char rcsid[] = "$Id$";
 #  include <krb.h>
 #endif /* HAVE_KERB4 */
 #ifdef HAVE_AFS
-#  include <afs/kauth.h>
+#  include <afs/stds.h>
 #  include <afs/kautils.h>
 #endif /* HAVE_AFS */
 #ifdef HAVE_SECURID
@@ -445,11 +445,6 @@ static void check_passwd()
 {
     char *pass;                        /* this is what gets entered    */
     register int counter = TRIES_FOR_PASSWORD;
-#ifdef HAVE_AFS
-    int code;
-    long password_expires = -1;
-    char *reason;
-#endif /* HAVE_AFS */
 #if defined(SHADOW_TYPE) && (SHADOW_TYPE == SPW_SECUREWARE)
     char salt[2];              /* Need the salt to perform the encryption */
     register int i;
@@ -551,16 +546,14 @@ static void check_passwd()
 #  endif /* HAVE_KERB4 */
 
 #  ifdef HAVE_AFS
-       code = ka_UserAuthenticateGeneral(KA_USERAUTH_VERSION+KA_USERAUTH_DOSETPAG,
-                                          user_name,
-                                          (char *) 0, 
-                                          (char *) 0,
-                                          pass,
-                                          0,
-                                          &password_expires,
-                                          0,
-                                          &reason);
-       if (code == 0)
+       if (ka_UserAuthenticateGeneral(KA_USERAUTH_VERSION,
+                                       user_name,      /* name */
+                                       NULL,           /* instance */
+                                       NULL            /* realm */
+                                       pass            /* password */
+                                       0,              /* lifetime */
+                                       0, 0,           /* spare */
+                                       NULL) == 0)     /* reason */
            return;
 #  endif /* HAVE_AFS */
 #  ifdef HAVE_DCE
index ecc1aa9ae91058b450de2dfccadbeb56cb194f8c..4dbf9798f8f154a7a6c43e9881a2169b0667b1b2 100644 (file)
@@ -19,6 +19,8 @@ SUDO_LIBS=""
 AC_SUBST(SUDO_LIBS)dnl
 VISUDO_LIBS=""
 AC_SUBST(VISUDO_LIBS)dnl
+AFS_LIBS=""
+AC_SUBST(AFS_LIBS)dnl
 CPPFLAGS=""
 AC_SUBST(CPPFLAGS)dnl
 OSDEFS=""
@@ -265,6 +267,10 @@ case "$OS" in
                    SHADOW_TYPE="SPW_SVR4"
                    AC_DEFINE_UNQUOTED(SHADOW_TYPE, $SHADOW_TYPE)
                fi
+               # AFS support needs -lucb
+               if test "$with_AFS" = "yes"; then
+                   AFS_LIBS="-lc -lucb"
+               fi
                ;;
     "aix")     echo "Looks like AIX"
                AC_DEFINE(_ALL_SOURCE)
@@ -338,9 +344,9 @@ case "$OS" in
                    fi
                fi
 
-               # AFS support
+               # AFS support needs -lBSD
                if test "$with_AFS" = "yes"; then
-                   SUDO_LIBS="-lBSD ${SUDO_LIBS}"
+                   AFS_LIBS="-lc -lBSD"
                fi
                ;;
     "osf1")    echo "Looks like OSF/1"
@@ -618,16 +624,48 @@ if test "$with_kerb4" = "yes" -o "$with_kerb5" = "yes"; then
 fi
 
 dnl
-dnl extra AFS libs
+dnl extra AFS libs and includes
 dnl
 if test "$with_AFS" = "yes"; then
-    if test -d "/usr/lib/afs"; then
-       SUDO_LDFLAGS="${SUDO_LDFLAGS} -L/usr/lib/afs"
-    else
-       echo 'Unable to locate AFS libraries, you will have to edit the Makefile and add -L/path/to/afs/libs to SUDO_LDFLAGS'
+
+    # looks like the "standard" place for AFS libs is /usr/afsws/lib
+    AFSLIBDIRS="/usr/lib/afs /usr/afsws/lib /usr/afsws/lib/afs"
+    for i in $AFSLIBDIRS; do
+       if test -d ${i}; then
+           SUDO_LDFLAGS="${SUDO_LDFLAGS} -L${i}"
+           FOUND_AFSLIBDIR=true
+       fi
+    done
+    if test -z "$FOUND_AFSLIBDIR"; then
+       echo 'Unable to locate AFS libraries, you will have to edit the Makefile and add -L/path/to/afs/libs to SUDO_LDFLAGS or rerun configure with the --with-libpath options.'
     fi
 
-    SUDO_LIBS="${SUDO_LIBS} -lkauth -lprot -lauth -lubik -lrxkad -lsys -ldes -lrx -llwp -lcom_err -laudit -lutil"
+    # Order is important here.  Note that we build AFS_LIBS from right to left
+    # since AFS_LIBS may be initialized with BSD compat libs that must go last
+    AFS_LIBS="-laudit ${AFS_LIBS}"
+    for i in $AFSLIBDIRS; do
+       if test -f ${i}/util.a; then
+           AFS_LIBS="${i}/util.a ${AFS_LIBS}"
+           FOUND_UTIL_A=true
+           break;
+       fi
+    done
+    if test -z "$FOUND_UTIL_A"; then
+       AFS_LIBS="-lutil ${AFS_LIBS}"
+    fi
+    AFS_LIBS="-lkauth -lprot -lubik -lauth -lrxkad -lsys -ldes -lrx -llwp -lcom_err ${AFS_LIBS}"
+
+    # AFS includes may live in /usr/include on some machines...
+    for i in /usr/afsws/include; do
+       if test -d ${i}; then
+           CPPFLAGS="${CPPFLAGS} -I${i}"
+           FOUND_AFSINCDIR=true
+       fi
+    done
+
+    if test -z "$FOUND_AFSLIBDIR"; then
+       echo 'Unable to locate AFS include dir, you may have to edit the Makefile and add -I/path/to/afs/includes to CPPFLAGS or rerun configure with the --with-incpath options.'
+    fi
 fi
 
 dnl