summaryrefslogtreecommitdiff
path: root/sbin
diff options
context:
space:
mode:
authorAlexander Bluhm <bluhm@cvs.openbsd.org>2019-11-14 20:41:47 +0000
committerAlexander Bluhm <bluhm@cvs.openbsd.org>2019-11-14 20:41:47 +0000
commit589d19aee85d29054e92fca7bf59e2f824f00824 (patch)
tree5f62663dca268e7919bcbf07dc1bce405df573a2 /sbin
parent6f0b215c36fdd5f6657e5f06f1d977115412766d (diff)
Do not print misleading error message about permission error for
non existing isakmpd.conf(5) file. This was a result of the changed realpath(3) behavior. Now isakmpd(8) uses the errno from the system. reported by igor kos; OK deraadt@
Diffstat (limited to 'sbin')
-rw-r--r--sbin/isakmpd/monitor.c19
1 files changed, 6 insertions, 13 deletions
diff --git a/sbin/isakmpd/monitor.c b/sbin/isakmpd/monitor.c
index 1510438d26c..8cdf0240ddb 100644
--- a/sbin/isakmpd/monitor.c
+++ b/sbin/isakmpd/monitor.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: monitor.c,v 1.77 2019/06/28 13:32:44 deraadt Exp $ */
+/* $OpenBSD: monitor.c,v 1.78 2019/11/14 20:41:46 bluhm Exp $ */
/*
* Copyright (c) 2003 Håkan Olsson. All rights reserved.
@@ -518,9 +518,9 @@ m_priv_getfd(void)
if ((ret = m_priv_local_sanitize_path(path, sizeof path, flags))
!= 0) {
- if (ret == 1)
+ if (errno != ENOENT)
log_print("m_priv_getfd: illegal path \"%s\"", path);
- err = EACCES;
+ err = errno;
v = -1;
} else {
if ((v = open(path, flags, mode)) == -1)
@@ -695,15 +695,8 @@ m_priv_local_sanitize_path(char *path, size_t pmax, int flags)
*/
if (realpath(path, new_path) == NULL ||
- realpath("/var/run", var_run) == NULL) {
- /*
- * We could not decide whether the path is ok or not.
- * Indicate this be returning 2.
- */
- if (errno == ENOENT)
- return 2;
- goto bad_path;
- }
+ realpath("/var/run", var_run) == NULL)
+ return 1;
strlcat(var_run, "/", sizeof(var_run));
if (strncmp(var_run, new_path, strlen(var_run)) == 0)
@@ -713,7 +706,7 @@ m_priv_local_sanitize_path(char *path, size_t pmax, int flags)
(flags & O_ACCMODE) == O_RDONLY)
return 0;
-bad_path:
+ errno = EACCES;
return 1;
}