Date: Wed, 31 Aug 2011 11:38:17 -0500
From: "jfoug" <jfoug@....net>
Subject: Outputting proper john.conf file name upon error
I knew this was an issue, and magnum poked me about it.
If there are errors in another .conf file, that was .included, then the line
numbers in the error message, would be right, but the file name output was
the 'master' john.conf file originally loaded.
This is now fixed, in patch 0005. I thought this would be harder to do than
it was. However, it ended up being pretty easy.
I had to add a cfg_name char* pointer within the cfg_line structure. Then
within the load line, when setting the line number of the file to be the
proper number, I then assign the global cfg_name pointer to the local
cfg_name pointer within the cfg_line structure being built.
Then in the load-new-file part, where I recurse into the new config file, I
save the global char *cfg_name into a stack variable, and upon return from
the recursive call, I reset the global pointer. What this will do is have
that global always be tracking the 'current' .conf file being loaded right
now, and then when that file has been completely read, the prior file name
is restored. Thus within cfg_load_line, the proper file name will always be
present, to set the cfg_line->cfg_name pointer.
I then had to make some changes in extern.c, rules,c and md5_gen_parser.c so
that the points where syntax checking found problems, and filename/line
number were being output, that the file name was changed from the global
cfg_name to instead use the cfg_name from the line's data.
All in all, pretty easy, and now the errors have proper context data.
Content of type "text/html" skipped
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.