[GH-ISSUE #2485] Incorrect usage of $JOHN in fopen(3) #1644

Closed
opened 2026-10-15 04:21:44 +07:00 by bsakaguchi · 6 comments
Owner

Originally created by @carlorosati on GitHub (Mar 27, 2017).
Original GitHub issue: https://github.com/openwall/john/issues/2485

On a default ./configure && make -j https://github.com/magnumripper/JohnTheRipper/blob/bleeding-jumbo/src/config.c#L233 is used by

./fake_salts.c:162: cfg_init(CFG_PRIVATE_FULL_NAME, 1);
./fake_salts.c:163: cfg_init(CFG_PRIVATE_ALT_NAME, 1);
./fake_salts.c:165: cfg_init(CFG_FULL_NAME, 1);
./fake_salts.c:166: cfg_init(CFG_ALT_NAME, 0);
./config.c:567: cfg_init(Name, allow_missing);
./dynamic_utils.c:72: cfg_init(CFG_PRIVATE_FULL_NAME, 1);
./dynamic_utils.c:73: cfg_init(CFG_PRIVATE_ALT_NAME, 1);
./dynamic_utils.c:75: cfg_init(CFG_FULL_NAME, 1);
./dynamic_utils.c:76: cfg_init(CFG_ALT_NAME, 0);
./john.c:1445: cfg_init(options.config, 0);
./john.c:1446: cfg_init(CFG_FULL_NAME, 1);
./john.c:1447: cfg_init(CFG_ALT_NAME, 0);
./john.c:1452: cfg_init(CFG_PRIVATE_FULL_NAME, 1);
./john.c:1453: cfg_init(CFG_PRIVATE_ALT_NAME, 1);
./john.c:1455: cfg_init(CFG_FULL_NAME, 1);
./john.c:1456: cfg_init(CFG_ALT_NAME, 0);

with the following parameters

params.h:152:#define CFG_FULL_NAME "$JOHN/john.conf"
params.h:153:#define CFG_ALT_NAME "$JOHN/john.ini"

containing $JOHN

These will not expand to the correspondingly named environment variable. It merely tries to open the file at base directory literally named $JOHN. Try it yourself by executing the following command in any directory other than ../run and you will see this fixes all of the missing {john,best64}.{ini,conf} issues.

ln -s /path/to/JohnTheRipper/run '$JOHN'
john --test
Originally created by @carlorosati on GitHub (Mar 27, 2017). Original GitHub issue: https://github.com/openwall/john/issues/2485 On a default ```./configure && make -j``` https://github.com/magnumripper/JohnTheRipper/blob/bleeding-jumbo/src/config.c#L233 is used by ./fake_salts.c:162: cfg_init(CFG_PRIVATE_FULL_NAME, 1); ./fake_salts.c:163: cfg_init(CFG_PRIVATE_ALT_NAME, 1); ./fake_salts.c:165: cfg_init(CFG_FULL_NAME, 1); ./fake_salts.c:166: cfg_init(CFG_ALT_NAME, 0); ./config.c:567: cfg_init(Name, allow_missing); ./dynamic_utils.c:72: cfg_init(CFG_PRIVATE_FULL_NAME, 1); ./dynamic_utils.c:73: cfg_init(CFG_PRIVATE_ALT_NAME, 1); ./dynamic_utils.c:75: cfg_init(CFG_FULL_NAME, 1); ./dynamic_utils.c:76: cfg_init(CFG_ALT_NAME, 0); ./john.c:1445: cfg_init(options.config, 0); ./john.c:1446: cfg_init(CFG_FULL_NAME, 1); ./john.c:1447: cfg_init(CFG_ALT_NAME, 0); ./john.c:1452: cfg_init(CFG_PRIVATE_FULL_NAME, 1); ./john.c:1453: cfg_init(CFG_PRIVATE_ALT_NAME, 1); ./john.c:1455: cfg_init(CFG_FULL_NAME, 1); ./john.c:1456: cfg_init(CFG_ALT_NAME, 0); with the following parameters params.h:152:#define CFG_FULL_NAME "$JOHN/john.conf" params.h:153:#define CFG_ALT_NAME "$JOHN/john.ini" containing ```$JOHN``` These will not expand to the correspondingly named environment variable. It merely tries to open the file at base directory literally named ```$JOHN```. Try it yourself by executing the following command in any directory other than ```../run``` and you will see this fixes all of the missing ```{john,best64}.{ini,conf}``` issues. ``` ln -s /path/to/JohnTheRipper/run '$JOHN' john --test ```
bsakaguchi 2026-10-15 04:21:44 +07:00
  • closed this issue
  • added the
    invalid
    label
Author
Owner

@magnumripper commented on GitHub (Mar 27, 2017):

These will not expand to the correspondingly named environment variable

They are not supposed to. While $JOHN may look like an environment variable, it isn't - it's just a placeholder. That placeholder is replaced with something else (depending on build type) in path_expand().

and you will see this fixes all of the missing {john,best64}.{ini,conf} issues.

What issues? I'm not aware of any. My guess is you try to use a non-systemwide build as if it was a systemwide one. If you use ./john or some/path/john instead of just john, there is no problem, right? If you want to use john without a path, you need to build systemwide. See params.h for (brief) hints about how that's done. Any questions to john-users mailing list, please.

<!-- gh-comment-id:289530631 --> @magnumripper commented on GitHub (Mar 27, 2017): > These will not expand to the correspondingly named environment variable They are not supposed to. While `$JOHN` may look like an environment variable, it isn't - it's just a placeholder. That placeholder is replaced with something else (depending on build type) in `path_expand()`. > and you will see this fixes all of the missing `{john,best64}.{ini,conf}` issues. What issues? I'm not aware of any. My guess is you try to use a non-systemwide build as if it was a systemwide one. If you use `./john` or `some/path/john` instead of just `john`, there is no problem, right? If you want to use john without a path, you need to build systemwide. See params.h for (brief) hints about how that's done. Any questions to john-users mailing list, please.
Author
Owner

@magnumripper commented on GitHub (Mar 27, 2017):

Watch this:

$ cd src
$ ../run/john --list=build-info | grep JOHN
$JOHN is ../run/

$ cd ../run      
$ ./john --list=build-info | grep JOHN
$JOHN is ./

$ PATH=$PATH:.
$ john --list=build-info | grep JOHN
$JOHN is 

The last one is "wrong use". For a systemwide build, $JOHN would have been replaced with some hardcoded path like /usr/share/john in that case. But this (like yours) is just a default build.

<!-- gh-comment-id:289531924 --> @magnumripper commented on GitHub (Mar 27, 2017): Watch this: ``` $ cd src $ ../run/john --list=build-info | grep JOHN $JOHN is ../run/ $ cd ../run $ ./john --list=build-info | grep JOHN $JOHN is ./ $ PATH=$PATH:. $ john --list=build-info | grep JOHN $JOHN is ``` The last one is "wrong use". For a systemwide build, $JOHN would have been replaced with some hardcoded path like /usr/share/john in that case. But this (like yours) is just a default build.
Author
Owner

@carlorosati commented on GitHub (Mar 27, 2017):

Well, path_expand() is not working.

% strace -e open ./john --test |& grep -F '$JOHN'
open("$JOHN/john.local.conf", O_RDONLY) = -1 ENOENT (No such file or directory)
open("$JOHN/john-local.conf", O_RDONLY) = -1 ENOENT (No such file or directory)

Also the build-info output does match yours.

% ./john --list=build-info | grep JOHN
$JOHN is ./

% ../run/john --list=build-info | grep JOHN
$JOHN is ../run/

% john --list=build-info | grep JOHN
$JOHN is

<!-- gh-comment-id:289533153 --> @carlorosati commented on GitHub (Mar 27, 2017): Well, ```path_expand()``` is not working. % strace -e open ./john --test |& grep -F '$JOHN' open("$JOHN/john.local.conf", O_RDONLY) = -1 ENOENT (No such file or directory) open("$JOHN/john-local.conf", O_RDONLY) = -1 ENOENT (No such file or directory) Also the build-info output does match yours. % ./john --list=build-info | grep JOHN $JOHN is ./ % ../run/john --list=build-info | grep JOHN $JOHN is ../run/ % john --list=build-info | grep JOHN $JOHN is
Author
Owner

@magnumripper commented on GitHub (Mar 27, 2017):

It looks for a john-local.conf that's not present (which is normal). Nothing wrong with that.

<!-- gh-comment-id:289533926 --> @magnumripper commented on GitHub (Mar 27, 2017): It looks for a john-local.conf that's not present (which is normal). Nothing wrong with that.
Author
Owner

@carlorosati commented on GitHub (Mar 27, 2017):

Okay. This will be fixed by the --prefix temporary workaround of copying files from run

<!-- gh-comment-id:289534899 --> @carlorosati commented on GitHub (Mar 27, 2017): Okay. This will be fixed by the --prefix temporary workaround of copying files from run
Author
Owner

@magnumripper commented on GitHub (Mar 27, 2017):

Also the build-info output does match yours.

Exactly, so there is no problem. You are/were just using it wrong. Please move this discussion to john-users mailing list.

<!-- gh-comment-id:289534916 --> @magnumripper commented on GitHub (Mar 27, 2017): > Also the build-info output does match yours. Exactly, so there is no problem. You are/were just using it wrong. Please move this discussion to john-users mailing list.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
openwall/john#1644
No description provided.