[Pkg-privacy-commits] [libgsecuredelete] 27/168: Added support for -z switch.
Ulrike Uhlig
u-guest at moszumanska.debian.org
Thu Jul 7 20:06:34 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 a845d8376e8e49c2b98b1bf908a3b2a6f1b55ff6
Author: Colomban Wendling <ban at herbesfolles.org>
Date: Mon Oct 5 01:47:12 2009 +0200
Added support for -z switch.
Added support for the -z option of srm, sfill (and later sswap) through
the new ZeroableOperation layer.
---
gsecuredelete/Makefile.am | 1 +
gsecuredelete/delete-operation.vala | 3 +-
gsecuredelete/fill-operation.vala | 8 ++---
gsecuredelete/zeroable-operation.vala | 66 +++++++++++++++++++++++++++++++++++
4 files changed, 71 insertions(+), 7 deletions(-)
diff --git a/gsecuredelete/Makefile.am b/gsecuredelete/Makefile.am
index 691ccdc..0b3cf43 100644
--- a/gsecuredelete/Makefile.am
+++ b/gsecuredelete/Makefile.am
@@ -10,6 +10,7 @@ libgsecuredelete_la_includedir=$(includedir)/gsecuredelete
libgsecuredelete_la_VALAFLAGS = $(AM_VALAFLAGS) --library=libgsecuredelete -H libgsecuredelete.h
libgsecuredelete_la_SOURCES = async-operation.vala \
securedelete-operation.vala \
+ zeroable-operation.vala \
delete-operation.vala \
fill-operation.vala \
mem-operation.vala \
diff --git a/gsecuredelete/delete-operation.vala b/gsecuredelete/delete-operation.vala
index 1c51fa2..fdb27f9 100644
--- a/gsecuredelete/delete-operation.vala
+++ b/gsecuredelete/delete-operation.vala
@@ -21,7 +21,7 @@ using GLib;
namespace SecureDelete
{
- public class DeleteOperation : SecureDeleteOperation
+ public class DeleteOperation : ZeroableOperation
{
private List<string> _paths;
private uint n_files = 0;
@@ -67,6 +67,7 @@ namespace SecureDelete
args.append ("srm");
args.append ("-rv");
this.add_mode_argument (ref args);
+ this.add_zeroise_argument (ref args);
this.n_files = 0;
foreach (unowned string path in this._paths) {
args.append (path);
diff --git a/gsecuredelete/fill-operation.vala b/gsecuredelete/fill-operation.vala
index c6ee314..69a5820 100644
--- a/gsecuredelete/fill-operation.vala
+++ b/gsecuredelete/fill-operation.vala
@@ -19,12 +19,7 @@
namespace SecureDelete
{
- /*
- * TODO:
- * perhaps add support -z.
- */
-
- public class FillOperation : SecureDeleteOperation
+ public class FillOperation : ZeroableOperation
{
/**
* WipeMode:
@@ -95,6 +90,7 @@ namespace SecureDelete
args.append ("-v");
this.add_mode_argument (ref args);
this.add_wipe_mode_argument (ref args);
+ this.add_zeroise_argument (ref args);
args.append (this.directory);
return args;
diff --git a/gsecuredelete/zeroable-operation.vala b/gsecuredelete/zeroable-operation.vala
new file mode 100644
index 0000000..32f2022
--- /dev/null
+++ b/gsecuredelete/zeroable-operation.vala
@@ -0,0 +1,66 @@
+/*
+ *
+ * Copyright (C) 2009 Colomban Wendling <ban at herbesfolles.org>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * 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, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+using GLib;
+
+namespace SecureDelete
+{
+
+ /**
+ * ZeroableOperation:
+ *
+ * A subclass of SecureDeleteOperation designed to be the base class for all
+ * SecureDelete operations that support wiping with zeros only as the last
+ * pass.
+ */
+ public abstract class ZeroableOperation : SecureDeleteOperation
+ {
+ /**
+ * zeroise:
+ *
+ * Whether to wipe with zeros at the last pass instead of random data.
+ */
+ public bool zeroise {
+ get;
+ set;
+ default = false;
+ }
+
+ /* returns the argument to pass to SecureDelete tools depending whether the
+ * last wiping pass should be done with zeros. %null wan be returned,
+ * meaning no argument should be added */
+ protected unowned string? get_argument_for_zeroise (bool zeroise)
+ {
+ if (zeroise) {
+ return "-z";
+ }
+ return null;
+ }
+
+ /* adds the argument needed by the currently set zeorise setting to an
+ * argument list */
+ protected void add_zeroise_argument (ref List<string> args)
+ {
+ unowned string? arg = this.get_argument_for_zeroise (this.zeroise);
+ if (arg != null) {
+ args.append (arg);
+ }
+ }
+ }
+}
--
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