[Pkg-privacy-commits] [libgsecuredelete] 47/168: Split -f from -l and -ll.
Ulrike Uhlig
u-guest at moszumanska.debian.org
Thu Jul 7 20:06:38 UTC 2016
This is an automated email from the git hooks/post-receive script.
u-guest pushed a commit to branch master
in repository libgsecuredelete.
commit 636ec9985691bb6fee9938d6783ebf36afef6339
Author: Colomban Wendling <ban at herbesfolles.org>
Date: Mon Feb 22 20:39:08 2010 +0100
Split -f from -l and -ll.
Split -f from security mode as it doesn't tune the same thing.
This breaks API and ABI. API changes:
* New :fast property in Gsd.SecureDeleteOperation, new name of -f;
* Rename of Gsd.SecureDeleteOperation.Mode.VERY_FAST and
VERY_VERY_FAST to respectively INSECURE and VERY_INSECURE;
* Removal of Gsd.SecureDeleteOperation.Mode.FAST (see first point).
---
gsecuredelete/delete-operation.vala | 1 +
gsecuredelete/fill-operation.vala | 1 +
gsecuredelete/main.vala | 6 ++--
gsecuredelete/mem-operation.vala | 1 +
gsecuredelete/securedelete-operation.vala | 49 +++++++++++++++++++++++--------
gsecuredelete/swap-operation.vala | 1 +
6 files changed, 43 insertions(+), 16 deletions(-)
diff --git a/gsecuredelete/delete-operation.vala b/gsecuredelete/delete-operation.vala
index 1e1b808..208efab 100644
--- a/gsecuredelete/delete-operation.vala
+++ b/gsecuredelete/delete-operation.vala
@@ -90,6 +90,7 @@ namespace Gsd
List<string> args = null;
args.append ("-rv");
+ this.add_fast_argument (ref args);
this.add_mode_argument (ref args);
this.add_zeroise_argument (ref args);
this.n_files = 0;
diff --git a/gsecuredelete/fill-operation.vala b/gsecuredelete/fill-operation.vala
index 3a71fc4..d76169b 100644
--- a/gsecuredelete/fill-operation.vala
+++ b/gsecuredelete/fill-operation.vala
@@ -96,6 +96,7 @@ namespace Gsd
}
args.append ("-v");
+ this.add_fast_argument (ref args);
this.add_mode_argument (ref args);
this.add_wipe_mode_argument (ref args);
this.add_zeroise_argument (ref args);
diff --git a/gsecuredelete/main.vala b/gsecuredelete/main.vala
index 03b942b..1751c7c 100644
--- a/gsecuredelete/main.vala
+++ b/gsecuredelete/main.vala
@@ -71,7 +71,7 @@ public class Test
{
var op = new DeleteOperation ();
- /*op.mode = SecureDeleteOperation.Mode.VERY_FAST;*/
+ /*op.mode = SecureDeleteOperation.Mode.INSECURE;*/
foreach (var arg in args) {
/* hack to skip the first argument */
if (arg != args[0])
@@ -99,7 +99,7 @@ public class Test
private static SecureDeleteOperation? prepare_memop (string[] args)
{
var op = new MemOperation ();
- op.mode = SecureDeleteOperation.Mode.VERY_VERY_FAST;
+ op.mode = SecureDeleteOperation.Mode.VERY_INSECURE;
return op;
}
@@ -108,7 +108,7 @@ public class Test
{
var op = new SwapOperation ();
op.device = "/dev/sda1";
- op.mode = SecureDeleteOperation.Mode.VERY_FAST;
+ op.mode = SecureDeleteOperation.Mode.INSECURE;
return op;
}
diff --git a/gsecuredelete/mem-operation.vala b/gsecuredelete/mem-operation.vala
index d982687..e1159e0 100644
--- a/gsecuredelete/mem-operation.vala
+++ b/gsecuredelete/mem-operation.vala
@@ -41,6 +41,7 @@ namespace Gsd
List<string> args = null;
args.append ("-v");
+ this.add_fast_argument (ref args);
this.add_mode_argument (ref args);
return args;
diff --git a/gsecuredelete/securedelete-operation.vala b/gsecuredelete/securedelete-operation.vala
index 58b38b9..3769d53 100644
--- a/gsecuredelete/securedelete-operation.vala
+++ b/gsecuredelete/securedelete-operation.vala
@@ -34,16 +34,21 @@ namespace Gsd
* Mode:
*
* Security mode:
- * @NORMAL: normal mode
- * @FAST: faster but less secure (correspond to the -f option)
- * @VERY_FAST: really faster but with a very poor security (-l option)
- * @VERY_VERY_FAST: even more faster, even less secure (-ll option)
+ * @NORMAL: normal mode (default) (38 passes)
+ * @INSECURE: less security (-l option) (2 passes)
+ * @VERY_INSECURE: even less security (-ll option) (1 pass)
*/
public enum Mode {
NORMAL,
- FAST,
- VERY_FAST,
- VERY_VERY_FAST
+ INSECURE,
+ VERY_INSECURE
+ }
+
+ /** Whether to use fast (and insecure) work mode (-f option). */
+ public bool fast {
+ get;
+ set;
+ default = false;
}
/** The security mode */
@@ -54,16 +59,34 @@ namespace Gsd
}
/* returns the argument to pass to SecureDelete tools depending on the
+ * speed mode. %null can be returned, meaning no argument should be
+ * added */
+ protected unowned string? get_argument_for_fast (bool fast)
+ {
+ if (fast) {
+ return "-f";
+ }
+ return null;
+ }
+
+ /* adds the argument needed by the current set speed to an argument list */
+ protected void add_fast_argument (ref List<string> args)
+ {
+ unowned string? arg_fast = this.get_argument_for_fast (this.fast);
+ if (arg_fast != null) {
+ args.append (arg_fast);
+ }
+ }
+
+ /* returns the argument to pass to SecureDelete tools depending on the
* security mode. %null can be returned, meaning no argument should be
* added */
protected unowned string? get_argument_for_mode (Mode mode)
{
switch (mode) {
- case Mode.FAST:
- return "-f";
- case Mode.VERY_FAST:
+ case Mode.INSECURE:
return "-l";
- case Mode.VERY_VERY_FAST:
+ case Mode.VERY_INSECURE:
return "-ll";
}
return null;
@@ -83,9 +106,9 @@ namespace Gsd
{
/* FIXME: Get the pass number reported by the program? */
switch (this.mode) {
- case Mode.VERY_FAST:
+ case Mode.INSECURE:
return 2;
- case Mode.VERY_VERY_FAST:
+ case Mode.VERY_INSECURE:
return 1;
default:
return 38;
diff --git a/gsecuredelete/swap-operation.vala b/gsecuredelete/swap-operation.vala
index 24067a1..b17d7c1 100644
--- a/gsecuredelete/swap-operation.vala
+++ b/gsecuredelete/swap-operation.vala
@@ -100,6 +100,7 @@ namespace Gsd
}
args.append ("-v");
+ this.add_fast_argument (ref args);
this.add_mode_argument (ref args);
this.add_zeroise_argument (ref args);
args.append (this.device);
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-privacy/packages/libgsecuredelete.git
More information about the Pkg-privacy-commits
mailing list