Re: [webmin-devel] DHCPD v3 user defined options problem

"Philippe Teissier" <[email protected]>
Newsgroups gmane.comp.web.webmin.devel
Message-ID <[email protected]>
Hi Jamie & All

I made a patch which now understands properly that format with brackets.
The parsers does OK (for the moment, I check if the bracket is following a
"=" sign, and if yes I don't start a sub, instead I consider it as simple
text.
Then, I did some small regexp changes in edit_options and save_options to
properly display and save that type. I'm now testing it a little bit, and
I'll send you a patch in a few days when it'll be OK, at least in my testing
environnement.

Bye for now.

2008/1/27, Jamie Cameron <[email protected]>:
>
> Hi Philippe,
>
> Thanks for pointing this out - the problem here is that Webmin doesn't
> understand this new DHCPd option format with the curly brackets, causing
> it's parser to go into an infinite loop.
>
> Do you plan to work on a patch to properly handle and display these types
> of options? If so, I'd be glad to include it in a future Webmin release..
>
>  - Jamie
>
> On 25/Jan/2008 06:07 Philippe Teissier wrote ..
>
> Hi,
>
> I needed to use option 122 (DOCSIS) in my DHCPD.conf and it appears that
> Webmin had some problem with DHCPD syntax to write it.  It hangs the parser,
> giving me an almost empty page instead of my subnets and groups.
>
> Here are the lines in the dhcpd.conf :
>
> option space docsis-ccc;
> option docsis-ccc.dhcp-server-1 code 1 = ip-address;
> option docsis-ccc.dhcp-server-2 code 2 = ip-address;
>
> option docsis-ccc.provision-server code 3 = { integer 8, string };  ##
> hangs
>
> option docsis-ccc.krb-realm-name code 6 = string;
> option docsis-ccc code 122 = encapsulate docsis-ccc; ## misunderstood
>
> Two of those line are misunderstood by Webmin dhcpd's module
>
> * The 4th line is the one which hangs the parser. It defines a record (int
> 8, string) as the type of the "provision server suboption". And webmin does
> not like it.
> For the moment, I just commented out this line as I do not user the
> provision server parameter.
> * The last line, with the encapsulate type, is also misunderstood, but
> does not hang the code. Instead, webmin will parse and silently forget
> encapsulate's parameter (here docsis-ccc). After a "client optiont" change
> in webmin, the dhcpd.conf will contain "option docsis-ccc code 122 =
> encapsulate;" and then DHCPD's parser will hang (cause this is a syntax
> error).
>
> (more about this option syntax by the end of this document
> http://www.linuxmanpages.com/man5/dhcp-options.5.php)
>
> I wrote a fast hack for that 2nd problem in order to prevent users from
> crashing dhcpd.
>
> [root@localhost dhcpd]# diff edit_options.cgi.Before_patch
> edit_options.cgi
> 168,169c168,176
> <               printf "<input name=dtype_$i size=10 value='%s'>\n",
> <                       $o->{'values'}->[4];
> ---
> >               if ($o->{'values'}->[4] eq "encapsulate") {
> >                   printf "<input name=dtype_$i size=10 value='%s'>\n",
> >                   $o->{'values'}->[4]. " ".$o->{'values'}->[5];
> >
> >               } else {
> >                   printf "<input name=dtype_$i size=10 value='%s'>\n",
> >                   $o->{'values'}->[4];
> >               }
> >
> [root@localhost dhcpd]# diff save_options.cgi.Before_patch
> save_options.cgi
> 116c116
> <               $in{"dtype_$i"} =~ /^[a-z0-9\.\-\_]+$/i ||
> ---
> >               $in{"dtype_$i"} =~ /^(encapsulate |)[a-z0-9\.\-\_]+$/i ||
>
>
> I didn't found anything about this bug in the tracking system. It's the
> 1st time I look at webmin's code, so I'll try to have a deeper look at it,
> and achieve a better patch with support of encapsulate, records, and even
> arrays which are also unsupported I can imagine.
>
> --
> Philippe Teissier
> [email protected]<http://reply_mail.cgi?new=1&to=philippe%2Eteissier%40m4tp%2Eorg>
>
>
>


-- 
Philippe Teissier
[email protected]

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

-
Forwarded by the Webmin development list at [email protected]
To remove yourself from this list, go to
http://lists.sourceforge.net/lists/listinfo/webadmin-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.