SHA256
1
0
forked from pool/systemd
systemd/0002-util-don-t-consider-tabs-special-in-string_has_cc-an.patch
Stephan Kulow c14a1e98d3 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 10:19:44 +00:00

118 lines
4.3 KiB
Diff

From 6294aa76d818e831de4592b41a37e225fd0871f9 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Mon, 7 Jul 2014 12:04:55 +0200
Subject: [PATCH] util: don't consider tabs special in string_has_cc() anymore
Instead, take a list of exceptions to our usual CC check
---
src/hostname/hostnamed.c | 3 +--
src/shared/env-util.c | 4 +++-
src/shared/fileio.c | 2 +-
src/shared/util.c | 19 ++++++++++---------
src/shared/util.h | 5 +++--
5 files changed, 18 insertions(+), 15 deletions(-)
Index: src/hostname/hostnamed.c
===================================================================
--- src/hostname/hostnamed.c.orig
+++ src/hostname/hostnamed.c
@@ -507,8 +507,7 @@ static int set_machine_info(Context *c,
if (prop == PROP_ICON_NAME && !filename_is_safe(name))
return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Invalid icon name '%s'", name);
- if (prop == PROP_PRETTY_HOSTNAME &&
- (string_has_cc(name) || chars_intersect(name, "\t")))
+ if (prop == PROP_PRETTY_HOSTNAME && string_has_cc(name, NULL))
return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Invalid pretty host name '%s'", name);
if (prop == PROP_CHASSIS && !valid_chassis(name))
return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Invalid chassis '%s'", name);
Index: src/shared/env-util.c
===================================================================
--- src/shared/env-util.c.orig
+++ src/shared/env-util.c
@@ -78,7 +78,9 @@ bool env_value_is_valid(const char *e) {
if (!utf8_is_valid(e))
return false;
- if (string_has_cc(e))
+ /* bash allows tabs in environment variables, and so should
+ * we */
+ if (string_has_cc(e, "\t"))
return false;
/* POSIX says the overall size of the environment block cannot
Index: src/shared/fileio.c
===================================================================
--- src/shared/fileio.c.orig
+++ src/shared/fileio.c
@@ -658,7 +658,7 @@ static void write_env_var(FILE *f, const
p++;
fwrite(v, 1, p-v, f);
- if (string_has_cc(p) || chars_intersect(p, WHITESPACE "\'\"\\`$")) {
+ if (string_has_cc(p, NULL) || chars_intersect(p, WHITESPACE "\'\"\\`$")) {
fputc('\"', f);
for (; *p; p++) {
Index: src/shared/util.c
===================================================================
--- src/shared/util.c.orig
+++ src/shared/util.c
@@ -5466,16 +5466,14 @@ bool filename_is_safe(const char *p) {
bool string_is_safe(const char *p) {
const char *t;
- assert(p);
+ if (!p)
+ return false;
for (t = p; *t; t++) {
if (*t > 0 && *t < ' ')
return false;
- if (*t == 127)
- return false;
-
- if (strchr("\\\"\'", *t))
+ if (strchr("\\\"\'\0x7f", *t))
return false;
}
@@ -5483,16 +5481,19 @@ bool string_is_safe(const char *p) {
}
/**
- * Check if a string contains control characters.
- * Spaces and tabs are not considered control characters.
+ * Check if a string contains control characters. If 'ok' is non-NULL
+ * it may be a string containing additional CCs to be considered OK.
*/
-bool string_has_cc(const char *p) {
+bool string_has_cc(const char *p, const char *ok) {
const char *t;
assert(p);
for (t = p; *t; t++) {
- if (*t > 0 && *t < ' ' && *t != '\t')
+ if (ok && strchr(ok, *t))
+ return false;
+
+ if (*t > 0 && *t < ' ')
return true;
if (*t == 127)
Index: src/shared/util.h
===================================================================
--- src/shared/util.h.orig
+++ src/shared/util.h
@@ -652,7 +652,7 @@ _alloc_(2, 3) static inline void *memdup
bool filename_is_safe(const char *p) _pure_;
bool path_is_safe(const char *p) _pure_;
bool string_is_safe(const char *p) _pure_;
-bool string_has_cc(const char *p) _pure_;
+bool string_has_cc(const char *p, const char *ok) _pure_;
/**
* Check if a string contains any glob patterns.