commit - c5d17ec881b7f4c35f151faa9d30ac436d812dc3
commit + e9e0377f452e9d3f600011e0714cc6c779f10bab
blob - aac808b4b78aea1e1c1e43492f46a8fd7ff4495f
blob + 61404820c89b2b713cc2e51739b6221e9ab104c1
--- gitwrapper/gitwrapper.c
+++ gitwrapper/gitwrapper.c
confpath = getenv("GOTD_CONF_PATH");
if (confpath == NULL)
confpath = GOTD_CONF_PATH;
- parse_config(confpath, PROC_GOTD, &gotd);
+ parse_config(confpath, PROC_GOTD, &gotd, 0);
error = apply_unveil(myserver);
if (error)
blob - c7a273204feec2eff188ea2e2530aa3c3d833253
blob + 794c48b1569cbd4214a7d34d9e2e81ac05ff789c
--- gotd/gotd.c
+++ gotd/gotd.c
if (geteuid() && (proc_id == PROC_GOTD || proc_id == PROC_LISTEN))
fatalx("need root privileges");
- if (parse_config(confpath, proc_id, &gotd) != 0)
+ if (parse_config(confpath, proc_id, &gotd, 1) != 0)
return 1;
pw = getpwnam(gotd.user_name);
blob - 63cffc677d842269d09d3f07a3cc61bdf1e6c28b
blob + 1f9b40a97a0e8ed68f190efc0abc407e5fbc5fde
--- gotd/gotd.h
+++ gotd/gotd.h
uint32_t client_id;
};
-int parse_config(const char *, enum gotd_procid, struct gotd *);
+int parse_config(const char *, enum gotd_procid, struct gotd *, int);
struct gotd_repo *gotd_find_repo_by_name(const char *, struct gotd *);
/* imsg.c */
blob - 9a5b91d273ade58fbf2195742c6bf0866eb7ac69
blob + b7d7e708dc1650571a862cb8f93f26798d1f1037
--- gotd/parse.y
+++ gotd/parse.y
int lineno;
int errors;
} *file;
-struct file *newfile(const char *, int);
+struct file *newfile(const char *, int, int);
static void closefile(struct file *);
int check_file_secrecy(int, const char *);
int yyparse(void);
}
struct file *
-newfile(const char *name, int secret)
+newfile(const char *name, int secret, int required)
{
struct file *nfile;
}
nfile->stream = fopen(nfile->name, "r");
if (nfile->stream == NULL) {
- log_warn("open %s", nfile->name);
+ if (required)
+ log_warn("open %s", nfile->name);
free(nfile->name);
free(nfile);
return (NULL);
int
parse_config(const char *filename, enum gotd_procid proc_id,
- struct gotd *env)
+ struct gotd *env, int require_config_file)
{
struct sym *sym, *next;
struct gotd_repo *repo;
gotd->request_timeout.tv_sec = GOTD_DEFAULT_REQUEST_TIMEOUT;
gotd->request_timeout.tv_usec = 0;
- file = newfile(filename, 0);
+ file = newfile(filename, 0, require_config_file);
if (file == NULL)
- return -1;
+ return require_config_file ? -1 : 0;
yyparse();
errors = file->errors;