httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David Jones" <oscare...@gmail.com>
Subject Re: PATCH: support utilities should enable crypt() , current htdbm checks broken
Date Fri, 23 Mar 2007 19:44:21 GMT
ok here's the simple patch at the 2.0.x level that just checks platforms for
htdbm.c

Also appended is the semi-related patch for htpasswd.c that adds TPF to the
platforms checked in 2 cases where its missed, which seems like an
oversight.

===================================================================
--- htdbm.c    (revision 521875)
+++ htdbm.c    (working copy)
@@ -66,7 +66,7 @@
 #define ALG_APMD5 1
 #define ALG_APSHA 2

-#if APR_HAVE_CRYPT_H
+#if (!(defined(WIN32) || defined(TPF) || defined(NETWARE)))
 #define ALG_CRYPT 3
 #endif

@@ -309,7 +309,7 @@
             /* XXX this len limitation is not in sync with any HTTPd len.
*/
             apr_cpystrn(cpw,htdbm->userpass,sizeof(cpw));
         break;
-#if APR_HAVE_CRYPT_H
+#if (!(defined(WIN32) || defined(TPF) || defined(NETWARE)))
         case ALG_CRYPT:
             (void) srand((int) time((time_t *) NULL));
             to64(&salt[0], rand(), 8);
@@ -340,7 +340,7 @@
 static void htdbm_usage(void)
 {

-#if APR_HAVE_CRYPT_H
+#if (!(defined(WIN32) || defined(TPF) || defined(NETWARE)))
 #define CRYPT_OPTION "d"
 #else
 #define CRYPT_OPTION ""
@@ -360,7 +360,7 @@
     fprintf(stderr, "   -c   Create a new database.\n");
     fprintf(stderr, "   -n   Don't update database; display results on
stdout.\n");
     fprintf(stderr, "   -m   Force MD5 encryption of the password
(default).\n");
-#if APR_HAVE_CRYPT_H
+#if (!(defined(WIN32) || defined(TPF) || defined(NETWARE)))
     fprintf(stderr, "   -d   Force CRYPT encryption of the password (now
deprecated).\n");
 #endif
     fprintf(stderr, "   -p   Do not encrypt the password (plaintext).\n");
@@ -467,7 +467,7 @@
             case 's':
                 h->alg = ALG_APSHA;
                 break;
-#if APR_HAVE_CRYPT_H
+#if (!(defined(WIN32) || defined(TPF) || defined(NETWARE)))
             case 'd':
                 h->alg = ALG_CRYPT;
                 break;




On 3/23/07, Jeff Trawick <trawick@gmail.com> wrote:
>
> On 3/20/07, William A. Rowe, Jr. <wrowe@rowe-clan.net> wrote:
> > Jeff Trawick wrote:
> > > On 3/20/07, William A. Rowe, Jr. <wrowe@rowe-clan.net> wrote:
> > >> httpd does not ;-)
> > >
> > > httpd the project (vs. apr, apr-util), not httpd the program (vs.
> > > htdbm, htpasswd)
> > >
> > > as in "In httpd, we don't call crypt(), we call APR..."
> >
> > So... what I suggest is;
> >
> > 1. use the same test from htpasswd to determine if crypt is used for
> >    htdbm from 2.0 - 2.2-branch.  E.g. which platforms?
> >
> > 2. use the APR_HAVE_CRYPT_H just to decide to include crypt.h, and the
> >    UNISTD test for unistd.h.
> >
> > 3. for trunk (2.4) forwards, add a new macro to APR trunk (1.3.x) that
> >    would 'reveal' if apr_password_* API's include crypt() support.
> >
> > Does that sound sane?
>
> sounds sane to me...
>
> looking for crypt() (issue #1) is cuter, but as it isn't the perfect
> solution anyway (issue #4) then don't bother with something that has a
> remote potential of hiding crypt() from somebody who has it today
>

Mime
View raw message