systemd/parse-crypttab-for-noauto-option.patch

79 lines
2.4 KiB
Diff
Raw Normal View History

---
src/fstab-generator/fstab-generator.c | 52 ++++++++++++++++++++++++++++++++--
1 file changed, 50 insertions(+), 2 deletions(-)
Accepting request 242359 from Base:System - Disable blkrrpart for SLES12 and below - Add upstream patch 1054-udev-exclude-MD-from-block-device-ownership-event-lo.patch - Add with condition blkrrpart to be able to disable the patches 1025, 1027, 1029, 1030, 1031, 1032, 1033, 1034, 1037, and 1054 which uses the BLKRRPART ioctl for e.g. synthesize change events which may interfere with other tools like parted. - Update handle-disable_caplock-and-compose_table-and-kbd_rate.patch, handle-numlock-value-in-etc-sysconfig-keyboard.patch: read /etc/vconsole.conf after /etc/sysconfig/(keyboard,console) otherwise empty value in /etc/sysconfig/keyboard might override /etc/vconsole.conf values. - Update : 0001-journal-compress-return-early-in-uncompress_startswi.patch 0002-util-don-t-consider-tabs-special-in-string_has_cc-an.patch 0002-vconsole-setup-run-setfont-before-loadkeys.patch 0003-core-never-consider-failure-when-reading-drop-ins-fa.patch 0003-fsck-consider-a-fsck-implementation-linked-to-bin-tr.patch apply-ACL-for-nvidia-device-nodes.patch keep-crypt-password-prompt.patch log-target-null-instead-kmsg.patch parse-crypttab-for-noauto-option.patch set-and-use-default-logconsole.patch: fix all warnings in code - Remove 0001-compress-fix-return-value.patch: not relevant to systemd v210 code. - Also change udev-generate-peristent-rule to udev-generate-persistent-rule OBS-URL: https://build.opensuse.org/request/show/242359 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/systemd?expand=0&rev=195
2014-07-26 12:19:44 +02:00
Index: systemd-210/src/fstab-generator/fstab-generator.c
===================================================================
--- systemd-210.orig/src/fstab-generator/fstab-generator.c
+++ systemd-210/src/fstab-generator/fstab-generator.c
@@ -37,6 +37,50 @@
static const char *arg_dest = "/tmp";
static bool arg_enabled = true;
+static int check_crypttab(const char *what) {
+ _cleanup_fclose_ FILE *f = NULL;
+ unsigned n = 0;
+
+ f = fopen("/etc/crypttab", "re");
+ if (!f) {
Accepting request 242359 from Base:System - Disable blkrrpart for SLES12 and below - Add upstream patch 1054-udev-exclude-MD-from-block-device-ownership-event-lo.patch - Add with condition blkrrpart to be able to disable the patches 1025, 1027, 1029, 1030, 1031, 1032, 1033, 1034, 1037, and 1054 which uses the BLKRRPART ioctl for e.g. synthesize change events which may interfere with other tools like parted. - Update handle-disable_caplock-and-compose_table-and-kbd_rate.patch, handle-numlock-value-in-etc-sysconfig-keyboard.patch: read /etc/vconsole.conf after /etc/sysconfig/(keyboard,console) otherwise empty value in /etc/sysconfig/keyboard might override /etc/vconsole.conf values. - Update : 0001-journal-compress-return-early-in-uncompress_startswi.patch 0002-util-don-t-consider-tabs-special-in-string_has_cc-an.patch 0002-vconsole-setup-run-setfont-before-loadkeys.patch 0003-core-never-consider-failure-when-reading-drop-ins-fa.patch 0003-fsck-consider-a-fsck-implementation-linked-to-bin-tr.patch apply-ACL-for-nvidia-device-nodes.patch keep-crypt-password-prompt.patch log-target-null-instead-kmsg.patch parse-crypttab-for-noauto-option.patch set-and-use-default-logconsole.patch: fix all warnings in code - Remove 0001-compress-fix-return-value.patch: not relevant to systemd v210 code. - Also change udev-generate-peristent-rule to udev-generate-persistent-rule OBS-URL: https://build.opensuse.org/request/show/242359 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/systemd?expand=0&rev=195
2014-07-26 12:19:44 +02:00
+ if (errno != ENOENT)
+ log_error("Failed to open /etc/crypttab: %m");
+
+ return 1;
+ }
+
+
+ for (;;) {
+ char line[LINE_MAX], *l;
+ _cleanup_free_ char *name = NULL, *device = NULL, *password = NULL, *options = NULL;
+ int k;
+
+ if (!fgets(line, sizeof(line), f))
+ break;
+
+ n++;
+
+ l = strstrip(line);
+ if (*l == '#' || *l == 0)
+ continue;
+
+ k = sscanf(l, "%ms %ms %ms %ms", &name, &device, &password, &options);
+ if (k < 2 || k > 4) {
+ log_error("Failed to parse /etc/crypttab:%u, ignoring.", n);
+ continue;
+ }
+
+ if (strcmp((what + 12), name) == 0) {
+ if (strstr(options, "noauto"))
+ return 0;
+
+ return 1;
+ }
+ }
+ return 1;
+}
+
+
static int mount_find_pri(struct mntent *me, int *ret) {
char *end, *pri;
unsigned long r;
Accepting request 242359 from Base:System - Disable blkrrpart for SLES12 and below - Add upstream patch 1054-udev-exclude-MD-from-block-device-ownership-event-lo.patch - Add with condition blkrrpart to be able to disable the patches 1025, 1027, 1029, 1030, 1031, 1032, 1033, 1034, 1037, and 1054 which uses the BLKRRPART ioctl for e.g. synthesize change events which may interfere with other tools like parted. - Update handle-disable_caplock-and-compose_table-and-kbd_rate.patch, handle-numlock-value-in-etc-sysconfig-keyboard.patch: read /etc/vconsole.conf after /etc/sysconfig/(keyboard,console) otherwise empty value in /etc/sysconfig/keyboard might override /etc/vconsole.conf values. - Update : 0001-journal-compress-return-early-in-uncompress_startswi.patch 0002-util-don-t-consider-tabs-special-in-string_has_cc-an.patch 0002-vconsole-setup-run-setfont-before-loadkeys.patch 0003-core-never-consider-failure-when-reading-drop-ins-fa.patch 0003-fsck-consider-a-fsck-implementation-linked-to-bin-tr.patch apply-ACL-for-nvidia-device-nodes.patch keep-crypt-password-prompt.patch log-target-null-instead-kmsg.patch parse-crypttab-for-noauto-option.patch set-and-use-default-logconsole.patch: fix all warnings in code - Remove 0001-compress-fix-return-value.patch: not relevant to systemd v210 code. - Also change udev-generate-peristent-rule to udev-generate-persistent-rule OBS-URL: https://build.opensuse.org/request/show/242359 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/systemd?expand=0&rev=195
2014-07-26 12:19:44 +02:00
@@ -212,7 +256,7 @@ static int add_mount(
*name = NULL, *unit = NULL, *lnk = NULL,
*automount_name = NULL, *automount_unit = NULL;
_cleanup_fclose_ FILE *f = NULL;
- int r;
+ int r, c;
assert(what);
assert(where);
Accepting request 242359 from Base:System - Disable blkrrpart for SLES12 and below - Add upstream patch 1054-udev-exclude-MD-from-block-device-ownership-event-lo.patch - Add with condition blkrrpart to be able to disable the patches 1025, 1027, 1029, 1030, 1031, 1032, 1033, 1034, 1037, and 1054 which uses the BLKRRPART ioctl for e.g. synthesize change events which may interfere with other tools like parted. - Update handle-disable_caplock-and-compose_table-and-kbd_rate.patch, handle-numlock-value-in-etc-sysconfig-keyboard.patch: read /etc/vconsole.conf after /etc/sysconfig/(keyboard,console) otherwise empty value in /etc/sysconfig/keyboard might override /etc/vconsole.conf values. - Update : 0001-journal-compress-return-early-in-uncompress_startswi.patch 0002-util-don-t-consider-tabs-special-in-string_has_cc-an.patch 0002-vconsole-setup-run-setfont-before-loadkeys.patch 0003-core-never-consider-failure-when-reading-drop-ins-fa.patch 0003-fsck-consider-a-fsck-implementation-linked-to-bin-tr.patch apply-ACL-for-nvidia-device-nodes.patch keep-crypt-password-prompt.patch log-target-null-instead-kmsg.patch parse-crypttab-for-noauto-option.patch set-and-use-default-logconsole.patch: fix all warnings in code - Remove 0001-compress-fix-return-value.patch: not relevant to systemd v210 code. - Also change udev-generate-peristent-rule to udev-generate-persistent-rule OBS-URL: https://build.opensuse.org/request/show/242359 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/systemd?expand=0&rev=195
2014-07-26 12:19:44 +02:00
@@ -288,7 +332,8 @@ static int add_mount(
return -errno;
}
- if (!noauto) {
+ c = check_crypttab(what);
+ if (!noauto && (c != 0)) {
if (post) {
lnk = strjoin(arg_dest, "/", post, nofail || automount ? ".wants/" : ".requires/", name, NULL);
if (!lnk)