From: Martin Mares Date: Mon, 16 Mar 2009 22:43:56 +0000 (+0100) Subject: Adapted to reflect changes in libucw. X-Git-Tag: python-dummy-working~124 X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=b253c8e5e959e8a4bbbc259b3f3e5328f33f056b;p=eval.git Adapted to reflect changes in libucw. --- diff --git a/mop/admin/md5crypt.c b/mop/admin/md5crypt.c index 27ace0b..f4ad12f 100644 --- a/mop/admin/md5crypt.c +++ b/mop/admin/md5crypt.c @@ -9,8 +9,8 @@ * ---------------------------------------------------------------------------- */ -#include "lib/lib.h" -#include "lib/md5.h" +#include "ucw/lib.h" +#include "ucw/md5.h" #include #include @@ -43,7 +43,7 @@ libshadow_md5_crypt(const char *pw, const char *salt) static const char *sp,*ep; unsigned char final[16]; int sl,pl,i,j; - struct MD5Context ctx,ctx1; + md5_context ctx,ctx1; unsigned long l; /* Refine the Salt first */ @@ -60,25 +60,25 @@ libshadow_md5_crypt(const char *pw, const char *salt) /* get the length of the true salt */ sl = ep - sp; - MD5Init(&ctx); + md5_init(&ctx); /* The password first, since that is what is most unknown */ - MD5Update(&ctx,pw,strlen(pw)); + md5_update(&ctx,pw,strlen(pw)); /* Then our magic string */ - MD5Update(&ctx,magic,strlen(magic)); + md5_update(&ctx,magic,strlen(magic)); /* Then the raw salt */ - MD5Update(&ctx,sp,sl); + md5_update(&ctx,sp,sl); /* Then just as many characters of the MD5(pw,salt,pw) */ - MD5Init(&ctx1); - MD5Update(&ctx1,pw,strlen(pw)); - MD5Update(&ctx1,sp,sl); - MD5Update(&ctx1,pw,strlen(pw)); - MD5Final(final,&ctx1); + md5_init(&ctx1); + md5_update(&ctx1,pw,strlen(pw)); + md5_update(&ctx1,sp,sl); + md5_update(&ctx1,pw,strlen(pw)); + memcpy(final, md5_final(&ctx1), 16); for(pl = strlen(pw); pl > 0; pl -= 16) - MD5Update(&ctx,final,pl>16 ? 16 : pl); + md5_update(&ctx,final,pl>16 ? 16 : pl); /* Don't leave anything around in vm they could use. */ memset(final,0,sizeof final); @@ -86,16 +86,16 @@ libshadow_md5_crypt(const char *pw, const char *salt) /* Then something really weird... */ for (j=0,i = strlen(pw); i ; i >>= 1) if(i&1) - MD5Update(&ctx, final+j, 1); + md5_update(&ctx, final+j, 1); else - MD5Update(&ctx, pw+j, 1); + md5_update(&ctx, pw+j, 1); /* Now make the output string */ strcpy(passwd,magic); strncat(passwd,sp,sl); strcat(passwd,"$"); - MD5Final(final,&ctx); + memcpy(final, md5_final(&ctx), 16); /* * and now, just to make sure things don't run too fast @@ -103,23 +103,23 @@ libshadow_md5_crypt(const char *pw, const char *salt) * need 30 seconds to build a 1000 entry dictionary... */ for(i=0;i<1000;i++) { - MD5Init(&ctx1); + md5_init(&ctx1); if(i & 1) - MD5Update(&ctx1,pw,strlen(pw)); + md5_update(&ctx1,pw,strlen(pw)); else - MD5Update(&ctx1,final,16); + md5_update(&ctx1,final,16); if(i % 3) - MD5Update(&ctx1,sp,sl); + md5_update(&ctx1,sp,sl); if(i % 7) - MD5Update(&ctx1,pw,strlen(pw)); + md5_update(&ctx1,pw,strlen(pw)); if(i & 1) - MD5Update(&ctx1,final,16); + md5_update(&ctx1,final,16); else - MD5Update(&ctx1,pw,strlen(pw)); - MD5Final(final,&ctx1); + md5_update(&ctx1,pw,strlen(pw)); + memcpy(final, md5_final(&ctx1), 16); } p = passwd + strlen(passwd); @@ -159,7 +159,7 @@ int main(void) return 1; } for (n=0; n<2; n++) - to64(salt+4*n, *(uint32 *)(rand+4*n), 4); + to64(salt+4*n, *(u32 *)(rand+4*n), 4); salt[8] = 0; printf("%s\n", libshadow_md5_crypt(pass, salt)); } diff --git a/submit/Makefile b/submit/Makefile index c7971f3..4b7944a 100644 --- a/submit/Makefile +++ b/submit/Makefile @@ -1,8 +1,8 @@ # Makefile for MO-Eval submitter # (c) 2008 Martin Mares -SUBCF=$(CFLAGS_LIBGCRYPT) $(CFLAGS_LIBGNUTLS) -SUBLF=$(LIBS_LIBGCRYPT) $(LIBS_LIBGNUTLS) +SUBCF=$(LIBGCRYPT_CFLAGS) $(LIBGNUTLS_CFLAGS) +SUBLF=$(LIBGCRYPT_LIBS) $(LIBGNUTLS_LIBS) DIRS+=submit SDIR=$(o)/submit diff --git a/submit/commands.c b/submit/commands.c index 3c3e3aa..98adf37 100644 --- a/submit/commands.c +++ b/submit/commands.c @@ -4,11 +4,11 @@ * (c) 2007 Martin Mares */ -#include "lib/lib.h" -#include "lib/mempool.h" -#include "lib/simple-lists.h" -#include "lib/stkstring.h" -#include "lib/fastbuf.h" +#include "ucw/lib.h" +#include "ucw/mempool.h" +#include "ucw/simple-lists.h" +#include "ucw/stkstring.h" +#include "ucw/fastbuf.h" #include "sherlock/object.h" #include "sherlock/objread.h" diff --git a/submit/connect.c b/submit/connect.c index 34e5f92..a15f17f 100644 --- a/submit/connect.c +++ b/submit/connect.c @@ -4,7 +4,7 @@ * (c) 2007 Martin Mares */ -#include "lib/lib.h" +#include "ucw/lib.h" #include #include diff --git a/submit/privkey.c b/submit/privkey.c index acc093d..64c5713 100644 --- a/submit/privkey.c +++ b/submit/privkey.c @@ -7,7 +7,7 @@ * (c) 2007 Martin Mares */ -#include "lib/lib.h" +#include "ucw/lib.h" #include #include diff --git a/submit/submitd.c b/submit/submitd.c index d062815..b3a52b6 100644 --- a/submit/submitd.c +++ b/submit/submitd.c @@ -6,9 +6,9 @@ #undef LOCAL_DEBUG -#include "lib/lib.h" -#include "lib/conf.h" -#include "lib/getopt.h" +#include "ucw/lib.h" +#include "ucw/conf.h" +#include "ucw/getopt.h" #include #include diff --git a/submit/submitd.h b/submit/submitd.h index db7a62e..f2b72ff 100644 --- a/submit/submitd.h +++ b/submit/submitd.h @@ -7,9 +7,9 @@ #ifndef _SUBMITD_H #define _SUBMITD_H -#include "lib/clists.h" -#include "lib/ipaccess.h" -#include "lib/fastbuf.h" +#include "ucw/clists.h" +#include "ucw/ipaccess.h" +#include "ucw/fastbuf.h" #include #include diff --git a/submit/tasks.c b/submit/tasks.c index d480167..ecb4cbf 100644 --- a/submit/tasks.c +++ b/submit/tasks.c @@ -4,12 +4,12 @@ * (c) 2007 Martin Mares */ -#include "lib/lib.h" -#include "lib/conf.h" -#include "lib/fastbuf.h" -#include "lib/stkstring.h" -#include "lib/simple-lists.h" -#include "lib/mempool.h" +#include "ucw/lib.h" +#include "ucw/conf.h" +#include "ucw/fastbuf.h" +#include "ucw/stkstring.h" +#include "ucw/simple-lists.h" +#include "ucw/mempool.h" #include "sherlock/object.h" #include