From 76c596ceb824fc1591c063c184d9562fc1a14676 Mon Sep 17 00:00:00 2001 From: Nicolas Williams Date: Wed, 10 Aug 2016 19:51:11 -0500 Subject: [PATCH] Complete support for --disable-afs-support --- appl/Makefile.am | 5 ++++- appl/ftp/ftpd/ftpcmd.y | 10 ++++++++-- appl/ftp/ftpd/ftpd.c | 4 +++- appl/ftp/ftpd/ftpd_locl.h | 2 +- appl/ftp/ftpd/gss_userok.c | 2 ++ appl/ftp/ftpd/kauth.c | 7 ++++++- appl/ftp/ftpd/ls.c | 9 ++------- appl/login/login.c | 6 +++--- appl/login/login_locl.h | 2 ++ appl/su/su.c | 4 ++++ cf/Makefile.am.common | 4 ++++ lib/kafs/kafs_locl.h | 2 ++ 12 files changed, 41 insertions(+), 16 deletions(-) diff --git a/appl/Makefile.am b/appl/Makefile.am index e596c59cb..dd667271f 100644 --- a/appl/Makefile.am +++ b/appl/Makefile.am @@ -8,8 +8,11 @@ endif if DCE dir_dce = dceutils endif +if !NO_AFS +dir_afsutil = afsutil +endif SUBDIRS = \ - afsutil \ + $(dir_afsutil) \ dbutils \ ftp \ login \ diff --git a/appl/ftp/ftpd/ftpcmd.y b/appl/ftp/ftpd/ftpcmd.y index 05ae7366b..b8f348007 100644 --- a/appl/ftp/ftpd/ftpcmd.y +++ b/appl/ftp/ftpd/ftpcmd.y @@ -536,8 +536,11 @@ cmd #if defined(KRB5) if(guest) reply(500, "Can't be done as guest."); - else if($5) + else if($5) { +#ifndef NO_AFS afslog(NULL, 0); +#endif + } #else reply(500, "Command not implemented."); #endif @@ -547,8 +550,11 @@ cmd #if defined(KRB5) if(guest) reply(500, "Can't be done as guest."); - else if($7) + else if($7) { +#ifndef NO_AFS afslog($5, 0); +#endif + } if($5) free($5); #else diff --git a/appl/ftp/ftpd/ftpd.c b/appl/ftp/ftpd/ftpd.c index 924ea23b3..04a2ce4cf 100644 --- a/appl/ftp/ftpd/ftpd.c +++ b/appl/ftp/ftpd/ftpd.c @@ -711,7 +711,7 @@ int do_login(int code, char *passwd) return -1; } initgroups(pw->pw_name, pw->pw_gid); -#if defined(KRB5) +#if defined(KRB5) && !defined(NO_AFS) if(k_hasafs()) k_setpag(); #endif @@ -864,9 +864,11 @@ krb5_verify(struct passwd *pwd, char *passwd) 1, NULL); krb5_free_principal(context, princ); +#ifndef NO_AFS if (k_hasafs()) { krb5_afslog_uid_home(context, id,NULL, NULL,pwd->pw_uid, pwd->pw_dir); } +#endif krb5_cc_destroy(context, id); krb5_free_context (context); if(ret) diff --git a/appl/ftp/ftpd/ftpd_locl.h b/appl/ftp/ftpd/ftpd_locl.h index cff3ff3d4..88a7f7b45 100644 --- a/appl/ftp/ftpd/ftpd_locl.h +++ b/appl/ftp/ftpd/ftpd_locl.h @@ -145,7 +145,7 @@ #include #endif /* KRB5 */ -#if defined(KRB5) +#if defined(KRB5) && !defined(NO_AFS) #include #endif diff --git a/appl/ftp/ftpd/gss_userok.c b/appl/ftp/ftpd/gss_userok.c index 6031b52a8..e9c10e930 100644 --- a/appl/ftp/ftpd/gss_userok.c +++ b/appl/ftp/ftpd/gss_userok.c @@ -67,7 +67,9 @@ gssapi_session(void *app_data, char *username) 1, 1, NULL, NULL); if (GSS_ERROR(major)) ret = 1; +#ifndef NO_AFS afslog(NULL, 1); +#endif } gss_release_cred(&minor, &data->delegated_cred_handle); diff --git a/appl/ftp/ftpd/kauth.c b/appl/ftp/ftpd/kauth.c index 546461d9d..63f757603 100644 --- a/appl/ftp/ftpd/kauth.c +++ b/appl/ftp/ftpd/kauth.c @@ -82,7 +82,9 @@ cond_kdestroy(void) #endif do_destroy_tickets = 0; } +#ifndef NO_AFS afsunlog(); +#endif } void @@ -91,11 +93,13 @@ kdestroy(void) #if KRB5 dest_cc(); #endif +#ifndef NO_AFS afsunlog(); +#endif reply(200, "Tickets destroyed"); } - +#ifndef NO_AFS void afslog(const char *cell, int quiet) { @@ -134,6 +138,7 @@ afsunlog(void) if(k_hasafs()) k_unlog(); } +#endif #else int ftpd_afslog_placeholder; diff --git a/appl/ftp/ftpd/ls.c b/appl/ftp/ftpd/ls.c index a8366b91e..3f0d042e1 100644 --- a/appl/ftp/ftpd/ls.c +++ b/appl/ftp/ftpd/ls.c @@ -405,16 +405,11 @@ find_log10(int num) * have to fetch them. */ -#ifdef KRB5 -static int do_the_afs_dance = 1; -#endif - static int lstat_file (const char *file, struct stat *sb) { -#ifdef KRB5 - if (do_the_afs_dance && - k_hasafs() +#if defined(KRB5) && !defined(NO_AFS) + if (k_hasafs() && strcmp(file, ".") && strcmp(file, "..") && strcmp(file, "/")) diff --git a/appl/login/login.c b/appl/login/login.c index 1d8138b69..3f6924179 100644 --- a/appl/login/login.c +++ b/appl/login/login.c @@ -145,9 +145,6 @@ otp_verify(struct passwd *pwd, const char *password) } #endif /* OTP */ - -static int pag_set = 0; - #ifdef KRB5 static krb5_context context; static krb5_ccache id, id2; @@ -207,6 +204,8 @@ krb5_finish (void) static void krb5_get_afs_tokens (const struct passwd *pwd) { +#ifndef NO_AFS + static int pag_set = 0; char cell[64]; char *pw_dir; krb5_error_code ret; @@ -231,6 +230,7 @@ krb5_get_afs_tokens (const struct passwd *pwd) pwd->pw_uid, pwd->pw_dir); krb5_cc_close (context, id2); } +#endif } #endif /* KRB5 */ diff --git a/appl/login/login_locl.h b/appl/login/login_locl.h index 020eac889..c0899f64d 100644 --- a/appl/login/login_locl.h +++ b/appl/login/login_locl.h @@ -87,7 +87,9 @@ #ifdef KRB5 #include #endif +#ifndef NO_AFS #include +#endif #ifdef OTP #include diff --git a/appl/su/su.c b/appl/su/su.c index 697a262a3..b6cb89cc1 100644 --- a/appl/su/su.c +++ b/appl/su/su.c @@ -57,7 +57,9 @@ RCSID("$Id$"); #ifdef KRB5 #include #endif +#ifndef NO_AFS #include +#endif #include #include #include @@ -252,11 +254,13 @@ krb5_start_session(void) } esetenv("KRB5CCNAME", cc_name, 1); +#ifndef NO_AFS /* convert creds? */ if(k_hasafs()) { if (k_setpag() == 0) krb5_afslog(context, ccache2, NULL, NULL); } +#endif krb5_cc_close(context, ccache2); krb5_cc_destroy(context, ccache); diff --git a/cf/Makefile.am.common b/cf/Makefile.am.common index a9ea71edd..dd8467e20 100644 --- a/cf/Makefile.am.common +++ b/cf/Makefile.am.common @@ -253,7 +253,11 @@ uninstall-hook: uninstall-cat-mans .et.c: $(COMPILE_ET) $< +if NO_AFS +LIB_kafs = +else LIB_kafs = $(top_builddir)/lib/kafs/libkafs.la $(AIX_EXTRA_KAFS) +endif if KRB5 LIB_krb5 = $(top_builddir)/lib/krb5/libkrb5.la \ diff --git a/lib/kafs/kafs_locl.h b/lib/kafs/kafs_locl.h index a028d8ea8..6f34ca631 100644 --- a/lib/kafs/kafs_locl.h +++ b/lib/kafs/kafs_locl.h @@ -99,7 +99,9 @@ #include typedef struct credentials CREDENTIALS; #endif /* KRB5 */ +#ifndef NO_AFS #include +#endif #include -- 2.11.4.GIT