rse 99/09/27 00:19:59
Modified: src/ap Makefile.tmpl src/support htpasswd.c Log: Make the support stuff finitely working again. 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... Revision Changes Path 1.7 +1 -1 apache-2.0/src/ap/Makefile.tmpl Index: Makefile.tmpl =================================================================== RCS file: /home/cvs/apache-2.0/src/ap/Makefile.tmpl,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- Makefile.tmpl 1999/09/23 19:07:56 1.6 +++ Makefile.tmpl 1999/09/27 07:19:47 1.7 @@ -5,7 +5,7 @@ LIB=libap.a -OBJS= ap_base64.o ap_buf.o ap_hooks.o +OBJS= ap_base64.o ap_sha1.o ap_buf.o ap_hooks.o .c.o: $(CC) -c $(INCLUDES) $(CFLAGS) $< 1.2 +13 -2 apache-2.0/src/support/htpasswd.c Index: htpasswd.c =================================================================== RCS file: /home/cvs/apache-2.0/src/support/htpasswd.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- htpasswd.c 1999/08/24 06:45:54 1.1 +++ htpasswd.c 1999/09/27 07:19:55 1.2 @@ -152,6 +152,17 @@ 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 @@ 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 @@ 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);