tag 403798 patch retitle 403798 john: don't clobber the default restore file name forwarded 403798 solar!openwall!com thanks
Included is a patch to prevent john from clobbering the default restore file name on its initial (non-restore) invocation. I'm not thrilled about the level of elegance, and the implications of re-overwriting the flags is not clear me. It might turn out to be necessary (or cleanest) to introduce a new global variable, "int was_restored". Alex, please feel free to comment. Ideally, Debian would apply the same patch used upstream (but perhaps before you make a new release). Happy y2k5, Justin References [0] http://bugs.debian.org/403798 diff -u john-1.6/debian/changelog john-1.6/debian/changelog --- john-1.6/debian/changelog +++ john-1.6/debian/changelog @@ -1,3 +1,25 @@ +john (1.6-33.1) unstable; urgency=low + + * Non-maintainer upload. + * Don't clobber unfortunately files with the default restore name + Closes: #403798 + + The logic is: + If a restore file is specified, and the file exists, then it is used as + a restore point + + If a restore file is specified, and it does not exist john exits with an + error message. + TODO: This should allow specification of a new restore file to be + created, but also should detect when a nonextant restore file is + specified (warn?) + + If no restore file is specified, john will error during initialization + if the default name of the restore file exists. Otherwise, it will + periodically save its state to that filename. + + -- Justin Pryzby <[EMAIL PROTECTED]> Mon, 1 Jan 2007 18:27:40 -0500 + john (1.6-33) unstable; urgency=medium * Fixed cronjob so that it doesn't send empty e-mails when no only in patch2: unchanged: --- john-1.6.orig/src/options.c +++ john-1.6/src/options.c @@ -125,6 +125,7 @@ if (options.flags & FLG_RESTORE_CHK) { rec_restore_args(1); + options.flags|=FLG_RESTORE_CHK; return; } only in patch2: unchanged: --- john-1.6.orig/src/recovery.c +++ john-1.6/src/recovery.c @@ -55,12 +55,19 @@ void rec_init(struct db_main *db, void (*save_mode)(FILE *file)) { + int mode=0; rec_done(1); if (!rec_argc) return; + else if (!(options.flags & FLG_RESTORE_CHK)) { + // The name of the default restore file shouldn't be + // overwritten if -restore isn't specified. + mode|=O_EXCL; + } - if ((rec_fd = open(path_expand(rec_name), O_RDWR | O_CREAT, 0600)) < 0) + if ((rec_fd = open(path_expand(rec_name), O_RDWR|O_CREAT|mode, 0600)) < 0) pexit("open: %s", path_expand(rec_name)); + rec_lock(); if (!(rec_file = fdopen(rec_fd, "w"))) pexit("fdopen"); -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]