diff --git a/appl/ftp/ftp/Makefile.am b/appl/ftp/ftp/Makefile.am index 3c50076b4..a11b67d38 100644 --- a/appl/ftp/ftp/Makefile.am +++ b/appl/ftp/ftp/Makefile.am @@ -8,6 +8,12 @@ INCLUDES = -I$(srcdir)/../common $(INCLUDE_readline) $(INCLUDE_krb4) $(INCLUDE_r bin_PROGRAMS = ftp +if KRB4 +krb4_sources = $(EXTRA_ftp_SOURCES) +else +krb4_sources = +endif + ftp_SOURCES = \ cmds.c \ cmdtab.c \ @@ -17,10 +23,11 @@ ftp_SOURCES = \ domacro.c \ globals.c \ security.c \ - krb4.c \ - kauth.c \ + $(krb4_sources) \ gssapi.c +EXTRA_ftp_SOURCES = krb4.c kauth.c + LDADD = \ ../common/libcommon.a \ $(top_builddir)/lib/gssapi/libgssapi.a \ diff --git a/appl/ftp/ftp/cmdtab.c b/appl/ftp/ftp/cmdtab.c index 803240d9b..5dc96efa3 100644 --- a/appl/ftp/ftp/cmdtab.c +++ b/appl/ftp/ftp/cmdtab.c @@ -105,11 +105,13 @@ char userhelp[] = "send new user information"; char verbosehelp[] = "toggle verbose mode"; char prothelp[] = "set protection level"; +#ifdef KRB4 char kauthhelp[] = "get remote tokens"; char klisthelp[] = "show remote tickets"; char kdestroyhelp[] = "destroy remote tickets"; char krbtkfilehelp[] = "set filename of remote tickets"; char afsloghelp[] = "obtain remote AFS tokens"; +#endif struct cmd cmdtab[] = { { "!", shellhelp, 0, 0, 0, shell }, @@ -186,11 +188,13 @@ struct cmd cmdtab[] = { { "?", helphelp, 0, 0, 1, help }, { "prot", prothelp, 0, 1, 0, sec_prot }, +#ifdef KRB4 { "kauth", kauthhelp, 0, 1, 0, kauth }, { "klist", klisthelp, 0, 1, 0, klist }, { "kdestroy", kdestroyhelp, 0, 1, 0, kdestroy }, { "krbtkfile", krbtkfilehelp, 0, 1, 0, krbtkfile }, { "afslog", afsloghelp, 0, 1, 0, afslog }, +#endif { 0 }, }; diff --git a/appl/ftp/ftp/security.c b/appl/ftp/ftp/security.c index 9d37c56f5..f5f250cc5 100644 --- a/appl/ftp/ftp/security.c +++ b/appl/ftp/ftp/security.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, 1996, 1997, 1998 Kungliga Tekniska Högskolan + * Copyright (c) 1998 Kungliga Tekniska Högskolan * (Royal Institute of Technology, Stockholm, Sweden). * All rights reserved. * @@ -93,8 +93,12 @@ name_to_level(const char *name) #ifdef FTP_SERVER static struct sec_server_mech *mechs[] = { +#ifdef KRB5 &gss_server_mech, +#endif +#ifdef KRB4 &krb4_server_mech, +#endif NULL }; @@ -103,8 +107,12 @@ static struct sec_server_mech *mech; #else static struct sec_client_mech *mechs[] = { +#ifdef KRB5 &gss_client_mech, +#endif +#ifdef KRB4 &krb4_client_mech, +#endif NULL }; diff --git a/appl/ftp/ftpd/Makefile.am b/appl/ftp/ftpd/Makefile.am index 1d70ecd24..01631c7ed 100644 --- a/appl/ftp/ftpd/Makefile.am +++ b/appl/ftp/ftpd/Makefile.am @@ -8,32 +8,45 @@ INCLUDES = -I$(srcdir)/../common $(INCLUDE_krb4) -DFTP_SERVER libexec_PROGRAMS = ftpd +if KRB4 +krb4_sources = $(EXTRA_ftpd_SOURCES) +else +krb4_sources = +endif + ftpd_SOURCES = \ ftpd.c \ ftpcmd.y \ logwtmp.c \ popen.c \ security.c \ - krb4.c \ - kauth.c \ + $(krb4_sources) \ gssapi.c +EXTRA_ftpd_SOURCES = krb4.c kauth.c + $(ftpd_OBJECTS): security.h security.c: @test -f security.c || $(LN_S) $(srcdir)/../ftp/security.c . security.h: - @test -f security.c || $(LN_S) $(srcdir)/../ftp/security.h . + @test -f security.h || $(LN_S) $(srcdir)/../ftp/security.h . krb4.c: - @test -f security.c || $(LN_S) $(srcdir)/../ftp/krb4.c . + @test -f krb4.c || $(LN_S) $(srcdir)/../ftp/krb4.c . gssapi.c: - @test -f security.c || $(LN_S) $(srcdir)/../ftp/gssapi.c . + @test -f gssapi.c || $(LN_S) $(srcdir)/../ftp/gssapi.c . CLEANFILES = security.c security.h krb4.c gssapi.c +if KRB4 +afslib = $(top_builddir)/lib/kafs/libkafs.a +else +afslib = +endif + LDADD = ../common/libcommon.a \ $(top_builddir)/lib/gssapi/libgssapi.a \ - $(top_builddir)/lib/kafs/libkafs.a \ + $(afslib) \ $(top_builddir)/lib/krb5/libkrb5.a \ $(top_builddir)/lib/des/libdes.a \ $(LIB_krb4) \ diff --git a/appl/ftp/ftpd/ftpcmd.y b/appl/ftp/ftpd/ftpcmd.y index 04fa32dff..f433428f9 100644 --- a/appl/ftp/ftpd/ftpcmd.y +++ b/appl/ftp/ftpd/ftpcmd.y @@ -493,6 +493,7 @@ cmd | SITE SP KAUTH check_login SP STRING CRLF { +#ifdef KRB4 char *p; if(guest) @@ -509,35 +510,55 @@ cmd } if($6 != NULL) free($6); +#else + reply(500, "Command not implemented."); +#endif } | SITE SP KLIST check_login CRLF { +#ifdef KRB4 if($4) klist(); +#else + reply(500, "Command not implemented."); +#endif } | SITE SP KDESTROY check_login CRLF { +#ifdef KRB4 if($4) kdestroy(); +#else + reply(500, "Command not implemented."); +#endif } | SITE SP KRBTKFILE check_login SP STRING CRLF { +#ifdef KRB4 if(guest) reply(500, "Can't be done as guest."); else if($4 && $6) krbtkfile($6); if($6) free($6); +#else + reply(500, "Command not implemented."); +#endif } | SITE SP AFSLOG check_login CRLF { +#ifdef KRB4 if(guest) reply(500, "Can't be done as guest."); else if($4) afslog(NULL); +#else + reply(500, "Command not implemented."); +#endif } | SITE SP AFSLOG check_login SP STRING CRLF { +#ifdef KRB4 if(guest) reply(500, "Can't be done as guest."); else if($4){ @@ -545,6 +566,9 @@ cmd } if($6) free($6); +#else + reply(500, "Command not implemented."); +#endif } | SITE SP FIND check_login SP STRING CRLF { diff --git a/appl/ftp/ftpd/ftpd.c b/appl/ftp/ftpd/ftpd.c index cf5d47a2e..35f596ec8 100644 --- a/appl/ftp/ftpd/ftpd.c +++ b/appl/ftp/ftpd/ftpd.c @@ -1673,7 +1673,9 @@ dologout(int status) if (logged_in) { seteuid((uid_t)0); ftpd_logwtmp(ttyline, "", ""); +#ifdef KRB4 cond_kdestroy(); +#endif } /* beware of flushing buffers after a SIGPIPE */ #ifdef XXX