[dm-devel] [PATCH] libdm: add "|" to _is_whitelisted_char()

Michael Shigorin mike at osdn.org.ua
Tue Nov 27 19:11:23 UTC 2012


	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 at altlinux.ru>
  ------ Linux.Kiev http://www.linux.kiev.ua/
-------------- next part --------------
From 6c36767acfbc6f72ad7ffed298200088b9bb123b Mon Sep 17 00:00:00 2001
From: Michael Shigorin <mike at 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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/dm-devel/attachments/20121127/470d4814/attachment.sig>


More information about the dm-devel mailing list