summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>2007-10-18 20:32:38 +0000
committerderaadt <deraadt@openbsd.org>2007-10-18 20:32:38 +0000
commit953e8caa74accad97f88ee1a8512c4fda2d61cdf (patch)
treee797f81dc146c58ca575f2e8082f5ae14328b477
parentavoid splassert, caused by the fact that iha_main() is called (diff)
downloadwireguard-openbsd-953e8caa74accad97f88ee1a8512c4fda2d61cdf.tar.xz
wireguard-openbsd-953e8caa74accad97f88ee1a8512c4fda2d61cdf.zip
repair file security warnings; ok pyr
-rw-r--r--usr.sbin/hoststated/parse.y14
-rw-r--r--usr.sbin/relayd/parse.y14
2 files changed, 16 insertions, 12 deletions
diff --git a/usr.sbin/hoststated/parse.y b/usr.sbin/hoststated/parse.y
index 7578f91e9bd..208e7f31cf7 100644
--- a/usr.sbin/hoststated/parse.y
+++ b/usr.sbin/hoststated/parse.y
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.y,v 1.65 2007/10/16 20:01:23 mpf Exp $ */
+/* $OpenBSD: parse.y,v 1.66 2007/10/18 20:32:38 deraadt Exp $ */
/*
* Copyright (c) 2006 Pierre-Yves Ritschard <pyr@openbsd.org>
@@ -1508,15 +1508,15 @@ check_file_secrecy(int fd, const char *fname)
struct stat st;
if (fstat(fd, &st)) {
- log_warn("cannot stat %s", fname);
+ warn("cannot stat %s", fname);
return (-1);
}
if (st.st_uid != 0 && st.st_uid != getuid()) {
- log_warnx("%s: owner not root or current user", fname);
+ warnx("%s: owner not root or current user", fname);
return (-1);
}
if (st.st_mode & (S_IRWXG | S_IRWXO)) {
- log_warnx("%s: group/world readable/writeable", fname);
+ warnx("%s: group/world readable/writeable", fname);
return (-1);
}
return (0);
@@ -1528,9 +1528,12 @@ pushfile(const char *name, int secret)
struct file *nfile;
if ((nfile = calloc(1, sizeof(struct file))) == NULL ||
- (nfile->name = strdup(name)) == NULL)
+ (nfile->name = strdup(name)) == NULL) {
+ warn("malloc", nfile->name);
return (NULL);
+ }
if ((nfile->stream = fopen(nfile->name, "r")) == NULL) {
+ warnx("%s", nfile->name);
free(nfile->name);
free(nfile);
return (NULL);
@@ -1611,7 +1614,6 @@ parse_config(const char *filename, int opts)
conf->confpath = filename;
if ((file = pushfile(filename, 1)) == NULL) {
- warn("%s", filename);
free(conf);
return (NULL);
}
diff --git a/usr.sbin/relayd/parse.y b/usr.sbin/relayd/parse.y
index 7578f91e9bd..208e7f31cf7 100644
--- a/usr.sbin/relayd/parse.y
+++ b/usr.sbin/relayd/parse.y
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.y,v 1.65 2007/10/16 20:01:23 mpf Exp $ */
+/* $OpenBSD: parse.y,v 1.66 2007/10/18 20:32:38 deraadt Exp $ */
/*
* Copyright (c) 2006 Pierre-Yves Ritschard <pyr@openbsd.org>
@@ -1508,15 +1508,15 @@ check_file_secrecy(int fd, const char *fname)
struct stat st;
if (fstat(fd, &st)) {
- log_warn("cannot stat %s", fname);
+ warn("cannot stat %s", fname);
return (-1);
}
if (st.st_uid != 0 && st.st_uid != getuid()) {
- log_warnx("%s: owner not root or current user", fname);
+ warnx("%s: owner not root or current user", fname);
return (-1);
}
if (st.st_mode & (S_IRWXG | S_IRWXO)) {
- log_warnx("%s: group/world readable/writeable", fname);
+ warnx("%s: group/world readable/writeable", fname);
return (-1);
}
return (0);
@@ -1528,9 +1528,12 @@ pushfile(const char *name, int secret)
struct file *nfile;
if ((nfile = calloc(1, sizeof(struct file))) == NULL ||
- (nfile->name = strdup(name)) == NULL)
+ (nfile->name = strdup(name)) == NULL) {
+ warn("malloc", nfile->name);
return (NULL);
+ }
if ((nfile->stream = fopen(nfile->name, "r")) == NULL) {
+ warnx("%s", nfile->name);
free(nfile->name);
free(nfile);
return (NULL);
@@ -1611,7 +1614,6 @@ parse_config(const char *filename, int opts)
conf->confpath = filename;
if ((file = pushfile(filename, 1)) == NULL) {
- warn("%s", filename);
free(conf);
return (NULL);
}