SHA256
1
0
forked from pool/systemd
systemd/parse-crypttab-for-noauto-option.patch
Stephan Kulow e0b301714e Accepting request 233091 from Base:System
- Add patch parse-crypttab-for-noauto-option.patch from Thomas Blume
  to handle the option 'noauto' in /etc/crypttab (bnc#742774)

- Modify and extend patch 
  0001-On_s390_con3270_disable_ANSI_colour_esc.patch
  to have the correct terminal type used with agetty
- Add patch 0001-tmpfiles-fix-permissions-on-new-journal-files.patch
  to allow users to access systemd user journal (bnc#876694) 

- Add patch parse-crypttab-for-noauto-option.patch from Thomas Blume
  to handle the option 'noauto' in /etc/crypttab (bnc#742774)

- Modify and extend patch 
  0001-On_s390_con3270_disable_ANSI_colour_esc.patch
  to have the correct terminal type used with agetty
- Add patch 0001-tmpfiles-fix-permissions-on-new-journal-files.patch
  to allow users to access systemd user journal (bnc#876694)

OBS-URL: https://build.opensuse.org/request/show/233091
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/systemd?expand=0&rev=185
2014-05-10 06:32:24 +00:00

80 lines
2.4 KiB
Diff

---
src/fstab-generator/fstab-generator.c | 52 ++++++++++++++++++++++++++++++++--
1 file changed, 50 insertions(+), 2 deletions(-)
--- systemd-210/src/fstab-generator/fstab-generator.c
+++ systemd-210/src/fstab-generator/fstab-generator.c 2014-05-07 09:15:01.003911151 +0000
@@ -37,6 +37,53 @@
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;
+ int r;
+
+ f = fopen("/etc/crypttab", "re");
+ if (!f) {
+ if (errno == ENOENT)
+ r = EXIT_SUCCESS;
+ else
+ 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;
@@ -212,7 +259,7 @@
*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);
@@ -286,7 +333,8 @@
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)