All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michael Shigorin <mike@osdn.org.ua>
To: dm-devel@redhat.com
Cc: Sergey Vlasov <vsu@altlinux.ru>, "Dmitry V. Levin" <ldv@altlinux.org>
Subject: [PATCH] libdm: add "|" to _is_whitelisted_char()
Date: Tue, 27 Nov 2012 21:11:23 +0200	[thread overview]
Message-ID: <20121127191123.GZ19704@osdn.org.ua> (raw)


[-- Attachment #1.1.1: Type: text/plain, Size: 558 bytes --]

	Hello,
please find attached a silly one-liner that was mentioned
on #device-mapper yesterday and discussed with asalor today.

It adds "|" to a whitelist of chars allowed in devnode names
for the sake of legacy compatibility with EVMS2 LVM plugin
which uses to name the nodes like "lvm2|vg|lv".

I'm going to add it to ALT Linux lvm2 package for that matter
but would definitely prefer not to fork even a single byte
for no good reason.

TIA

-- 
 ---- WBR, Michael Shigorin <mike@altlinux.ru>
  ------ Linux.Kiev http://www.linux.kiev.ua/

[-- Attachment #1.1.2: 0001-libdm-add-to-_is_whitelisted_char.patch --]
[-- Type: text/plain, Size: 1431 bytes --]

From 6c36767acfbc6f72ad7ffed298200088b9bb123b Mon Sep 17 00:00:00 2001
From: Michael Shigorin <mike@altlinux.org>
Date: Fri, 23 Nov 2012 17:21:33 +0200
Subject: [PATCH] libdm: add "|" to _is_whitelisted_char()

The issue is that EVMS' lvm2 plugin would yield names like
"/dev/mapper/lvm2|vg|lv" and the current libdevmapper will
turn these down; this makes migrating legacy environments
involving devmapper-aware tools in the target configuration
a somewhat harder task than it might be.

There's a potential security consideration with any faulty
scripts which wouldn't get device names quoted as noted by
asalor on #device-mapper; this is rather mitigated by the
fact that one needs to have EVMS activated for the devices
in question, even if these are USB flash ones.  Speaking of
such scripts, these are prone to misbehave upon "=" either.
---
 libdm/libdm-common.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libdm/libdm-common.c b/libdm/libdm-common.c
index afdac89..e715629 100644
--- a/libdm/libdm-common.c
+++ b/libdm/libdm-common.c
@@ -320,7 +320,7 @@ static int _is_whitelisted_char(char c)
         if ((c >= '0' && c <= '9') ||
             (c >= 'A' && c <= 'Z') ||
             (c >= 'a' && c <= 'z') ||
-            strchr("#+-.:=@_", c) != NULL)
+            strchr("#+-.:=@_|", c) != NULL)
                 return 1;
 
         return 0;
-- 
1.7.12.4


[-- Attachment #1.2: Type: application/pgp-signature, Size: 189 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



             reply	other threads:[~2012-11-27 19:11 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-27 19:11 Michael Shigorin [this message]
2012-11-28 12:04 ` [PATCH] libdm: add "|" to _is_whitelisted_char() Peter Rajnoha
2012-11-28 12:50   ` Peter Rajnoha

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20121127191123.GZ19704@osdn.org.ua \
    --to=mike@osdn.org.ua \
    --cc=dm-devel@redhat.com \
    --cc=ldv@altlinux.org \
    --cc=vsu@altlinux.ru \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.