Re: Whitespaces in ID_VENDOR and ID_MODEL

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

 



On Mon, Jan 5, 2009 at 23:26, Marcel Holtmann <marcel@xxxxxxxxxxxx> wrote:
> so I was playing with adding environment variables to devices in the
> udev database for later easy enumeration. And I like having ID_VENDOR
> and ID_MODEL available and would like to extend this even to PCI and
> SDIO in the future, but why are all whitespace replaced with "_".

> E: ID_VENDOR=Novatel_Wireless
> E: ID_MODEL=Novatel_Wireless_HSUPA_Modem
> E: ID_REVISION=0000
> E: ID_SERIAL=Novatel_Wireless_Novatel_Wireless_HSUPA_Modem_356846015115701

Yeah, all strings in usb_id are mangled to be used in symlink names.
Like all the other *_id tools do too. When we started doing that,
nobody thought we would ever use these strings for anything else than
creating symlinks. :)

Some of the values, like ATA and SCSI just fill the whole remaining
string buffer with whitespaces, which need to be stripped too, to be
used in symlinks.

For stuff that needs to be reversible, like filesystem label strings,
which can contain any char, need to be valid and safe chars to be a
symlink, and we need to be able to translate the name back to the
original value, we encode the string with url encoding, like:
  ID_FS_LABEL=/
  ID_FS_LABEL_ENC=\x2f

We need to sanitize the values at least for things like newline,
quoting and other control chars, because most of these values are
completely "untrusted userdata", and a fake device with a usb model
string like "Foo\nBAR=1" we don't want to import unmangled. :)

If you have an idea what we should do/change to make these values more
useful, let me know.

Kay
--
To unsubscribe from this list: send the line "unsubscribe linux-hotplug" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel]     [Linux DVB]     [Asterisk Internet PBX]     [DCCP]     [Netdev]     [X.org]     [Util Linux NG]     [Fedora Women]     [ALSA Devel]     [Linux USB]

  Powered by Linux