X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=bacula%2Fsrc%2Flib%2Fmd5.c;h=26532fbf0f3a1355aeb38a24d337d0031208f9ac;hb=5450f5e38d6dd94600c7c35fedf7f9ccea3e7adb;hp=0725dc5eaa8b37483d7213857f00eaaadd57e026;hpb=79774c7c223b633a83ae3bc3a8e4d5054edc3cad;p=bacula%2Fbacula diff --git a/bacula/src/lib/md5.c b/bacula/src/lib/md5.c index 0725dc5eaa..26532fbf0f 100644 --- a/bacula/src/lib/md5.c +++ b/bacula/src/lib/md5.c @@ -1,3 +1,30 @@ +/* + Bacula® - The Network Backup Solution + + Copyright (C) 2000-2007 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 + License as published by the Free Software Foundation and included + in the file LICENSE. + + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + 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 + 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 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. +*/ /* * This code implements the MD5 message-digest algorithm. * The algorithm is due to Ron Rivest. This code was @@ -21,6 +48,8 @@ prototypes) to maintain the tradition that Netfone will compile with Sun's original "cc". */ + + #include "bacula.h" #ifndef HAVE_BIGENDIAN @@ -298,7 +327,7 @@ int main(int argc, char *argv[]) exit(1); } - fd = fopen(argv[0], "r"); + fd = fopen(argv[0], "rb"); if (!fd) { printf("Could not open %s: ERR=%s\n", argv[0], strerror(errno)); exit(1); @@ -317,7 +346,7 @@ int main(int argc, char *argv[]) #ifdef OUTPUT_BASE64 char MD5buf[40]; /* 24 should do */ memset(MD5buf, 0, 40); - bin_to_base64(MD5buf, (char *)signature, 16); /* encode 16 bytes */ + bin_to_base64(MD5buf, sizeof(MD5buf), (char *)signature, 16, true); /* encode 16 bytes */ printf(" %s", MD5buf); #endif printf(" %s\n", argv[0]); @@ -347,7 +376,7 @@ decode_it: } signature[16] = 0; printf("%s", buf); - bin_to_base64(bin, (char *)signature, 16); + bin_to_base64(bin, sizeof(bin), (char *)signature, 16, true); printf("%s\n", bin); } }