public inbox for lvm2-cvs@sourceware.org help / color / mirror / Atom feed
From: prajnoha@sourceware.org To: lvm-devel@redhat.com, lvm2-cvs@sourceware.org Subject: LVM2 ./WHATS_NEW_DM libdm/libdm-common.c libdm ... Date: Mon, 05 Mar 2012 12:48:00 -0000 [thread overview] Message-ID: <20120305124815.27974.qmail@sourceware.org> (raw) CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: prajnoha@sourceware.org 2012-03-05 12:48:13 Modified files: . : WHATS_NEW_DM libdm : libdm-common.c libdm-common.h libdm/ioctl : libdm-iface.c tools : dmsetup.c Log message: Check for multiple mangled names in auto mangling mode. Auto mode can't deal with multiple mangled names. We can do that while working in hex mode, but in auto mode, this would lead to device name ambiguity. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW_DM.diff?cvsroot=lvm2&r1=1.588&r2=1.589 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/libdm-common.c.diff?cvsroot=lvm2&r1=1.146&r2=1.147 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/libdm-common.h.diff?cvsroot=lvm2&r1=1.14&r2=1.15 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/ioctl/libdm-iface.c.diff?cvsroot=lvm2&r1=1.142&r2=1.143 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/dmsetup.c.diff?cvsroot=lvm2&r1=1.185&r2=1.186 --- LVM2/WHATS_NEW_DM 2012/03/05 12:45:43 1.588 +++ LVM2/WHATS_NEW_DM 2012/03/05 12:48:12 1.589 @@ -1,5 +1,6 @@ Version 1.02.74 - ================================ + Check for multiple mangled names in auto mangling mode. Fix dm_task_get_name_unmangled to not unmangle already unmangled name. Check whether device names are properly mangled on ioctl return. Deactivation of failed thin check on thin pool returns success. --- LVM2/libdm/libdm-common.c 2012/03/05 12:45:43 1.146 +++ LVM2/libdm/libdm-common.c 2012/03/05 12:48:12 1.147 @@ -326,6 +326,17 @@ return 0; } +int check_multiple_mangled_name_allowed(dm_string_mangling_t mode, const char *name) +{ + if (mode == DM_STRING_MANGLING_AUTO && strstr(name, "\\x5cx")) { + log_error("The name \"%s\" seems to be multiple mangled. " + "This is not allowed in auto mode.", name); + return 0; + } + + return 1; +} + /* * Mangle all characters in the input string which are not on a whitelist * with '\xNN' format where NN is the hex value of the character. @@ -485,6 +496,9 @@ return 0; } + if (!check_multiple_mangled_name_allowed(mangling_mode, name)) + return_0; + if (mangling_mode != DM_STRING_MANGLING_NONE && (r = mangle_name(name, strlen(name), mangled_name, sizeof(mangled_name), mangling_mode)) < 0) { @@ -620,6 +634,9 @@ return 0; } + if (!check_multiple_mangled_name_allowed(mangling_mode, newname)) + return_0; + if (mangling_mode != DM_STRING_MANGLING_NONE && (r = mangle_name(newname, strlen(newname), mangled_name, sizeof(mangled_name), mangling_mode)) < 0) { --- LVM2/libdm/libdm-common.h 2012/02/15 12:23:16 1.14 +++ LVM2/libdm/libdm-common.h 2012/03/05 12:48:13 1.15 @@ -28,6 +28,8 @@ int unmangle_name(const char *str, size_t len, char *buf, size_t buf_len, dm_string_mangling_t mode); +int check_multiple_mangled_name_allowed(dm_string_mangling_t mode, const char *name); + struct target *create_target(uint64_t start, uint64_t len, const char *type, const char *params); --- LVM2/libdm/ioctl/libdm-iface.c 2012/03/05 12:43:03 1.142 +++ LVM2/libdm/ioctl/libdm-iface.c 2012/03/05 12:48:13 1.143 @@ -1559,6 +1559,9 @@ if (mode == DM_STRING_MANGLING_NONE) return 1; + if (!check_multiple_mangled_name_allowed(mode, name)) + return_0; + if ((r = unmangle_name(name, DM_NAME_LEN, buf, sizeof(buf), dm_get_name_mangling_mode())) < 0) { log_debug("_do_dm_ioctl_unmangle_name: failed to " --- LVM2/tools/dmsetup.c 2012/03/01 21:56:44 1.185 +++ LVM2/tools/dmsetup.c 2012/03/05 12:48:13 1.186 @@ -2944,6 +2944,12 @@ target_format = _switches[MANGLENAME_ARG] ? _int_args[MANGLENAME_ARG] : DEFAULT_DM_NAME_MANGLING; + if (target_format == DM_STRING_MANGLING_AUTO && strstr(name, "\\x5cx")) { + log_error("The name \"%s\" seems to be multiple mangled. " + "Manual intervention required to rename the device.", name); + goto out; + } + if (target_format == DM_STRING_MANGLING_NONE) { if (!(new_name = dm_task_get_name_unmangled(dmt))) goto out;
next reply other threads:[~2012-03-05 12:48 UTC|newest] Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top 2012-03-05 12:48 prajnoha [this message] -- strict thread matches above, loose matches on Subject: below -- 2012-03-05 12:43 prajnoha 2012-01-09 12:26 zkabelac 2011-11-18 19:34 zkabelac 2011-03-02 0:29 agk 2009-01-07 12:17 prajnoha
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=20120305124815.27974.qmail@sourceware.org \ --to=prajnoha@sourceware.org \ --cc=lvm-devel@redhat.com \ --cc=lvm2-cvs@sourceware.org \ /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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).