#
# Makefile for the Squid Object Cache server
#
-# $Id: Makefile.am,v 1.5 2003/05/31 11:31:46 hno Exp $
+# $Id: Makefile.am,v 1.6 2007/06/25 11:27:03 hno Exp $
#
# Uncomment and customize the following to suit your needs:
#
libexec_PROGRAMS = ncsa_auth
ncsa_auth_SOURCES = ncsa_auth.c crypt_md5.c crypt_md5.h
+man_MANS = ncsa_auth.8
+EXTRA_DIST = ncsa_auth.8
LDADD = -L$(top_builddir)/lib -lmiscutil $(CRYPTLIB) $(XTRA_LIBS) $(SSLLIB)
INCLUDES = -I$(top_srcdir)/include
*/
#include <string.h>
+#include <stdio.h>
#include "config.h"
#include "md5.h"
return passwd;
}
+
+/* Created by Ramon de Carvalho <ramondecarvalho@yahoo.com.br>
+ Refined by Rodrigo Rubira Branco <rodrigo@kernelhacking.com>
+*/
+char *md5sum(const char *s){
+ static unsigned char digest[16];
+ MD5_CTX ctx;
+ int idx;
+ static char sum[33];
+
+ memset(digest,0,16);
+
+ MD5Init(&ctx);
+ MD5Update(&ctx,(const unsigned char *)s,strlen(s));
+ MD5Final(digest,&ctx);
+
+ for(idx=0;idx<16;idx++)
+ sprintf(&sum[idx*2],"%02x",digest[idx]);
+
+ sum[32]='\0';
+
+ /* Don't leave anything around in vm they could use. */
+ memset(digest, 0, sizeof digest);
+
+ return sum;
+}
+
* salt[0] = '\0';
*/
char *crypt_md5(const char *pw, const char *salt);
+
+/* MD5 hash without salt */
+char *md5sum(const char *s);
u = (user_data *) hash_lookup(hash, user);
if (u == NULL) {
printf("ERR No such user\n");
+#if HAVE_CRYPT
} else if (strcmp(u->passwd, (char *) crypt(passwd, u->passwd)) == 0) {
printf("OK\n");
+#endif
} else if (strcmp(u->passwd, (char *) crypt_md5(passwd, u->passwd)) == 0) {
printf("OK\n");
+ } else if (strcmp(u->passwd, (char *) md5sum(passwd)) == 0) { /* md5 without salt and magic strings - Added by Ramon de Carvalho and Rodrigo Rubira Branco */
+ printf("OK\n");
} else {
printf("ERR Wrong password\n");
}