mirror of https://github.com/omar-polo/gmid.git
require absolute paths in config file
This commit is contained in:
parent
bcf5d929e6
commit
e17642a7bb
|
@ -1,3 +1,7 @@
|
||||||
|
2021-02-01 Omar Polo <op@omarpolo.com>
|
||||||
|
|
||||||
|
* parse.y (servopt): require absolute paths in config file
|
||||||
|
|
||||||
2021-01-31 Omar Polo <op@omarpolo.com>
|
2021-01-31 Omar Polo <op@omarpolo.com>
|
||||||
|
|
||||||
* gmid.c (main): cgi scripts now have only std{in,out,err} open
|
* gmid.c (main): cgi scripts now have only std{in,out,err} open
|
||||||
|
|
15
parse.y
15
parse.y
|
@ -40,6 +40,7 @@ const char *config_path;
|
||||||
void yyerror(const char*);
|
void yyerror(const char*);
|
||||||
int parse_portno(const char*);
|
int parse_portno(const char*);
|
||||||
void parse_conf(const char*);
|
void parse_conf(const char*);
|
||||||
|
char *ensure_absolute_path(char*);
|
||||||
|
|
||||||
%}
|
%}
|
||||||
|
|
||||||
|
@ -111,9 +112,9 @@ servopts : /* empty */
|
||||||
| servopts servopt
|
| servopts servopt
|
||||||
;
|
;
|
||||||
|
|
||||||
servopt : TCERT TSTRING { host->cert = $2; }
|
servopt : TCERT TSTRING { host->cert = ensure_absolute_path($2); }
|
||||||
| TKEY TSTRING { host->key = $2; }
|
| TKEY TSTRING { host->key = ensure_absolute_path($2); }
|
||||||
| TROOT TSTRING { host->dir = $2; }
|
| TROOT TSTRING { host->dir = ensure_absolute_path($2); }
|
||||||
| TCGI TSTRING {
|
| TCGI TSTRING {
|
||||||
host->cgi = $2;
|
host->cgi = $2;
|
||||||
/* drop the starting '/', if any */
|
/* drop the starting '/', if any */
|
||||||
|
@ -191,3 +192,11 @@ parse_conf(const char *path)
|
||||||
if (goterror)
|
if (goterror)
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
char *
|
||||||
|
ensure_absolute_path(char *path)
|
||||||
|
{
|
||||||
|
if (path == NULL || *path != '/')
|
||||||
|
yyerror("not an absolute path");
|
||||||
|
return path;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue