]> mj.ucw.cz Git - moe.git/commitdiff
Adapted to reflect changes in libucw.
authorMartin Mares <mj@ucw.cz>
Mon, 16 Mar 2009 22:43:56 +0000 (23:43 +0100)
committerMartin Mares <mj@ucw.cz>
Mon, 16 Mar 2009 22:43:56 +0000 (23:43 +0100)
mop/admin/md5crypt.c
submit/Makefile
submit/commands.c
submit/connect.c
submit/privkey.c
submit/submitd.c
submit/submitd.h
submit/tasks.c

index 27ace0b6cc722031057b4fba4f44b57bf8002653..f4ad12f429366089e03778ab1d940ac1b9c13984 100644 (file)
@@ -9,8 +9,8 @@
  * ----------------------------------------------------------------------------
  */
 
-#include "lib/lib.h"
-#include "lib/md5.h"
+#include "ucw/lib.h"
+#include "ucw/md5.h"
 
 #include <stdio.h>
 #include <string.h>
@@ -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));
     }
index c7971f37198aa5386de40e98b73c08bb086cc10f..4b7944a9e2ca127ac9a63307b860311e2a1a1bb1 100644 (file)
@@ -1,8 +1,8 @@
 # Makefile for MO-Eval submitter
 # (c) 2008 Martin Mares <mj@ucw.cz>
 
-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
index 3c3e3aa530548bd2f71df3ba4f69a89c795e91f5..98adf37f3e8a21f63653b3c6200e6c3e9a26346f 100644 (file)
@@ -4,11 +4,11 @@
  *  (c) 2007 Martin Mares <mj@ucw.cz>
  */
 
-#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"
 
index 34e5f92e3c15d8dc27d6c68fd99179910062a726..a15f17f7b2bb8e6b329b07c5f9e33367e5c282db 100644 (file)
@@ -4,7 +4,7 @@
  *  (c) 2007 Martin Mares <mj@ucw.cz>
  */
 
-#include "lib/lib.h"
+#include "ucw/lib.h"
 
 #include <stdio.h>
 #include <string.h>
index acc093da4f286db6fb29a26ae263a72a3b3c98f0..64c5713d185c1a85cf71e06928c15489983e73f8 100644 (file)
@@ -7,7 +7,7 @@
  *  (c) 2007 Martin Mares <mj@ucw.cz>
  */
 
-#include "lib/lib.h"
+#include "ucw/lib.h"
 
 #include <stdio.h>
 #include <sys/types.h>
index d062815b46cd6ab8014ab6f4396c6b5b97e63732..b3a52b6dd54520a2fe465e814bb753b5f7cdd682 100644 (file)
@@ -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 <string.h>
 #include <stdlib.h>
index db7a62eccf92e01a27aa5df3cea848014e2b38f0..f2b72ff9cfbc817690b56c41fb4ab9d0ed76a988 100644 (file)
@@ -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 <gnutls/gnutls.h>
 #include <gnutls/x509.h>
index d4801670075d90c221c3ed2be0ae2c83989ee30f..ecb4cbfc34c925598ec0eebd19ff2bad39373052 100644 (file)
@@ -4,12 +4,12 @@
  *  (c) 2007 Martin Mares <mj@ucw.cz>
  */
 
-#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 <sys/stat.h>