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

Re: Relax dhclient hostname checks



Quoting Henning Brauer (lists-openbsdtech_(_at_)_bsws_(_dot_)_de):
> > I think that, if you want to improve readability,
> > you should kill this useless macro soup entirely.
> 
> I agree.
> 
> but... one thing at a time :)
> 
> Michael, perhaps it would be cleverer to restrict the diff to the pure 
> _ allowance for now

Yeah, sure. I also noticed that I had missed that the asterchar() macro
was unused.

I used the existing approach with macro goo for the `pure' patch in case
I or someone else doesn't get around to rewriting this anytime soon:

Index: dhclient.c
===================================================================
RCS file: /cvs/src/sbin/dhclient/dhclient.c,v
retrieving revision 1.63
diff -u -r1.63 dhclient.c
--- dhclient.c  2005/02/06 17:10:13     1.63
+++ dhclient.c  2005/03/29 14:25:54
@@ -61,12 +61,13 @@
 #define        bslashchar(c) ((c) == 0x5c)
 #define        periodchar(c) ((c) == PERIOD)
 #define        asterchar(c) ((c) == 0x2a)
+#define	uscorechar(c) ((c) == '_'))
 #define        alphachar(c) (((c) >= 0x41 && (c) <= 0x5a) || \
            ((c) >= 0x61 && (c) <= 0x7a))
 #define        digitchar(c) ((c) >= 0x30 && (c) <= 0x39)
 
 #define        borderchar(c) (alphachar(c) || digitchar(c))
-#define        middlechar(c) (borderchar(c) || hyphenchar(c))
+#define        middlechar(c) (borderchar(c) || hyphenchar(c) || uscorechar(c))
 #define        domainchar(c) ((c) > 0x20 && (c) < 0x7f)
 
 #define        CLIENT_PATH "PATH=/usr/bin:/usr/sbin:/bin:/sbin"

Please test this.

-- 
Rumour is information distilled so finely that it can filter through
anything.
-- (Terry Pratchett, Feet of Clay)



Visit your host, monkey.org