DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT <http://nagoya.apache.org/bugzilla/show_bug.cgi?id=10870>. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=10870 htpasswd error ------- Additional Comments From [EMAIL PROTECTED] 2002-07-22 08:25 ------- In order to get a working htpasswd, I found that fixing one problem uncovered others when compiling this with gcc-2.95 on a Linux system (particularly the grouping of logical expressions partially fixed in patch "c and n options conflict". That patches one place; the same kind of thing was needed in several). The following is a patch which addresses several problems, but I am not satisfied it supplies the expected logic of the options. However, it produces a functioning htpasswd. By "expected logic", I mean for example, if a password file exists, and the -c option is used again, should it just carry out the rest of the operation without recreating the file, or should it warn and quit? I put this here for review of other patch writers, and to give you a functioning htpasswd, if not one perfectly acceptable to everyone: ------------------ cut here ------------------------------------ --- httpd-2.0.39/support/htpasswd.c Sun Jul 21 21:51:13 2002 +++ httpd-2.0.39.work/support/htpasswd.c Mon Jul 22 00:58:34 2002 @@ -297,7 +297,7 @@ */ static int writable(apr_pool_t *pool, char *fname) { - return accessible(pool, fname, APR_APPEND); + return accessible(pool, fname, APR_WRITE); } /* @@ -375,7 +375,7 @@ } } - if (*mask & (APHTP_NEWFILE | APHTP_NOFILE)) { + if (*mask & APHTP_NEWFILE && *mask & APHTP_NOFILE) { apr_file_printf(errfile, "%s: -c and -n options conflict\n", argv[0]); exit(ERR_SYNTAX); } @@ -486,14 +486,15 @@ "just not work on this platform.\n"); } #endif - if (! mask & APHTP_NOFILE) { + if (! (mask & APHTP_NOFILE)) { /* * Only do the file checks if we're supposed to frob it. * * Verify that the file exists if -c was omitted. We give a special * message if it doesn't. */ - if ((! mask & APHTP_NEWFILE) && (! exists(pwfilename, pool))) { + + if ((! (mask & APHTP_NEWFILE)) && (! exists(pwfilename, pool))) { apr_file_printf(errfile, "%s: cannot modify file %s; use '-c' to create it\n", argv[0], pwfilename); @@ -504,7 +505,7 @@ * Verify that we can read the existing file in the case of an update * to it (rather than creation of a new one). */ - if ((! mask & APHTP_NEWFILE) && (! readable(pool, pwfilename))) { + if ((! (mask & APHTP_NEWFILE)) && (! readable(pool, pwfilename))) { apr_file_printf(errfile, "%s: cannot open file %s for read access\n", argv[0], pwfilename); perror("apr_file_open"); @@ -590,13 +591,16 @@ else { /* We found the user we were looking for, add him to the file. */ + found = -1; apr_file_printf(errfile, "Updating "); + strcat(record, "\n"); putline(ftemp, record); } } } if (!found) { apr_file_printf(errfile, "Adding "); + strcat(record, "\n"); putline(ftemp, record); } apr_file_printf(errfile, "password for user %s\n", user); ------------------ cut here ------------------------------------ --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
