srm-devel Mailing List for secure rm (Page 2)
srm is a command-line program to delete files securely.
Brought to you by:
doj
You can subscribe to this list here.
2002 |
Jan
(2) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
---|---|---|---|---|---|---|---|---|---|---|---|---|
2008 |
Jan
|
Feb
|
Mar
|
Apr
(3) |
May
|
Jun
|
Jul
(18) |
Aug
|
Sep
|
Oct
|
Nov
(18) |
Dec
(7) |
2009 |
Jan
|
Feb
(5) |
Mar
(2) |
Apr
|
May
|
Jun
|
Jul
(5) |
Aug
(20) |
Sep
(10) |
Oct
(2) |
Nov
|
Dec
|
2010 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(21) |
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
(10) |
Dec
|
2011 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(14) |
Jul
(3) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(2) |
2013 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(1) |
Oct
|
Nov
|
Dec
(6) |
2014 |
Jan
(5) |
Feb
|
Mar
(2) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Dirk J. <do...@us...> - 2011-06-30 05:36:27
|
Update of /cvsroot/srm/srm In directory vz-cvs-3.sog:/tmp/cvs-serv32317 Modified Files: configure.in Log Message: honour CFLAGS passed to configure Index: configure.in =================================================================== RCS file: /cvsroot/srm/srm/configure.in,v retrieving revision 1.37 retrieving revision 1.38 diff -u -d -r1.37 -r1.38 --- configure.in 25 Nov 2010 23:09:56 -0000 1.37 +++ configure.in 30 Jun 2011 05:36:24 -0000 1.38 @@ -6,8 +6,6 @@ dnl Checks for programs. AC_PROG_CC -dnl reset CFLAGS -CFLAGS= AC_PROG_INSTALL AC_PROG_RANLIB |
From: SourceForge.net <no...@so...> - 2011-06-24 04:07:02
|
Bugs item #3326296, was opened at 2011-06-23 23:06 Message generated for change (Settings changed) made by You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=103297&aid=3326296&group_id=3297 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None Status: Open Resolution: None >Priority: 3 Private: No Submitted By: Jeffrey Walton () Assigned to: Nobody/Anonymous (nobody) Summary: Configure/Makefile ignores --prefix Initial Comment: $ ./configure --prefix=/bin $ make ... $ sudo make install ... $ ls -al /bin/srm ls: cannot access /bin/srm: No such file or directory ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=103297&aid=3326296&group_id=3297 |
From: SourceForge.net <no...@so...> - 2011-06-24 04:06:50
|
Bugs item #3326296, was opened at 2011-06-23 23:06 Message generated for change (Tracker Item Submitted) made by You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=103297&aid=3326296&group_id=3297 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None Status: Open Resolution: None Priority: 5 Private: No Submitted By: Jeffrey Walton () Assigned to: Nobody/Anonymous (nobody) Summary: Configure/Makefile ignores --prefix Initial Comment: $ ./configure --prefix=/bin $ make ... $ sudo make install ... $ ls -al /bin/srm ls: cannot access /bin/srm: No such file or directory ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=103297&aid=3326296&group_id=3297 |
From: SourceForge.net <no...@so...> - 2011-06-24 04:01:21
|
Bugs item #3326264, was opened at 2011-06-23 22:56 Message generated for change (Settings changed) made by You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=103297&aid=3326264&group_id=3297 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None Status: Open Resolution: None >Priority: 3 Private: No Submitted By: Jeffrey Walton () Assigned to: Nobody/Anonymous (nobody) Summary: Configure/Makefile ignore CFLAGS Initial Comment: ./configure CFLAGS="-Wall -Wextra -g -O2 -DNDEBUG -m64 -mtune=core2" was ignored in the resulting makefiles. Perhaps the following would be more appropriate (from Makefile, line 174): CFLAGS += -O2 -DNDEBUG rather than: CFLAG = -O2 -DNDEBUG ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=103297&aid=3326264&group_id=3297 |
From: SourceForge.net <no...@so...> - 2011-06-24 04:00:51
|
Bugs item #3326273, was opened at 2011-06-23 22:59 Message generated for change (Settings changed) made by You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=103297&aid=3326273&group_id=3297 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None Status: Open Resolution: None >Priority: 3 Private: No Submitted By: Jeffrey Walton () Assigned to: Nobody/Anonymous (nobody) Summary: Make &-Wall -Wextra: warning due to ignoring fgets return Initial Comment: In tree_walk.c, the following would clear the warning: static int prompt_user(const char *string) { char inbuf[8]; if(!string) return 0; printf("%s", string); fflush(stdout); const char* s = fgets(inbuf, 4, stdin); if(!s) return 0; return strncmp(inbuf, "y", 1) == 0 || strncmp(inbuf, "Y", 1) == 0; } ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=103297&aid=3326273&group_id=3297 |
From: SourceForge.net <no...@so...> - 2011-06-24 03:59:23
|
Bugs item #3326273, was opened at 2011-06-23 22:59 Message generated for change (Tracker Item Submitted) made by You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=103297&aid=3326273&group_id=3297 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None Status: Open Resolution: None Priority: 5 Private: No Submitted By: Jeffrey Walton () Assigned to: Nobody/Anonymous (nobody) Summary: Make &-Wall -Wextra: warning due to ignoring fgets return Initial Comment: In tree_walk.c, the following would clear the warning: static int prompt_user(const char *string) { char inbuf[8]; if(!string) return 0; printf("%s", string); fflush(stdout); const char* s = fgets(inbuf, 4, stdin); if(!s) return 0; return strncmp(inbuf, "y", 1) == 0 || strncmp(inbuf, "Y", 1) == 0; } ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=103297&aid=3326273&group_id=3297 |
From: SourceForge.net <no...@so...> - 2011-06-24 03:56:39
|
Bugs item #3326264, was opened at 2011-06-23 22:56 Message generated for change (Tracker Item Submitted) made by You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=103297&aid=3326264&group_id=3297 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None Status: Open Resolution: None Priority: 5 Private: No Submitted By: Jeffrey Walton () Assigned to: Nobody/Anonymous (nobody) Summary: Configure/Makefile ignore CFLAGS Initial Comment: ./configure CFLAGS="-Wall -Wextra -g -O2 -DNDEBUG -m64 -mtune=core2" was ignored in the resulting makefiles. Perhaps the following would be more appropriate (from Makefile, line 174): CFLAGS += -O2 -DNDEBUG rather than: CFLAG = -O2 -DNDEBUG ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=103297&aid=3326264&group_id=3297 |
From: Dirk J. <do...@us...> - 2011-06-09 18:04:29
|
Update of /cvsroot/srm/srm/src In directory vz-cvs-3.sog:/tmp/cvs-serv31930/src Modified Files: main.c srm.h sunlink.c Log Message: add command line argument for Gutmann method, change verbosity Index: sunlink.c =================================================================== RCS file: /cvsroot/srm/srm/src/sunlink.c,v retrieving revision 1.39 retrieving revision 1.40 diff -u -d -r1.39 -r1.40 --- sunlink.c 25 Nov 2010 22:45:05 -0000 1.39 +++ sunlink.c 9 Jun 2011 18:04:26 -0000 1.40 @@ -300,7 +300,7 @@ if(srm->options & SRM_MODE_DOD) { - if((srm->options&SRM_OPT_V) == SRM_OPT_V) + if((srm->options&SRM_OPT_V) > 1) printf("US DoD mode\n"); if(overwrite_byte(srm, 1, 0xF6) < 0) return -1; if(overwrite_byte(srm, 2, 0x00) < 0) return -1; @@ -312,14 +312,14 @@ } else if(srm->options & SRM_MODE_DOE) { - if((srm->options&SRM_OPT_V) == SRM_OPT_V) + if((srm->options&SRM_OPT_V) > 1) printf("US DoE mode\n"); if(overwrite_random(srm, 1, 2) < 0) return -1; if(overwrite_bytes(srm, 3, 'D', 'o', 'E') < 0) return -1; } else if(srm->options & SRM_MODE_OPENBSD) { - if((srm->options&SRM_OPT_V) == SRM_OPT_V) + if((srm->options&SRM_OPT_V) > 1) printf("OpenBSD mode\n"); if(overwrite_byte(srm, 1, 0xFF) < 0) return -1; if(overwrite_byte(srm, 2, 0x00) < 0) return -1; @@ -327,14 +327,16 @@ } else if(srm->options & SRM_MODE_SIMPLE) { - if((srm->options&SRM_OPT_V) == SRM_OPT_V) + if((srm->options&SRM_OPT_V) > 1) printf("Simple mode\n"); if(overwrite_byte(srm, 1, 0x00) < 0) return -1; } else { - if((srm->options&SRM_OPT_V) == SRM_OPT_V) - printf("Full mode\n"); + if(! (srm->options & SRM_MODE_35)) + fprintf(stderr, "something is strange, did not have mode_35 bit\n"); + if((srm->options&SRM_OPT_V) > 1) + printf("Full 35-pass mode (Gutmann method)\n"); if(overwrite_random(srm, 1, 4) < 0) return -1; if(overwrite_byte(srm, 5, 0x55) < 0) return -1; if(overwrite_byte(srm, 6, 0xAA) < 0) return -1; @@ -400,7 +402,7 @@ #endif if(srm.buffer_size < 16) srm.buffer_size = 512; - if((srm.options & SRM_OPT_V) == SRM_OPT_V) + if((srm.options & SRM_OPT_V) > 2) printf("buffer_size=%u\n", srm.buffer_size); #ifdef __linux__ @@ -418,7 +420,7 @@ perror("could not ioctl(BLKSSZGET)"); return 1; } - if((options&SRM_OPT_V) == SRM_OPT_V) + if((options&SRM_OPT_V) > 2) printf("sector size %i bytes\n", secsize); if(ioctl(srm.fd, BLKGETSIZE, &blocks) < 0) @@ -426,7 +428,7 @@ perror("could not ioctl(BLKGETSIZE)"); return 1; } - if((options&SRM_OPT_V) == SRM_OPT_V) + if((options&SRM_OPT_V) > 2) printf("BLKGETSIZE %i blocks\n", (int)blocks); if(ioctl(srm.fd, BLKGETSIZE64, &u) < 0) @@ -434,7 +436,7 @@ perror("could not ioctl(BLKGETSIZE64)"); return 1; } - if((options&SRM_OPT_V) == SRM_OPT_V) + if((options&SRM_OPT_V) > 2) printf("BLKGETSIZE64 %llu bytes\n", (unsigned long long)u); u_=((uint64_t)blocks)*secsize; @@ -509,7 +511,7 @@ #else #error Please define your platform. #endif - if((srm.options & SRM_OPT_V) == SRM_OPT_V) + if((srm.options & SRM_OPT_V) > 2) printf("buffer_size=%u\n", srm.buffer_size); #if defined(HAVE_LINUX_EXT2_FS_H) || defined(HAVE_LINUX_EXT3_FS_H) Index: srm.h =================================================================== RCS file: /cvsroot/srm/srm/src/srm.h,v retrieving revision 1.15 retrieving revision 1.16 diff -u -d -r1.15 -r1.16 --- srm.h 6 Jun 2010 17:27:04 -0000 1.15 +++ srm.h 9 Jun 2011 18:04:26 -0000 1.16 @@ -22,6 +22,11 @@ #define SRM_MODE_DOD (1 << 18) /** US DoE overwrite mode */ #define SRM_MODE_DOE (1 << 19) +/** 35-pass overwrite mode */ +#define SRM_MODE_35 (1 << 20) + +/** bitmask of overwrite modes */ +#define SRM_MODE_MASK (SRM_MODE_SIMPLE|SRM_MODE_OPENBSD|SRM_MODE_DOD|SRM_MODE_DOE|SRM_MODE_35) #ifdef __cplusplus extern "C" { Index: main.c =================================================================== RCS file: /cvsroot/srm/srm/src/main.c,v retrieving revision 1.15 retrieving revision 1.16 diff -u -d -r1.15 -r1.16 --- main.c 6 Jun 2010 17:44:03 -0000 1.15 +++ main.c 9 Jun 2011 18:04:26 -0000 1.16 @@ -34,6 +34,7 @@ { "openbsd", no_argument, NULL, 'P'}, { "dod", no_argument, NULL, 'D'}, { "doe", no_argument, NULL, 'E'}, + { "gutmann", no_argument, NULL, 'G'}, { "verbose", no_argument, NULL, 'v' }, { "help", no_argument, &show_help, 'h' }, { "version", no_argument, &show_version, 'V' }, @@ -43,14 +44,14 @@ int main(int argc, char *argv[]) { int opt, q; char* *trees; - int options = 0; + int options = SRM_MODE_35; if ( (program_name = strrchr(argv[0], SRM_DIRSEP)) != NULL) program_name++; else program_name = argv[0]; - while ((opt = getopt_long(argc, argv, "dDEfhirRPsvVx", longopts, NULL)) != -1) + while ((opt = getopt_long(argc, argv, "dDEfGhirRPsvVx", longopts, NULL)) != -1) { switch (opt) { @@ -67,10 +68,11 @@ case 'r': case 'R': options |= SRM_OPT_R; break; case 'x': options |= SRM_OPT_X; break; - case 's': options |= SRM_MODE_SIMPLE; break; - case 'P': options |= SRM_MODE_OPENBSD; break; - case 'D': options |= SRM_MODE_DOD; break; - case 'E': options |= SRM_MODE_DOE; break; + case 's': options &= ~SRM_MODE_MASK; options |= SRM_MODE_SIMPLE; break; + case 'P': options &= ~SRM_MODE_MASK; options |= SRM_MODE_OPENBSD; break; + case 'D': options &= ~SRM_MODE_MASK; options |= SRM_MODE_DOD; break; + case 'E': options &= ~SRM_MODE_MASK; options |= SRM_MODE_DOE; break; + case 'G': options &= ~SRM_MODE_MASK; options |= SRM_MODE_35; break; case 'V': show_version=1; break; case 'v': if((options & SRM_OPT_V) < SRM_OPT_V) @@ -84,7 +86,8 @@ if (show_help) { printf( "Usage: %s [OPTION]... [FILE]...\n" - "Overwrite and remove (unlink) the files.\n" + "Overwrite and remove (unlink) the files. By default use the 35-pass Gutmann\n" + "method to overwrite files.\n" "\n" " -d, --directory ignored (for compatability with rm(1))\n" " -f, --force ignore nonexistant files, never prompt\n" @@ -96,6 +99,7 @@ " -P, --openbsd overwrite with three passes like OpenBSD rm\n" " -D, --dod overwrite with 7 US DoD compliant passes\n" " -E, --doe overwrite with 3 US DoE compliant passes\n" + " -G, --gutmann overwrite with 35-pass Gutmann method (default)\n" " -r, -R, --recursive remove the contents of directories\n" " -v, --verbose explain what is being done\n" " -h, --help display this help and exit\n" |
From: Dirk J. <do...@us...> - 2010-11-25 23:10:05
|
Update of /cvsroot/srm/srm In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv8051 Modified Files: NEWS configure.in Log Message: bump version to 1.2.12 Index: NEWS =================================================================== RCS file: /cvsroot/srm/srm/NEWS,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- NEWS 6 Jun 2010 18:37:46 -0000 1.12 +++ NEWS 25 Nov 2010 23:09:56 -0000 1.13 @@ -1,10 +1,12 @@ This is a summary of user visible changes in srm. +release-1_2_12 + release-1_2_11 Win32 command line wildcard expansion -v -v displays current write position SIGINFO, SIGUSR2 display current write position - -x does not cross file system boundaries + -x does not cross file system boundaries overwrite block devices release-1_2_10 Index: configure.in =================================================================== RCS file: /cvsroot/srm/srm/configure.in,v retrieving revision 1.36 retrieving revision 1.37 diff -u -d -r1.36 -r1.37 --- configure.in 6 Jun 2010 17:27:04 -0000 1.36 +++ configure.in 25 Nov 2010 23:09:56 -0000 1.37 @@ -1,7 +1,7 @@ dnl Process this file with autoconf to produce a configure script. AC_INIT AC_CONFIG_SRCDIR([src/rename_unlink.c]) -AM_INIT_AUTOMAKE(srm, 1.2.11) +AM_INIT_AUTOMAKE(srm, 1.2.12) AM_CONFIG_HEADER(config.h) dnl Checks for programs. |
From: Dirk J. <do...@us...> - 2010-11-25 23:10:04
|
Update of /cvsroot/srm/srm/win In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv8051/win Modified Files: config.h Log Message: bump version to 1.2.12 Index: config.h =================================================================== RCS file: /cvsroot/srm/srm/win/config.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- config.h 18 Aug 2009 18:05:44 -0000 1.3 +++ config.h 25 Nov 2010 23:09:56 -0000 1.4 @@ -4,7 +4,7 @@ /* configuration for Win32 compilation */ #define PACKAGE "srm" -#define VERSION "1.2.11" +#define VERSION "1.2.12" #define HAVE_STRING_H 1 #define _CRT_SECURE_NO_WARNINGS 1 |
From: Dirk J. <do...@us...> - 2010-11-25 23:10:04
|
Update of /cvsroot/srm/srm/doc In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv8051/doc Modified Files: srm.1 Log Message: bump version to 1.2.12 Index: srm.1 =================================================================== RCS file: /cvsroot/srm/srm/doc/srm.1,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- srm.1 6 Jun 2010 19:06:32 -0000 1.12 +++ srm.1 25 Nov 2010 23:09:56 -0000 1.13 @@ -1,4 +1,4 @@ -.TH "srm" "1" "1.2.11" "Matt Gauthier" "" +.TH "srm" "1" "1.2.12" "Matt Gauthier" "" .SH "NAME" srm \- securely remove files or directories .SH "SYNOPSIS" |
From: Dirk J. <do...@us...> - 2010-11-25 22:47:48
|
Update of /cvsroot/srm/srm In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv3254 Modified Files: TODO Log Message: up Index: TODO =================================================================== RCS file: /cvsroot/srm/srm/TODO,v retrieving revision 1.29 retrieving revision 1.30 diff -u -d -r1.29 -r1.30 --- TODO 22 Nov 2010 01:47:11 -0000 1.29 +++ TODO 25 Nov 2010 22:47:40 -0000 1.30 @@ -1,4 +1,4 @@ -- for srm 1.2.11 +- for srm 1.2.12 + check ext2 special flags, unremovable, immutable, appendonly + FreeBSD test, check st_flags in sunlink.c + check with ext4 (http://ext4.wiki.kernel.org/index.php/Main_Page), jfs, xfs, reiserfs |
From: Dirk J. <do...@us...> - 2010-11-25 22:47:05
|
Update of /cvsroot/srm/srm In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv3116 Modified Files: ChangeLog Log Message: changelog update for 1.2.11 Index: ChangeLog =================================================================== RCS file: /cvsroot/srm/srm/ChangeLog,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- ChangeLog 17 Aug 2009 18:44:49 -0000 1.3 +++ ChangeLog 25 Nov 2010 22:46:57 -0000 1.4 @@ -1,5 +1,76 @@ +2010-11-25 Dirk Jagdmann <do...@cu...> + + * aclocal.m4, src/error.c, src/random.c, src/sunlink.c, win/unistd.h: + Windows compilation fixes + +2010-11-22 Dirk Jagdmann <do...@cu...> + + * src/sunlink.c, README.OsX, TODO, srm.spec.in, srmtest.sh: OsX updates + +2010-06-06 Dirk Jagdmann <do...@cu...> + + * doc/srm.1, src/sunlink.c: FreeBSD fixes + + * NEWS, doc/srm.1, src/sunlink.c: block device handling + + * src/error.c, src/main.c, src/rename_unlink.c, src/sunlink.c, src/tree_walker.c: + made a run of gimpel + + * src/random.c: fallback to rand() + + * NEWS, configure.in, doc/srm.1, src/main.c, src/srm.h, src/sunlink.c, src/tree_walker.c: + -x support, FreeBSD fixes + + * src/random.c: use rand48 function + + * Makefile.am, configure.in, src/sunlink.c, test.sh, win/Makefile.am: + build updates + + * win/tree.cpp, Makefile.am, src/impl.h, src/sunlink.c, src/tree_walker.c, srm.vcproj, win/srm.ico, win/srm.rc: + Win32 fixes + + * src/Makefile.am, src/error.c, src/impl.h, src/main.c, src/rename_unlink.c, src/srm.h, src/sunlink.c, src/tree_walker.c, TODO, aclocal.m4: + removed global variables + +2009-10-19 Dirk Jagdmann <do...@cu...> + + * TODO, src/main.c, src/sunlink.c, srm.vcproj: Win32 fixes + +2009-09-26 Dirk Jagdmann <do...@cu...> + + * NEWS, TODO, src/main.c, src/srm.h, src/sunlink.c, doc/srm.1: + SIGINFO, SIGUSR2 show current write position + + * doc/srm.1, src/main.c, src/srm.h, src/sunlink.c, NEWS, TODO, test.sh: + -v -v displays current write position + + * src/sunlink.c: delete whitespace + use stderr for error messages + + * NEWS, TODO, src/sunlink.c: check results of write() in sunlink.c + +2009-08-19 Dirk Jagdmann <do...@cu...> + + * Makefile.am, TODO, srm.vcproj: Win32 command line wildcard expansion + + * lib/getopt.c, lib/getopt1.c: fix MS CC warnings + + * doc/srm.1: SEE ALSO section + +2009-08-18 Dirk Jagdmann <do...@cu...> + + * src/srm.h, src/tree_walker.c, win/config.h, TODO, aclocal.m4, configure.in: + fixes + + * doc/srm.1: updates website + fixed typo + 2009-08-17 Dirk Jagdmann <do...@cu...> + * Makefile.am: added Visual Studio project files to EXTRA_DIST + + * NEWS, ChangeLog: updates + * ChangeLog, README.OsX, TODO, src/srm.h, src/sunlink.c: OsX works again |
From: Dirk J. <do...@us...> - 2010-11-25 22:45:13
|
Update of /cvsroot/srm/srm/src In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv2427/src Modified Files: error.c random.c sunlink.c Log Message: Windows compilation fixes Index: random.c =================================================================== RCS file: /cvsroot/srm/srm/src/random.c,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- random.c 6 Jun 2010 17:43:48 -0000 1.8 +++ random.c 25 Nov 2010 22:45:05 -0000 1.9 @@ -39,6 +39,10 @@ #endif } +#ifdef _MSC_VER +// I don't know why, but Microsoft does not like our readn() function below +#define readn read +#else /** reads from a file descriptor into a buffer. The function finishes when either count bytes have been read, the file descriptor reached @@ -74,6 +78,7 @@ /*lint -e{713} ignore loss of precision*/ return count - nleft; } +#endif int randomize_buffer(unsigned char *buffer, int length) { int i; Index: sunlink.c =================================================================== RCS file: /cvsroot/srm/srm/src/sunlink.c,v retrieving revision 1.38 retrieving revision 1.39 diff -u -d -r1.38 -r1.39 --- sunlink.c 22 Nov 2010 01:47:12 -0000 1.38 +++ sunlink.c 25 Nov 2010 22:45:05 -0000 1.39 @@ -52,10 +52,6 @@ #include <linux/ext2_fs.h> #endif -#if defined(_MSC_VER) -typedef int ssize_t; -#endif - #include "srm.h" #include "impl.h" @@ -397,7 +393,11 @@ return -1; srm.file_size = statbuf.st_size; +#ifdef _MSC_VER + srm.buffer_size = 4096; +#else srm.buffer_size = statbuf.st_blksize; +#endif if(srm.buffer_size < 16) srm.buffer_size = 512; if((srm.options & SRM_OPT_V) == SRM_OPT_V) Index: error.c =================================================================== RCS file: /cvsroot/srm/srm/src/error.c,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- error.c 6 Jun 2010 17:44:03 -0000 1.6 +++ error.c 25 Nov 2010 22:45:05 -0000 1.7 @@ -5,6 +5,7 @@ #include <stdarg.h> #include <stdio.h> +#include <unistd.h> #include "impl.h" |
From: Dirk J. <do...@us...> - 2010-11-25 22:45:13
|
Update of /cvsroot/srm/srm In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv2427 Modified Files: aclocal.m4 Log Message: Windows compilation fixes Index: aclocal.m4 =================================================================== RCS file: /cvsroot/srm/srm/aclocal.m4,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- aclocal.m4 6 Jun 2010 05:50:40 -0000 1.10 +++ aclocal.m4 25 Nov 2010 22:45:05 -0000 1.11 @@ -13,8 +13,8 @@ m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl -m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.64],, -[m4_warning([this file was generated for autoconf 2.64. +m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.67],, +[m4_warning([this file was generated for autoconf 2.67. You have another version of autoconf. It may work, but is not guaranteed to. If you have problems, you may need to regenerate the build system entirely. To do so, use the procedure documented by the package, typically `autoreconf'.])]) |
From: Dirk J. <do...@us...> - 2010-11-25 22:45:13
|
Update of /cvsroot/srm/srm/win In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv2427/win Modified Files: unistd.h Log Message: Windows compilation fixes Index: unistd.h =================================================================== RCS file: /cvsroot/srm/srm/win/unistd.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- unistd.h 10 Jul 2008 22:01:49 -0000 1.1 +++ unistd.h 25 Nov 2010 22:45:05 -0000 1.2 @@ -15,6 +15,8 @@ #define snprintf _snprintf +typedef _W64 signed int ssize_t; + /* we define all fake functions for windows compilation here */ _inline int getpid() { return _getpid(); } |
From: Dirk J. <do...@us...> - 2010-11-22 01:47:23
|
Update of /cvsroot/srm/srm In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv27345 Modified Files: README.OsX TODO srm.spec.in Added Files: srmtest.sh Log Message: OsX updates --- NEW FILE: srmtest.sh --- #!/bin/bash # (c) by Apple, ripped from http://www.opensource.apple.com/source/srm/srm-6/test/srmtest.sh?txt # Script to test srm performance # # (Note: we use bash since it honors 'echo -n', unlike sh) # ---------------------------------------------------------------------- # Location of standard srm command (as a baseline control) STDSRM=/usr/bin/srm # Location of srm command we are testing BASEDIR=`pwd` TSTSRM="${BASEDIR}/src/srm" # Location of temporary directory (warning: this directory will be wiped!) TMPDIR="${BASEDIR}/temp" # Strings to identify hardware & software (note: this is OS-specific) SW_VERS="`sw_vers -productVersion` (`sw_vers -buildVersion`)" HW_VERS="`system_profiler SPHardwareDataType | grep Name | sed 's/^[ ]*//'`" # ---------------------------------------------------------------------- # Subroutines TAB=" " csh_time () { /bin/csh -sf << EOF time $* >& /dev/null EOF } createLargeFiles () { if [ ! -d "${TMPDIR}" ] ; then mkdir -p "${TMPDIR}" ; fi if [ ! -f "${TMPDIR}/284mb" ] ; then # Make a 284MB file /bin/dd if=/dev/zero of="${TMPDIR}/284mb" bs=1k count=290816 sync echo "Created ${TMPDIR}/284mb" ls -la "${TMPDIR}/284mb" fi if [ ! -f "${TMPDIR}/100mb" ] ; then # Make a 100MB file /bin/dd if=/dev/zero of="${TMPDIR}/100mb" bs=1k count=102400 sync echo "Created ${TMPDIR}/100mb" ls -la "${TMPDIR}/100mb" fi } createSmallFiles () { if [ ! -d "${TMPDIR}" ] ; then mkdir -p "${TMPDIR}" ; fi if [ ! -d "${TMPDIR}/smallfiles" ] ; then # Create a directory containing many small files # (in this case, a copy of /usr/include/sys) /bin/cp -r /usr/include/sys "${TMPDIR}/smallfiles" sync echo "Created ${TMPDIR}/smallfiles" du -h "${TMPDIR}/smallfiles" fi } doForN () { # $1 = command to execute # $2 = string to print on first iteration # $3 = number of times to execute command i=1 q=${3-1} echo -n "$2" while [ $i -le $q ] ; do echo -n "${TAB}" if [ $i -gt 1 ] ; then echo -n "${TAB}${TAB}" ; fi csh_time "$1" i=$((i+1)) if [ ! -d "${TMPDIR}/smallfiles" ] ; then # srm incorrectly renamed the folder [4498712] createSmallFiles fi done } doTest () { # $1 = command-line options # $2 = number of times to execute command doForN "${STDSRM}""$1" "baseline time${TAB}" "$2" doForN "${TSTSRM}"' --bsize=4096 '"$1" "buffsize=4096${TAB}" "$2" doForN "${TSTSRM}"' --bsize=65536 '"$1" "buffsize=65536${TAB}" "$2" doForN "${TSTSRM}"' --bsize=131072 '"$1" "buffsize=131072${TAB}" "$2" doForN "${TSTSRM}"' --bsize=1048576 '"$1" "buffsize=1048576" "$2" doForN "${TSTSRM}"' --bsize=4194304 '"$1" "buffsize=4194304" "$2" doForN "${TSTSRM}"' --bsize=8388608 '"$1" "buffsize=8388608" "$2" } # ---------------------------------------------------------------------- # Begin script echo "`date`: ${HW_VERS}" echo "`date`: Current system is ${SW_VERS}" echo "`date`: Current directory is ${BASEDIR}" echo "`date`: Starting tests" if [ -d "${TMPDIR}" ] ; then rm -rf "${TMPDIR}" ; fi createLargeFiles createSmallFiles echo echo "### 1-pass tests ###" echo echo "file: ${TMPDIR}/284mb" doTest ' -s -n '"${TMPDIR}/284mb" 3 echo echo "folder: ${TMPDIR}/smallfiles" doTest ' -s -r -f -n '"${TMPDIR}/smallfiles" 3 echo echo "### 7-pass tests ###" echo echo "file: ${TMPDIR}/284mb" doTest ' -m -n '"${TMPDIR}/284mb" 3 echo echo "folder: ${TMPDIR}/smallfiles" doTest ' -m -r -f -n '"${TMPDIR}/smallfiles" 3 echo echo "### 35-pass tests ###" echo echo "file: ${TMPDIR}/100mb" doTest ' -n '"${TMPDIR}/100mb" 3 echo echo "folder: ${TMPDIR}/smallfiles" doTest ' -r -f -n '"${TMPDIR}/smallfiles" 3 if [ -d "${TMPDIR}" ] ; then rm -rf "${TMPDIR}" ; fi echo echo "`date`: Completed tests" exit 0 Index: TODO =================================================================== RCS file: /cvsroot/srm/srm/TODO,v retrieving revision 1.28 retrieving revision 1.29 diff -u -d -r1.28 -r1.29 --- TODO 6 Jun 2010 05:50:40 -0000 1.28 +++ TODO 22 Nov 2010 01:47:11 -0000 1.29 @@ -1,7 +1,6 @@ - for srm 1.2.11 + check ext2 special flags, unremovable, immutable, appendonly + FreeBSD test, check st_flags in sunlink.c - + merge with changes from http://www.opensource.apple.com/darwinsource/Current/srm-6/srm/src/ , archive/srm-6.tar.gz + check with ext4 (http://ext4.wiki.kernel.org/index.php/Main_Page), jfs, xfs, reiserfs - make a library from sunlink.c so other programs can use the function Index: README.OsX =================================================================== RCS file: /cvsroot/srm/srm/README.OsX,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- README.OsX 17 Aug 2009 18:41:49 -0000 1.1 +++ README.OsX 22 Nov 2010 01:47:11 -0000 1.2 @@ -1,6 +1,5 @@ Apple Mac OsX ships with a version of srm derived from 1.2.8. The srm project was abandoned for a couple of years and the Apple team created -their version with the most critical bugs fixed. In a future release -of the SourceForge srm version all those changes will be merged back, -but for now Apple users can simply continue to use the Apple version -of srm. +their version with the most critical bugs fixed. This version from Sourceforge +has merged the important changes made by Apple and an be used as an alternative +if you would like to use the additional features (new overwrite modes). Index: srm.spec.in =================================================================== RCS file: /cvsroot/srm/srm/srm.spec.in,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- srm.spec.in 14 Oct 2000 22:36:11 -0000 1.2 +++ srm.spec.in 22 Nov 2010 01:47:11 -0000 1.3 @@ -4,7 +4,7 @@ License: X11 URL: http://srm.sourceforge.net Group: Applications/File -Vendor: Matt Gauthier <el...@ya...> +Vendor: Dirk Jagdmann <do...@cu...> Packager: %{vendor} Prefix: /usr @@ -12,15 +12,16 @@ Buildroot: /tmp/%{name}.buildroot Source: %{name}-%{version}.tar.gz -Summary: srm (secure rm) is a command-line compatible rm(1) which destroys file contents before unlinking. +Summary: srm (secure rm) is a command-line compatible rm(1) which overwrites file contents before unlinking. %description This is srm, a secure replacement for rm(1). Unlike the standard rm, -it overwrites the data in the target files before unlinkg them. This -prevents command-line recovery of the data by examining the raw block -device. It may also help frustrate physical examination of the disk, -although it's unlikely that completely protects against this type of +it overwrites the data in the target files before unlinking them. This +prevents recovery of the data by examining the raw block device. It +may also help frustrate physical examination of the disk, although +it's unlikely that it completely protects against this type of recovery. + %prep %setup ./configure @@ -38,4 +39,3 @@ %files %attr(-, root, root) /usr/bin/srm %attr(-, root, root) %doc /usr/man/man1/* - |
From: Dirk J. <do...@us...> - 2010-11-22 01:47:21
|
Update of /cvsroot/srm/srm/src In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv27345/src Modified Files: sunlink.c Log Message: OsX updates Index: sunlink.c =================================================================== RCS file: /cvsroot/srm/srm/src/sunlink.c,v retrieving revision 1.37 retrieving revision 1.38 diff -u -d -r1.37 -r1.38 --- sunlink.c 6 Jun 2010 19:06:20 -0000 1.37 +++ sunlink.c 22 Nov 2010 01:47:12 -0000 1.38 @@ -23,6 +23,10 @@ #include <sys/vfs.h> #endif +#if defined(__APPLE__) +#include <sys/disk.h> +#endif + #if defined(HAVE_SYS_PARAM_H) && defined(HAVE_SYS_MOUNT_H) #include <sys/param.h> #include <sys/mount.h> @@ -152,6 +156,22 @@ return count; } +static void flush(int fd) +{ + /* force buffered writes to be flushed to disk */ +#if defined F_FULLFSYNC + /* F_FULLFSYNC is equivalent to fsync plus device flush to media */ + if (fcntl(fd, F_FULLFSYNC, NULL) != 0) { + /* we're not on a fs that supports this; fall back to plain fsync */ + fsync(fd); + } +#elif HAVE_FDATASYNC + fdatasync(fd); +#else + fsync(fd); +#endif +} + static int overwrite(struct srm_target *srm, const int pass) { off_t i = 0; @@ -213,16 +233,7 @@ fflush(stdout); } -#ifdef HAVE_FDATASYNC - fdatasync(srm->fd); -#else - -#ifdef F_FULLFSYNC - fcntl(srm->fd, F_FULLFSYNC, 1); /* ignore failure, since it's only a nice-to-have */ -#endif - - fsync(srm->fd); -#endif /* HAVE_FDATASYNC */ + flush(srm->fd); if(lseek(srm->fd, 0, SEEK_SET) != 0) { @@ -280,6 +291,11 @@ { if(!srm) return -1; +#if defined(F_NOCACHE) + /* before performing file I/O, set F_NOCACHE to prevent caching */ + (void)fcntl(srm->fd, F_NOCACHE, 1); +#endif + if( (srm->buffer = (unsigned char *)alloca(srm->buffer_size)) == NULL ) { errno = ENOMEM; @@ -488,10 +504,10 @@ #if defined(__linux__) srm.buffer_size = fs_stats.f_bsize; -#elif defined(__FreeBSD__) +#elif defined(__FreeBSD__) || defined(__APPLE__) srm.buffer_size = fs_stats.f_iosize; #else -#warn Please define your platform. +#error Please define your platform. #endif if((srm.options & SRM_OPT_V) == SRM_OPT_V) printf("buffer_size=%u\n", srm.buffer_size); @@ -600,7 +616,7 @@ goto rsrc_fork_failed; } - if (snprintf(rsrc.file_name, MAXPATHLEN, RSRCFORKSPEC "%s", srm.file_name) > MAXPATHLEN - 1) + if (snprintf((char*)rsrc.file_name, MAXPATHLEN, RSRCFORKSPEC "%s", srm.file_name) > MAXPATHLEN - 1) { errno = ENAMETOOLONG; goto rsrc_fork_failed; @@ -627,12 +643,12 @@ goto rsrc_fork_failed; } - if (srm->options & OPT_V) + if (rsrc.options & SRM_OPT_V) printf("removing %s\n", rsrc.file_name); if(overwrite_selector(&rsrc) < 0) { - if (srm->options & OPT_V) + if (rsrc.options & SRM_OPT_V) fprintf(stderr, "could not overwrite ressource fork %s: %s\n", rsrc.file_name, strerror(errno)); } @@ -642,7 +658,7 @@ } rsrc_fork_failed: - if (srm->options & OPT_V) + if (rsrc.options & SRM_OPT_V) fprintf(stderr, "could not access ressource fork %s: %s\n", srm.file_name, strerror(errno)); rsrc_fork_done: ; |
From: SourceForge.net <no...@so...> - 2010-07-14 06:40:00
|
Bugs item #3029333, was opened at 2010-07-13 23:40 Message generated for change (Tracker Item Submitted) made by daveyost You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=103297&aid=3029333&group_id=3297 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None Status: Open Resolution: None Priority: 5 Private: No Submitted By: Dave Yost (daveyost) Assigned to: Nobody/Anonymous (nobody) Summary: erase once on SSD Initial Comment: If srm can identify the type of the underlying storage as SSD, then it should default to "simple" mode, i.e. one pass. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=103297&aid=3029333&group_id=3297 |
From: SourceForge.net <no...@so...> - 2010-06-24 16:47:52
|
Feature Requests item #3020346, was opened at 2010-06-23 12:21 Message generated for change (Comment added) made by doj You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=353297&aid=3020346&group_id=3297 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None Status: Open Priority: 5 Private: No Submitted By: Dave Yost (daveyost) Assigned to: Nobody/Anonymous (nobody) Summary: smv would be useful, too Initial Comment: When doing a mv across volumes, the original needs to be deleted securely. ---------------------------------------------------------------------- >Comment By: Dirk Jagdmann (doj) Date: 2010-06-24 09:47 Message: True. To address this usecase, and generally securely delete any files, I want to create a shared library from srm. This would intercept any calls to unlink() via the LD_PRELOAD feature. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=353297&aid=3020346&group_id=3297 |
From: SourceForge.net <no...@so...> - 2010-06-23 19:21:07
|
Feature Requests item #3020346, was opened at 2010-06-23 12:21 Message generated for change (Tracker Item Submitted) made by daveyost You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=353297&aid=3020346&group_id=3297 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None Status: Open Priority: 5 Private: No Submitted By: Dave Yost (daveyost) Assigned to: Nobody/Anonymous (nobody) Summary: smv would be useful, too Initial Comment: When doing a mv across volumes, the original needs to be deleted securely. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=353297&aid=3020346&group_id=3297 |
From: Dirk J. <do...@us...> - 2010-06-06 19:06:40
|
Update of /cvsroot/srm/srm/doc In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv4085 Modified Files: srm.1 Log Message: FreeBSD fixes Index: srm.1 =================================================================== RCS file: /cvsroot/srm/srm/doc/srm.1,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- srm.1 6 Jun 2010 18:37:46 -0000 1.11 +++ srm.1 6 Jun 2010 19:06:32 -0000 1.12 @@ -20,7 +20,8 @@ .P You can use .B srm -to overwrite block devices. The device node is not removed after overwriting. +to overwrite block devices. The device node is not removed after +overwriting. This feature is available on Linux. .P .BR srm , like every program that uses the getopt function to parse its |
From: Dirk J. <do...@us...> - 2010-06-06 19:06:28
|
Update of /cvsroot/srm/srm/src In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv4034 Modified Files: sunlink.c Log Message: FreeBSD fixes Index: sunlink.c =================================================================== RCS file: /cvsroot/srm/srm/src/sunlink.c,v retrieving revision 1.36 retrieving revision 1.37 diff -u -d -r1.36 -r1.37 --- sunlink.c 6 Jun 2010 18:37:46 -0000 1.36 +++ sunlink.c 6 Jun 2010 19:06:20 -0000 1.37 @@ -387,7 +387,7 @@ if((srm.options & SRM_OPT_V) == SRM_OPT_V) printf("buffer_size=%u\n", srm.buffer_size); -#ifdef __unix__ +#ifdef __linux__ if(S_ISBLK(statbuf.st_mode)) { int secsize=512; @@ -423,10 +423,22 @@ u_=((uint64_t)blocks)*secsize; if(u_ != u) - printf("!Warning! sectorsize*blocks:%lld != bytes:%lld\n", u_, u); + printf("!Warning! sectorsize*blocks:%llu != bytes:%llu\n", u_, u); srm.file_size = u; - srm.buffer_size = 512; + srm.buffer_size = secsize; + + if(srm.file_size == 0) + { + close(srm.fd); + if (srm.options & SRM_OPT_V) + fprintf(stderr, "could not determine block device %s filesize\n", srm.file_name); + errno = EIO; + return -1; + } + + if((options&SRM_OPT_V) > 1) + printf("block device %s size: %llu bytes\n", srm.file_name, (unsigned long long)u); if(overwrite_selector(&srm) < 0) { |
From: Dirk J. <do...@us...> - 2010-06-06 18:37:55
|
Update of /cvsroot/srm/srm In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv31224 Modified Files: NEWS Log Message: block device handling Index: NEWS =================================================================== RCS file: /cvsroot/srm/srm/NEWS,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- NEWS 6 Jun 2010 17:27:04 -0000 1.11 +++ NEWS 6 Jun 2010 18:37:46 -0000 1.12 @@ -5,6 +5,7 @@ -v -v displays current write position SIGINFO, SIGUSR2 display current write position -x does not cross file system boundaries + overwrite block devices release-1_2_10 Mac OsX compiles and works again |
From: Dirk J. <do...@us...> - 2010-06-06 18:37:55
|
Update of /cvsroot/srm/srm/src In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv31224/src Modified Files: sunlink.c Log Message: block device handling Index: sunlink.c =================================================================== RCS file: /cvsroot/srm/srm/src/sunlink.c,v retrieving revision 1.35 retrieving revision 1.36 diff -u -d -r1.35 -r1.36 --- sunlink.c 6 Jun 2010 17:44:03 -0000 1.35 +++ sunlink.c 6 Jun 2010 18:37:46 -0000 1.36 @@ -16,6 +16,7 @@ #if defined(__unix__) #include <sys/ioctl.h> +#include <stdint.h> #endif #ifdef HAVE_SYS_VFS_H @@ -54,6 +55,12 @@ #include "srm.h" #include "impl.h" +#ifndef O_SYNC +#define O_SYNC 0 +#endif + +#define NO_UNLINK 0 + #define KiB 1024 #define MiB (KiB*KiB) #define GiB (KiB*KiB*KiB) @@ -273,8 +280,16 @@ { if(!srm) return -1; + if( (srm->buffer = (unsigned char *)alloca(srm->buffer_size)) == NULL ) + { + errno = ENOMEM; + return -1; + } + if(srm->options & SRM_MODE_DOD) { + if((srm->options&SRM_OPT_V) == SRM_OPT_V) + printf("US DoD mode\n"); if(overwrite_byte(srm, 1, 0xF6) < 0) return -1; if(overwrite_byte(srm, 2, 0x00) < 0) return -1; if(overwrite_byte(srm, 3, 0xFF) < 0) return -1; @@ -285,21 +300,29 @@ } else if(srm->options & SRM_MODE_DOE) { + if((srm->options&SRM_OPT_V) == SRM_OPT_V) + printf("US DoE mode\n"); if(overwrite_random(srm, 1, 2) < 0) return -1; if(overwrite_bytes(srm, 3, 'D', 'o', 'E') < 0) return -1; } else if(srm->options & SRM_MODE_OPENBSD) { + if((srm->options&SRM_OPT_V) == SRM_OPT_V) + printf("OpenBSD mode\n"); if(overwrite_byte(srm, 1, 0xFF) < 0) return -1; if(overwrite_byte(srm, 2, 0x00) < 0) return -1; if(overwrite_byte(srm, 3, 0xFF) < 0) return -1; } else if(srm->options & SRM_MODE_SIMPLE) { + if((srm->options&SRM_OPT_V) == SRM_OPT_V) + printf("Simple mode\n"); if(overwrite_byte(srm, 1, 0x00) < 0) return -1; } else { + if((srm->options&SRM_OPT_V) == SRM_OPT_V) + printf("Full mode\n"); if(overwrite_random(srm, 1, 4) < 0) return -1; if(overwrite_byte(srm, 5, 0x55) < 0) return -1; if(overwrite_byte(srm, 6, 0xAA) < 0) return -1; @@ -358,14 +381,67 @@ return -1; srm.file_size = statbuf.st_size; -#ifdef __unix__ srm.buffer_size = statbuf.st_blksize; -#else - srm.buffer_size = 4096; -#endif + if(srm.buffer_size < 16) + srm.buffer_size = 512; if((srm.options & SRM_OPT_V) == SRM_OPT_V) printf("buffer_size=%u\n", srm.buffer_size); +#ifdef __unix__ + if(S_ISBLK(statbuf.st_mode)) + { + int secsize=512; + long blocks=0; + uint64_t u=0, u_; + + if( (srm.fd = open(srm.file_name, O_WRONLY)) < 0) + return -1; + + if(ioctl(srm.fd, BLKSSZGET, &secsize) < 0) + { + perror("could not ioctl(BLKSSZGET)"); + return 1; + } + if((options&SRM_OPT_V) == SRM_OPT_V) + printf("sector size %i bytes\n", secsize); + + if(ioctl(srm.fd, BLKGETSIZE, &blocks) < 0) + { + perror("could not ioctl(BLKGETSIZE)"); + return 1; + } + if((options&SRM_OPT_V) == SRM_OPT_V) + printf("BLKGETSIZE %i blocks\n", (int)blocks); + + if(ioctl(srm.fd, BLKGETSIZE64, &u) < 0) + { + perror("could not ioctl(BLKGETSIZE64)"); + return 1; + } + if((options&SRM_OPT_V) == SRM_OPT_V) + printf("BLKGETSIZE64 %llu bytes\n", (unsigned long long)u); + + u_=((uint64_t)blocks)*secsize; + if(u_ != u) + printf("!Warning! sectorsize*blocks:%lld != bytes:%lld\n", u_, u); + + srm.file_size = u; + srm.buffer_size = 512; + + if(overwrite_selector(&srm) < 0) + { + int e=errno; + if (srm.options & SRM_OPT_V) + fprintf(stderr, "could not overwrite device %s: %s\n", srm.file_name, strerror(errno)); + close(srm.fd); + errno=e; + return -1; + } + close(srm.fd); + return 0; + } +#endif + if (!S_ISREG(statbuf.st_mode) || srm.file_size==0) return rename_unlink(srm.file_name); @@ -375,12 +451,14 @@ return -1; } - if ( (srm.fd = open(srm.file_name, O_WRONLY)) < 0) /* BSD doesn't support O_SYNC */ + if ( (srm.fd = open(srm.file_name, O_WRONLY|O_SYNC)) < 0) return -1; #ifdef __unix__ if (fcntl(srm.fd, F_WRLCK, &flock) < 0) { + int e=errno; close(srm.fd); + errno=e; return -1; } #endif @@ -390,7 +468,9 @@ struct statfs fs_stats; if (fstatfs(srm.fd, &fs_stats) < 0 && errno != ENOSYS) { + int e=errno; close(srm.fd); + errno=e; return -1; } @@ -411,7 +491,9 @@ if (ioctl(srm.fd, EXT2_IOC_GETFLAGS, &flags) < 0) { + int e=errno; close(srm.fd); + errno=e; return -1; } @@ -466,18 +548,13 @@ } #endif /* HAVE_CHFLAGS */ - if ( (srm.buffer = (unsigned char *)alloca(srm.buffer_size)) == NULL ) - { - close(srm.fd); - errno = ENOMEM; - return -1; - } - if(overwrite_selector(&srm) < 0) { + int e=errno; if (srm.options & SRM_OPT_V) fprintf(stderr, "could not overwrite file %s: %s\n", srm.file_name, strerror(errno)); close(srm.fd); + errno=e; return -1; } @@ -485,10 +562,14 @@ ioctl(srm.fd, EXT2_IOC_SETFLAGS, EXT2_SECRM_FL); #endif +#if !NO_UNLINK if (ftruncate(srm.fd, 0) < 0) { + int e=errno; close(srm.fd); + errno=e; return -1; } +#endif close(srm.fd); srm.fd = -1; @@ -525,7 +606,7 @@ if (rsrc.file_size > 0) { - if ((rsrc.fd = open(rsrc.file_name, O_WRONLY)) < 0) + if ((rsrc.fd = open(rsrc.file_name, O_WRONLY|O_SYNC)) < 0) goto rsrc_fork_failed; if (fcntl(rsrc.fd, F_WRLCK, &flock) == -1) @@ -556,5 +637,9 @@ } #endif /* __APPLE__ */ +#if NO_UNLINK + return 0; +#else return rename_unlink(srm.file_name); +#endif } |