httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wr...@apache.org
Subject cvs commit: httpd-2.0/support htpasswd.c
Date Sat, 14 Sep 2002 16:43:25 GMT
wrowe       2002/09/14 09:43:25

  Modified:    support  htpasswd.c
  Log:
    Move another non-exists test into the non-existing tests block, and
    clean up the comments a bit more.
  
  Revision  Changes    Path
  1.63      +19 -16    httpd-2.0/support/htpasswd.c
  
  Index: htpasswd.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/support/htpasswd.c,v
  retrieving revision 1.62
  retrieving revision 1.63
  diff -u -r1.62 -r1.63
  --- htpasswd.c	14 Sep 2002 08:44:26 -0000	1.62
  +++ htpasswd.c	14 Sep 2002 16:43:24 -0000	1.63
  @@ -497,25 +497,16 @@
                           "might just not work on this platform.\n");
       }
   #endif
  +
  +    /*
  +     * Only do the file checks if we're supposed to frob it.
  +     */
       if (!(mask & APHTP_NOFILE)) {
           existing_file = exists(pwfilename, pool);
  -        /*
  -         * 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) && !existing_file) {
  -            apr_file_printf(errfile,
  -                    "%s: cannot modify file %s; use '-c' to create it\n",
  -                    argv[0], pwfilename);
  -            exit(ERR_FILEPERM);
  -        }
  -        /*
  -         * If the file exists, check that it's readable and writable.
  -         * If it doesn't exist, verify that we can create it.
  -         */
           if (existing_file) {
  +            /*
  +             * Check that this existing file is readable and writable.
  +             */
               if (!accessible(pool, pwfilename, APR_READ | APR_APPEND)) {
                   apr_file_printf(errfile, "%s: cannot open file %s for "
                                   "read/write access\n", argv[0], pwfilename);
  @@ -523,6 +514,18 @@
               }
           }
           else {
  +            /*
  +             * Error out if -c was omitted for this non-existant file.
  +             */
  +            if (!(mask & APHTP_NEWFILE)) {
  +                apr_file_printf(errfile,
  +                        "%s: cannot modify file %s; use '-c' to create it\n",
  +                        argv[0], pwfilename);
  +                exit(ERR_FILEPERM);
  +            }
  +            /*
  +             * As it doesn't exist yet, verify that we can create it.
  +             */
               if (!accessible(pool, pwfilename, APR_CREATE | APR_WRITE)) {
                   apr_file_printf(errfile, "%s: cannot create file %s\n",
                                   argv[0], pwfilename);
  
  
  

Mime
View raw message