summaryrefslogtreecommitdiff
path: root/libexec
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2002-11-25 22:45:40 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2002-11-25 22:45:40 +0000
commit9d6ab873be4d419a39b860f8e32bac7b1d9ce244 (patch)
tree4bf36f44faffe5a1f394d6700af7942f75c30b99 /libexec
parentdc7406bb51781f7d04ed41dcdecd5d1a742915e6 (diff)
Change a setuid() that should be seteuid(), not iced by grange@
Move a va_end so it gets called in an error condition as well
Diffstat (limited to 'libexec')
-rw-r--r--libexec/ftpd/ftpd.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/libexec/ftpd/ftpd.c b/libexec/ftpd/ftpd.c
index 924ffc00b79..c01568d409f 100644
--- a/libexec/ftpd/ftpd.c
+++ b/libexec/ftpd/ftpd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ftpd.c,v 1.138 2002/11/15 19:52:15 millert Exp $ */
+/* $OpenBSD: ftpd.c,v 1.139 2002/11/25 22:45:39 millert Exp $ */
/* $NetBSD: ftpd.c,v 1.15 1995/06/03 22:46:47 mycroft Exp $ */
/*
@@ -74,7 +74,7 @@ static const char copyright[] =
static const char sccsid[] = "@(#)ftpd.c 8.4 (Berkeley) 4/16/94";
#else
static const char rcsid[] =
- "$OpenBSD: ftpd.c,v 1.138 2002/11/15 19:52:15 millert Exp $";
+ "$OpenBSD: ftpd.c,v 1.139 2002/11/25 22:45:39 millert Exp $";
#endif
#endif /* not lint */
@@ -1043,7 +1043,7 @@ pass(passwd)
} else
lreply(230, "No directory! Logging in with home=/");
}
- if (setuid(pw->pw_uid) < 0) {
+ if (seteuid(pw->pw_uid) < 0) {
reply(550, "Can't set uid.");
goto bad;
}
@@ -1896,10 +1896,13 @@ void
reply(int n, const char *fmt, ...)
{
char *buf, *p, *next;
+ int rval;
va_list ap;
va_start(ap, fmt);
- if (vasprintf(&buf, fmt, ap) == -1 || buf == NULL) {
+ rval = vasprintf(&buf, fmt, ap);
+ va_end(ap);
+ if (rval == -1 || buf == NULL) {
printf("412 Local resource failure: malloc\r\n");
fflush(stdout);
dologout(1);
@@ -1913,7 +1916,6 @@ reply(int n, const char *fmt, ...)
}
(void)fflush(stdout);
free(buf);
- va_end(ap);
}
void