Complete support for --disable-afs-support

This commit is contained in:
Nicolas Williams
2016-08-10 19:51:11 -05:00
parent 3e6fb5bb41
commit 76c596ceb8
12 changed files with 41 additions and 16 deletions

View File

@@ -8,8 +8,11 @@ endif
if DCE if DCE
dir_dce = dceutils dir_dce = dceutils
endif endif
if !NO_AFS
dir_afsutil = afsutil
endif
SUBDIRS = \ SUBDIRS = \
afsutil \ $(dir_afsutil) \
dbutils \ dbutils \
ftp \ ftp \
login \ login \

View File

@@ -536,8 +536,11 @@ cmd
#if defined(KRB5) #if defined(KRB5)
if(guest) if(guest)
reply(500, "Can't be done as guest."); reply(500, "Can't be done as guest.");
else if($5) else if($5) {
#ifndef NO_AFS
afslog(NULL, 0); afslog(NULL, 0);
#endif
}
#else #else
reply(500, "Command not implemented."); reply(500, "Command not implemented.");
#endif #endif
@@ -547,8 +550,11 @@ cmd
#if defined(KRB5) #if defined(KRB5)
if(guest) if(guest)
reply(500, "Can't be done as guest."); reply(500, "Can't be done as guest.");
else if($7) else if($7) {
#ifndef NO_AFS
afslog($5, 0); afslog($5, 0);
#endif
}
if($5) if($5)
free($5); free($5);
#else #else

View File

@@ -711,7 +711,7 @@ int do_login(int code, char *passwd)
return -1; return -1;
} }
initgroups(pw->pw_name, pw->pw_gid); initgroups(pw->pw_name, pw->pw_gid);
#if defined(KRB5) #if defined(KRB5) && !defined(NO_AFS)
if(k_hasafs()) if(k_hasafs())
k_setpag(); k_setpag();
#endif #endif
@@ -864,9 +864,11 @@ krb5_verify(struct passwd *pwd, char *passwd)
1, 1,
NULL); NULL);
krb5_free_principal(context, princ); krb5_free_principal(context, princ);
#ifndef NO_AFS
if (k_hasafs()) { if (k_hasafs()) {
krb5_afslog_uid_home(context, id,NULL, NULL,pwd->pw_uid, pwd->pw_dir); krb5_afslog_uid_home(context, id,NULL, NULL,pwd->pw_uid, pwd->pw_dir);
} }
#endif
krb5_cc_destroy(context, id); krb5_cc_destroy(context, id);
krb5_free_context (context); krb5_free_context (context);
if(ret) if(ret)

View File

@@ -145,7 +145,7 @@
#include <krb5.h> #include <krb5.h>
#endif /* KRB5 */ #endif /* KRB5 */
#if defined(KRB5) #if defined(KRB5) && !defined(NO_AFS)
#include <kafs.h> #include <kafs.h>
#endif #endif

View File

@@ -67,7 +67,9 @@ gssapi_session(void *app_data, char *username)
1, 1, NULL, NULL); 1, 1, NULL, NULL);
if (GSS_ERROR(major)) if (GSS_ERROR(major))
ret = 1; ret = 1;
#ifndef NO_AFS
afslog(NULL, 1); afslog(NULL, 1);
#endif
} }
gss_release_cred(&minor, &data->delegated_cred_handle); gss_release_cred(&minor, &data->delegated_cred_handle);

View File

@@ -82,7 +82,9 @@ cond_kdestroy(void)
#endif #endif
do_destroy_tickets = 0; do_destroy_tickets = 0;
} }
#ifndef NO_AFS
afsunlog(); afsunlog();
#endif
} }
void void
@@ -91,11 +93,13 @@ kdestroy(void)
#if KRB5 #if KRB5
dest_cc(); dest_cc();
#endif #endif
#ifndef NO_AFS
afsunlog(); afsunlog();
#endif
reply(200, "Tickets destroyed"); reply(200, "Tickets destroyed");
} }
#ifndef NO_AFS
void void
afslog(const char *cell, int quiet) afslog(const char *cell, int quiet)
{ {
@@ -134,6 +138,7 @@ afsunlog(void)
if(k_hasafs()) if(k_hasafs())
k_unlog(); k_unlog();
} }
#endif
#else #else
int ftpd_afslog_placeholder; int ftpd_afslog_placeholder;

