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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



	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@xxxxxxxxxxx>
  ------ Linux.Kiev http://www.linux.kiev.ua/
From 6c36767acfbc6f72ad7ffed298200088b9bb123b Mon Sep 17 00:00:00 2001
From: Michael Shigorin <mike@xxxxxxxxxxxx>
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: pgpbXhgxozzLK.pgp
Description: PGP signature

--
dm-devel mailing list
dm-devel@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/dm-devel

[Index of Archives]     [DM Crypt]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Packaging]     [Fedora SELinux]     [Yosemite Discussion]     [KDE Users]     [Fedora Docs]

  Powered by Linux