From: Tom Yu Date: Mon, 23 Feb 1998 01:13:39 +0000 (+0000) Subject: * ftpd.c: Use krb5_seteuid() and krb5_setegid(). [krb5-libs/505] X-Git-Tag: krb5-1.1-beta1~803 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=afe12d1cd4617fea327e5216c97f56a1f5f80698;p=krb5.git * ftpd.c: Use krb5_seteuid() and krb5_setegid(). [krb5-libs/505] * Makefile.in (ftpd): Fix up KRB4COMPAT_LIBS (was KRB5_BASE_LIBS), and add UTIL_LIB. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@10470 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/appl/gssftp/ftpd/ChangeLog b/src/appl/gssftp/ftpd/ChangeLog index 26d69bcac..9f088a37d 100644 --- a/src/appl/gssftp/ftpd/ChangeLog +++ b/src/appl/gssftp/ftpd/ChangeLog @@ -1,3 +1,10 @@ +Sun Feb 22 19:37:07 1998 Tom Yu + + * ftpd.c: Use krb5_seteuid() and krb5_setegid(). [krb5-libs/505] + + * Makefile.in (ftpd): Fix up KRB4COMPAT_LIBS (was KRB5_BASE_LIBS), + and add UTIL_LIB. + Wed Feb 18 15:30:10 1998 Tom Yu * Makefile.in: Remove trailing slash from thisconfigdir. Fix up diff --git a/src/appl/gssftp/ftpd/Makefile.in b/src/appl/gssftp/ftpd/Makefile.in index ba3ea25a8..41e7333bc 100644 --- a/src/appl/gssftp/ftpd/Makefile.in +++ b/src/appl/gssftp/ftpd/Makefile.in @@ -27,8 +27,8 @@ DEFINES = -DGSSAPI -DNOCONFIDENTIAL all:: ftpd -ftpd: $(OBJS) $(GSS_DEPLIBS) $(KRB5_BASE_DEPLIBS) - $(CC_LINK) -o $@ $(OBJS) $(GSS_LIBS) $(KRB4COMPAT_LIBS) +ftpd: $(OBJS) $(GSS_DEPLIBS) $(UTIL_DEPLIB) $(KRB4COMPAT_DEPLIBS) + $(CC_LINK) -o $@ $(OBJS) $(GSS_LIBS) $(UTIL_LIB) $(KRB4COMPAT_LIBS) clean:: $(RM) ftpd ftpcmd.c diff --git a/src/appl/gssftp/ftpd/ftpd.c b/src/appl/gssftp/ftpd/ftpd.c index 68668faae..6edeb1e17 100644 --- a/src/appl/gssftp/ftpd/ftpd.c +++ b/src/appl/gssftp/ftpd/ftpd.c @@ -107,12 +107,7 @@ extern char *sys_errlist[]; extern char *mktemp (); -#ifndef HAVE_SETEUID -#ifdef HAVE_SETRESUID -#define seteuid(e) setresuid(-1,e,-1) -#define setegid(e) setresgid(-1,e,-1) -#endif -#endif +#include #ifdef STDARG extern reply(int, char *, ...); @@ -709,7 +704,7 @@ checkuser(name) end_login() { - (void) seteuid((uid_t)0); + (void) krb5_seteuid((uid_t)0); if (logged_in) ftp_logwtmp(ttyline, "", ""); pw = NULL; @@ -820,7 +815,7 @@ pass(passwd) } } login_attempts = 0; /* this time successful */ - (void) setegid((gid_t)pw->pw_gid); + (void) krb5_setegid((gid_t)pw->pw_gid); (void) initgroups(pw->pw_name, pw->pw_gid); /* open wtmp before chroot */ @@ -846,7 +841,7 @@ pass(passwd) } else lreply(230, "No directory! Logging in with home=/"); } - if (seteuid((uid_t)pw->pw_uid) < 0) { + if (krb5_seteuid((uid_t)pw->pw_uid) < 0) { reply(550, "Can't set uid."); goto bad; } @@ -1017,7 +1012,7 @@ getdatasock(mode) if (data >= 0) return (fdopen(data, mode)); - (void) seteuid((uid_t)0); + (void) krb5_seteuid((uid_t)0); s = socket(AF_INET, SOCK_STREAM, 0); if (s < 0) goto bad; @@ -1035,7 +1030,7 @@ getdatasock(mode) goto bad; sleep(tries); } - (void) seteuid((uid_t)pw->pw_uid); + (void) krb5_seteuid((uid_t)pw->pw_uid); #ifdef IP_TOS #ifdef IPTOS_THROUGHPUT on = IPTOS_THROUGHPUT; @@ -1045,7 +1040,7 @@ getdatasock(mode) #endif return (fdopen(s, mode)); bad: - (void) seteuid((uid_t)pw->pw_uid); + (void) krb5_seteuid((uid_t)pw->pw_uid); (void) close(s); return (NULL); } @@ -1695,7 +1690,7 @@ dologout(status) int status; { if (logged_in) { - (void) seteuid((uid_t)0); + (void) krb5_seteuid((uid_t)0); ftp_logwtmp(ttyline, "", ""); } /* beware of flushing buffers after a SIGPIPE */ @@ -1752,12 +1747,12 @@ passive() } pasv_addr = ctrl_addr; pasv_addr.sin_port = 0; - (void) seteuid((uid_t)0); + (void) krb5_seteuid((uid_t)0); if (bind(pdata, (struct sockaddr *)&pasv_addr, sizeof(pasv_addr)) < 0) { - (void) seteuid((uid_t)pw->pw_uid); + (void) krb5_seteuid((uid_t)pw->pw_uid); goto pasv_error; } - (void) seteuid((uid_t)pw->pw_uid); + (void) krb5_seteuid((uid_t)pw->pw_uid); len = sizeof(pasv_addr); if (getsockname(pdata, (struct sockaddr *) &pasv_addr, &len) < 0) goto pasv_error;