summaryrefslogtreecommitdiff
path: root/source/a/util-linux/0001-mount-old-fix-encryption-usage.patch
diff options
context:
space:
mode:
Diffstat (limited to 'source/a/util-linux/0001-mount-old-fix-encryption-usage.patch')
-rw-r--r--source/a/util-linux/0001-mount-old-fix-encryption-usage.patch88
1 files changed, 88 insertions, 0 deletions
diff --git a/source/a/util-linux/0001-mount-old-fix-encryption-usage.patch b/source/a/util-linux/0001-mount-old-fix-encryption-usage.patch
new file mode 100644
index 00000000..afe6e5c9
--- /dev/null
+++ b/source/a/util-linux/0001-mount-old-fix-encryption-usage.patch
@@ -0,0 +1,88 @@
+--- ./mount/mount.c.orig 2012-05-25 04:44:58.993195438 -0500
++++ ./mount/mount.c 2012-08-02 12:04:52.455435631 -0500
+@@ -41,6 +41,7 @@
+ #include "nls.h"
+ #include "blkdev.h"
+ #include "strutils.h"
++#include "xgetpass.h"
+
+ #define DO_PS_FIDDLING
+
+@@ -1238,6 +1239,8 @@
+ int looptype;
+ uintmax_t offset = 0, sizelimit = 0;
+ struct loopdev_cxt lc;
++ char *pwd = NULL;
++ int ret = EX_FAIL;
+
+ /*
+ * In the case of a loop mount, either type is of the form lo@/dev/loop5
+@@ -1317,8 +1320,18 @@
+ return EX_FAIL;
+ }
+
++ if (opt_encryption) {
++#ifdef MCL_FUTURE
++ if (mlockall(MCL_CURRENT | MCL_FUTURE)) {
++ error(_("mount: couldn't lock into memory"));
++ return EX_FAIL;
++ }
++#endif
++ pwd = xgetpass(pfd, _("Password: "));
++ }
++
+ loopcxt_init(&lc, 0);
+- /* loopcxt_enable_debug(&lc, 1); */
++ /*loopcxt_enable_debug(&lc, 1);*/
+
+ if (*loopdev && **loopdev)
+ loopcxt_set_device(&lc, *loopdev); /* use loop=<devname> */
+@@ -1343,6 +1356,8 @@
+ rc = loopcxt_set_offset(&lc, offset);
+ if (!rc && sizelimit)
+ rc = loopcxt_set_sizelimit(&lc, sizelimit);
++ if (!rc && opt_encryption && pwd)
++ loopcxt_set_encryption(&lc, opt_encryption, pwd);
+ if (!rc)
+ loopcxt_set_flags(&lc, loop_opts);
+
+@@ -1358,8 +1373,7 @@
+ break; /* success */
+
+ if (rc != -EBUSY) {
+- if (verbose)
+- printf(_("mount: failed setting up loop device\n"));
++ error(_("mount: %s: failed setting up loop device: %m"), *loopfile);
+ if (!opt_loopdev) {
+ my_free(*loopdev);
+ *loopdev = NULL;
+@@ -1399,9 +1413,15 @@
+ }
+ }
+
+- return 0;
++ ret = 0;
+ err:
+- return EX_FAIL;
++ if (pwd) {
++ char *p = pwd;
++ while (*p)
++ *p++ = '\0';
++ free(pwd);
++ }
++ return ret;
+ }
+
+
+--- ./mount/Makefile.am.orig 2012-05-25 04:44:58.000000000 -0500
++++ ./mount/Makefile.am 2012-08-02 12:04:14.958439138 -0500
+@@ -23,7 +23,8 @@
+ $(top_srcdir)/lib/at.c \
+ $(top_srcdir)/lib/sysfs.c \
+ $(top_srcdir)/lib/loopdev.c \
+- $(top_srcdir)/lib/strutils.c
++ $(top_srcdir)/lib/strutils.c \
++ $(top_srcdir)/lib/xgetpass.c
+
+ # generic flags for all programs
+ # -- note that pkg-config autoconf macros (pkg.m4) does not differentiate