]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/lib/md5.c
Update version + date
[bacula/bacula] / bacula / src / lib / md5.c
index 97b0517f48d304db738ae0daa4a8a593c7d6c89d..ba7eff104125f610a6a076c07409645525580e00 100644 (file)
@@ -1,12 +1,12 @@
 /*
    Bacula® - The Network Backup Solution
 
-   Copyright (C) 2000-2007 Free Software Foundation Europe e.V.
+   Copyright (C) 2000-2011 Free Software Foundation Europe e.V.
 
    The main author of Bacula is Kern Sibbald, with contributions from
    many others, a complete list can be found in the file AUTHORS.
    This program is Free Software; you can redistribute it and/or
-   modify it under the terms of version two of the GNU General Public
+   modify it under the terms of version three of the GNU Affero General Public
    License as published by the Free Software Foundation and included
    in the file LICENSE.
 
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
    General Public License for more details.
 
-   You should have received a copy of the GNU General Public License
+   You should have received a copy of the GNU Affero General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   Bacula® is a registered trademark of John Walker.
+   Bacula® is a registered trademark of Kern Sibbald.
    The licensor of Bacula is the Free Software Foundation Europe
    (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
    Switzerland, email:ftf@fsfeurope.org.
@@ -41,7 +41,6 @@
  * needed on buffers full of bytes, and then call MD5Final, which
  * will fill a supplied 16-byte array with the digest.
  *
- *   Version $Id$
  */
 
 /* Brutally hacked by John Walker back from ANSI C to K&R (no
 
 #include "bacula.h"
 
-#ifndef HAVE_BIGENDIAN
-#define byteReverse(buf, len)   /* Nothing */
-#else
 /*
- * Note: this code is harmless on little-endian machines.
+ * Note: this code is harmless on little-endian machines. We'll swap the bytes
+ * on big-endian machines.
  */
 void byteReverse(unsigned char *buf, unsigned longs)
 {
     uint32_t t;
-    do {
-        t = (uint32_t) ((unsigned) buf[3] << 8 | buf[2]) << 16 |
-            ((unsigned) buf[1] << 8 | buf[0]);
-        *(uint32_t *) buf = t;
-        buf += 4;
-    } while (--longs);
+    if (bigendian()) {
+        do {
+            t = (uint32_t) ((unsigned) buf[3] << 8 | buf[2]) << 16 |
+                ((unsigned) buf[1] << 8 | buf[0]);
+            *(uint32_t *) buf = t;
+            buf += 4;
+        } while (--longs);
+    }
 }
-#endif
 
 /*
  * Start MD5 accumulation.  Set bit count to 0 and buffer to mysterious
@@ -379,5 +377,6 @@ decode_it:
       bin_to_base64(bin, sizeof(bin), (char *)signature, 16, true);
       printf("%s\n", bin);
    }
+   fclose(fd);
 }
 #endif