diff options
author | 2019-11-14 20:41:46 +0000 | |
---|---|---|
committer | 2019-11-14 20:41:46 +0000 | |
commit | f9fe46d2a87201e405f1b4ee2ade9ef7c695e8e4 (patch) | |
tree | e2273403371b38124b3a40f68d2e70e546ff94b1 | |
parent | Fix undefined symbol for ikev2_ike_sa_setreason. (diff) | |
download | wireguard-openbsd-f9fe46d2a87201e405f1b4ee2ade9ef7c695e8e4.tar.xz wireguard-openbsd-f9fe46d2a87201e405f1b4ee2ade9ef7c695e8e4.zip |
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@
-rw-r--r-- | sbin/isakmpd/monitor.c | 19 |
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; } |