From owner-freebsd-geom@FreeBSD.ORG Wed Aug 18 16:50:03 2010 Return-Path: Delivered-To: freebsd-geom@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C018C106564A for ; Wed, 18 Aug 2010 16:50:03 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 951208FC0A for ; Wed, 18 Aug 2010 16:50:03 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.4/8.14.4) with ESMTP id o7IGo3lN096177 for ; Wed, 18 Aug 2010 16:50:03 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.4/8.14.4/Submit) id o7IGo3vu096176; Wed, 18 Aug 2010 16:50:03 GMT (envelope-from gnats) Date: Wed, 18 Aug 2010 16:50:03 GMT Message-Id: <201008181650.o7IGo3vu096176@freefall.freebsd.org> To: freebsd-geom@FreeBSD.org From: Oliver Fromme Cc: Subject: Re: kern/149762: volume labels with rogue characters X-BeenThere: freebsd-geom@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Oliver Fromme List-Id: GEOM-specific discussions and implementations List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 Aug 2010 16:50:03 -0000 The following reply was made to PR kern/149762; it has been noted by GNATS. From: Oliver Fromme To: freebsd-bugs@FreeBSD.ORG, bug-followup@FreeBSD.ORG, walter@pelissero.de Cc: Subject: Re: kern/149762: volume labels with rogue characters Date: Wed, 18 Aug 2010 18:36:22 +0200 (CEST) Walter C. Pelissero wrote: > In the following patch, the function sanitise_name (controlled > by kern.geom.label.sanitation sysctl) replaces characters > deemed invalid according to three levels: > > 0 - replace only '/'s with '#'s > 1 - like 0, but also replace whitespace and all the ASCII control > characters (anything below 0x20) with '_' > 2 - like 1, but also replace anything above 0x7E with '#' > > Note that the replacement of '/'s is done in any case. I > don't know whether that might be redundant or even bad in the > context of the other geom_label stuff. It just made sense, > but I don't have enough familiarity with that code. FWIW, I like this approach much better than the one from bin/149424. (Trying to put personal attitudes aside.) I have reviewed the patch (the second one from the followup), and it looks good to me, except for a few minor style(9) issues, and one type problem: By default, char is unsigned, so the comparisons p <= ' ' and p > '~' probably don't do what you expect. Other than that, the patch looks fine to me. But I'm not authoritative regarding the geom code in the kernel, so I cannot pick this up myself. I'll re-assign the PR to -geom, maybe someone there can help. Best regards Oliver -- Oliver Fromme, secnetix GmbH & Co. KG, Marktplatz 29, 85567 Grafing b. M. Handelsregister: Registergericht Muenchen, HRA 74606, Geschäftsfuehrung: secnetix Verwaltungsgesellsch. mbH, Handelsregister: Registergericht Mün- chen, HRB 125758, Geschäftsführer: Maik Bachmann, Olaf Erb, Ralf Gebhart FreeBSD-Dienstleistungen, -Produkte und mehr: http://www.secnetix.de/bsd "... there are two ways of constructing a software design: One way is to make it so simple that there are _obviously_ no deficiencies and the other way is to make it so complicated that there are no _obvious_ deficiencies." -- C.A.R. Hoare, ACM Turing Award Lecture, 1980