=================================================================== RCS file: /cvs/cvs/blind/parse.y,v retrieving revision 1.8 retrieving revision 1.9 diff -u -p -r1.8 -r1.9 --- blind/parse.y 2022/03/22 02:18:20 1.8 +++ blind/parse.y 2022/03/25 21:12:46 1.9 @@ -16,14 +16,13 @@ %{ #include -#include #include #include -#include #include #include "blind.h" +#include "config.h" #include "log.h" TAILQ_HEAD(files, file) files = TAILQ_HEAD_INITIALIZER(files); @@ -54,9 +53,7 @@ int yyerror(const char *, ...) int config_load(struct blind *); struct file *config_push(const char *); int config_pop(void); -int config_perm(int, const char *); - TAILQ_HEAD(symhead, sym) symhead = TAILQ_HEAD_INITIALIZER(symhead); struct sym { TAILQ_ENTRY(sym) entry; @@ -518,24 +515,4 @@ config_pop(void) file = prv; return (file ? 0 : EOF); -} - -int -config_perm(int fd, const char *name) -{ - struct stat st; - - if (fstat(fd, &st)) { - log_debug("cannot stat config file"); - return (-1); - } - if (st.st_uid != 0 && st.st_uid != getuid()) { - log_debug("not root or current user owned"); - return (-1); - } - if (st.st_mode & (S_IWGRP | S_IXGRP | S_IRWXO)) { - log_debug("insecure config file"); - return (-1); - } - return (0); }