From: Kern Sibbald Date: Mon, 4 Dec 2006 09:39:26 +0000 (+0000) Subject: kes Enable data encryption code. X-Git-Tag: Release-2.0.0~174 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=50911bccc5338537b4e1584fc6c1e637ca53410e;p=bacula%2Fbacula kes Enable data encryption code. kes Add gigaslam.c to src/tools. It creates a 1GB file that contains only two blocks -- i.e. it is a real sparse file. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@3743 91ce42f0-d328-0410-95d8-f526ca767f89 --- diff --git a/bacula/src/lib/util.c b/bacula/src/lib/util.c index b457f0a396..9cb5e07755 100644 --- a/bacula/src/lib/util.c +++ b/bacula/src/lib/util.c @@ -76,8 +76,9 @@ bool is_buf_zero(char *buf, int len) void lcase(char *str) { while (*str) { - if (B_ISUPPER(*str)) + if (B_ISUPPER(*str)) { *str = tolower((int)(*str)); + } str++; } } diff --git a/bacula/src/stored/read_record.c b/bacula/src/stored/read_record.c index b2dc3113f1..cc555c4d24 100644 --- a/bacula/src/stored/read_record.c +++ b/bacula/src/stored/read_record.c @@ -145,7 +145,7 @@ bool read_records(DCR *dcr, display_tape_error_status(jcr, dev); if (forge_on || jcr->ignore_label_errors) { dev->fsr(1); /* try skipping bad record */ - Pmsg0(000, _("Did fsr\n")); + Pmsg0(000, _("Did fsr in attemp to skip bad record.\n")); continue; /* try to continue */ } ok = false; /* stop everything */ diff --git a/bacula/src/tools/.cvsignore b/bacula/src/tools/.cvsignore index 4fb9b68d23..dce368b7b1 100644 --- a/bacula/src/tools/.cvsignore +++ b/bacula/src/tools/.cvsignore @@ -9,3 +9,4 @@ bsmtp testfind fstype drivetype +gigaslam diff --git a/bacula/src/tools/Makefile.in b/bacula/src/tools/Makefile.in index 15502f3ec5..441896dbad 100644 --- a/bacula/src/tools/Makefile.in +++ b/bacula/src/tools/Makefile.in @@ -55,7 +55,7 @@ INSTOOLS = $(INS@DIR_TOOLS@) @echo "Compiling $<" $(NO_ECHO)$(CXX) $(DEFS) $(DEBUG) -c $(CPPFLAGS) $(PYTHON_INC) -I$(srcdir) -I$(basedir) $(DINCLUDE) $(CFLAGS) $< #------------------------------------------------------------------------- -all: Makefile $(TOOLS) +all: Makefile $(TOOLS) gigaslam @echo "==== Make of tools is good ====" @echo " " @@ -96,6 +96,11 @@ bwild: ../findlib/libfind.a ../lib/libbac.a bwild.o $(CXX) -g $(LDFLAGS) -L. -L../lib -o $@ bwild.o \ $(DLIB) -lbac -lm $(LIBS) $(GETTEXT_LIBS) $(OPENSSL_LIBS) +gigaslam.o: gigaslam.c + $(CC) -c $< + +gigaslam: gigaslam.o + $(CC) -o $@ gigaslam.o Makefile: $(srcdir)/Makefile.in $(topdir)/config.status diff --git a/bacula/src/tools/gigaslam.c b/bacula/src/tools/gigaslam.c new file mode 100644 index 0000000000..42dc6f9112 --- /dev/null +++ b/bacula/src/tools/gigaslam.c @@ -0,0 +1,50 @@ +/* + By John Walker written ages ago. + + Create a sparse file. + + Beat denial of service floggers to death by persuading + them to download a HOW_BIG pseudo GIF file which is actually + a holey file occupying trivial space on our server. + + Make: make gigaslam + Run: ./gigaslam + Output: a file named gigaslam.gif that contains something like + 16K bytes (i.e. 2-8K blocks), but appears to be 1GB in + length because the second block is written at a 1GB + address. + + Be careful what you do with this file as not all programs know + how to deal with sparse files. + +*/ + +#define HOW_BIG 1000000000ll + +#ifdef __GNUC__ +#ifndef _GNU_SOURCE +#define _GNU_SOURCE +#endif +#ifndef _FILE_OFFSET_BITS +#define _FILE_OFFSET_BITS 64 +#endif +#endif + +#include +#include +#include + +int main(void) +{ + FILE *fp = fopen("gigaslam.gif", "w"); + char header[] = "\n\n
\n"; + char trailer[] = "\n"; + off_t howBig = HOW_BIG; + + fwrite(header, sizeof header, 1, fp); + fseeko(fp, howBig - strlen(trailer), 0); + fwrite(trailer, strlen(trailer), 1, fp); + fclose(fp); + return 0; + +} diff --git a/bacula/src/version.h b/bacula/src/version.h index 362944af0b..369efec563 100644 --- a/bacula/src/version.h +++ b/bacula/src/version.h @@ -4,8 +4,8 @@ #undef VERSION #define VERSION "1.39.29" -#define BDATE "02 December 2006" -#define LSMDATE "02Dec06" +#define BDATE "04 December 2006" +#define LSMDATE "04Dec06" #define PROG_COPYRIGHT "Copyright (C) %d-2006 Free Software Foundation Europe e.V.\n" #define BYEAR "2006" /* year for copyright messages in progs */ @@ -49,7 +49,7 @@ /* If this is set stdout will not be closed on startup */ #define DEVELOPER 1 -/* #define DATA_ENCRYPTION 1 */ +#define DATA_ENCRYPTION 1 #define USE_BSNPRINTF 1 diff --git a/bacula/technotes-1.39 b/bacula/technotes-1.39 index 8265b4e174..a609f9044c 100644 --- a/bacula/technotes-1.39 +++ b/bacula/technotes-1.39 @@ -1,6 +1,10 @@ Technical notes on version 1.39 General: +04Dec06 +kes Enable data encryption code. +kes Add gigaslam.c to src/tools. It creates a 1GB file that contains + only two blocks -- i.e. it is a real sparse file. 03Dec06 kes Enable disk seeking on restore. kes Implement the SD 'Block Positioning = yes|no' directive. This