summaryrefslogtreecommitdiff
path: root/sbin/isakmpd/monitor.c
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2005-06-13 13:33:00 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2005-06-13 13:33:00 +0000
commit11c6024a5a3022b2e4b178ebce35f64cd7ccc455 (patch)
tree87932127b2f2b01a9b242aed49994c832bdb1b38 /sbin/isakmpd/monitor.c
parentc487199c2d4b84a5754a9435a36cca8812ab9c1c (diff)
Allow isakmpd to write a pid file when /var is a subdir (e.g. /usr/var)
and not a mount point.
Diffstat (limited to 'sbin/isakmpd/monitor.c')
-rw-r--r--sbin/isakmpd/monitor.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/sbin/isakmpd/monitor.c b/sbin/isakmpd/monitor.c
index 64c0bd79336..9008de6e2fe 100644
--- a/sbin/isakmpd/monitor.c
+++ b/sbin/isakmpd/monitor.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: monitor.c,v 1.59 2005/05/28 18:48:12 hshoexer Exp $ */
+/* $OpenBSD: monitor.c,v 1.60 2005/06/13 13:32:59 millert Exp $ */
/*
* Copyright (c) 2003 Håkan Olsson. All rights reserved.
@@ -777,7 +777,7 @@ must_write(const void *buf, size_t n)
static int
m_priv_local_sanitize_path(char *path, size_t pmax, int flags)
{
- char new_path[PATH_MAX];
+ char new_path[PATH_MAX], var_run[PATH_MAX];
/*
* We only permit paths starting with
@@ -785,13 +785,15 @@ m_priv_local_sanitize_path(char *path, size_t pmax, int flags)
* /var/run/ (rw)
*/
- if (realpath(path, new_path) == NULL) {
+ if (realpath(path, new_path) == NULL ||
+ realpath("/var/run", var_run) == NULL) {
if (errno == ENOENT)
return 1;
goto bad_path;
}
+ strlcat(var_run, "/", sizeof(var_run));
- if (strncmp("/var/run/", new_path, strlen("/var/run/")) == 0)
+ if (strncmp(var_run, new_path, strlen(var_run)) == 0)
return 0;
if (strncmp(ISAKMPD_ROOT, new_path, strlen(ISAKMPD_ROOT)) == 0 &&