View File

@@ -405,16 +405,11 @@ find_log10(int num)
* have to fetch them. * have to fetch them.
*/ */
#ifdef KRB5
static int do_the_afs_dance = 1;
#endif
static int static int
lstat_file (const char *file, struct stat *sb) lstat_file (const char *file, struct stat *sb)
{ {
#ifdef KRB5 #if defined(KRB5) && !defined(NO_AFS)
if (do_the_afs_dance && if (k_hasafs()
k_hasafs()
&& strcmp(file, ".") && strcmp(file, ".")
&& strcmp(file, "..") && strcmp(file, "..")
&& strcmp(file, "/")) && strcmp(file, "/"))

View File

@@ -145,9 +145,6 @@ otp_verify(struct passwd *pwd, const char *password)
} }
#endif /* OTP */ #endif /* OTP */
static int pag_set = 0;
#ifdef KRB5 #ifdef KRB5
static krb5_context context; static krb5_context context;
static krb5_ccache id, id2; static krb5_ccache id, id2;
@@ -207,6 +204,8 @@ krb5_finish (void)
static void static void
krb5_get_afs_tokens (const struct passwd *pwd) krb5_get_afs_tokens (const struct passwd *pwd)
{ {
#ifndef NO_AFS
static int pag_set = 0;
char cell[64]; char cell[64];
char *pw_dir; char *pw_dir;
krb5_error_code ret; krb5_error_code ret;
@@ -231,6 +230,7 @@ krb5_get_afs_tokens (const struct passwd *pwd)
pwd->pw_uid, pwd->pw_dir); pwd->pw_uid, pwd->pw_dir);
krb5_cc_close (context, id2); krb5_cc_close (context, id2);
} }
#endif
} }
#endif /* KRB5 */ #endif /* KRB5 */

View File

@@ -87,7 +87,9 @@
#ifdef KRB5 #ifdef KRB5
#include <krb5.h> #include <krb5.h>
#endif #endif
#ifndef NO_AFS
#include <kafs.h> #include <kafs.h>
#endif
#ifdef OTP #ifdef OTP
#include <otp.h> #include <otp.h>

View File

@@ -57,7 +57,9 @@ RCSID("$Id$");
#ifdef KRB5 #ifdef KRB5
#include <krb5.h> #include <krb5.h>
#endif #endif
#ifndef NO_AFS
#include <kafs.h> #include <kafs.h>
#endif
#include <err.h> #include <err.h>
#include <roken.h> #include <roken.h>
#include <getarg.h> #include <getarg.h>
@@ -252,11 +254,13 @@ krb5_start_session(void)
} }
esetenv("KRB5CCNAME", cc_name, 1); esetenv("KRB5CCNAME", cc_name, 1);
#ifndef NO_AFS
/* convert creds? */ /* convert creds? */
if(k_hasafs()) { if(k_hasafs()) {
if (k_setpag() == 0) if (k_setpag() == 0)
krb5_afslog(context, ccache2, NULL, NULL); krb5_afslog(context, ccache2, NULL, NULL);
} }
#endif
krb5_cc_close(context, ccache2); krb5_cc_close(context, ccache2);
krb5_cc_destroy(context, ccache); krb5_cc_destroy(context, ccache);

View File

@@ -253,7 +253,11 @@ uninstall-hook: uninstall-cat-mans
.et.c: .et.c:
$(COMPILE_ET) $< $(COMPILE_ET) $<
if NO_AFS
LIB_kafs =
else
LIB_kafs = $(top_builddir)/lib/kafs/libkafs.la $(AIX_EXTRA_KAFS) LIB_kafs = $(top_builddir)/lib/kafs/libkafs.la $(AIX_EXTRA_KAFS)
endif
if KRB5 if KRB5
LIB_krb5 = $(top_builddir)/lib/krb5/libkrb5.la \ LIB_krb5 = $(top_builddir)/lib/krb5/libkrb5.la \

View File

@@ -99,7 +99,9 @@
#include <krb5-v4compat.h> #include <krb5-v4compat.h>
typedef struct credentials CREDENTIALS; typedef struct credentials CREDENTIALS;
#endif /* KRB5 */ #endif /* KRB5 */
#ifndef NO_AFS
#include <kafs.h> #include <kafs.h>
#endif
#include <resolve.h> #include <resolve.h>