diff options
author | Ian Jackson <Ian.Jackson@eu.citrix.com> | 2011-01-11 19:31:41 +0000 |
---|---|---|
committer | Ian Jackson <Ian.Jackson@eu.citrix.com> | 2011-01-11 19:31:41 +0000 |
commit | 54fbaf446bb350aff4dd5c4b0f44557186dd7d31 (patch) | |
tree | 935bc0f929a867e75ad01a6d21cc97ea8f1c02da /tools/libxl/libxlu_cfg.c | |
parent | 3e58e5d9c1fdc16dee74b891403f30e987965877 (diff) | |
download | xen-54fbaf446bb350aff4dd5c4b0f44557186dd7d31.tar.gz xen-54fbaf446bb350aff4dd5c4b0f44557186dd7d31.tar.bz2 xen-54fbaf446bb350aff4dd5c4b0f44557186dd7d31.zip |
libxl: config parser: print warning for apparent arbitrary python
The characters - + . ( ) : are not legal in xl config files but are
valid Python and use of at least one of them is almost essential for
writing arbitrary Python in the config file.
So if we see one of these during lexing, note it, and then after the
parse is complete if it failed we print a special extra warning.
Currently this warning refers to the nonexistent wiki page
http://wiki.xen.org/xenwiki/PythonInXlConfig
which will have to be written (and/or given a better name) before the
actual 4.1 release.
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Diffstat (limited to 'tools/libxl/libxlu_cfg.c')
-rw-r--r-- | tools/libxl/libxlu_cfg.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/tools/libxl/libxlu_cfg.c b/tools/libxl/libxlu_cfg.c index 821b8c04c4..663fdf9a02 100644 --- a/tools/libxl/libxlu_cfg.c +++ b/tools/libxl/libxlu_cfg.c @@ -24,6 +24,7 @@ static int ctx_prep(CfgParseContext *ctx, XLU_Config *cfg) { ctx->cfg= cfg; ctx->err= 0; ctx->lexerrlineno= -1; + ctx->likely_python= 0; ctx->scanner= 0; e= xlu__cfg_yylex_init_extra(ctx, &ctx->scanner); @@ -44,6 +45,14 @@ static void parse(CfgParseContext *ctx) { int r; r= xlu__cfg_yyparse(ctx); if (r) assert(ctx->err); + + if (ctx->err && ctx->likely_python) { + fputs( + "warning: Config file looks like it contains Python code.\n" + "warning: Arbitrary Python is no longer supported.\n" + "warning: See http://wiki.xen.org/xenwiki/PythonInXlConfig\n", + ctx->cfg->report); + } } int xlu_cfg_readfile(XLU_Config *cfg, const char *real_filename) { |