]> granicus.if.org Git - apache/commitdiff
Make the support stuff finitely working again.
authorRalf S. Engelschall <rse@apache.org>
Mon, 27 Sep 1999 07:19:55 +0000 (07:19 +0000)
committerRalf S. Engelschall <rse@apache.org>
Mon, 27 Sep 1999 07:19:55 +0000 (07:19 +0000)
BTW, how can it be that nowadays it can happen that the Apache Group has a
source tree which doesn't compile under Unix for more than two weeks (I was
busy with exams and it didn't compile src/support/ already there)? In the past
this was definitely not possible.  Seems like the source-centered hacker focus
drifts away... sorry, for me this seems like a horrifying evolution, friends.
Please let us always make sure that the source at least compiles. I don't want
to say it should also run, but hell, it should at least compile and if not it
should be fixed within a few days...

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@83919 13f79535-47bb-0310-9956-ffa450edef68

support/htpasswd.c

index 21a24e0c0a39089f6f93c8b9353a418f5a8fbb36..e65daba095de0b8e45901847ef3d70b2202a3462 100644 (file)
@@ -152,6 +152,17 @@ static void putline(FILE *f, char *l)
     fputc('\n', f);
 }
 
+static void to64(char *s, unsigned long v, int n)
+{
+    static unsigned char itoa64[] =         /* 0 ... 63 => ASCII - 64 */
+       "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
+
+    while (--n >= 0) {
+       *s++ = itoa64[v&0x3f];
+       v >>= 6;
+    }
+}
+
 /*
  * Make a password record from the given information.  A zero return
  * indicates success; failure means that the output buffer contains an
@@ -192,7 +203,7 @@ static int mkrecord(char *user, char *record, size_t rlen, char *passwd,
 
     case ALG_APMD5: 
         (void) srand((int) time((time_t *) NULL));
-        ap_to64(&salt[0], rand(), 8);
+        to64(&salt[0], rand(), 8);
         salt[8] = '\0';
 
        ap_MD5Encode((const unsigned char *)pw, (const unsigned char *)salt,
@@ -207,7 +218,7 @@ static int mkrecord(char *user, char *record, size_t rlen, char *passwd,
     case ALG_CRYPT:
     default:
         (void) srand((int) time((time_t *) NULL));
-        ap_to64(&salt[0], rand(), 8);
+        to64(&salt[0], rand(), 8);
         salt[8] = '\0';
 
        ap_cpystrn(cpw, (char *)crypt(pw, salt), sizeof(cpw) - 1);