summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgilles <gilles@openbsd.org>2019-01-30 21:33:34 +0000
committergilles <gilles@openbsd.org>2019-01-30 21:33:34 +0000
commitfe56b6ec41a7e432cbd5325fd77633ca1c00eb47 (patch)
tree5df0af0e6cafc5f998312b06bb53f00348b0e67d
parentrevert previous commit, i wasn't happy with it and it probably came from a (diff)
downloadwireguard-openbsd-fe56b6ec41a7e432cbd5325fd77633ca1c00eb47.tar.xz
wireguard-openbsd-fe56b6ec41a7e432cbd5325fd77633ca1c00eb47.zip
missed in previous revert, function not called anymore
-rw-r--r--usr.sbin/smtpd/util.c49
1 files changed, 1 insertions, 48 deletions
diff --git a/usr.sbin/smtpd/util.c b/usr.sbin/smtpd/util.c
index 468c326c8df..2d9628488d6 100644
--- a/usr.sbin/smtpd/util.c
+++ b/usr.sbin/smtpd/util.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: util.c,v 1.139 2019/01/30 14:21:01 gilles Exp $ */
+/* $OpenBSD: util.c,v 1.140 2019/01/30 21:33:34 gilles Exp $ */
/*
* Copyright (c) 2000,2001 Markus Friedl. All rights reserved.
@@ -602,53 +602,6 @@ secure_file(int fd, char *path, char *userdir, uid_t uid, int mayread)
return 1;
}
-int
-secure_forward(int fd, char *path, char *userdir, uid_t uid)
-{
- char buf[PATH_MAX];
- char homedir[PATH_MAX];
- struct stat st;
- char *cp;
-
- if (realpath(path, buf) == NULL)
- return 0;
-
- if (realpath(userdir, homedir) == NULL)
- homedir[0] = '\0';
-
- /* Check the open file to avoid races. */
- if (fstat(fd, &st) < 0 ||
- !S_ISREG(st.st_mode) ||
- st.st_uid != uid ||
- (st.st_mode & S_IWOTH) != 0)
- return 0;
-
- /* For each component of the canonical path, walking upwards. */
- for (;;) {
- if ((cp = dirname(buf)) == NULL)
- return 0;
- (void)strlcpy(buf, cp, sizeof(buf));
-
- if (stat(buf, &st) < 0 ||
- (st.st_uid != 0 && st.st_uid != uid) ||
- (st.st_mode & S_IWOTH) != 0)
- return 0;
-
- /* We can stop checking after reaching homedir level. */
- if (strcmp(homedir, buf) == 0)
- break;
-
- /*
- * dirname should always complete with a "/" path,
- * but we can be paranoid and check for "." too
- */
- if ((strcmp("/", buf) == 0) || (strcmp(".", buf) == 0))
- break;
- }
-
- return 1;
-}
-
void
addargs(arglist *args, char *fmt, ...)
{