Home | History | Annotate | Download | only in webmin
      1 dnsmasq/0000755000000000000000000000000010512645440011223 5ustar  rootrootdnsmasq/config.info0000644000000000000000000000013210505663743013351 0ustar  rootrootconfig_file=Full path to DNSmasq config file,0
      2 restart=Shell script to re-start DNSmasq,0
      3 dnsmasq/config0000644000000000000000000000006110505663767012426 0ustar  rootrootconfig_file=/etc/dnsmasq.conf
      4 restart=restart.sh
      5 dnsmasq/images/0000755000000000000000000000000010506375201012466 5ustar  rootrootdnsmasq/images/icon.gif0000644000000000000000000000061610505632635014116 0ustar  rootrootGIF89a00ccc,00I8k;`xqBY~b
      6 vq*W^9\HCG!D?+ -p P	j:@o1~9~mz{~}my|D-@VQb,P'VOr^Vjxz;[f^zL}1O`By{{H@0E1F,D)~dH!%rYm_61gw4+3&,;\ZTEL{Z
      8 5jS?;dnsmasq/images/template.gif0000644000000000000000000000356006771443034015005 0ustar  rootrootGIF89a0UUU999rrr!Made with GIMP,0	8AZdihkshL|G,rYq0	0-]%6AkX=Q}~T{Moa-W~~x,vuc&$xa4eSyu`g$b~	`lj\Q>"{9FYW?QdJf)hcv'w+#1|XgO-ahB(`DZU.EbP	FKD[B<
     10 ["Ji0*a-VI@
     13 \(I
     15 /*!0@*>Lhp20:v6V..a&9M$bE\
     17 d"uKw;_a_J]6'yDt3WA3i6In:&Q,~tj'-W{! 71w^w P	8hY
2T\mS|FG]GEvM1%!U.#pGDeV+.>>Y68duZ&8\GM}gMY{U.XX&#)kpKL(XF1M\Jh#Ma&qrYF*]AhF9hT)L\]1lfj`\pyV*M|8tY.$>\)(vJ:(Nn/{'^yySUgj5-,%K5;[~,|J:uzAd^8)W1z)nj. z9scm%Z[=Sy\ So]5E_]K[+uO5Sn3
     19 bM 5rmBN!-?58
hOk~
}3^Q8Yi{=8'r;+pz*r4[0k&<#/$q;t" C
Mtv0_+PI	7 >$*F,N|H}t>YxT7s=X!ZJsd;vF`%-xG#6..O8xdH!DXjXV>q7c @<2_V1X^F p\2)'OEf'$GceeD/rI4@,+'6dlTT(7!@*:!,&<	}h&iRUiibkCfPM~O('%Sfxy:5v*_I6m=Hn$z4Z(Q\e>5
DnRj4W5%&Gi:fXJQ-IXq":xFS|`Hj--{
     35 DGjRv-[rzhhGKiW6{lgK nwk\
pEr=:}t+R5.K;dnsmasq/images/up.gif0000644000000000000000000000014710506373750013612 0ustar  rootrootGIF89arrr!Made with GIMP!
     37 ,&
     38 |'Io|b%eRG;Ssf;dnsmasq/images/down.gif0000644000000000000000000000015410506373750014133 0ustar  rootrootGIF89arrr!Made with GIMP!
     39 ,+@"IUieJbAIm.dN;dnsmasq/images/gap.gif0000644000000000000000000000011110506375201013715 0ustar  rootrootGIF89a!Made with GIMP!
     42 ,>;dnsmasq/module.info0000644000000000000000000000014210501433425013356 0ustar  rootrootname=DNSMasq
     43 desc=DNSMasq integrated DNS & DHCP servers
     44 os_support=
     45 depends=0.77
     46 category=servers
     47 dnsmasq/index.cgi0000755000000000000000000000753110512641067013030 0ustar  rootroot#!/usr/bin/perl
     48 #
     49 #    DNSMasq Webmin Module - index.cgi; basic DNS config     
     50 #    Copyright (C) 2006 by Neil Fisher
     51 #    
     52 #    This program is free software; you can redistribute it and/or modify
     53 #    it under the terms of the GNU General Public License as published by
     54 #    the Free Software Foundation; either version 2 of the License, or
     55 #    (at your option) any later version.
     56 #
     57 #    This program is distributed in the hope that it will be useful,
     58 #    but WITHOUT ANY WARRANTY; without even the implied warranty of
     59 #    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     60 #    GNU General Public License for more details.
     61 #
     62 #    This module inherited from the Webmin Module Template 0.79.1 by tn
     63 
     64 do '../web-lib.pl';
     65 do '../ui-lib.pl';
     66 do 'dnsmasq-lib.pl';
     67 
     68 $|=1;
     69 &init_config("DNSMasq");
     70 
     71 %access=&get_module_acl;
     72 
     73 ## put in ACL checks here if needed
     74 
     75 
     76 ## sanity checks
     77 
     78 &header($text{'index_title'}, "", "intro", 1, 1, undef,
     79         "Written by Neil Fisher<BR><A HREF=mailto:neil\@magnecor.com.au>Author</A><BR><A HREF=http://www.authorpage.invalid>Home://page</A>");
     80 # uses the index_title entry from ./lang/en or appropriate
     81 
     82 ## Insert Output code here
     83 # read config file
     84 $config_file = &read_file_lines( $config{config_file} );
     85 # pass into data structure
     86 
     87 
     88 # output as web page
     89 
     90 
     91 &header( "DNSMasq settings", "" );
     92 &parse_config_file( \%config, \$config_file );
     93 print "<hr>\n";
     94 if( $config{errors} > 0 )
     95 {
     96 	print "<h3>WARNING: found ";
     97 	print $config{errors};
     98 	print "errors in config file!</h3><br>\n";
     99 }
    100 print &ui_form_start( 'basic_apply.cgi', "post" );
    101 print "<br>\n";
    102 print "<h2>$text{'DNS_settings'}</h2>";
    103 print "<br><br>\n";
    104 print $text{'local_domain'};
    105 print &ui_textbox( "local_domain", $config{domain}{domain}, 32 );
    106 print "<br><br>\n";
    107 print $text{'domain_needed'};
    108 print &ui_yesno_radio( "domain_needed", ($config{domain_needed}{used})?1:0 );
    109 print "<br><br>\n";
    110 print $text{'expand_hosts'};
    111 print &ui_yesno_radio( "expand_hosts", ($config{expand_hosts}{used})?1:0 );
    112 print "<br><br>\n";
    113 print $text{'bogus_priv'};
    114 print &ui_yesno_radio( "bogus_priv", ($config{bogus_priv}{used})?0:1 );
    115 print "<br><br>\n";
    116 print $text{'filterwin2k'};
    117 print &ui_yesno_radio( "filterwin2k", ($config{filterwin2k}{used})?1:0 );
    118 print "<br><br>\n";
    119 print $text{'hosts'};
    120 print &ui_yesno_radio( "hosts", ($config{no_hosts}{used}?0:1) );
    121 print "<br>\n";
    122 print $text{'xhosts'};
    123 print &ui_yesno_radio( "xhosts", ($config{addn_hosts}{used}?1:0) );
    124 print "<br>\n";
    125 print $text{'xhostsfile'};
    126 print &ui_textbox( "addn_hosts", $config{addn_hosts}{file}, 40 );
    127 print "<br><br>\n";
    128 print $text{'neg_cache'};
    129 print &ui_yesno_radio( "neg_cache", ($config{neg_cache}{used}?0:1) );
    130 print "<br><br>\n";
    131 print $text{'cache_size'};
    132 print &ui_yesno_radio( "cache_size", ($config{cache_size}{used}?1:0) );
    133 print "<br>\n";
    134 print $text{'cust_cache_size'};
    135 print &ui_textbox( "cust_cache_size", $config{cache_size}{size}, 40 );
    136 print "<br><br>\n";
    137 print $text{'log_queries'};
    138 print &ui_yesno_radio( "log_queries", ($config{log_queries}{used}?1:0) );
    139 print "<br><br>\n";
    140 print $text{'local_ttl'};
    141 print &ui_yesno_radio( "local_ttl", ($config{local_ttl}{used}?1:0) );
    142 print "<br>\n";
    143 print $text{'ttl'};
    144 print &ui_textbox( "ttl", $config{local_ttl}{ttl}, 40 );
    145 print "<br><br>\n";
    146 print &ui_submit( $text{'save_button'} );
    147 print &ui_form_end( );
    148 print "<hr>";
    149 print "<a href=\"servers.cgi\">";
    150 print $text{'servers_config'};
    151 print "</a><br>";
    152 print "<a href=\"iface.cgi\">";
    153 print $text{'iface_config'};
    154 print "</a><br>";
    155 print "<a href=\"alias.cgi\">";
    156 print $text{'alias_config'};
    157 print "</a><br>";
    158 print "<hr>";
    159 print "<a href=\"dhcp.cgi\">";
    160 print $text{'DHCP_config'};
    161 print "</a><br>";
    162 print "<hr>";
    163 print "<a href=\"restart.cgi\">";
    164 print $text{'restart'};
    165 print "</a><br>";
    166 &footer("/", $text{'index'});
    167 # uses the index entry in /lang/en
    168 
    169 
    170 
    171 ## if subroutines are not in an extra file put them here
    172 
    173 
    174 ### END of index.cgi ###.
    175 dnsmasq/acl_security.pl0000644000000000000000000000056107000420647014246 0ustar  rootroot
    176 # acl_security_form(&options)
    177 # Output HTML for editing security options for the apache module
    178 sub acl_security_form
    179 {
    180 
    181 ## Here you have to fill in the code for output
    182 
    183 }
    184 
    185 # acl_security_save(&options)
    186 # Parse the form for security options for the apache module
    187 sub acl_security_save
    188 {
    189 
    190 ## here you have to fill in the handling code for the saving the ACL
    191 
    192 }
    193 
    194 ### END.dnsmasq/lang/0000755000000000000000000000000010512641175012145 5ustar  rootrootdnsmasq/lang/en0000644000000000000000000000766610512637344012514 0ustar  rootroot
    195 lang=en
    196 author=Neil Fisher
    197 module_author=Neil Fisher
    198 homepage=www.nonexistent.invalid
    199 copyright=(C) 2006 by Neil Fisher <neil (a] magnecor.com.au>
    200 license=GPL
    201 
    202 index_title=DNSMasq - integrated DNS and DHCP servers
    203 DNS_settings=Basic DNS settings
    204 DHCP_settings=DHCP settings
    205 DNS_servers=DNS Upstream Servers Configuration
    206 iface_settings=Network Interface Settings
    207 alias_settings=Alias / Redirect Settings
    208 local_domain=Local domain name 
    209 domain_needed=Only forward names with a domain part 
    210 expand_hosts=Add local domain name to DHCP leases & hosts in /etc/hosts 
    211 bogus_priv=Allow unresolved reverse lookups on local network to propogate out 
    212 filterwin2k=Prevent windows SOA & SRV requests propogating out
    213 resolv=Read /etc/resolv.conf 
    214 poll=poll resolv.conf file 
    215 resolv_file_explicit=Use non-standard resolv.conf file
    216 resolv_file=non-standard resolv.conf file to use
    217 strict_order=Always use nameservers in order provided
    218 hosts=Read /etc/hosts file
    219 xhosts=Use additional hosts file
    220 xhostsfile=File to use for additional hosts
    221 neg_cache=Cache negative responses
    222 log_queries=Log each DNS lookup
    223 cache_size=Use custom cache size
    224 cust_cache_size=Custom cache size to use
    225 local_ttl=Use specified local Time-To-Live
    226 ttl=Local TTL
    227 dynamic=Defined in resolv.conf file
    228 domain=For domain
    229 address=IP address
    230 in_use=In use
    231 used=In Use
    232 not_used=Defined only (not used)
    233 in_file=Defined in config file
    234 new_dns_serv=Add new upstream server to config file
    235 save_button=Save
    236 servers_config=Configure upstream DNS Servers
    237 alias_config=Configure Forced Domains and Alias responses
    238 iface_config=Configure network interfaces
    239 DHCP_config=Configure DHCP
    240 restart=Restart DNSmasq
    241 restarting=Trying to restart DNSmasq. Script messages are:
    242 srv_edit=Edit upstream DNS server
    243 srv_named=For specific domain
    244 srv_name=Specific domain
    245 srv_addr=Server address
    246 delet=Delete
    247 iface=Interface
    248 xiface=Except Interface
    249 listen=Listen on
    250 new_iface=Add new interface
    251 iface_listen=Interface to listen on
    252 xiface_listen=Except interfaces
    253 listen_addr=Listen Address
    254 new_addr=Add new address
    255 edit_iface=Edit interface
    256 iface_name=Interface name
    257 edit_xiface=Edit except interface
    258 listen_name=Listen address
    259 edit_listen=Edit listen address
    260 xiface_name=Except interface name
    261 bind_iface=Bind to individual interfaces instead of wildcard address
    262 forced=Forced domain responses
    263 nx=Forced NXDOMAIN IP addresses
    264 alias=Aliased IP addresses
    265 forced_domain=Domain name
    266 forced_ip=To IP address
    267 forced_from=From IP address
    268 forced_mask=Netmask
    269 forced_mask_used=Use a netmask
    270 forced_add=Add new forced domain
    271 alias_add=Add new alias
    272 nx_add=Add new forced NXDOMAIN
    273 forced_edit=Edit forced domain reponse
    274 alias_edit=Edit IP address alias
    275 nx_edit=Edit Forced NXDOMAIN response
    276 net_id=Network/Client ID
    277 timed=Use a lease time
    278 leasetime=Lease time
    279 dhcp_range=DHCP IP address ranges
    280 range_edit=Edit DHCP range
    281 range_add=Add new DHCP range
    282 ided=Network ID
    283 id=Network ID to use
    284 hosts=Specific Hosts
    285 host_add=Add a new host specification
    286 vendor_classes=Vendor Class Specification
    287 user_classes=User Class Specification
    288 vendor=Vendor
    289 user=User
    290 class=Class
    291 vend_add=Add new vendor class
    292 user_add=Add new user class
    293 read_ethers=Read /etc/ethers for lease info
    294 misc=Miscellaneous DHCP options
    295 dhcp_options=Non-standard DHCP options
    296 dhcp_option=Option
    297 dhcp_add=Add new option
    298 edit_host=Edit DHCP host specification
    299 edit_opt=Edit DHCP options
    300 opt_spec=DHCP option specification
    301 use_bootp=Use BOOTP (network boot)
    302 bootp_host=Hostname
    303 bootp_file=File
    304 bootp_address=IP Address
    305 max_leases=Maximum number of leases to grant
    306 leasefile=Use a nonstandard lease file
    307 lfikletouse=Nonstandard leasefile to use
    308 error_heading=Warning - ERROR!!!!
    309 err_line=Error in line: 
    310 err_type=Type of error is:
    311 err_help=Try going back and retyping the offending information
    312 err_notip=Not a valid IP address
    313 err_notmask=Not a valid netmask
    314 err_nottime=not a valid time
    315 err_configbad=Configuration file has an error
    316 err_filebad=Bad file name
    317 err_hostbad=Bad host name
    318 err_numbbad=Bad number
    319 err_domainbad=Bad domain
    320 err_namebad=Bad name
    321 dnsmasq/lang/en~0000644000000000000000000000034407076651262012702 0ustar  rootroot
    322 lang=en
    323 author=Name of language file author here
    324 module_author=Writers name here
    325 homepage=modules homepage url here
    326 copyright=(C) YYYY by author <email (a] author.any>
    327 license=GPL
    328 
    329 your_message=here you have to write your messages
    330 dnsmasq/.index.cgi.swp0000644000000000000000000003000010475225557013710 0ustar  rootrootb0VIM 6.3R+DB#staffupstairs.localnet~staff/template/index.cgi3210#"! UtpIad$\	IVU


R
Q
=
7




]BA54
    363 
    364 
    365 
    366 
    367 
    368 
    369 
    370 
    371 ~
    372 z
    373 w
    374 u
    375 t
    376 _
    377 E
    378 C
    379  
    380 
    381 
    382 						x	w	v	\	### END of### END of index.cgi ###.## if subroutines are not in an extra file put them here# uses the index entry in /lang/en&footer("/", $text{'index'});&header( "DNSmasq configuration", "" );}	print "$key = $config{$key}<br>";{foreach my $key (%config)# output as web page}	}		}			$config{"$line"}=1;		{		else 		}			$config{"$1"}=$2;		{		if ($line =~ /(.*)\=(.*)/)		next if( $line =~ /^\#/ );	{	if (defined ($line)){foreach my $line (@$config_file)my %config;# pass into data structure$config_file = &read_file_lines( "/etc/dnsmasq.conf" );# read config file## Insert Output code here# uses the index_title entry from ./lang/en or appropriate        "Written by Neil Fisher<BR><A HREF=mailto:neil\@magnecor.com.au>Author</A><BR><A HREF=http://www.authorpage.invalid>Home://page</A>");&header($text{'index_title'}, "", "intro", 1, 1, undef,## sanity checks## put in ACL checks here if needed%access=&get_module_acl;&init_config("MODULENAME");$|=1;do '../web-lib.pl';#    This module inherited from the Webmin Module Template 0.79.1 by tn##    GNU General Public License for more details.#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the#    but WITHOUT ANY WARRANTY; without even the implied warranty of#    This program is distributed in the hope that it will be useful,##    (at your option) any later version.#    the Free Software Foundation; either version 2 of the License, or#    it under the terms of the GNU General Public License as published by#    This program is free software; you can redistribute it and/or modify#    #    Copyright (C) 2006 by Neil Fisher#    DNSMasq Webmin Module      ##!/usr/bin/perldnsmasq/srv_edit.cgi0000755000000000000000000000450310512323643013531 0ustar  rootroot#!/usr/bin/perl
    383 #
    384 #    DNSMasq Webmin Module - dns_edit.cgi;  upstream server edit
    385 #    Copyright (C) 2006 by Neil Fisher
    386 #    
    387 #    This program is free software; you can redistribute it and/or modify
    388 #    it under the terms of the GNU General Public License as published by
    389 #    the Free Software Foundation; either version 2 of the License, or
    390 #    (at your option) any later version.
    391 #
    392 #    This program is distributed in the hope that it will be useful,
    393 #    but WITHOUT ANY WARRANTY; without even the implied warranty of
    394 #    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    395 #    GNU General Public License for more details.
    396 #
    397 #    This module inherited from the Webmin Module Template 0.79.1 by tn
    398 
    399 do '../web-lib.pl';
    400 do '../ui-lib.pl';
    401 do 'dnsmasq-lib.pl';
    402 
    403 $|=1;
    404 &init_config("DNSMasq");
    405 
    406 %access=&get_module_acl;
    407 
    408 ## put in ACL checks here if needed
    409 
    410 
    411 ## sanity checks
    412 
    413 
    414 ## Insert Output code here
    415 # read config file
    416 $config_file = &read_file_lines( $config{config_file} );
    417 # pass into data structure
    418 &parse_config_file( \%config, \$config_file );
    419 # read posted data
    420 &ReadParse();
    421 # check for errors in read config
    422 if( $config{errors} > 0 )
    423 {
    424 	&header( "DNSMasq settings", "" );
    425 	print "<hr><h2>";
    426 	print $text{warn_errors};
    427 	print $config{errors};
    428 	print $text{didnt_apply};
    429 	print "</h3><hr>\n";
    430 	&footer( "/", $text{'index'});
    431 	exit;
    432 }
    433 # adjust everything to what we got
    434 #
    435 &header( "DNSMasq settings", "" );
    436 print "<h2>".$text{srv_edit}."</h2>";
    437 print &ui_form_start( "srv_edit_apply.cgi", "post" );
    438 print &ui_hidden( "idx", $in{idx} );
    439 print "<br>".$text{in_use}.&ui_yesno_radio( "used",
    440 				($config{servers}[$in{idx}]{used})?1:0 );
    441 print "<br>".$text{srv_named}.&ui_yesno_radio( "named", 
    442 				($config{servers}[$in{idx}]{domain_used})?1:0 );
    443 print "<br>".$text{srv_name};
    444 print &ui_textbox( "name", $config{servers}[$in{idx}]{domain}, 50 );
    445 print "<br>".$text{srv_addr};
    446 print &ui_textbox( "addr", $config{servers}[$in{idx}]{address}, 18 );
    447 print "<br><br>" . &ui_submit( $text{'save_button'} )."<br>";
    448 print &ui_form_end();
    449 print "<a href=delete.cgi?idx=".$in{idx}."&what=servers&where=servers.cgi".
    450 	">".$text{delet}."</a>";
    451 #print "<a href=dns_del.cgi?idx=".$in{idx}.">".$text{delet}."</a>";
    452 print "<br><a href=servers.cgi>".$text{servers_config}."</a>";
    453 &footer( "/", $text{'index'});
    454 #
    455 
    456 # 
    457 # sub-routines
    458 #
    459 ### END of dns_edit.cgi ###.
    460 dnsmasq/dnsmasq-lib.pl0000755000000000000000000003354710512631060014002 0ustar  rootroot#
    461 # dnsmasq-lib.pl
    462 #
    463 # dnsmasq webmin module library module
    464 #
    465 #
    466 # the config hash holds the parsed config file
    467 # 
    468 my %config = {
    469 		errors => 0,
    470 		mx_host => { used => 0, line => 0, host => "" },
    471 		mx_target => { used => 0, line => 0, host => "" },
    472 		selfmx => { used => 0, line => 0 },
    473 		localmx => { used => 0, line => 0 },	
    474 		domain_needed => { line => 0, used => 0 },
    475 		bogus_priv => { line =>0, used => 0 },
    476 		filterwin2k => { line => 0, used => 0 },
    477 		resolv_file => { line => 0, used => 0,				
    478 				filename => "/etc/hosts"
    479 			       },
    480 		strict_order => { line => 0, used => 0 },
    481 		no_resolv => { line => 0, used => 0 },
    482 		no_poll => { line => 0, used => 0 },
    483 		servers => [],
    484 		locals => [],
    485 		forced => [],
    486 		bogus => [],
    487 		user => { used => 0, user =>"" },
    488 		group => { used => 0, group => "" },
    489 		interface =>  [],
    490 		ex_interface =>  [],
    491 		listen_on => 	[],
    492 		alias => [],
    493 		bind_interfaces => { used => 0, line => 0 },
    494 		no_hosts => { used => 0, line => 0 },
    495 		addn_hosts => { used => 0, line => 0, file => "" },
    496 		expand_hosts => { used => 0, line => 0 },
    497  		domain => { used => 0, line => 0, domain => "" },
    498 		cache_size => { used => 0, line =>0, size => 0 },
    499 		neg_cache => { used => 0, line => 0 },
    500 		local_ttl => { used => 0, line => 0, ttl => 0 },
    501 		log_queries => { used => 0, line => 0 },	
    502 		dhcp_range => [],
    503 		dhcp_host => [],
    504 		vendor_class => [],
    505 		user_class => [],
    506 		dhcp_option => [],
    507 		dhcp_boot => { used => 0, line => 0, file => "",
    508 				host => "", address => "" },
    509 		dhcp_leasemax => { used => 0, line => 0, max => 0 },
    510 		dhcp_leasefile => { used => 0, line => 0, file => "" },
    511 		dhcp_ethers => { used => 0, line => 0 }
    512 	     };
    513 #
    514 # parse the configuration file and populate the %config structure
    515 # 
    516 sub parse_config_file
    517 {
    518 	
    519 my $lineno;
    520 my $config = shift;
    521 my $config_file = shift;
    522 $IPADDR = "[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}";
    523 $NAME = "[a-zA-Z\_\.][0-9a-zA-Z\_\.]*";
    524 $TIME = "[0-9}+[h|m]*";
    525 $FILE = "[0-9a-zA-Z\_\-\.\/]+";
    526 $NUMBER="[0-9]+";
    527 
    528 $lineno=-1;
    529 foreach my $line (@$$config_file)
    530 {
    531 	my $subline;
    532 	my %temp;
    533 	
    534 	$lineno++;
    535 	if (defined ($line))
    536 	{
    537 		#
    538 		# we always use regexp starting with 
    539 		# ^[\#]*[\s]*
    540 		# because that allows for a commented out line with
    541 		#  possibly space(s) between the comment marker and keyword
    542 		# while rejecting any comments that carry our keyword
    543 		#
    544 		# reject lines blank at start!
    545 		next if ($line !~ /^[0-9a-zA-Z\_\-\#]/);
    546 		# MX records server?
    547 		if ( $line =~ /(^[\#]*[\s]*mx-host)\=([0-9a-zA-Z\.\-]*)/ )
    548 		{
    549 		}
    550 		elsif ($line =~ /(^[\#]*[\s]*mx-target)\=([0-9a-zA-Z\.\-]*)/ )
    551 		{
    552 		}
    553 		elsif ($line =~ /^[\#]*[\s]*selfmx/ )
    554 		{
    555 			$$config{selfmx}{line}=$lineno;
    556 			$$config{selfmx}{used}=($line !~ /^\#/);
    557 		}
    558 		elsif ($line =~ /^[\#]*[\s]*localmx/ )
    559 		{
    560 			$$config{localmx}{line}=$lineno;
    561 			$$config{localmx}{used}=($line !~ /^\#/);
    562 		}
    563 		# forward names witout a domain?
    564 		elsif ($line =~ /^[\#]*[\s]*domain-needed/ )
    565 		{
    566 			$$config{domain_needed}{used}=($line!~/^\#/);
    567 			$$config{domain_needed}{line}=$lineno;
    568 		}
    569 		#forward names in nonrouted address space?
    570 		elsif ($line =~ /^[\#]*[\s]*bogus-priv/ )
    571 		{
    572 			$$config{bogus_priv}{used}=($line!~/^\#/);
    573 			$$config{bogus_priv}{line}=$lineno;
    574 		}
    575 		# filter windows wierdo names?
    576 		elsif ($line =~ /^[\#]*[\s]*filterwin2k/ )
    577 		{
    578 			$$config{filterwin2k}{used}=($line!~/^\#/);
    579 			$$config{filterwin2k}{line}=$lineno;
    580 		}
    581 		# resolv.conf file
    582 		elsif ($line =~ /(^[\#]*[\s]*resolv-file\=)([0-9a-zA-Z\/\.\-]*)/ )
    583 		{
    584 			$$config{resolv_file}{filename}=$2;
    585 			$$config{resolv_file}{line}=$lineno;
    586 			$$config{resolv_file}{used}=($line!~/^\#/);
    587 		}
    588 		# any resolv.conf file at all?
    589 		elsif ($line =~ /^[\#]*[\s]*no-resolv/ )
    590 		{
    591 			$$config{no_resolv}{used}=($line!~/^\#/);
    592 			$$config{no_resolv}{line}=$lineno;
    593 		}
    594 		# upstream servers in order?
    595 		elsif ($line =~ /^[\#]*[\s]*strict-order/ )
    596 		{
    597 			$$config{strict_order}{used}=($line!~/^\#/);
    598 			$$config{strict_order}{line}=$lineno;
    599 		}
    600 		# check resolv. conf regularly?
    601 		elsif ($line =~ /^[\#]*[\s]*no-poll/ )
    602 		{
    603 			$$config{no_poll}{used}=($line!~/^\#/);
    604 			$$config{no_poll}{line}=$lineno;
    605 		}
    606 		# extra name servers?
    607 		elsif ($line =~ /(^[\#]*[\s]*server\=)([0-9a-zA-Z\.\-\/]*)/ )
    608 		{
    609 			$subline=$2;
    610 			%temp = {};
    611 			if( $subline =~ /\/($NAME)\/($IPADDR)/ )
    612 			{
    613 				$temp{domain}=$1;
    614 				$temp{domain_used}=1;
    615 				$temp{address}=$2;
    616 				$temp{line}=$lineno;
    617 				$temp{used}= ($line !~ /^\#/);
    618 				push @{ $$config{servers} }, { %temp };
    619 			}
    620 			elsif( $subline =~ /($IPADDR)/ )
    621 			{
    622 				$temp{domain}="";
    623 				$temp{domain_used}=0;
    624 				$temp{address}=$1;
    625 				$temp{line}=$lineno;
    626 				$temp{used}= ($line !~ /^\#/);
    627 				push @{ $$config{servers} }, { %temp };
    628 			}
    629 			else
    630 			{
    631 				print "Error in line $lineno!";
    632 				$$config{errors}++;
    633 			}
    634 		}
    635 		# local-only domains
    636 		elsif ($line =~ /(^[\#]*[\s]*local\=)([0-9a-zA-Z\.\-\/]*)/ )
    637 		{
    638 			$subline=$2;
    639 			%temp={};
    640 			if( $subline =~ /\/($NAME)\// )
    641 			{
    642 				$temp{domain}=$1;
    643 				$temp{lineno}=$lineno;
    644 				$temp{used}=($line !~ /^\#/);
    645 				push @{ $$config{locals} }, { %temp };
    646 			}
    647 			else
    648 			{
    649 				print "Error in line $lineno!";
    650 				$$config{errors}++;
    651 			}
    652 		}
    653 		# force lookups to addresses
    654 		elsif ($line =~ /(^[\#]*[\s]*address\=)([0-9a-zA-Z\.\-\/]*)/ )
    655 		{
    656 			$subline=$2;
    657 			%temp = {};
    658 			if( $subline =~ /\/($NAME)\/($IPADDR)/ )
    659 			{
    660 				$temp{line}=$lineno;
    661 				$temp{domain}=$1;
    662 				$temp{addr}=$2;
    663 				$temp{used}=($line !~ /^\#/);
    664 				push @{ $$config{forced} }, { %temp };
    665 			}
    666 			else
    667 			{
    668 				print "Error in line $lineno!";
    669 				$$config{errors}++;
    670 			}
    671 		}
    672 		# deprecated /etc/ppp/resolv.conf permissions
    673 		elsif ($line =~ /(^[\#]*[\s]*user\=)([0-9a-zA-Z\.\-\/]*)/ )
    674 		{
    675 		}
    676 		elsif ($line =~ /(^[\#]*[\s]*group\=)([0-9a-zA-Z\.\-\/]*)/ )
    677 		{
    678 		}
    679 		# where and how do we listen?
    680 		elsif ($line =~ /(^[\#]*[\s]*listen-address\=)([0-9\.]*)/ )
    681 		{
    682 			$subline=$2;
    683 			%temp = {};
    684 			if( $subline =~ /($IPADDR)/ )
    685 			{
    686 				$temp{line}=$lineno;
    687 				$temp{address}=$1;
    688 				$temp{used}= ($line !~ /^\#/);
    689 				push @{ $$config{listen_on} }, { %temp };
    690 			}
    691 			else
    692 			{
    693 				print "Error in line $lineno!";
    694 				$$config{errors}++;
    695 			}
    696 		}
    697 		elsif ($line =~ /(^[\#]*[\s]*except-interface\=)([0-9a-zA-Z\.\-\/]*)/ )
    698 		{
    699 			$subline=$2;
    700 			%temp = {};
    701 			if( $subline =~ /($NAME)/ )
    702 			{
    703 				$temp{line}=$lineno;
    704 				$temp{iface}=$1;
    705 				$temp{used}= ($line !~ /^\#/);
    706 				push @{ $$config{ex_interface} }, { %temp };
    707 			}
    708 			else
    709 			{
    710 				print "Error in line $lineno!";
    711 				$$config{errors}++;
    712 			}
    713 		}
    714 		elsif ($line =~ /(^[\#]*[\s]*interface\=)([0-9a-zA-Z\.\-\/]*)/ )
    715 		{
    716 			$subline=$2;
    717 			%temp = {};
    718 			if( $subline =~ /($NAME)/ )
    719 			{
    720 				$temp{line}=$lineno;
    721 				$temp{iface}=$1;
    722 				$temp{used}= ($line !~ /^\#/);
    723 				push @{ $$config{interface} }, { %temp };
    724 			}
    725 			else
    726 			{
    727 				print "Error in line $lineno!";
    728 				$$config{errors}++;
    729 			}
    730 		}
    731 		elsif ($line =~ /^[\#]*[\s]*bind-interfaces/ )
    732 		{
    733 			$$config{bind_interfaces}{used}=($line!~/^\#/);
    734 			$$config{bind_interfaces}{line}=$lineno;
    735 		}
    736 		# hosts file
    737 		elsif ($line =~ /^[\#]*[\s]*no-hosts/ )
    738 		{
    739 			$$config{no_hosts}{used}=($line!~/^\#/);
    740 			$$config{no_hosts}{line}=$lineno;
    741 		}
    742 		elsif ($line =~ /(^[\#]*[\s]*addn-hosts\=)([0-9a-zA-Z\_\.\-\/]*)/ )
    743 		{
    744 			$$config{addn_hosts}{line}=$lineno;
    745 			$$config{addn_hosts}{file}=$2;
    746 			$$config{addn_hosts}{used}=($line!~/^\#/);
    747 		}
    748 		# add domain to hosts file?
    749 		elsif ($line =~ /^[\#]*[\s]*expand-hosts/ )
    750 		{
    751 			$$config{expand_hosts}{used}=($line!~/^\#/);
    752 			$$config{expand_hosts}{line}=$lineno;
    753 		} 
    754 		# translate wild-card responses to NXDOMAIN
    755 		elsif ($line =~ /(^[\#]*[\s]*bogus-nxdomain\=)([0-9\.]*)/ )
    756 		{
    757 			$subline=$2;
    758 			%temp = {};
    759 			if( $subline =~ /($IPADDR)/ )
    760 			{
    761 				$temp{line}=$lineno;
    762 				$temp{addr}=$1;
    763 				$temp{used}= ($line !~ /^\#/);
    764 				push @{ $$config{bogus} }, { %temp };
    765 			}
    766 			else
    767 			{
    768 				print "Error in line $lineno!";
    769 				$$config{errors}++;
    770 			}
    771 		}
    772 		# local domain
    773 		elsif ($line =~ /(^[\#]*[\s]*domain\=)([0-9a-zA-Z\.\-\/]*)/ )
    774 		{
    775 			$$config{domain}{line}=$lineno;
    776 			$$config{domain}{domain}=$2;
    777 			$$config{domain}{used}=($line!~/^\#/);
    778 		}
    779 		# cache size
    780 		elsif ($line =~ /(^[\#]*[\s]*cache-size\=)([0-9]*)/ )
    781 		{
    782 			$$config{cache_size}{line}=$lineno;
    783 			$$config{cache_size}{size}=$2;
    784 			$$config{cache_size}{used}=($line !~/^\#/);
    785 		}
    786 		# negative cache 
    787 		elsif ($line =~ /(^[\#]*[\s]*no-negcache)/ )
    788 		{
    789 			$$config{neg_cache}{line}=$lineno;
    790 			$$config{neg_cache}{used}=($line !~/^\#/);
    791 		}
    792 		# local ttl
    793 		elsif ($line =~ /(^[\#]*[\s]*local-ttl\=)([0-9]*)/ )
    794 		{
    795 			$$config{local_ttl}{line}=$lineno;
    796 			$$config{local_ttl}{ttl}=$2;
    797 			$$config{local_ttl}{used}=($line !~/^\#/);
    798 		}
    799 		# log requests? 
    800 		elsif ($line =~ /(^[\#]*[\s]*log-queries)/ )
    801 		{
    802 			$$config{log_queries}{line}=$lineno;
    803 			$$config{log_queries}{used}=($line !~/^\#/);
    804 		}
    805 		# alias IP addresses
    806 		elsif ($line =~ /(^[\#]*[\s]*alias\=)([0-9\.\,]*)/ )
    807 		{
    808 			$subline=$2;
    809 			%temp = {};
    810 			if( $subline =~ /($IPADDR)\,($IPADDR)\,($IPADDR)/ )
    811 			{ # with netmask
    812 				$temp{line}=$lineno;
    813 				$temp{from}=$1;
    814 				$temp{to}=$2;
    815 				$temp{netmask}=$3;
    816 				$temp{netmask_used}=1;
    817 				$temp{used}= ($line !~ /^\#/);
    818 				push @{ $$config{alias} }, { %temp };
    819 			}
    820 			elsif( $subline =~ /($IPADDR)\,($IPADDR)/ )
    821 			{ # no netmask
    822 				$temp{line}=$lineno;
    823 				$temp{from}=$1;
    824 				$temp{to}=$2;
    825 				$temp{netmask}=0;
    826 				$temp{netmask_used}=0;
    827 				$temp{used}= ($line !~ /^\#/);
    828 				push @{ $$config{alias} }, { %temp };
    829 			}
    830 			else
    831 			{
    832 				print "Error in line $lineno!";
    833 				$$config{errors}++;
    834 			}
    835 		}
    836 		# DHCP
    837 		# address range to use
    838 		elsif ($line =~ /(^[\#]*[\s]*dhcp-range\=)([0-9a-zA-Z\.\,\-\_]*)/ )
    839 		{
    840 			%temp={};
    841 			$subline=$2;
    842 			$temp{line}=$lineno;
    843 			$temp{used}=($line !~/^\#/);
    844 			if ($subline =~ /^($NAME)\,($IPADDR)\,($IPADDR)\,($IPADDR)(\,*)(\d*[mh]*)/ )
    845 			{
    846 				# network id, start, end, netmask, time (optionally)
    847 				$temp{id}=$1;
    848 				$temp{id_used}=1;
    849 				$temp{start}=$2;
    850 				$temp{end}=$3;
    851 				$temp{mask}=$4;
    852 				$temp{mask_used}=1;
    853 				$temp{leasetime}=$6;
    854 				$temp{time_used}=($6 =~ /^\d/);
    855 				$temp{used} =( $line !~ /^\#/ );
    856 				push @{ $$config{dhcp_range} }, { %temp };
    857 			}
    858 			elsif ($subline =~ /^($NAME)\,($IPADDR)\,($IPADDR)(\,*)(\d*[mh]*)/ )
    859 			{
    860 				# network id, start, end, time (optionally)
    861 				$temp{id}=$1;
    862 				$temp{id_used}=1;
    863 				$temp{start}=$2;
    864 				$temp{end}=$3;
    865 				$temp{mask}="";
    866 				$temp{mask_used}=0;
    867 				$temp{leasetime}=$5;
    868 				$temp{time_used}=($5 =~ /^\d/);
    869 				$temp{used} =( $line !~ /^\#/ );
    870 				push @{ $$config{dhcp_range} }, { %temp };
    871 			}
    872 			elsif ($subline =~ /^($IPADDR)\,($IPADDR)\,($IPADDR)(\,*)(\d*[mh]*)/ )
    873 			{
    874 				# start, end, netmask, time (optionally)
    875 				$temp{id}="";
    876 				$temp{id_used}=0;
    877 				$temp{start}=$1;
    878 				$temp{end}=$2;
    879 				$temp{mask}=$3;
    880 				$temp{mask_used}=1;
    881 				$temp{leasetime}=$5;
    882 				$temp{time_used}=($5 =~ /^\d/);
    883 				$temp{used} =( $line !~ /^\#/ );
    884 				push @{ $$config{dhcp_range} }, { %temp };
    885 			}
    886 			elsif ($subline =~ /^($IPADDR)\,($IPADDR)(\,*)(\d*[mh]*)/ )
    887 			{
    888 				# start, end, time (optionally)
    889 				$temp{id}="";
    890 				$temp{id_used}=0;
    891 				$temp{start}=$1;
    892 				$temp{end}=$2;
    893 				$temp{mask}="";
    894 				$temp{mask_used}=0;
    895 				$temp{leasetime}=$4;
    896 				$temp{time_used}=($4 =~ /^\d/);
    897 				$temp{used} =( $line !~ /^\#/ );
    898 				push @{ $$config{dhcp_range} }, { %temp };
    899 			}
    900 			else
    901 			{
    902 				print "Error in line $lineno!";
    903 				$$config{errors}++;
    904 			}
    905 		}
    906 		# specify hosts
    907 		elsif ($line =~ /(^[\#]*[\s]*dhcp-host\=)([0-9a-zA-Z\.\:\,\*]*)/)
    908 		{
    909 			# too many to classify - all as string!
    910 			%temp = {};
    911 			$temp{line}=$lineno;
    912 			$temp{option}=$2;
    913 			$temp{used}=($line !~/^\#/);
    914 			push @{ $$config{dhcp_host} }, { %temp };
    915 		}
    916 		# vendor class
    917 		elsif ($line =~ /(^[\#]*[\s]*dhcp-vendorclass\=)($NAME)\,($NAME)/ )
    918 		{
    919 			%temp = {};
    920 			$temp{line}=$lineno;
    921 			$temp{class}=$2;
    922 			$temp{vendor}=$3;
    923 			$temp{used}=($line !~/^\#/);
    924 			push @{ $$config{vendor_class} }, { %temp };
    925 		}
    926 		# user class
    927 		elsif ($line =~ /(^[\#]*[\s]*dhcp-userclass\=)($NAME)\,($NAME)/ )
    928 		{
    929 			%temp = {};
    930 			$temp{line}=$lineno;
    931 			$temp{class}=$2;
    932 			$temp{user}=$3;
    933 			$temp{used}=($line !~/^\#/);
    934 			push @{ $$config{user_class} }, { %temp };
    935 		}
    936 		# /etc/ethers?
    937 		elsif ($line =~ /(^[\#]*[\s]*read-ethers)/ )
    938 		{
    939 			$$config{dhcp_ethers}{line}=$lineno;
    940 			$$config{dhcp_ethers}{used}=($line !~/^\#/);
    941 		}
    942 		# dchp options
    943 		elsif ($line =~ /(^[\#]*[\s]*dhcp-option\=)([0-9a-zA-Z\,\_\.]*)/ )
    944 		{
    945 			# too many to classify - all as string!
    946 			%temp = {};
    947 			$temp{line}=$lineno;
    948 			$temp{option}=$2;
    949 			$temp{used}=($line !~/^\#/);
    950 			push @{ $$config{dhcp_option} }, { %temp };
    951 		}
    952 		# lease time
    953 		elsif ($line =~ /(^[\#]*[\s]*dhcp-lease-max\=)([0-9]*)/ )
    954 		{
    955 			$$config{dhcp_leasemax}{line}=$lineno;
    956 			$$config{dhcp_leasemax}{max}=$2;
    957 			$$config{dhcp_leasemax}{used}=($line !~/^\#/);
    958 		}
    959 		# bootp host & file
    960 		elsif ($line =~ /(^[\#]*[\s]*dhcp-boot\=)([0-9a-zA-Z0-9\,\_\.\/]*)/ )
    961 		{
    962 			$subline=$2;
    963 			if( $subline =~ /([0-9a-zA-Z\.\-\_\/]+)\,($NAME)\,($IPADDR)/ )
    964 			{
    965 				$$config{dhcp_boot}{line}=$lineno;
    966 				$$config{dhcp_boot}{file}=$1;
    967 				$$config{dhcp_boot}{host}=$2;
    968 				$$config{dhcp_boot}{address}=$3;
    969 				$$config{dhcp_boot}{used}=($line !~/^\#/);
    970 			}
    971 		}
    972 		#  leases file
    973 		elsif ($line =~ /(^[\#]*[\s]*dhcp-leasefile\=)([0-9a-zA-Z0-9\_\.\/]*)/ )
    974 		{
    975 			$$config{dhcp_leasefile}{line}=$lineno;
    976 			$$config{dhcp_leasefile}{file}=$2;
    977 			$$config{dhcp_leasefile}{used}=($line !~/^\#/);
    978 		}
    979 		else
    980 		{
    981 			# everything else that's not a comment 
    982 			# we don't understand so it may be an error!
    983 			if( $line !~ /^#/ )
    984 			{
    985 				$config{errors}++;
    986 			}
    987 		}
    988 	}
    989 }
    990 
    991 } #end of sub read_config_file
    992 #
    993 # update the config file array
    994 #
    995 # arguments are:
    996 # 	$lineno - the line number (array index) to update
    997 # 	$text   - the new contents of the line
    998 # 	$file   - reference to the array to change
    999 # 	$comm   - put a comment marker ('#') at start of line?
   1000 # 	          false (0) means comment the line
   1001 #
   1002 sub update
   1003 {
   1004 	my $lineno = shift;
   1005 	my $text = shift;
   1006 	my $file = shift;
   1007 	my $comm = shift;
   1008 	my $line;
   1009 
   1010 	$line = ( $comm != 0 ) ?
   1011 		$text :
   1012 		"#" . $text;
   1013 	if( $lineno == 0 )
   1014 	{
   1015 		push @$file, $line;
   1016 	}
   1017 	else
   1018 	{
   1019 		@$file[$lineno]=$line;
   1020 	}
   1021 } # end of sub update
   1022 1;
   1023 dnsmasq/servers.cgi0000755000000000000000000000704010512350076013402 0ustar  rootroot#!/usr/bin/perl
   1024 #
   1025 #    DNSMasq Webmin Module - server.cgi; Upstream Servers config
   1026 #    Copyright (C) 2006 by Neil Fisher
   1027 #    
   1028 #    This program is free software; you can redistribute it and/or modify
   1029 #    it under the terms of the GNU General Public License as published by
   1030 #    the Free Software Foundation; either version 2 of the License, or
   1031 #    (at your option) any later version.
   1032 #
   1033 #    This program is distributed in the hope that it will be useful,
   1034 #    but WITHOUT ANY WARRANTY; without even the implied warranty of
   1035 #    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   1036 #    GNU General Public License for more details.
   1037 #
   1038 #    This module inherited from the Webmin Module Template 0.79.1 by tn
   1039 
   1040 do '../web-lib.pl';
   1041 do '../ui-lib.pl';
   1042 do 'dnsmasq-lib.pl';
   1043 
   1044 $|=1;
   1045 &init_config("DNSMasq");
   1046 
   1047 %access=&get_module_acl;
   1048 
   1049 ## put in ACL checks here if needed
   1050 
   1051 
   1052 ## sanity checks
   1053 
   1054 &header($text{'index_title'}, "", "intro", 1, 1, undef,
   1055         "Written by Neil Fisher<BR><A HREF=mailto:neil\@magnecor.com.au>Author</A><BR><A HREF=http://www.authorpage.invalid>Home://page</A>");
   1056 # uses the index_title entry from ./lang/en or appropriate
   1057 
   1058 ## Insert Output code here
   1059 # read config file
   1060 $config_file = &read_file_lines( $config{config_file} );
   1061 # pass into data structure
   1062 
   1063 
   1064 # output as web page
   1065 
   1066 my $count=0;
   1067 &header( "DNSMasq settings", "" );
   1068 &parse_config_file( \%config, \$config_file );
   1069 print "<h2>";
   1070 print $text{'DNS_servers'};
   1071 print "</h2>";
   1072 print &ui_form_start( "srv_apply.cgi", "post" );
   1073 print "<h3>".$text{dynamic}."</h3>";
   1074 print $text{resolv};
   1075 print &ui_yesno_radio( "resolv", ($config{no_resolv}{used}?0:1) );
   1076 print "<br>".$text{resolv_file_explicit};
   1077 print &ui_yesno_radio( "resolv_std", ($config{resolv_file}{used}?1:0) );
   1078 print "<br>".$text{resolv_file};
   1079 print &ui_textbox( "resolv_file", $config{resolv_file}{filename}, 50 );
   1080 print "<br><br>".$text{poll}."<br>";
   1081 print &ui_yesno_radio( "poll", ($config{no_poll}{used}?0:1) );
   1082 print "<br><br>".$text{strict_order};
   1083 print &ui_yesno_radio( "strict", ($config{strict_order}{used}?1:0) );
   1084 print "<br><br><h3>".$text{in_file}."</h3>";
   1085 print &ui_columns_start( [ $text{domain}, $text{address}, 
   1086 			   $text{in_use}, "" ], 100 );
   1087 foreach my $server ( @{$config{servers}} )
   1088 {
   1089 	local ( $mover, $edit );
   1090 	if( $count == @{$config{servers}}-1 )
   1091 	{
   1092 		$mover="<img src=images/gap.gif>";
   1093 	}
   1094 	else
   1095 	{	
   1096 		$mover = "<a href='srv_move.cgi?idx=$count&".
   1097 		"dir=down'><img src=".
   1098 		"images/down.gif border=0></a>";
   1099 	}
   1100         if( $count == 0 )
   1101 	{
   1102 		$mover.="<img src=images/gap.gif>";
   1103 	}
   1104 	else
   1105 	{
   1106 		$mover .= "<a href='srv_move.cgi?idx=$count&".
   1107 		"dir=up'><img src=images/up.gif ".
   1108 		"border=0></a>";
   1109 	}
   1110 	$edit = "<a href=srv_edit.cgi?idx=$count>".$$server{address}."</a>";
   1111 	print &ui_columns_row( [ $$server{domain}, $edit,
   1112 		($$server{used})?$text{used}:$text{not_used}, $mover ],
   1113        		[ "width=30%", "width=30%", "width=30%", "width=10%" ]	);
   1114 	$count++;
   1115 }
   1116 print &ui_columns_end();
   1117 print "<br><a href=add.cgi?what=server=0.0.0.0&where=servers.cgi>".
   1118 		$text{new_dns_serv}."</a><hr>";
   1119 print "<br>" . &ui_submit( $text{'save_button'} );
   1120 print &ui_form_end();
   1121 print "<hr>";
   1122 print "<a href=\"index.cgi\">";
   1123 print $text{'DNS_settings'};
   1124 print "</a><br>";
   1125 print "<a href=\"iface.cgi\">";
   1126 print $text{'iface_config'};
   1127 print "</a><br>";
   1128 print "<a href=\"alias.cgi\">";
   1129 print $text{'alias_config'};
   1130 print "</a><br>";
   1131 print "<hr>";
   1132 print "<a href=\"dhcp.cgi\">";
   1133 print $text{'DHCP_config'};
   1134 print "</a><br>";
   1135 &footer("/", $text{'index'});
   1136 # uses the index entry in /lang/en
   1137 
   1138 
   1139 
   1140 ## if subroutines are not in an extra file put them here
   1141 
   1142 
   1143 ### END of servers.cgi ###.
   1144 dnsmasq/iface.cgi0000755000000000000000000000711710512345430012763 0ustar  rootroot#!/usr/bin/perl
   1145 #
   1146 #    DNSMasq Webmin Module - iface.cgi; network interfaces
   1147 #    Copyright (C) 2006 by Neil Fisher
   1148 #    
   1149 #    This program is free software; you can redistribute it and/or modify
   1150 #    it under the terms of the GNU General Public License as published by
   1151 #    the Free Software Foundation; either version 2 of the License, or
   1152 #    (at your option) any later version.
   1153 #
   1154 #    This program is distributed in the hope that it will be useful,
   1155 #    but WITHOUT ANY WARRANTY; without even the implied warranty of
   1156 #    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   1157 #    GNU General Public License for more details.
   1158 #
   1159 #    This module inherited from the Webmin Module Template 0.79.1 by tn
   1160 
   1161 do '../web-lib.pl';
   1162 do '../ui-lib.pl';
   1163 do 'dnsmasq-lib.pl';
   1164 
   1165 $|=1;
   1166 &init_config("DNSMasq");
   1167 
   1168 %access=&get_module_acl;
   1169 
   1170 ## put in ACL checks here if needed
   1171 
   1172 
   1173 ## sanity checks
   1174 
   1175 &header($text{'index_title'}, "", "intro", 1, 1, undef,
   1176         "Written by Neil Fisher<BR><A HREF=mailto:neil\@magnecor.com.au>Author</A><BR><A HREF=http://www.authorpage.invalid>Home://page</A>");
   1177 # uses the index_title entry from ./lang/en or appropriate
   1178 
   1179 ## Insert Output code here
   1180 # read config file
   1181 $config_file = &read_file_lines( $config{config_file} );
   1182 # pass into data structure
   1183 
   1184 
   1185 # output as web page
   1186 
   1187 my $count=0;
   1188 &header( "DNSMasq settings", "" );
   1189 &parse_config_file( \%config, \$config_file );
   1190 print "<h2>";
   1191 print $text{'iface_listen'};
   1192 print "</h2>";
   1193 print &ui_columns_start( [ $text{iface}, $text{in_use} ], 100 );
   1194 foreach my $iface ( @{$config{interface}} )
   1195 {
   1196 	my $edit = "<a href=iface_edit.cgi?idx=$count>".$$iface{iface}."</a>";
   1197 	print &ui_columns_row( [ $edit, ($$iface{used})?$text{used}:$text{not_used} ],
   1198        		[ "width=30%", "width=30%", "width=30%" ]	);
   1199 	$count++;
   1200 }
   1201 print &ui_columns_end();
   1202 print "<br><a href=add.cgi?what=interface=new&where=iface.cgi>".
   1203 		$text{new_iface}."</a><hr>";
   1204 print "<h2>";
   1205 print $text{'xiface_listen'};
   1206 print "</h2>";
   1207 $count=0;
   1208 print &ui_columns_start( [ $text{xiface}, $text{in_use} ], 100 );
   1209 foreach my $iface ( @{$config{ex_interface}} )
   1210 {
   1211 	my $edit = "<a href=xiface_edit.cgi?idx=$count>".$$iface{iface}."</a>";
   1212 	print &ui_columns_row( [ $edit, ($$iface{used})?$text{used}:$text{not_used} ],
   1213        		[ "width=30%", "width=30%", "width=30%" ]	);
   1214 	$count++;
   1215 }
   1216 print &ui_columns_end();
   1217 print "<br><a href=add.cgi?what=except-interface=new&where=iface.cgi>".
   1218 		$text{new_iface}."</a><hr>";
   1219 print "<h2>";
   1220 print $text{'listen_addr'};
   1221 print "</h2>";
   1222 $count=0;
   1223 print &ui_columns_start( [ $text{listen_addr}, $text{in_use} ], 100 );
   1224 foreach my $iface ( @{$config{listen_on}} )
   1225 {
   1226 	my $edit = "<a href=listen_edit.cgi?idx=$count>".$$iface{address}."</a>";
   1227 	print &ui_columns_row( [ $edit, ($$iface{used})?$text{used}:$text{not_used} ],
   1228        		[ "width=30%", "width=30%", "width=30%" ]	);
   1229 	$count++;
   1230 }
   1231 print &ui_columns_end();
   1232 print "<br>";
   1233 print "<br><a href=add.cgi?what=listen-address=0.0.0.0&where=iface.cgi>".
   1234 		$text{new_addr}."</a><hr><br>";
   1235 print &ui_form_start( 'iface_apply.cgi', "post" );
   1236 print $text{bind_iface};
   1237 print &ui_yesno_radio( "bind_iface", ($config{bind_interfaces}{used})?1:0 );
   1238 print "<br>".&ui_submit( $text{save_button} );
   1239 print &ui_form_end();
   1240 print "<hr><br><a href=\"index.cgi\">".$text{'DNS_settings'}."</a><br>";
   1241 print "<a href=\"servers.cgi\">".$text{'servers_config'}."</a><br>";
   1242 print "<a href=\"alias.cgi\">".$text{'alias_config'}."</a><br>";
   1243 print "<hr>";
   1244 print "<a href=\"dhcp.cgi\">";
   1245 print $text{'DHCP_config'};
   1246 print "</a><br>";
   1247 &footer("/", $text{'index'});
   1248 # uses the index entry in /lang/en
   1249 
   1250 
   1251 
   1252 ## if subroutines are not in an extra file put them here
   1253 
   1254 
   1255 ### END of iface.cgi ###.
   1256 dnsmasq/iface_edit.cgi0000755000000000000000000000406110512324451013763 0ustar  rootroot#!/usr/bin/perl
   1257 #
   1258 #    DNSMasq Webmin Module - iface_edit.cgi;  edit interface
   1259 #    Copyright (C) 2006 by Neil Fisher
   1260 #    
   1261 #    This program is free software; you can redistribute it and/or modify
   1262 #    it under the terms of the GNU General Public License as published by
   1263 #    the Free Software Foundation; either version 2 of the License, or
   1264 #    (at your option) any later version.
   1265 #
   1266 #    This program is distributed in the hope that it will be useful,
   1267 #    but WITHOUT ANY WARRANTY; without even the implied warranty of
   1268 #    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   1269 #    GNU General Public License for more details.
   1270 #
   1271 #    This module inherited from the Webmin Module Template 0.79.1 by tn
   1272 
   1273 do '../web-lib.pl';
   1274 do '../ui-lib.pl';
   1275 do 'dnsmasq-lib.pl';
   1276 
   1277 $|=1;
   1278 &init_config("DNSMasq");
   1279 
   1280 %access=&get_module_acl;
   1281 
   1282 ## put in ACL checks here if needed
   1283 
   1284 
   1285 ## sanity checks
   1286 
   1287 
   1288 ## Insert Output code here
   1289 # read config file
   1290 $config_file = &read_file_lines( $config{config_file} );
   1291 # pass into data structure
   1292 &parse_config_file( \%config, \$config_file );
   1293 # read posted data
   1294 &ReadParse();
   1295 # check for errors in read config
   1296 if( $config{errors} > 0 )
   1297 {
   1298 	&header( "DNSMasq settings", "" );
   1299 	print "<hr><h2>";
   1300 	print $text{warn_errors};
   1301 	print $config{errors};
   1302 	print $text{didnt_apply};
   1303 	print "</h3><hr>\n";
   1304 	&footer( "/", $text{'index'});
   1305 	exit;
   1306 }
   1307 # adjust everything to what we got
   1308 #
   1309 &header( "DNSMasq settings", "" );
   1310 print "<h2>".$text{edit_iface}."</h2>";
   1311 print &ui_form_start( "iface_edit_apply.cgi", "post" );
   1312 print &ui_hidden( "idx", $in{idx} );
   1313 print "<br>".$text{in_use}.&ui_yesno_radio( "used",
   1314 				($config{interface}[$in{idx}]{used})?1:0 );
   1315 print "<br>".$text{iface_name};
   1316 print &ui_textbox( "iface", $config{interface}[$in{idx}]{iface}, 50 );
   1317 print "<br><br>" . &ui_submit( $text{'save_button'} )."<br>";
   1318 print &ui_form_end();
   1319 print "<a href=delete.cgi?idx=".$in{idx}."&what=interface&where=iface.cgi".
   1320 	">".$text{delet}."</a>";
   1321 print "<br><a href=iface.cgi>".$text{iface_config}."</a>";
   1322 &footer( "/", $text{'index'});
   1323 #
   1324 
   1325 # 
   1326 # sub-routines
   1327 #
   1328 ### END of iface_edit.cgi ###.
   1329 dnsmasq/help/0000755000000000000000000000000010507121320012141 5ustar  rootrootdnsmasq/help/intro.html0000644000000000000000000000202210507121320014156 0ustar  rootroot<header>DNSmasq Configuration</header>
   1330 
   1331 <h3>Introduction to DNSmasq</h3>
   1332 DNSmasq is an integrated DNS caching proxy server and DHCP server designed 
   1333 to run on a host that is masquerading a local private network to the rest
   1334 of the internet. <p>
   1335 <h3>Configuring DNSmasq</h3>
   1336 In most cases, all you'll need to change will be the local domain name. Under
   1337 some circumstances, you may want to change how DNSmasq resolves names to
   1338 allow for other local nameservers (if for example you are using a VPN
   1339 tunnel to another location).<p>
   1340 All the functionality of DNSmasq is beyond the scope of this help file - 
   1341 please read the man pages!
   1342 <h3>Limitations</h3>
   1343 Please read the README file.<br>
   1344 In Short, this is a quick and dirty implementation with virtually <em>
   1345 	no error checking</em>. Therefore, it assumes <em>you
   1346 	know what you are doing!</em> <br>
   1347 <h3>Use with care!</h3> If you enter a name where a IP address 
   1348 should be (for example) then you may need to edit the config file
   1349 manually to remove or edit the offending line. YOU HAVE BEEN WARNED!
   1350 dnsmasq/alias.cgi0000755000000000000000000000754010512627251013011 0ustar  rootroot#!/usr/bin/perl
   1351 #
   1352 #    DNSMasq Webmin Module - alias.cgi; aliasing and redirection
   1353 #    Copyright (C) 2006 by Neil Fisher
   1354 #    
   1355 #    This program is free software; you can redistribute it and/or modify
   1356 #    it under the terms of the GNU General Public License as published by
   1357 #    the Free Software Foundation; either version 2 of the License, or
   1358 #    (at your option) any later version.
   1359 #
   1360 #    This program is distributed in the hope that it will be useful,
   1361 #    but WITHOUT ANY WARRANTY; without even the implied warranty of
   1362 #    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   1363 #    GNU General Public License for more details.
   1364 #
   1365 #    This module inherited from the Webmin Module Template 0.79.1 by tn
   1366 
   1367 do '../web-lib.pl';
   1368 do '../ui-lib.pl';
   1369 do 'dnsmasq-lib.pl';
   1370 
   1371 $|=1;
   1372 &init_config("DNSMasq");
   1373 
   1374 %access=&get_module_acl;
   1375 
   1376 ## put in ACL checks here if needed
   1377 
   1378 
   1379 ## sanity checks
   1380 
   1381 
   1382 ## Insert Output code here
   1383 # read config file
   1384 $config_file = &read_file_lines( $config{config_file} );
   1385 # pass into data structure
   1386 
   1387 
   1388 # output as web page
   1389 
   1390 
   1391 &parse_config_file( \%config, \$config_file );
   1392 if( $config{errors} > 0 )
   1393 {
   1394 	my $line="error.cgi?line=xx&type=".$text{err_configbad};
   1395 	&redirect( $line );
   1396 	exit;
   1397 }
   1398 &header($text{'index_title'}, "", "intro", 1, 1, undef,
   1399         "Written by Neil Fisher<BR><A HREF=mailto:neil\@magnecor.com.au>Author</A><BR><A HREF=http://www.authorpage.invalid>Home://page</A>");
   1400 print "<hr>\n";
   1401 # uses the index_title entry from ./lang/en or appropriate
   1402 print "<br>\n";
   1403 print "<h2>".$text{forced}."</h2>";
   1404 print "<br><br>\n";
   1405 my $count=0;
   1406 print &ui_columns_start( [ $text{forced_domain}, $text{forced_ip},
   1407 			$text{in_use} ], 100 );
   1408 foreach my $frcd ( @{$config{forced}} )
   1409 {
   1410 	my $edit = "<a href=forced_edit.cgi?idx=$count>".$$frcd{domain}."</a>";
   1411 	print &ui_columns_row( [ $edit, $$frcd{addr}, ($$frcd{used}) ?
   1412 			$text{used} : $text{not_used} ],
   1413 			[ "width=30%", "width=30%", "width=30%" ] );
   1414 	$count++;
   1415 }
   1416 print &ui_columns_end();
   1417 print "<br>\n";
   1418 print "<a href=add.cgi?what=address=/new/0.0.0.0&where=alias.cgi>".
   1419 	$text{forced_add}."</a>";
   1420 print "<br>\n";
   1421 print "<br><br>\n";
   1422 print "<hr>";
   1423 print "<br>\n";
   1424 print "<h2>".$text{alias}."</h2>";
   1425 print "<br><br>\n";
   1426 $count=0;
   1427 print &ui_columns_start( [ $text{forced_from}, $text{forced_ip},
   1428 			$text{forced_mask}, $text{in_use} ], 100 );
   1429 foreach my $frcd ( @{$config{alias}} )
   1430 {
   1431 	my $edit = "<a href=alias_edit.cgi?idx=$count>".$$frcd{from}."</a>";
   1432 	print &ui_columns_row( [ 
   1433 			$edit, $$frcd{to}, 
   1434 			($$frcd{netmask_used}) ?  
   1435 				$$frcd{netmask} : "255.255.255.255",
   1436 			($$frcd{used}) ?
   1437 				$text{used} : $text{not_used} ],
   1438 			[ "width=25%", "width=25%", "width=25%", "width=25%" ] );
   1439 	$count++;
   1440 }
   1441 print &ui_columns_end();
   1442 print "<br>\n";
   1443 print "<a href=add.cgi?what=alias=0.0.0.0,0.0.0.0&where=alias.cgi>".
   1444 	$text{alias_add}."</a>";
   1445 print "<br>\n";
   1446 print "<hr>";
   1447 print "<br>\n";
   1448 print "<h2>".$text{nx}."</h2>";
   1449 print "<br><br>\n";
   1450 $count=0;
   1451 print &ui_columns_start( [ $text{forced_from}, $text{in_use} ], 100 );
   1452 foreach my $frcd ( @{$config{bogus}} )
   1453 {
   1454 	my $edit = "<a href=nx_edit.cgi?idx=$count>".$$frcd{addr}."</a>";
   1455 	print &ui_columns_row( [ 
   1456 			$edit, 
   1457 			($$frcd{used}) ?
   1458 				$text{used} : $text{not_used} ],
   1459 			[ "width=50%", "width=50%" ] );
   1460 	$count++;
   1461 }
   1462 print &ui_columns_end();
   1463 print "<br>\n";
   1464 print "<a href=add.cgi?what=bogus-nxdomain=0.0.0.0&where=alias.cgi>".
   1465 	$text{nx_add}."</a>";
   1466 print "<br>\n";
   1467 print "<hr>";
   1468 print "<br><br>\n";
   1469 print "<br><br>\n";
   1470 print "<a href=\"index.cgi\">";
   1471 print $text{'DNS_settings'};
   1472 print "</a><br>";
   1473 print "<a href=\"servers.cgi\">";
   1474 print $text{'DNS_servers'};
   1475 print "</a><br>";
   1476 print "<a href=\"iface.cgi\">";
   1477 print $text{'iface_config'};
   1478 print "</a><br>";
   1479 print "<hr>";
   1480 print "<a href=\"dhcp.cgi\">";
   1481 print $text{'DHCP_config'};
   1482 print "</a><br>";
   1483 &footer("/", $text{'index'});
   1484 # uses the index entry in /lang/en
   1485 
   1486 
   1487 
   1488 ## if subroutines are not in an extra file put them here
   1489 
   1490 
   1491 ### END of alias.cgi ###.
   1492 dnsmasq/dhcp.cgi0000755000000000000000000001306010512347345012633 0ustar  rootroot#!/usr/bin/perl
   1493 #
   1494 #    DNSMasq Webmin Module - dhcp.cgi; DHCP config
   1495 #    Copyright (C) 2006 by Neil Fisher
   1496 #    
   1497 #    This program is free software; you can redistribute it and/or modify
   1498 #    it under the terms of the GNU General Public License as published by
   1499 #    the Free Software Foundation; either version 2 of the License, or
   1500 #    (at your option) any later version.
   1501 #
   1502 #    This program is distributed in the hope that it will be useful,
   1503 #    but WITHOUT ANY WARRANTY; without even the implied warranty of
   1504 #    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   1505 #    GNU General Public License for more details.
   1506 #
   1507 #    This module inherited from the Webmin Module Template 0.79.1 by tn
   1508 
   1509 do '../web-lib.pl';
   1510 do '../ui-lib.pl';
   1511 do 'dnsmasq-lib.pl';
   1512 
   1513 $|=1;
   1514 &init_config("DNSMasq");
   1515 
   1516 %access=&get_module_acl;
   1517 
   1518 ## put in ACL checks here if needed
   1519 
   1520 
   1521 ## sanity checks
   1522 
   1523 &header($text{'index_title'}, "", "intro", 1, 1, undef,
   1524         "Written by Neil Fisher<BR><A HREF=mailto:neil\@magnecor.com.au>Author</A><BR><A HREF=http://www.authorpage.invalid>Home://page</A>");
   1525 # uses the index_title entry from ./lang/en or appropriate
   1526 
   1527 ## Insert Output code here
   1528 # read config file
   1529 $config_file = &read_file_lines( $config{config_file} );
   1530 # pass into data structure
   1531 
   1532 
   1533 # output as web page
   1534 
   1535 
   1536 &header( "DNSMasq settings", "" );
   1537 &parse_config_file( \%config, \$config_file );
   1538 print "<hr>\n";
   1539 if( $config{errors} > 0 )
   1540 {
   1541 	print "<h3>WARNING: found ";
   1542 	print $config{errors};
   1543 	print "errors in config file!</h3><br>\n";
   1544 }
   1545 print "<br>\n";
   1546 print "<h2>$text{'DHCP_settings'}</h2>";
   1547 print "<br><hr><br>\n";
   1548 my $count;
   1549 my $width;
   1550 $count=0;
   1551 $width="width=33%";
   1552 print "<h2>".$text{vendor_classes}."</h2>";
   1553 print &ui_columns_start( [ $text{class},
   1554 				$text{vendor}, $text{in_use} ], 100 );
   1555 foreach my $range ( @{$config{vendor_class}} )
   1556 {
   1557 	my $edit = "<a href=vend_edit.cgi?idx=$count>".$$range{class}."</a>";
   1558 	print &ui_columns_row( [
   1559 			$edit, $$range{vendor},
   1560 			($$range{used}) ?
   1561 				$text{used} : $text{not_used} ],
   1562 			[ $width, $width, $width ] );
   1563 	$count++;
   1564 }
   1565 print &ui_columns_end();
   1566 print "<br><a href=add.cgi?what=dhcp-vendorclass=new&where=dhcp.cgi>".
   1567 		$text{vend_add}."</a><br><hr><br>";
   1568 $count=0;
   1569 $width="width=33%";
   1570 print "<h2>".$text{user_classes}."</h2>";
   1571 print &ui_columns_start( [ $text{class},
   1572 				$text{user}, $text{in_use} ], 100 );
   1573 foreach my $range ( @{$config{user_class}} )
   1574 {
   1575 	my $edit = "<a href=user_edit.cgi?idx=$count>".$$range{class}."</a>";
   1576 	print &ui_columns_row( [
   1577 			$edit, $$range{user},
   1578 			($$range{used}) ?
   1579 				$text{used} : $text{not_used} ],
   1580 			[ $width, $width, $width ] );
   1581 	$count++;
   1582 }
   1583 print &ui_columns_end();
   1584 print "<br><a href=add.cgi?what=dhcp-userclass=new&where=dhcp.cgi>".
   1585 		$text{user_add}."</a><br><hr><br>";
   1586 $count=0;
   1587 $width="20%";
   1588 print "<h2>".$text{dhcp_range}."</h2>";
   1589 print &ui_columns_start( [ $text{net_id}, $text{forced_from}, $text{forced_ip},
   1590 				$text{forced_mask}, $text{leasetime},
   1591 			        $text{in_use}	], 100 );
   1592 foreach my $range ( @{$config{dhcp_range}} )
   1593 {
   1594 	my $edit = "<a href=range_edit.cgi?idx=$count>".$$range{start}."</a>";
   1595 	print &ui_columns_row( [
   1596 			$$range{id}, $edit, $$range{end}, $$range{mask},
   1597 			$$range{leasetime}, 
   1598 			($$range{used}) ?
   1599 				$text{used} : $text{not_used} ],
   1600 			[ $width, $width, $width, $width, $width ] );
   1601 	$count++;
   1602 }
   1603 print &ui_columns_end();
   1604 print "<br><a href=add.cgi?what=dhcp-range=0.0.0.0,0.0.0.0&where=dhcp.cgi>".
   1605 		$text{range_add}."</a><br><hr><br>";
   1606 $count=0;
   1607 $width="width=50%";
   1608 print "<h2>".$text{hosts}."</h2>";
   1609 print &ui_columns_start( [ $text{hosts}, $text{in_use} ], 100 );
   1610 foreach my $range ( @{$config{dhcp_host}} )
   1611 {
   1612 	my $edit = "<a href=host_edit.cgi?idx=$count>".$$range{option}."</a>";
   1613 	print &ui_columns_row( [
   1614 			$edit,
   1615 			($$range{used}) ?
   1616 				$text{used} : $text{not_used} ],
   1617 			[ $width, $width ] );
   1618 	$count++;
   1619 }
   1620 print &ui_columns_end();
   1621 print "<br><a href=add.cgi?what=dhcp-host=new,0.0.0.0&where=dhcp.cgi>".
   1622 		$text{host_add}."</a><br><hr><br>";
   1623 $count=0;
   1624 $width="width=50%";
   1625 print "<h2>".$text{dhcp_options}."</h2>";
   1626 print &ui_columns_start( [ $text{dhcp_option}, $text{in_use} ], 100 );
   1627 foreach my $range ( @{$config{dhcp_option}} )
   1628 {
   1629 	my $edit = "<a href=option_edit.cgi?idx=$count>".$$range{option}."</a>";
   1630 	print &ui_columns_row( [
   1631 			$edit,
   1632 			($$range{used}) ?
   1633 				$text{used} : $text{not_used} ],
   1634 			[ $width, $width ] );
   1635 	$count++;
   1636 }
   1637 print &ui_columns_end();
   1638 print "<br><a href=add.cgi?what=dhcp-option=27&where=dhcp.cgi>".
   1639 	$text{dhcp_add}."</a><br><hr><br>";
   1640 print &ui_form_start( 'dhcp_apply.cgi', "get" );
   1641 print "<h2>".$text{misc}."</h2><br>";
   1642 print $text{read_ethers}.&ui_yesno_radio( "ethers", 
   1643 			($config{dhcp_ethers}{used})?1:0 );
   1644 print "<br><br>".$text{use_bootp}.&ui_yesno_radio ( "bootp",
   1645 			($config{dhcp_boot}{used})?1:0 );
   1646 print "<br>".$text{bootp_host}.&ui_textbox( "bootp_host",
   1647 			$config{dhcp_boot}{host}, 80 );
   1648 print "<br>".$text{bootp_file}.&ui_textbox( "bootp_file",
   1649 			$config{dhcp_boot}{file}, 80 );
   1650 print "<br>".$text{bootp_address}.&ui_textbox( "bootp_addr",
   1651 			$config{dhcp_boot}{address}, 80 );
   1652 print "<br><br>".$text{max_leases}.&ui_textbox( "max_leases",
   1653 			$config{dhcp_leasemax}{max}, 10 );
   1654 print "<br><br>".$text{leasefile}.&ui_yesno_radio( "useleasefile",
   1655 			($config{dhcp_leasefile}{used})?1:0 );
   1656 print "<br>".$text{lfiletouse}.&ui_textbox( "leasefile",
   1657 			$config{dhcp_leasefile}{file}, 80 );
   1658 print "<br><br>".&ui_submit( $text{'save_button'} );
   1659 print &ui_form_end( );
   1660 print "<br><hr><br><a href=\"index.cgi\">";
   1661 print $text{'DNS_settings'};
   1662 print "</a><br>";
   1663 &footer("/", $text{'index'});
   1664 # uses the index entry in /lang/en
   1665 
   1666 
   1667 
   1668 ## if subroutines are not in an extra file put them here
   1669 
   1670 
   1671 ### END of dhcp.cgi ###.
   1672 dnsmasq/restart.cgi0000755000000000000000000000300510507123056013372 0ustar  rootroot#!/usr/bin/perl
   1673 #
   1674 #    DNSMasq Webmin Module - restart.cgi; restart DNSmasq
   1675 #    Copyright (C) 2006 by Neil Fisher
   1676 #    
   1677 #    This program is free software; you can redistribute it and/or modify
   1678 #    it under the terms of the GNU General Public License as published by
   1679 #    the Free Software Foundation; either version 2 of the License, or
   1680 #    (at your option) any later version.
   1681 #
   1682 #    This program is distributed in the hope that it will be useful,
   1683 #    but WITHOUT ANY WARRANTY; without even the implied warranty of
   1684 #    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   1685 #    GNU General Public License for more details.
   1686 #
   1687 #    This module inherited from the Webmin Module Template 0.79.1 by tn
   1688 
   1689 do '../web-lib.pl';
   1690 do '../ui-lib.pl';
   1691 do 'dnsmasq-lib.pl';
   1692 
   1693 $|=1;
   1694 &init_config("DNSMasq");
   1695 
   1696 %access=&get_module_acl;
   1697 
   1698 ## put in ACL checks here if needed
   1699 
   1700 
   1701 ## sanity checks
   1702 
   1703 &header($text{'index_title'}, "", "intro", 1, 1, undef,
   1704         "Written by Neil Fisher<BR><A HREF=mailto:neil\@magnecor.com.au>Author</A><BR><A HREF=http://www.authorpage.invalid>Home://page</A>");
   1705 # uses the index_title entry from ./lang/en or appropriate
   1706 
   1707 ## Insert Output code here
   1708 
   1709 
   1710 # output as web page
   1711 
   1712 my $line=$config{restart};
   1713 &header( "DNSMasq settings", "" );
   1714 print $text{restarting} . "<br>"; 
   1715 print `$line`;
   1716 print "<br><hr><a href=index.cgi>";
   1717 print $text{DNS_settings};
   1718 print "</a>";
   1719 &footer("/", $text{'index'});
   1720 # uses the index entry in /lang/en
   1721 
   1722 
   1723 
   1724 ## if subroutines are not in an extra file put them here
   1725 
   1726 
   1727 ### END of restart.cgi ###.
   1728 dnsmasq/srv_apply.cgi0000755000000000000000000000415310512642213013727 0ustar  rootroot#!/usr/bin/perl
   1729 #
   1730 #    DNSMasq Webmin Module - srv_apply.cgi; update DNS server info     
   1731 #    Copyright (C) 2006 by Neil Fisher
   1732 #    
   1733 #    This program is free software; you can redistribute it and/or modify
   1734 #    it under the terms of the GNU General Public License as published by
   1735 #    the Free Software Foundation; either version 2 of the License, or
   1736 #    (at your option) any later version.
   1737 #
   1738 #    This program is distributed in the hope that it will be useful,
   1739 #    but WITHOUT ANY WARRANTY; without even the implied warranty of
   1740 #    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   1741 #    GNU General Public License for more details.
   1742 #
   1743 #    This module inherited from the Webmin Module Template 0.79.1 by tn
   1744 
   1745 do '../web-lib.pl';
   1746 do '../ui-lib.pl';
   1747 do 'dnsmasq-lib.pl';
   1748 
   1749 $|=1;
   1750 &init_config("DNSMasq");
   1751 
   1752 %access=&get_module_acl;
   1753 
   1754 ## put in ACL checks here if needed
   1755 
   1756 
   1757 ## sanity checks
   1758 
   1759 
   1760 ## Insert Output code here
   1761 # read config file
   1762 $config_file = &read_file_lines( $config{config_file} );
   1763 # pass into data structure
   1764 &parse_config_file( \%config, \$config_file );
   1765 # read posted data
   1766 &ReadParse();
   1767 # check for errors in read config
   1768 if( $config{errors} > 0 )
   1769 {
   1770 	my $line = "error.cgi?line=xx&type=".$text{err_configbad};
   1771 	&redirect( $line );
   1772 	exit;
   1773 }
   1774 # check for input data errors
   1775 if( ($in{resolv_std}) && ($in{resolv_file} !~ /^$FILE$/) )
   1776 {
   1777 	my $line = "error.cgi?line=".$text{resolv_file};
   1778 	$line .= "&type=".$text{err_filebad};
   1779 	&redirect( $line );
   1780 	exit;
   1781 }
   1782 # adjust everything to what we got
   1783 
   1784 #
   1785 # use resolv.conf?
   1786 #
   1787 &update( $config{no_resolv}{line}, "no-resolv", 
   1788 	$config_file, ( $in{resolv} == 0 ) );
   1789 #
   1790 # standard location for resolv.conf?
   1791 # 
   1792 &update( $config{resolv_file}{line}, "resolv-file=".$in{resolv_file}, 
   1793 	$config_file, ( $in{resolv_std} == 1 ) );
   1794 
   1795 #
   1796 # servers in order provided?
   1797 # 
   1798 &update( $config{strict_order}{line}, "strict-order", 
   1799 	$config_file, ( $in{strict} == 1 ) );
   1800 #
   1801 # poll resolv.conf?
   1802 # 
   1803 &update( $config{no_poll}{line}, "no-poll", 
   1804 	$config_file, ( $in{poll} == 0 ) );
   1805 #
   1806 #
   1807 # write file!!
   1808 &flush_file_lines();
   1809 #
   1810 # re-load basic page
   1811 &redirect( "servers.cgi" );
   1812 
   1813 # 
   1814 # sub-routines
   1815 #
   1816 ### END of srv_apply.cgi ###.
   1817 dnsmasq/restart.sh0000755000000000000000000000034010506066357013252 0ustar  rootroot#!/bin/bash
   1818 echo "killing existing process PID is "
   1819 cat /var/run/dnsmasq.pid
   1820 kill -9 `cat /var/run/dnsmasq.pid`
   1821 echo "done. Starting new process..."
   1822 /usr/local/sbin/dnsmasq
   1823 echo "Done. New PID is "
   1824 cat /var/run/dnsmasq.pid
   1825 
   1826 dnsmasq/srv_move.cgi0000755000000000000000000000404510507102723013551 0ustar  rootroot#!/usr/bin/perl
   1827 #
   1828 #    DNSMasq Webmin Module - dns_move.cgi; move server     
   1829 #    Copyright (C) 2006 by Neil Fisher
   1830 #    
   1831 #    This program is free software; you can redistribute it and/or modify
   1832 #    it under the terms of the GNU General Public License as published by
   1833 #    the Free Software Foundation; either version 2 of the License, or
   1834 #    (at your option) any later version.
   1835 #
   1836 #    This program is distributed in the hope that it will be useful,
   1837 #    but WITHOUT ANY WARRANTY; without even the implied warranty of
   1838 #    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   1839 #    GNU General Public License for more details.
   1840 #
   1841 #    This module inherited from the Webmin Module Template 0.79.1 by tn
   1842 
   1843 do '../web-lib.pl';
   1844 do '../ui-lib.pl';
   1845 do 'dnsmasq-lib.pl';
   1846 
   1847 $|=1;
   1848 &init_config("DNSMasq");
   1849 
   1850 %access=&get_module_acl;
   1851 
   1852 ## put in ACL checks here if needed
   1853 
   1854 
   1855 ## sanity checks
   1856 
   1857 
   1858 ## Insert Output code here
   1859 # read config file
   1860 $config_file = &read_file_lines( $config{config_file} );
   1861 # pass into data structure
   1862 &parse_config_file( \%config, \$config_file );
   1863 # read posted data
   1864 &ReadParse();
   1865 # check for errors in read config
   1866 if( $config{errors} > 0 )
   1867 {
   1868 	&header( "DNSMasq settings", "" );
   1869 	print "<hr><h2>";
   1870 	print $text{warn_errors};
   1871 	print $config{errors};
   1872 	print $text{didnt_apply};
   1873 	print "</h3><hr>\n";
   1874 	&footer( "/", $text{'index'});
   1875 	exit;
   1876 }
   1877 # adjust everything to what we got
   1878 #
   1879 my $selected=$config{servers}[$in{idx}]{line};
   1880 if( $in{dir} eq "up" )
   1881 {
   1882 	$config{servers}[$in{idx}]{line}=$config{servers}[$in{idx}-1]{line};
   1883 	$config{servers}[$in{idx}-1]{line}=$selected;
   1884 }
   1885 else
   1886 {
   1887 	$config{servers}[$in{idx}]{line}=$config{servers}[$in{idx}+1]{line};
   1888 	$config{servers}[$in{idx}+1]{line}=$selected;
   1889 }
   1890 foreach my $server (@{$config{servers}})
   1891 {
   1892 	$line= ($$server{domain_used}) ?
   1893 		"server=/".$$server{domain}."/".$$server{address} :
   1894 		"server=".$$server{address};
   1895 	&update( $$server{line}, $line, 
   1896 		$config_file, ($$server{used}) );
   1897 }
   1898 #
   1899 # write file!!
   1900 &flush_file_lines();
   1901 #
   1902 # re-load basic page
   1903 &redirect( "servers.cgi" );
   1904 
   1905 # 
   1906 # sub-routines
   1907 #
   1908 ### END of dns_move.cgi ###.
   1909 dnsmasq/srv_edit_apply.cgi0000755000000000000000000000364610512642225014745 0ustar  rootroot#!/usr/bin/perl
   1910 #
   1911 #    DNSMasq Webmin Module - srv_edit_apply.cgi; do the update      
   1912 #    Copyright (C) 2006 by Neil Fisher
   1913 #    
   1914 #    This program is free software; you can redistribute it and/or modify
   1915 #    it under the terms of the GNU General Public License as published by
   1916 #    the Free Software Foundation; either version 2 of the License, or
   1917 #    (at your option) any later version.
   1918 #
   1919 #    This program is distributed in the hope that it will be useful,
   1920 #    but WITHOUT ANY WARRANTY; without even the implied warranty of
   1921 #    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   1922 #    GNU General Public License for more details.
   1923 #
   1924 #    This module inherited from the Webmin Module Template 0.79.1 by tn
   1925 
   1926 do '../web-lib.pl';
   1927 do '../ui-lib.pl';
   1928 do 'dnsmasq-lib.pl';
   1929 
   1930 $|=1;
   1931 &init_config("DNSMasq");
   1932 
   1933 %access=&get_module_acl;
   1934 
   1935 ## put in ACL checks here if needed
   1936 
   1937 
   1938 ## sanity checks
   1939 
   1940 
   1941 ## Insert Output code here
   1942 # read config file
   1943 $config_file = &read_file_lines( $config{config_file} );
   1944 # pass into data structure
   1945 &parse_config_file( \%config, \$config_file );
   1946 # read posted data
   1947 &ReadParse();
   1948 # check for errors in read config
   1949 if( $config{errors} > 0 )
   1950 {
   1951 	my $line = "error.cgi?line=xx&type=".$text{err_configbad};
   1952 	&redirect( $line );
   1953 	exit;
   1954 }
   1955 # check for input data errors
   1956 if( $in{addr} !~ /^$IPADDR$/ )
   1957 {
   1958 	my $line = "error.cgi?line=".$text{srv_addr};
   1959 	$line .= "&type=".$text{err_notip};
   1960 	&redirect( $line );
   1961 	exit;
   1962 }
   1963 if( ($in{named}) && ($in{name} !~ /^$NAME$/) )
   1964 {
   1965 	my $line = "error.cgi?line=".$text{srv_name};
   1966 	$line .= "&type=".$text{err_domainbad};
   1967 	&redirect( $line );
   1968 	exit;
   1969 }
   1970 # adjust everything to what we got
   1971 #
   1972 my $line="server=";
   1973 $line .= ($in{named})?"/".$in{name}."/":"";
   1974 $line .= $in{addr};
   1975 &update( $config{servers}[$in{idx}]{line}, $line,
   1976 	$config_file, ( $in{used} == 1 ) );
   1977 #
   1978 # write file!!
   1979 &flush_file_lines();
   1980 #
   1981 # re-load basic page
   1982 &redirect( "servers.cgi" );
   1983 
   1984 # 
   1985 # sub-routines
   1986 #
   1987 ### END of srv_edit_apply.cgi ###.
   1988 dnsmasq/delete.cgi0000755000000000000000000000265410512627424013165 0ustar  rootroot#!/usr/bin/perl
   1989 #
   1990 #    DNSMasq Webmin Module - delete.cgi;  delete a line     
   1991 #    Copyright (C) 2006 by Neil Fisher
   1992 #    
   1993 #    This program is free software; you can redistribute it and/or modify
   1994 #    it under the terms of the GNU General Public License as published by
   1995 #    the Free Software Foundation; either version 2 of the License, or
   1996 #    (at your option) any later version.
   1997 #
   1998 #    This program is distributed in the hope that it will be useful,
   1999 #    but WITHOUT ANY WARRANTY; without even the implied warranty of
   2000 #    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   2001 #    GNU General Public License for more details.
   2002 #
   2003 #    This module inherited from the Webmin Module Template 0.79.1 by tn
   2004 
   2005 do '../web-lib.pl';
   2006 do '../ui-lib.pl';
   2007 do 'dnsmasq-lib.pl';
   2008 
   2009 $|=1;
   2010 &init_config("DNSMasq");
   2011 
   2012 %access=&get_module_acl;
   2013 
   2014 ## put in ACL checks here if needed
   2015 
   2016 
   2017 ## sanity checks
   2018 
   2019 
   2020 ## Insert Output code here
   2021 # read config file
   2022 $config_file = &read_file_lines( $config{config_file} );
   2023 # pass into data structure
   2024 &parse_config_file( \%config, \$config_file );
   2025 # read posted data
   2026 &ReadParse();
   2027 # check for errors in read config
   2028 if( $config{errors} > 0 )
   2029 {
   2030 	my $line="error.cgi?line=xx&type=".$text{err_configbad};
   2031 	&redirect( $line );
   2032 	exit;
   2033 }
   2034 # adjust everything to what we got
   2035 #
   2036 #
   2037 &update( $config{$in{what}}[$in{idx}]{line}, "",
   2038 	$config_file, 0 );
   2039 &flush_file_lines();
   2040 &redirect( $in{where} );
   2041 # 
   2042 # sub-routines
   2043 #
   2044 ### END of delete.cgi ###.
   2045 dnsmasq/xiface_edit.cgi0000755000000000000000000000410410512343715014155 0ustar  rootroot#!/usr/bin/perl
   2046 #
   2047 #    DNSMasq Webmin Module - xiface_edit.cgi;  edit except interface
   2048 #    Copyright (C) 2006 by Neil Fisher
   2049 #    
   2050 #    This program is free software; you can redistribute it and/or modify
   2051 #    it under the terms of the GNU General Public License as published by
   2052 #    the Free Software Foundation; either version 2 of the License, or
   2053 #    (at your option) any later version.
   2054 #
   2055 #    This program is distributed in the hope that it will be useful,
   2056 #    but WITHOUT ANY WARRANTY; without even the implied warranty of
   2057 #    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   2058 #    GNU General Public License for more details.
   2059 #
   2060 #    This module inherited from the Webmin Module Template 0.79.1 by tn
   2061 
   2062 do '../web-lib.pl';
   2063 do '../ui-lib.pl';
   2064 do 'dnsmasq-lib.pl';
   2065 
   2066 $|=1;
   2067 &init_config("DNSMasq");
   2068 
   2069 %access=&get_module_acl;
   2070 
   2071 ## put in ACL checks here if needed
   2072 
   2073 
   2074 ## sanity checks
   2075 
   2076 
   2077 ## Insert Output code here
   2078 # read config file
   2079 $config_file = &read_file_lines( $config{config_file} );
   2080 # pass into data structure
   2081 &parse_config_file( \%config, \$config_file );
   2082 # read posted data
   2083 &ReadParse();
   2084 # check for errors in read config
   2085 if( $config{errors} > 0 )
   2086 {
   2087 	&header( "DNSMasq settings", "" );
   2088 	print "<hr><h2>";
   2089 	print $text{warn_errors};
   2090 	print $config{errors};
   2091 	print $text{didnt_apply};
   2092 	print "</h3><hr>\n";
   2093 	&footer( "/", $text{'index'});
   2094 	exit;
   2095 }
   2096 # adjust everything to what we got
   2097 #
   2098 &header( "DNSMasq settings", "" );
   2099 print "<h2>".$text{edit_xiface}."</h2>";
   2100 print &ui_form_start( "xiface_edit_apply.cgi", "post" );
   2101 print &ui_hidden( "idx", $in{idx} );
   2102 print "<br>".$text{in_use}.&ui_yesno_radio( "used",
   2103 				($config{ex_interface}[$in{idx}]{used})?1:0 );
   2104 print "<br>".$text{xiface_name};
   2105 print &ui_textbox( "iface", $config{ex_interface}[$in{idx}]{iface}, 50 );
   2106 print "<br><br>" . &ui_submit( $text{'save_button'} )."<br>";
   2107 print &ui_form_end();
   2108 print "<a href=delete.cgi?idx=".$in{idx}."&what=ex_interface&where=dhcp.cgi>".
   2109 		$text{delet}."</a>";
   2110 print "<br>< a href=iface.cgi>".$text{iface_config}."</a>";
   2111 &footer( "/", $text{'index'});
   2112 #
   2113 
   2114 # 
   2115 # sub-routines
   2116 #
   2117 ### END of xiface_edit.cgi ###.
   2118 dnsmasq/listen_edit.cgi0000755000000000000000000000407010512324553014215 0ustar  rootroot#!/usr/bin/perl
   2119 #
   2120 #    DNSMasq Webmin Module - listen_edit.cgi;  edit listen on
   2121 #    Copyright (C) 2006 by Neil Fisher
   2122 #    
   2123 #    This program is free software; you can redistribute it and/or modify
   2124 #    it under the terms of the GNU General Public License as published by
   2125 #    the Free Software Foundation; either version 2 of the License, or
   2126 #    (at your option) any later version.
   2127 #
   2128 #    This program is distributed in the hope that it will be useful,
   2129 #    but WITHOUT ANY WARRANTY; without even the implied warranty of
   2130 #    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   2131 #    GNU General Public License for more details.
   2132 #
   2133 #    This module inherited from the Webmin Module Template 0.79.1 by tn
   2134 
   2135 do '../web-lib.pl';
   2136 do '../ui-lib.pl';
   2137 do 'dnsmasq-lib.pl';
   2138 
   2139 $|=1;
   2140 &init_config("DNSMasq");
   2141 
   2142 %access=&get_module_acl;
   2143 
   2144 ## put in ACL checks here if needed
   2145 
   2146 
   2147 ## sanity checks
   2148 
   2149 
   2150 ## Insert Output code here
   2151 # read config file
   2152 $config_file = &read_file_lines( $config{config_file} );
   2153 # pass into data structure
   2154 &parse_config_file( \%config, \$config_file );
   2155 # read posted data
   2156 &ReadParse();
   2157 # check for errors in read config
   2158 if( $config{errors} > 0 )
   2159 {
   2160 	&header( "DNSMasq settings", "" );
   2161 	print "<hr><h2>";
   2162 	print $text{warn_errors};
   2163 	print $config{errors};
   2164 	print $text{didnt_apply};
   2165 	print "</h3><hr>\n";
   2166 	&footer( "/", $text{'index'});
   2167 	exit;
   2168 }
   2169 # adjust everything to what we got
   2170 #
   2171 &header( "DNSMasq settings", "" );
   2172 print "<h2>".$text{edit_listen}."</h2>";
   2173 print &ui_form_start( "listen_edit_apply.cgi", "post" );
   2174 print &ui_hidden( "idx", $in{idx} );
   2175 print "<br>".$text{in_use}.&ui_yesno_radio( "used",
   2176 				($config{listen_on}[$in{idx}]{used})?1:0 );
   2177 print "<br>".$text{listen_name};
   2178 print &ui_textbox( "addr", $config{listen_on}[$in{idx}]{address}, 50 );
   2179 print "<br><br>" . &ui_submit( $text{'save_button'} )."<br>";
   2180 print &ui_form_end();
   2181 print "<a href=delete.cgi?idx=".$in{idx}."&what=listen_on&where=iface.cgi".
   2182 		">".$text{delet}."</a>";
   2183 print "<br><a href=iface.cgi>".$text{iface_config}."</a>";
   2184 &footer( "/", $text{'index'});
   2185 #
   2186 
   2187 # 
   2188 # sub-routines
   2189 #
   2190 ### END of listen_edit.cgi ###.
   2191 dnsmasq/nx_edit.cgi0000755000000000000000000000402510512324660013343 0ustar  rootroot#!/usr/bin/perl
   2192 #
   2193 #    DNSMasq Webmin Module - nx_edit.cgi;  edit forced NXDOMAIN
   2194 #    Copyright (C) 2006 by Neil Fisher
   2195 #    
   2196 #    This program is free software; you can redistribute it and/or modify
   2197 #    it under the terms of the GNU General Public License as published by
   2198 #    the Free Software Foundation; either version 2 of the License, or
   2199 #    (at your option) any later version.
   2200 #
   2201 #    This program is distributed in the hope that it will be useful,
   2202 #    but WITHOUT ANY WARRANTY; without even the implied warranty of
   2203 #    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   2204 #    GNU General Public License for more details.
   2205 #
   2206 #    This module inherited from the Webmin Module Template 0.79.1 by tn
   2207 
   2208 do '../web-lib.pl';
   2209 do '../ui-lib.pl';
   2210 do 'dnsmasq-lib.pl';
   2211 
   2212 $|=1;
   2213 &init_config("DNSMasq");
   2214 
   2215 %access=&get_module_acl;
   2216 
   2217 ## put in ACL checks here if needed
   2218 
   2219 
   2220 ## sanity checks
   2221 
   2222 
   2223 ## Insert Output code here
   2224 # read config file
   2225 $config_file = &read_file_lines( $config{config_file} );
   2226 # pass into data structure
   2227 &parse_config_file( \%config, \$config_file );
   2228 # read posted data
   2229 &ReadParse();
   2230 # check for errors in read config
   2231 if( $config{errors} > 0 )
   2232 {
   2233 	&header( "DNSMasq settings", "" );
   2234 	print "<hr><h2>";
   2235 	print $text{warn_errors};
   2236 	print $config{errors};
   2237 	print $text{didnt_apply};
   2238 	print "</h3><hr>\n";
   2239 	&footer( "/", $text{'index'});
   2240 	exit;
   2241 }
   2242 # adjust everything to what we got
   2243 #
   2244 &header( "DNSMasq settings", "" );
   2245 print "<h2>".$text{bogus}."</h2>";
   2246 print &ui_form_start( "nx_edit_apply.cgi", "post" );
   2247 print &ui_hidden( "idx", $in{idx} );
   2248 print $text{forced_from}. &ui_textbox( "from", 
   2249 					$config{bogus}[$in{idx}]{addr}, 15 );
   2250 print "<br>".$text{in_use}.&ui_yesno_radio( "used",
   2251 				($config{bogus}[$in{idx}]{used})?1:0 );
   2252 print "<br><br>" . &ui_submit( $text{'save_button'} )."<br>";
   2253 print &ui_form_end();
   2254 print "<a href=delete.cgi?idx=".$in{idx}."&what=bogus&where=alias.cgi".
   2255 	">".$text{delet}."</a>";
   2256 print "<br><a href=alias.cgi>".$text{alias_config}."</a>";
   2257 &footer( "/", $text{'index'});
   2258 #
   2259 
   2260 # 
   2261 # sub-routines
   2262 #
   2263 ### END of nx_edit.cgi ###.
   2264 dnsmasq/add.cgi0000755000000000000000000000265010512627117012446 0ustar  rootroot#!/usr/bin/perl
   2265 #
   2266 #    DNSMasq Webmin Module - add.cgi; add a line    
   2267 #    Copyright (C) 2006 by Neil Fisher
   2268 #    
   2269 #    This program is free software; you can redistribute it and/or modify
   2270 #    it under the terms of the GNU General Public License as published by
   2271 #    the Free Software Foundation; either version 2 of the License, or
   2272 #    (at your option) any later version.
   2273 #
   2274 #    This program is distributed in the hope that it will be useful,
   2275 #    but WITHOUT ANY WARRANTY; without even the implied warranty of
   2276 #    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   2277 #    GNU General Public License for more details.
   2278 #
   2279 #    This module inherited from the Webmin Module Template 0.79.1 by tn
   2280 
   2281 do '../web-lib.pl';
   2282 do '../ui-lib.pl';
   2283 do 'dnsmasq-lib.pl';
   2284 
   2285 $|=1;
   2286 &init_config("DNSMasq");
   2287 
   2288 %access=&get_module_acl;
   2289 
   2290 ## put in ACL checks here if needed
   2291 
   2292 
   2293 ## sanity checks
   2294 
   2295 
   2296 ## Insert Output code here
   2297 # read config file
   2298 $config_file = &read_file_lines( $config{config_file} );
   2299 # pass into data structure
   2300 &parse_config_file( \%config, \$config_file );
   2301 # read posted data
   2302 &ReadParse();
   2303 # check for errors in read config
   2304 if( $config{errors} > 0 )
   2305 {
   2306 	my $line="error.cgi?line=xx&type=".$text{err_configbad};
   2307 	&redirect( $line );
   2308 	exit;
   2309 }
   2310 # adjust everything to what we got
   2311 #
   2312 push @{$config_file}, "#".$in{what};
   2313 #
   2314 # write file!!
   2315 &flush_file_lines();
   2316 #
   2317 # re-load basic page
   2318 &redirect( $in{where} );
   2319 
   2320 # 
   2321 # sub-routines
   2322 #
   2323 ### END of add.cgi ###.
   2324 dnsmasq/README0000644000000000000000000000425510512644024012106 0ustar  rootroot
   2325 This is the README for the DNSmasq webmin module.
   2326 
   2327 Problems:
   2328 
   2329 1) There's only basic error checking - if you enter some bad
   2330 addresses or names, they will go straight into the config file
   2331 although we do check for things like IP addresses being of
   2332 the correct form (no letters, 4 groups of up to 3 digits
   2333 separated by dots etc). One thing that ISN'T CHECKED FOR is
   2334 that IP dotted quads are all numbers < 256. Another is that
   2335 netmasks are logical (you could enter a netmask of 255.0.255.0 
   2336 for example). Essentially, if it'll pass the config file
   2337 regex scanner (and the above examples will), it won't be 
   2338 flagged as "bad" even if it is a big no-no for dnsmasq itself. 
   2339 
   2340 2) Code is ugly and a kludge - I ain't a programmer! There are probably 
   2341 a lot of things that could be done to tidy up the code - eg, 
   2342 it probably wouldn't hurt to move some common stuff into the lib file.
   2343 
   2344 3) I've used the %text hash and written an english lang file, but
   2345 I am mono-lingual so no other language support as yet.
   2346 
   2347 4) for reasons unknown to me, the icon does not appear properly
   2348 on the servers page of webmin (at least it doesn't for me!)
   2349 
   2350 5) icons have been shamelessly stolen from the ipfilter module,
   2351 specifically the up and down arrows.
   2352 
   2353 6) if you delete an item, the config file will contain
   2354 an otherwise empty, but commented line. This means that if
   2355 you add some new stuff, then delete it, the config file
   2356 will have a number of lines at the end that are just comments.
   2357 Therefore, the config file could possibly grow quite large.
   2358 
   2359 7) NO INCLUDE FILES!
   2360 if you use an include file, it'll be flagged as an error. 
   2361 OK if the include file line is commented out though.
   2362 
   2363 8) deprecated lines not supported (eg user and group) - they
   2364 may produce an error! (user and group don't, but you can't change
   2365 them)
   2366 
   2367 IOW, it works, it's just not very elegant and not very robust.
   2368 
   2369 Hope you find it useful though - I do, as I prevents me having to ever
   2370 wade through the config file and man pages again.
   2371 
   2372 If you modify it, or add a language file, and you have a spare moment,
   2373 please e-mail me - I won't be upset at all if you fix my poor coding!
   2374 (rather the opposite - I'd be pleased someone found it usefull)
   2375 
   2376 Cheers,
   2377 	Neil Fisher <neil (a] magnecor.com.au>
   2378 dnsmasq/iface_edit_apply.cgi0000755000000000000000000000304010512633233015165 0ustar  rootroot#!/usr/bin/perl
   2379 #
   2380 #    DNSMasq Webmin Module - iface_edit_apply.cgi; do the update      
   2381 #    Copyright (C) 2006 by Neil Fisher
   2382 #    
   2383 #    This program is free software; you can redistribute it and/or modify
   2384 #    it under the terms of the GNU General Public License as published by
   2385 #    the Free Software Foundation; either version 2 of the License, or
   2386 #    (at your option) any later version.
   2387 #
   2388 #    This program is distributed in the hope that it will be useful,
   2389 #    but WITHOUT ANY WARRANTY; without even the implied warranty of
   2390 #    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   2391 #    GNU General Public License for more details.
   2392 #
   2393 #    This module inherited from the Webmin Module Template 0.79.1 by tn
   2394 
   2395 do '../web-lib.pl';
   2396 do '../ui-lib.pl';
   2397 do 'dnsmasq-lib.pl';
   2398 
   2399 $|=1;
   2400 &init_config("DNSMasq");
   2401 
   2402 %access=&get_module_acl;
   2403 
   2404 ## put in ACL checks here if needed
   2405 
   2406 
   2407 ## sanity checks
   2408 
   2409 
   2410 ## Insert Output code here
   2411 # read config file
   2412 $config_file = &read_file_lines( $config{config_file} );
   2413 # pass into data structure
   2414 &parse_config_file( \%config, \$config_file );
   2415 # read posted data
   2416 &ReadParse();
   2417 # check for errors in read config
   2418 if( $config{errors} > 0 )
   2419 {
   2420 	my $line = "error.cgi?line=xx&type=".$text{err_configbad};
   2421 	&redirect( $line );
   2422 	exit;
   2423 }
   2424 # adjust everything to what we got
   2425 #
   2426 my $line="interface=".$in{iface};
   2427 &update( $config{interface}[$in{idx}]{line}, $line,
   2428 	$config_file, ( $in{used} == 1 ) );
   2429 #
   2430 # write file!!
   2431 &flush_file_lines();
   2432 #
   2433 # re-load basic page
   2434 &redirect( "iface.cgi" );
   2435 
   2436 # 
   2437 # sub-routines
   2438 #
   2439 ### END of iface_edit_apply.cgi ###.
   2440 dnsmasq/xiface_edit_apply.cgi0000755000000000000000000000305510512640306015362 0ustar  rootroot#!/usr/bin/perl
   2441 #
   2442 #    DNSMasq Webmin Module - xiface_edit_apply.cgi; do the update      
   2443 #    Copyright (C) 2006 by Neil Fisher
   2444 #    
   2445 #    This program is free software; you can redistribute it and/or modify
   2446 #    it under the terms of the GNU General Public License as published by
   2447 #    the Free Software Foundation; either version 2 of the License, or
   2448 #    (at your option) any later version.
   2449 #
   2450 #    This program is distributed in the hope that it will be useful,
   2451 #    but WITHOUT ANY WARRANTY; without even the implied warranty of
   2452 #    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   2453 #    GNU General Public License for more details.
   2454 #
   2455 #    This module inherited from the Webmin Module Template 0.79.1 by tn
   2456 
   2457 do '../web-lib.pl';
   2458 do '../ui-lib.pl';
   2459 do 'dnsmasq-lib.pl';
   2460 
   2461 $|=1;
   2462 &init_config("DNSMasq");
   2463 
   2464 %access=&get_module_acl;
   2465 
   2466 ## put in ACL checks here if needed
   2467 
   2468 
   2469 ## sanity checks
   2470 
   2471 
   2472 ## Insert Output code here
   2473 # read config file
   2474 $config_file = &read_file_lines( $config{config_file} );
   2475 # pass into data structure
   2476 &parse_config_file( \%config, \$config_file );
   2477 # read posted data
   2478 &ReadParse();
   2479 # check for errors in read config
   2480 if( $config{errors} > 0 )
   2481 {
   2482 	my $line = "error.cgi?line=xx&type=".$text{err_configbad};
   2483 	&redirect( $line );
   2484 	exit;
   2485 }
   2486 # adjust everything to what we got
   2487 #
   2488 my $line="except-interface=".$in{iface};
   2489 &update( $config{ex_interface}[$in{idx}]{line}, $line,
   2490 	$config_file, ( $in{used} == 1 ) );
   2491 #
   2492 # write file!!
   2493 &flush_file_lines();
   2494 #
   2495 # re-load basic page
   2496 &redirect( "iface.cgi" );
   2497 
   2498 # 
   2499 # sub-routines
   2500 #
   2501 ### END of _xiface_edit_apply.cgi ###.
   2502 dnsmasq/listen_edit_apply.cgi0000755000000000000000000000332510512642154015424 0ustar  rootroot#!/usr/bin/perl
   2503 #
   2504 #    DNSMasq Webmin Module - listen_edit_apply.cgi; do the update      
   2505 #    Copyright (C) 2006 by Neil Fisher
   2506 #    
   2507 #    This program is free software; you can redistribute it and/or modify
   2508 #    it under the terms of the GNU General Public License as published by
   2509 #    the Free Software Foundation; either version 2 of the License, or
   2510 #    (at your option) any later version.
   2511 #
   2512 #    This program is distributed in the hope that it will be useful,
   2513 #    but WITHOUT ANY WARRANTY; without even the implied warranty of
   2514 #    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   2515 #    GNU General Public License for more details.
   2516 #
   2517 #    This module inherited from the Webmin Module Template 0.79.1 by tn
   2518 
   2519 do '../web-lib.pl';
   2520 do '../ui-lib.pl';
   2521 do 'dnsmasq-lib.pl';
   2522 
   2523 $|=1;
   2524 &init_config("DNSMasq");
   2525 
   2526 %access=&get_module_acl;
   2527 
   2528 ## put in ACL checks here if needed
   2529 
   2530 
   2531 ## sanity checks
   2532 
   2533 
   2534 ## Insert Output code here
   2535 # read config file
   2536 $config_file = &read_file_lines( $config{config_file} );
   2537 # pass into data structure
   2538 &parse_config_file( \%config, \$config_file );
   2539 # read posted data
   2540 &ReadParse();
   2541 # check for errors in read config
   2542 if( $config{errors} > 0 )
   2543 {
   2544 	my $line= "error.cgi?line=x&type=".$text{listen_addr};
   2545 	&redirect( $line );
   2546 	exit;
   2547 }
   2548 # check for input data errors
   2549 if( $in{addr} !~ /^$IPADDR$/ )
   2550 {
   2551 	my $line= "error.cgi?line=".$text{listen_addr};
   2552 	$line .= "&type=".$text{err_notip};
   2553 	&redirect( $line );
   2554 	exit;
   2555 }
   2556 # adjust everything to what we got
   2557 #
   2558 my $line="listen-address=".$in{addr};
   2559 &update( $config{listen_on}[$in{idx}]{line}, $line,
   2560 	$config_file, ( $in{used} == 1 ) );
   2561 #
   2562 # write file!!
   2563 &flush_file_lines();
   2564 #
   2565 # re-load basic page
   2566 &redirect( "iface.cgi" );
   2567 
   2568 # 
   2569 # sub-routines
   2570 #
   2571 ### END of listen_edit_apply.cgi ###.
   2572 dnsmasq/range_edit_apply.cgi0000755000000000000000000000535210512642203015217 0ustar  rootroot#!/usr/bin/perl
   2573 #
   2574 #    DNSMasq Webmin Module - range_edit_apply.cgi; do the update      
   2575 #    Copyright (C) 2006 by Neil Fisher
   2576 #    
   2577 #    This program is free software; you can redistribute it and/or modify
   2578 #    it under the terms of the GNU General Public License as published by
   2579 #    the Free Software Foundation; either version 2 of the License, or
   2580 #    (at your option) any later version.
   2581 #
   2582 #    This program is distributed in the hope that it will be useful,
   2583 #    but WITHOUT ANY WARRANTY; without even the implied warranty of
   2584 #    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   2585 #    GNU General Public License for more details.
   2586 #
   2587 #    This module inherited from the Webmin Module Template 0.79.1 by tn
   2588 
   2589 do '../web-lib.pl';
   2590 do '../ui-lib.pl';
   2591 do 'dnsmasq-lib.pl';
   2592 
   2593 $|=1;
   2594 &init_config("DNSMasq");
   2595 
   2596 %access=&get_module_acl;
   2597 
   2598 ## put in ACL checks here if needed
   2599 
   2600 
   2601 ## sanity checks
   2602 
   2603 
   2604 ## Insert Output code here
   2605 # read config file
   2606 $config_file = &read_file_lines( $config{config_file} );
   2607 # pass into data structure
   2608 &parse_config_file( \%config, \$config_file );
   2609 # read posted data
   2610 &ReadParse();
   2611 # check for errors in read config
   2612 if( $config{errors} > 0 )
   2613 {
   2614 	my $line = "error.cgi?line=xx&type=".$text{err_configbad};
   2615 	&redirect( $line );
   2616 	exit;
   2617 }
   2618 # check for input data errors
   2619 if( $in{from} !~ /^$IPADDR$/ )
   2620 {
   2621 	my $line = "error.cgi?line=".$text{forced_from};
   2622 	$line .= "&type=".$text{err_notip};
   2623 	&redirect( $line );
   2624 	exit;
   2625 }
   2626 if( $in{to} !~ /^$IPADDR$/ )
   2627 {
   2628 	my $line = "error.cgi?line=".$text{forced_ip};
   2629 	$line .= "&type=".$text{err_notip};
   2630 	&redirect( $line );
   2631 	exit;
   2632 }
   2633 if( ($in{masked}) && ($in{mask} !~ /^$IPADDR$/) )
   2634 {
   2635 	my $line = "error.cgi?line=".$text{forced_mask};
   2636 	$line .= "&type=".$text{err_notmask};
   2637 	&redirect( $line );
   2638 	exit;
   2639 }
   2640 if( ($in{timed}) && ($in{'time'} !~ /^$TIME$/) )
   2641 {
   2642 	my $line = "error.cgi?line=".$text{leasetime};
   2643 	$line .= "&type=".$text{err_nottime};
   2644 	&redirect( $line );
   2645 	exit;
   2646 }
   2647 # adjust everything to what we got
   2648 #
   2649 my $line="dhcp-range=";
   2650 $line .= $in{id}."," if $in{ided};
   2651 $line .= $in{from}.",".$in{to};
   2652 $line .= $in{mask} if $in{masked};
   2653 $line .= $in{'time'} if $in{timed};
   2654 &update( $config{dhcp_range}[$in{idx}]{line}, $line,
   2655 	$config_file, ( $in{used} == 1 ) );
   2656 #
   2657 # write file!!
   2658 &flush_file_lines();
   2659 #
   2660 # re-load basic page
   2661 &redirect( "dhcp.cgi" );
   2662 
   2663 # 
   2664 # sub-routines
   2665 #
   2666 ### END of range_edit_apply.cgi ###.
   2667 # adjust everything to what we got
   2668 #
   2669 my $line="dhcp-range=";
   2670 $line .= $in{id}."," if $in{ided};
   2671 $line .= $in{from}.",".$in{to};
   2672 $line .= $in{mask} if $in{masked};
   2673 $line .= $in{'time'} if $in{timed};
   2674 &update( $config{dhcp_range}[$in{idx}]{line}, $line,
   2675 	$config_file, ( $in{used} == 1 ) );
   2676 #
   2677 # write file!!
   2678 &flush_file_lines();
   2679 #
   2680 # re-load basic page
   2681 &redirect( "dhcp.cgi" );
   2682 
   2683 # 
   2684 # sub-routines
   2685 #
   2686 ### END of range_edit_apply.cgi ###.
   2687 dnsmasq/host_edit.cgi0000755000000000000000000000405710512351537013703 0ustar  rootroot#!/usr/bin/perl
   2688 #
   2689 #    DNSMasq Webmin Module - host_edit.cgi;  edit DHCP host
   2690 #        Copyright (C) 2006 by Neil Fisher
   2691 #    
   2692 #    This program is free software; you can redistribute it and/or modify
   2693 #    it under the terms of the GNU General Public License as published by
   2694 #    the Free Software Foundation; either version 2 of the License, or
   2695 #    (at your option) any later version.
   2696 #
   2697 #    This program is distributed in the hope that it will be useful,
   2698 #    but WITHOUT ANY WARRANTY; without even the implied warranty of
   2699 #    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   2700 #    GNU General Public License for more details.
   2701 #
   2702 #    This module inherited from the Webmin Module Template 0.79.1 by tn
   2703 
   2704 do '../web-lib.pl';
   2705 do '../ui-lib.pl';
   2706 do 'dnsmasq-lib.pl';
   2707 
   2708 $|=1;
   2709 &init_config("DNSMasq");
   2710 
   2711 %access=&get_module_acl;
   2712 
   2713 ## put in ACL checks here if needed
   2714 
   2715 
   2716 ## sanity checks
   2717 
   2718 
   2719 ## Insert Output code here
   2720 # read config file
   2721 $config_file = &read_file_lines( $config{config_file} );
   2722 # pass into data structure
   2723 &parse_config_file( \%config, \$config_file );
   2724 # read posted data
   2725 &ReadParse();
   2726 # check for errors in read config
   2727 if( $config{errors} > 0 )
   2728 {
   2729 	&header( "DNSMasq settings", "" );
   2730 	print "<hr><h2>";
   2731 	print $text{warn_errors};
   2732 	print $config{errors};
   2733 	print $text{didnt_apply};
   2734 	print "</h3><hr>\n";
   2735 	&footer( "/", $text{'index'});
   2736 	exit;
   2737 }
   2738 # adjust everything to what we got
   2739 #
   2740 &header( "DNSMasq settings", "" );
   2741 print "<h2>".$text{edit_host}."</h2>";
   2742 print &ui_form_start( "host_edit_apply.cgi", "post" );
   2743 print &ui_hidden( "idx", $in{idx} );
   2744 print "<br>".$text{in_use}.&ui_yesno_radio( "used",
   2745 				($config{dhcp_host}[$in{idx}]{used})?1:0 );
   2746 print "<br>".$text{host_spec};
   2747 print &ui_textbox( "host", $config{dhcp_host}[$in{idx}]{option}, 80 );
   2748 print "<br><br>" . &ui_submit( $text{'save_button'} )."<br>";
   2749 print &ui_form_end();
   2750 print "<a href=delete.cgi?idx=".$in{idx}."&what=dhcp_host&where=dhcp.cgi".
   2751 	">".$text{delet}."</a>";
   2752 print "<br><a href=dhcp.cgi>".$text{DHCP_settings}."</a>";
   2753 &footer( "/", $text{'index'});
   2754 #
   2755 
   2756 # 
   2757 # sub-routines
   2758 #
   2759 ### END of host_edit.cgi ###.
   2760 dnsmasq/range_edit.cgi0000755000000000000000000000541310512347165014021 0ustar  rootroot#!/usr/bin/perl
   2761 #
   2762 #    DNSMasq Webmin Module - range_edit.cgi;  DHCP range edit
   2763 #    Copyright (C) 2006 by Neil Fisher
   2764 #    
   2765 #    This program is free software; you can redistribute it and/or modify
   2766 #    it under the terms of the GNU General Public License as published by
   2767 #    the Free Software Foundation; either version 2 of the License, or
   2768 #    (at your option) any later version.
   2769 #
   2770 #    This program is distributed in the hope that it will be useful,
   2771 #    but WITHOUT ANY WARRANTY; without even the implied warranty of
   2772 #    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   2773 #    GNU General Public License for more details.
   2774 #
   2775 #    This module inherited from the Webmin Module Template 0.79.1 by tn
   2776 
   2777 do '../web-lib.pl';
   2778 do '../ui-lib.pl';
   2779 do 'dnsmasq-lib.pl';
   2780 
   2781 $|=1;
   2782 &init_config("DNSMasq");
   2783 
   2784 %access=&get_module_acl;
   2785 
   2786 ## put in ACL checks here if needed
   2787 
   2788 
   2789 ## sanity checks
   2790 
   2791 
   2792 ## Insert Output code here
   2793 # read config file
   2794 $config_file = &read_file_lines( $config{config_file} );
   2795 # pass into data structure
   2796 &parse_config_file( \%config, \$config_file );
   2797 # read posted data
   2798 &ReadParse();
   2799 # check for errors in read config
   2800 if( $config{errors} > 0 )
   2801 {
   2802 	&header( "DNSMasq settings", "" );
   2803 	print "<hr><h2>";
   2804 	print $text{warn_errors};
   2805 	print $config{errors};
   2806 	print $text{didnt_apply};
   2807 	print "</h3><hr>\n";
   2808 	&footer( "/", $text{'index'});
   2809 	exit;
   2810 }
   2811 # adjust everything to what we got
   2812 #
   2813 &header( "DNSMasq settings", "" );
   2814 print "<h2>".$text{range_edit}."</h2>";
   2815 print &ui_form_start( "range_edit_apply.cgi", "post" );
   2816 print &ui_hidden( "idx", $in{idx} );
   2817 print "<br>".$text{in_use}.&ui_yesno_radio( "used",
   2818 				($config{dhcp_range}[$in{idx}]{used})?1:0 );
   2819 print "<br>".$text{ided}.&ui_yesno_radio( "ided", 
   2820 				($config{dhcp_range}[$in{idx}]{id_used})?1:0 );
   2821 print "<br>".$text{id};
   2822 print &ui_textbox( "id", $config{dhcp_range}[$in{idx}]{id}, 50 );
   2823 print "<br>".$text{forced_from};
   2824 print &ui_textbox( "from", $config{dhcp_range}[$in{idx}]{start}, 18 );
   2825 print "<br>".$text{forced_ip};
   2826 print &ui_textbox( "to", $config{dhcp_range}[$in{idx}]{end}, 18 );
   2827 print "<br>".$text{forced_mask_used}.&ui_yesno_radio( "masked", 
   2828 				($config{dhcp_range}[$in{idx}]{mask_used})?1:0 );
   2829 print "<br>".$text{forced_mask};
   2830 print &ui_textbox( "mask", $config{dhcp_range}[$in{idx}]{mask}, 18 );
   2831 print "<br>".$text{timed}.&ui_yesno_radio( "timed", 
   2832 				($config{dhcp_range}[$in{idx}]{time_used})?1:0 );
   2833 print "<br>".$text{leasetime};
   2834 print &ui_textbox( "time", $config{dhcp_range}[$in{idx}]{leasetime}, 18 );
   2835 print "<br><br>" . &ui_submit( $text{'save_button'} )."<br>";
   2836 print &ui_form_end();
   2837 print "<a href=delete.cgi?idx=".$in{idx}."&what=dhcp_range&where=dhcp.cgi".
   2838 		">".$text{delet}."</a>";
   2839 print "<br><a href=dhcp.cgi>".$text{DHCP_settings}."</a>";
   2840 &footer( "/", $text{'index'});
   2841 #
   2842 
   2843 # 
   2844 # sub-routines
   2845 #
   2846 ### END of range_edit.cgi ###.
   2847 dnsmasq/option_edit.cgi0000755000000000000000000000407610512351517014235 0ustar  rootroot#!/usr/bin/perl
   2848 #
   2849 #    DNSMasq Webmin Module - option_edit.cgi;  edit DHCP option
   2850 #        Copyright (C) 2006 by Neil Fisher
   2851 #    
   2852 #    This program is free software; you can redistribute it and/or modify
   2853 #    it under the terms of the GNU General Public License as published by
   2854 #    the Free Software Foundation; either version 2 of the License, or
   2855 #    (at your option) any later version.
   2856 #
   2857 #    This program is distributed in the hope that it will be useful,
   2858 #    but WITHOUT ANY WARRANTY; without even the implied warranty of
   2859 #    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   2860 #    GNU General Public License for more details.
   2861 #
   2862 #    This module inherited from the Webmin Module Template 0.79.1 by tn
   2863 
   2864 do '../web-lib.pl';
   2865 do '../ui-lib.pl';
   2866 do 'dnsmasq-lib.pl';
   2867 
   2868 $|=1;
   2869 &init_config("DNSMasq");
   2870 
   2871 %access=&get_module_acl;
   2872 
   2873 ## put in ACL checks here if needed
   2874 
   2875 
   2876 ## sanity checks
   2877 
   2878 
   2879 ## Insert Output code here
   2880 # read config file
   2881 $config_file = &read_file_lines( $config{config_file} );
   2882 # pass into data structure
   2883 &parse_config_file( \%config, \$config_file );
   2884 # read posted data
   2885 &ReadParse();
   2886 # check for errors in read config
   2887 if( $config{errors} > 0 )
   2888 {
   2889 	&header( "DNSMasq settings", "" );
   2890 	print "<hr><h2>";
   2891 	print $text{warn_errors};
   2892 	print $config{errors};
   2893 	print $text{didnt_apply};
   2894 	print "</h3><hr>\n";
   2895 	&footer( "/", $text{'index'});
   2896 	exit;
   2897 }
   2898 # adjust everything to what we got
   2899 #
   2900 &header( "DNSMasq settings", "" );
   2901 print "<h2>".$text{edit_opt}."</h2>";
   2902 print &ui_form_start( "option_edit_apply.cgi", "post" );
   2903 print &ui_hidden( "idx", $in{idx} );
   2904 print "<br>".$text{in_use}.&ui_yesno_radio( "used",
   2905 				($config{dhcp_option}[$in{idx}]{used})?1:0 );
   2906 print "<br>".$text{option_spec};
   2907 print &ui_textbox( "host", $config{dhcp_option}[$in{idx}]{option}, 80 );
   2908 print "<br><br>" . &ui_submit( $text{'save_button'} )."<br>";
   2909 print &ui_form_end();
   2910 print "<a href=delete.cgi?idx=".$in{idx}."&what=dhcp_option&where=dhcp.cgi".
   2911 	">".$text{delet}."</a>";
   2912 print "<br><a href=dhcp.cgi>".$text{DHCP_settings}."</a>";
   2913 &footer( "/", $text{'index'});
   2914 #
   2915 
   2916 # 
   2917 # sub-routines
   2918 #
   2919 ### END of option_edit.cgi ###.
   2920 dnsmasq/host_edit_apply.cgi0000755000000000000000000000303210512633002015066 0ustar  rootroot#!/usr/bin/perl
   2921 #
   2922 #    DNSMasq Webmin Module - host_edit_apply.cgi; do the update      
   2923 #    Copyright (C) 2006 by Neil Fisher
   2924 #    
   2925 #    This program is free software; you can redistribute it and/or modify
   2926 #    it under the terms of the GNU General Public License as published by
   2927 #    the Free Software Foundation; either version 2 of the License, or
   2928 #    (at your option) any later version.
   2929 #
   2930 #    This program is distributed in the hope that it will be useful,
   2931 #    but WITHOUT ANY WARRANTY; without even the implied warranty of
   2932 #    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   2933 #    GNU General Public License for more details.
   2934 #
   2935 #    This module inherited from the Webmin Module Template 0.79.1 by tn
   2936 
   2937 do '../web-lib.pl';
   2938 do '../ui-lib.pl';
   2939 do 'dnsmasq-lib.pl';
   2940 
   2941 $|=1;
   2942 &init_config("DNSMasq");
   2943 
   2944 %access=&get_module_acl;
   2945 
   2946 ## put in ACL checks here if needed
   2947 
   2948 
   2949 ## sanity checks
   2950 
   2951 
   2952 ## Insert Output code here
   2953 # read config file
   2954 $config_file = &read_file_lines( $config{config_file} );
   2955 # pass into data structure
   2956 &parse_config_file( \%config, \$config_file );
   2957 # read posted data
   2958 &ReadParse();
   2959 # check for errors in read config
   2960 if( $config{errors} > 0 )
   2961 {
   2962 	my $line="error.cgi?line=xx&type=".$text{err_configbad};
   2963 	&redirect( $line );
   2964 	exit;
   2965 }
   2966 # adjust everything to what we got
   2967 #
   2968 my $line="dhcp-host=".$in{host};
   2969 &update( $config{dhcp_host}[$in{idx}]{line}, $line,
   2970 	$config_file, ( $in{used} == 1 ) );
   2971 #
   2972 # write file!!
   2973 &flush_file_lines();
   2974 #
   2975 # re-load basic page
   2976 &redirect( "dhcp.cgi" );
   2977 
   2978 # 
   2979 # sub-routines
   2980 #
   2981 ### END of host_edit_apply.cgi ###.
   2982 dnsmasq/iface_apply.cgi0000755000000000000000000000300210512633156014162 0ustar  rootroot#!/usr/bin/perl
   2983 #
   2984 #    DNSMasq Webmin Module - iface_apply.cgi; do the update      
   2985 #    Copyright (C) 2006 by Neil Fisher
   2986 #    
   2987 #    This program is free software; you can redistribute it and/or modify
   2988 #    it under the terms of the GNU General Public License as published by
   2989 #    the Free Software Foundation; either version 2 of the License, or
   2990 #    (at your option) any later version.
   2991 #
   2992 #    This program is distributed in the hope that it will be useful,
   2993 #    but WITHOUT ANY WARRANTY; without even the implied warranty of
   2994 #    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   2995 #    GNU General Public License for more details.
   2996 #
   2997 #    This module inherited from the Webmin Module Template 0.79.1 by tn
   2998 
   2999 do '../web-lib.pl';
   3000 do '../ui-lib.pl';
   3001 do 'dnsmasq-lib.pl';
   3002 
   3003 $|=1;
   3004 &init_config("DNSMasq");
   3005 
   3006 %access=&get_module_acl;
   3007 
   3008 ## put in ACL checks here if needed
   3009 
   3010 
   3011 ## sanity checks
   3012 
   3013 
   3014 ## Insert Output code here
   3015 # read config file
   3016 $config_file = &read_file_lines( $config{config_file} );
   3017 # pass into data structure
   3018 &parse_config_file( \%config, \$config_file );
   3019 # read posted data
   3020 &ReadParse();
   3021 # check for errors in read config
   3022 if( $config{errors} > 0 )
   3023 {
   3024 	my $line = "error.cgi?line=xx&type=".$text{err_configbad};
   3025 	&redirect( $line );
   3026 	exit;
   3027 }
   3028 # adjust everything to what we got
   3029 #
   3030 &update( $config{bind_interfaces}{line}, "bind-interfaces",
   3031 	$config_file, ( $in{bind_iface} == 1 ) );
   3032 #
   3033 # write file!!
   3034 &flush_file_lines();
   3035 #
   3036 # re-load basic page
   3037 &redirect( "iface.cgi" );
   3038 
   3039 # 
   3040 # sub-routines
   3041 #
   3042 ### END of iface_apply.cgi ###.
   3043 dnsmasq/forced_edit.cgi0000755000000000000000000000423010512324260014152 0ustar  rootroot#!/usr/bin/perl
   3044 #
   3045 #    DNSMasq Webmin Module - forced_edit.cgi;  forced domain response edit
   3046 #    Copyright (C) 2006 by Neil Fisher
   3047 #    
   3048 #    This program is free software; you can redistribute it and/or modify
   3049 #    it under the terms of the GNU General Public License as published by
   3050 #    the Free Software Foundation; either version 2 of the License, or
   3051 #    (at your option) any later version.
   3052 #
   3053 #    This program is distributed in the hope that it will be useful,
   3054 #    but WITHOUT ANY WARRANTY; without even the implied warranty of
   3055 #    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   3056 #    GNU General Public License for more details.
   3057 #
   3058 #    This module inherited from the Webmin Module Template 0.79.1 by tn
   3059 
   3060 do '../web-lib.pl';
   3061 do '../ui-lib.pl';
   3062 do 'dnsmasq-lib.pl';
   3063 
   3064 $|=1;
   3065 &init_config("DNSMasq");
   3066 
   3067 %access=&get_module_acl;
   3068 
   3069 ## put in ACL checks here if needed
   3070 
   3071 
   3072 ## sanity checks
   3073 
   3074 
   3075 ## Insert Output code here
   3076 # read config file
   3077 $config_file = &read_file_lines( $config{config_file} );
   3078 # pass into data structure
   3079 &parse_config_file( \%config, \$config_file );
   3080 # read posted data
   3081 &ReadParse();
   3082 # check for errors in read config
   3083 if( $config{errors} > 0 )
   3084 {
   3085 	&header( "DNSMasq settings", "" );
   3086 	print "<hr><h2>";
   3087 	print $text{warn_errors};
   3088 	print $config{errors};
   3089 	print $text{didnt_apply};
   3090 	print "</h3><hr>\n";
   3091 	&footer( "/", $text{'index'});
   3092 	exit;
   3093 }
   3094 # adjust everything to what we got
   3095 #
   3096 &header( "DNSMasq settings", "" );
   3097 print "<h2>".$text{forced}."</h2>";
   3098 print &ui_form_start( "forced_edit_apply.cgi", "post" );
   3099 print &ui_hidden( "idx", $in{idx} );
   3100 print $text{forced_domain}. &ui_textbox( "domain", 
   3101 					$config{forced}[$in{idx}]{domain}, 50 );
   3102 print "<br>";
   3103 print $text{forced_ip}. &ui_textbox( "to", 
   3104 					$config{forced}[$in{idx}]{addr}, 15 );
   3105 print "<br>".$text{in_use}.&ui_yesno_radio( "used",
   3106 				($config{forced}[$in{idx}]{used})?1:0 );
   3107 print "<br><br>" . &ui_submit( $text{'save_button'} )."<br>";
   3108 print &ui_form_end();
   3109 print "<a href=delete.cgi?idx=".$in{idx}."&what=forced&where=alias.cgi".
   3110 	">".$text{delet}."</a>";
   3111 print "<br><a href=alias.cgi>".$text{alias_config}."</a>";
   3112 &footer( "/", $text{'index'});
   3113 #
   3114 
   3115 # 
   3116 # sub-routines
   3117 #
   3118 ### END of forced_edit.cgi ###.
   3119 dnsmasq/alias_edit.cgi0000755000000000000000000000435010512627345014016 0ustar  rootroot#!/usr/bin/perl
   3120 #
   3121 #    DNSMasq Webmin Module - alias_edit.cgi;  IP alias edit
   3122 #    Copyright (C) 2006 by Neil Fisher
   3123 #    
   3124 #    This program is free software; you can redistribute it and/or modify
   3125 #    it under the terms of the GNU General Public License as published by
   3126 #    the Free Software Foundation; either version 2 of the License, or
   3127 #    (at your option) any later version.
   3128 #
   3129 #    This program is distributed in the hope that it will be useful,
   3130 #    but WITHOUT ANY WARRANTY; without even the implied warranty of
   3131 #    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   3132 #    GNU General Public License for more details.
   3133 #
   3134 #    This module inherited from the Webmin Module Template 0.79.1 by tn
   3135 
   3136 do '../web-lib.pl';
   3137 do '../ui-lib.pl';
   3138 do 'dnsmasq-lib.pl';
   3139 
   3140 $|=1;
   3141 &init_config("DNSMasq");
   3142 
   3143 %access=&get_module_acl;
   3144 
   3145 ## put in ACL checks here if needed
   3146 
   3147 
   3148 ## sanity checks
   3149 
   3150 
   3151 ## Insert Output code here
   3152 # read config file
   3153 $config_file = &read_file_lines( $config{config_file} );
   3154 # pass into data structure
   3155 &parse_config_file( \%config, \$config_file );
   3156 # read posted data
   3157 &ReadParse();
   3158 # check for errors in read config
   3159 if( $config{errors} > 0 )
   3160 {
   3161 	my $line="error.cgi?line=xx&type=".$text{err_configbad};
   3162 	&redirect( $line );
   3163 	exit;
   3164 }
   3165 # adjust everything to what we got
   3166 #
   3167 &header( "DNSMasq settings", "" );
   3168 print "<h2>".$text{alias}."</h2>";
   3169 print &ui_form_start( "alias_edit_apply.cgi", "post" );
   3170 print &ui_hidden( "idx", $in{idx} );
   3171 print $text{forced_from}. &ui_textbox( "from", 
   3172 					$config{alias}[$in{idx}]{from}, 15 );
   3173 print "<br>";
   3174 print $text{forced_ip}. &ui_textbox( "to", 
   3175 					$config{alias}[$in{idx}]{to}, 15 );
   3176 print "<br>";
   3177 print $text{forced_mask_used}. &ui_yesno_radio( "mask",
   3178 				($config{alias}[$in{idx}]{netmask_used})?1:0 );
   3179 print $text{forced_mask}. &ui_textbox( "netmask",
   3180 				$config{alias}[$in{idx}]{netmask}, 15 );
   3181 print "<br>".$text{in_use}.&ui_yesno_radio( "used",
   3182 				($config{forced}[$in{idx}]{used})?1:0 );
   3183 print "<br><br>" . &ui_submit( $text{'save_button'} )."<br>";
   3184 print &ui_form_end();
   3185 print "<a href=delete.cgi?idx=".$in{idx}."&what=alias&where=alias.cgi".
   3186 	">".$text{delet}."</a>";
   3187 print "<br><a href=alias.cgi>".$text{alias_config}."</a>";
   3188 &footer( "/", $text{'index'});
   3189 #
   3190 
   3191 # 
   3192 # sub-routines
   3193 #
   3194 ### END of alias_edit.cgi ###.
   3195 dnsmasq/option_edit_apply.cgi0000755000000000000000000000304010512633571015433 0ustar  rootroot#!/usr/bin/perl
   3196 #
   3197 #    DNSMasq Webmin Module - option_edit_apply.cgi; do the update      
   3198 #    Copyright (C) 2006 by Neil Fisher
   3199 #    
   3200 #    This program is free software; you can redistribute it and/or modify
   3201 #    it under the terms of the GNU General Public License as published by
   3202 #    the Free Software Foundation; either version 2 of the License, or
   3203 #    (at your option) any later version.
   3204 #
   3205 #    This program is distributed in the hope that it will be useful,
   3206 #    but WITHOUT ANY WARRANTY; without even the implied warranty of
   3207 #    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   3208 #    GNU General Public License for more details.
   3209 #
   3210 #    This module inherited from the Webmin Module Template 0.79.1 by tn
   3211 
   3212 do '../web-lib.pl';
   3213 do '../ui-lib.pl';
   3214 do 'dnsmasq-lib.pl';
   3215 
   3216 $|=1;
   3217 &init_config("DNSMasq");
   3218 
   3219 %access=&get_module_acl;
   3220 
   3221 ## put in ACL checks here if needed
   3222 
   3223 
   3224 ## sanity checks
   3225 
   3226 
   3227 ## Insert Output code here
   3228 # read config file
   3229 $config_file = &read_file_lines( $config{config_file} );
   3230 # pass into data structure
   3231 &parse_config_file( \%config, \$config_file );
   3232 # read posted data
   3233 &ReadParse();
   3234 # check for errors in read config
   3235 if( $config{errors} > 0 )
   3236 {
   3237 	my $line= "error.cgi?line=x&type=".$text{listen_addr};
   3238 	&redirect( $line );
   3239 	exit;
   3240 }
   3241 # adjust everything to what we got
   3242 #
   3243 my $line="dhcp-option=".$in{host};
   3244 &update( $config{dhcp_option}[$in{idx}]{line}, $line,
   3245 	$config_file, ( $in{used} == 1 ) );
   3246 #
   3247 # write file!!
   3248 &flush_file_lines();
   3249 #
   3250 # re-load basic page
   3251 &redirect( "dhcp.cgi" );
   3252 
   3253 # 
   3254 # sub-routines
   3255 #
   3256 ### END of option_edit_apply.cgi ###.
   3257 dnsmasq/basic_apply.cgi0000755000000000000000000000720010512642037014176 0ustar  rootroot#!/usr/bin/perl
   3258 #
   3259 #    DNSMasq Webmin Module - dns_apply.cgi; update basic DNS info     
   3260 #    Copyright (C) 2006 by Neil Fisher
   3261 #    
   3262 #    This program is free software; you can redistribute it and/or modify
   3263 #    it under the terms of the GNU General Public License as published by
   3264 #    the Free Software Foundation; either version 2 of the License, or
   3265 #    (at your option) any later version.
   3266 #
   3267 #    This program is distributed in the hope that it will be useful,
   3268 #    but WITHOUT ANY WARRANTY; without even the implied warranty of
   3269 #    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   3270 #    GNU General Public License for more details.
   3271 #
   3272 #    This module inherited from the Webmin Module Template 0.79.1 by tn
   3273 
   3274 do '../web-lib.pl';
   3275 do '../ui-lib.pl';
   3276 do 'dnsmasq-lib.pl';
   3277 
   3278 $|=1;
   3279 &init_config("DNSMasq");
   3280 
   3281 %access=&get_module_acl;
   3282 
   3283 ## put in ACL checks here if needed
   3284 
   3285 
   3286 ## sanity checks
   3287 
   3288 
   3289 ## Insert Output code here
   3290 # read config file
   3291 $config_file = &read_file_lines( $config{config_file} );
   3292 # pass into data structure
   3293 &parse_config_file( \%config, \$config_file );
   3294 # read posted data
   3295 &ReadParse();
   3296 # check for errors in read config
   3297 if( $config{errors} > 0 )
   3298 {
   3299 	my $line = "error.cgi?line=xx&type=".$text{err_configbad};
   3300 	&redirect( $line );
   3301 	exit;
   3302 }
   3303 # check user input for obvious errors
   3304 if( $in{local_domain} !~ /^$FILE$/ )
   3305 {
   3306 	my $line = "error.cgi?line=".$text{local_domain};
   3307 	$line .= "&type=".$text{err_domainbad};
   3308 	&redirect( $line );
   3309 	exit;
   3310 }
   3311 if( ($in{xhosts}) && ($in{addn_hosts} !~ /^$FILE$/) )
   3312 {
   3313 	my $line = "error.cgi?line=".$text{xhostsfile};
   3314 	$line .= "&type=".$text{err_filebad};
   3315 	&redirect( $line );
   3316 	exit;
   3317 }
   3318 if( ($in{cache_size}) && ($in{cust_cache_size} !~ /^$NUMBER/) )
   3319 {
   3320 	my $line = "error.cgi?line=".$text{cust_cache_size};
   3321 	$line .= "&type=".$text{err_numbbad};
   3322 	&redirect( $line );
   3323 	exit;
   3324 }
   3325 if( ($in{local_ttl}) && ($in{ttl} !~ /^$NUMBER/) )
   3326 {
   3327 	my $line = "error.cgi?line=".$text{ttl};
   3328 	$line .= "&type=".$text{err_numbbad};
   3329 	&redirect( $line );
   3330 	exit;
   3331 }
   3332 # adjust everything to what we got
   3333 
   3334 #
   3335 #our local domain
   3336 #
   3337 &update( $config{domain}{line}, "domain=".$in{local_domain}, 
   3338 	$config_file, 1 );
   3339 #
   3340 # need domains for forwarded lookups?
   3341 # 
   3342 &update( $config{domain_needed}{line}, "domain-needed", 
   3343 	$config_file, ( $in{domain_needed} == 1 ) );
   3344 
   3345 #
   3346 # add local domain to local hosts?
   3347 # 
   3348 &update( $config{expand_hosts}{line}, "expand-hosts", 
   3349 	$config_file, ( $in{expand_hosts} == 1 ) );
   3350 #
   3351 # reverse lookups of local subnets propogating?
   3352 # 
   3353 # NOTE: reversed logic in question!
   3354 &update( $config{bogus_priv}{line}, "bogus-priv", 
   3355 	$config_file, ( $in{bogus_priv} == 0 ) );
   3356 #
   3357 # reverse lookups of local subnets propogating?
   3358 # 
   3359 &update( $config{filterwin2k}{line}, "filterwin2k", 
   3360 	$config_file, ( $in{filterwin2k} == 1 ) );
   3361 #
   3362 # read /etc/hosts?
   3363 # 
   3364 #  NOTE: reverse logic in config file
   3365 &update( $config{no_hosts}{line}, "no-hosts", 
   3366 	$config_file, ( $in{hosts} == 0 ) );
   3367 #
   3368 # read extra hosts file?
   3369 # 
   3370 &update( $config{addn_hosts}{line}, "addn-hosts=".$in{addn_hosts}, 
   3371 	$config_file, ( $in{xhosts} == 1 ) );
   3372 #
   3373 # negative caching?
   3374 # 
   3375 # NOTE: reverse logic in config file
   3376 &update( $config{neg_cache}{line}, "no-negcache", 
   3377 	$config_file, ( $in{neg_cache} == 0 ) );
   3378 #
   3379 # custom cache size?
   3380 # 
   3381 &update( $config{cache_size}{line}, "cache-size=".$in{cust_cache_size}, 
   3382 	$config_file, ( $in{cache_size} == 1 ) );
   3383 #
   3384 # log all lookups?
   3385 # 
   3386 &update( $config{log_queries}{line}, "log-queries", 
   3387 	$config_file, ( $in{log_queries} == 1 ) );
   3388 #
   3389 # cache size?
   3390 # 
   3391 &update( $config{local_ttl}{line}, "local-ttl=".$in{ttl}, 
   3392 	$config_file, ( $in{local_ttl} == 1) );
   3393 #
   3394 #
   3395 #
   3396 # write file!!
   3397 &flush_file_lines();
   3398 #
   3399 # re-load basic page
   3400 &redirect( "index.cgi" );
   3401 
   3402 # 
   3403 # sub-routines
   3404 #
   3405 ### END of dns_apply.cgi ###.
   3406 dnsmasq/alias_edit_apply.cgi0000755000000000000000000000407310512641777015232 0ustar  rootroot#!/usr/bin/perl
   3407 #
   3408 #    DNSMasq Webmin Module - alias_edit_apply.cgi; do the update      
   3409 #    Copyright (C) 2006 by Neil Fisher
   3410 #    
   3411 #    This program is free software; you can redistribute it and/or modify
   3412 #    it under the terms of the GNU General Public License as published by
   3413 #    the Free Software Foundation; either version 2 of the License, or
   3414 #    (at your option) any later version.
   3415 #
   3416 #    This program is distributed in the hope that it will be useful,
   3417 #    but WITHOUT ANY WARRANTY; without even the implied warranty of
   3418 #    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   3419 #    GNU General Public License for more details.
   3420 #
   3421 #    This module inherited from the Webmin Module Template 0.79.1 by tn
   3422 
   3423 do '../web-lib.pl';
   3424 do '../ui-lib.pl';
   3425 do 'dnsmasq-lib.pl';
   3426 
   3427 $|=1;
   3428 &init_config("DNSMasq");
   3429 
   3430 %access=&get_module_acl;
   3431 
   3432 ## put in ACL checks here if needed
   3433 
   3434 
   3435 ## sanity checks
   3436 
   3437 
   3438 ## Insert Output code here
   3439 # read config file
   3440 $config_file = &read_file_lines( $config{config_file} );
   3441 # pass into data structure
   3442 &parse_config_file( \%config, \$config_file );
   3443 # read posted data
   3444 &ReadParse();
   3445 # check for errors in read config
   3446 if( $config{errors} > 0 )
   3447 {
   3448 	my $line="error.cgi?line=xx&type=".$text{err_configbad};
   3449 	&redirect( $line );
   3450 	exit;
   3451 }
   3452 # check user input for obvious errors
   3453 if( $in{from} !~ /^$IPADDR$/ )
   3454 {
   3455 	my $line="error.cgi?line=".$text{forced_from};
   3456 	$line .= "&type=".$text{err_notip};
   3457 	&redirect( $line );
   3458 	exit;
   3459 }
   3460 if( $in{to} !~ /^$IPADDR$/ )
   3461 {
   3462 	my $line="error.cgi?line=".$text{forced_ip};
   3463 	$line .= "&type=".$text{err_notip};
   3464 	&redirect( $line );
   3465 	exit;
   3466 }
   3467 if( ($in{mask}) && ($in{netmask} !~ /^$IPADDR$/) )
   3468 {
   3469 	my $line="error.cgi?line=".$text{forced_mask};
   3470 	$line .= "&type=".$text{err_notip};
   3471 	&redirect( $line );
   3472 	exit;
   3473 }
   3474 # adjust everything to what we got
   3475 #
   3476 my $line="alias=".$in{from}.",".$in{to};
   3477 $line .= ",".$in{netmask} if $in{mask};
   3478 &update( $config{alias}[$in{idx}]{line}, $line,
   3479 	$config_file, ( $in{used} == 1 ) );
   3480 #
   3481 # write file!!
   3482 &flush_file_lines();
   3483 #
   3484 # re-load basic page
   3485 &redirect( "alias.cgi" );
   3486 
   3487 # 
   3488 # sub-routines
   3489 #
   3490 ### END of alias_edit_apply.cgi ###.
   3491 dnsmasq/forced_edit_apply.cgi0000755000000000000000000000357110512642101015363 0ustar  rootroot#!/usr/bin/perl
   3492 #
   3493 #    DNSMasq Webmin Module - forced_edit_apply.cgi; do the update      
   3494 #    Copyright (C) 2006 by Neil Fisher
   3495 #    
   3496 #    This program is free software; you can redistribute it and/or modify
   3497 #    it under the terms of the GNU General Public License as published by
   3498 #    the Free Software Foundation; either version 2 of the License, or
   3499 #    (at your option) any later version.
   3500 #
   3501 #    This program is distributed in the hope that it will be useful,
   3502 #    but WITHOUT ANY WARRANTY; without even the implied warranty of
   3503 #    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   3504 #    GNU General Public License for more details.
   3505 #
   3506 #    This module inherited from the Webmin Module Template 0.79.1 by tn
   3507 
   3508 do '../web-lib.pl';
   3509 do '../ui-lib.pl';
   3510 do 'dnsmasq-lib.pl';
   3511 
   3512 $|=1;
   3513 &init_config("DNSMasq");
   3514 
   3515 %access=&get_module_acl;
   3516 
   3517 ## put in ACL checks here if needed
   3518 
   3519 
   3520 ## sanity checks
   3521 
   3522 
   3523 ## Insert Output code here
   3524 # read config file
   3525 $config_file = &read_file_lines( $config{config_file} );
   3526 # pass into data structure
   3527 &parse_config_file( \%config, \$config_file );
   3528 # read posted data
   3529 &ReadParse();
   3530 # check for errors in read config
   3531 if( $config{errors} > 0 )
   3532 {
   3533 	my $line="error.cgi?line=xx&type=".$text{err_configbad};
   3534 	&redirect( $line );
   3535 	exit;
   3536 }
   3537 # check for input data errors
   3538 if( $in{domain} !~ /^$NAME$/ )
   3539 {
   3540 	my $line="error.cgi?line=".$text{forced_domain};
   3541 	$line .= "&type=".$text{err_domainbad};
   3542 	&redirect( $line );
   3543 	exit;
   3544 }
   3545 if( $in{to} !~ /^$IPADDR$/ )
   3546 {
   3547 	my $line="error.cgi?line=".$text{forced_domain};
   3548 	$line .= "&type=".$text{err_domainbad};
   3549 	&redirect( $line );
   3550 	exit;
   3551 }
   3552 # adjust everything to what we got
   3553 #
   3554 my $line="address=/".$in{domain}."/".$in{to};
   3555 &update( $config{forced}[$in{idx}]{line}, $line,
   3556 	$config_file, ( $in{used} == 1 ) );
   3557 #
   3558 # write file!!
   3559 &flush_file_lines();
   3560 #
   3561 # re-load basic page
   3562 &redirect( "alias.cgi" );
   3563 
   3564 # 
   3565 # sub-routines
   3566 #
   3567 ### END of forced_edit_apply.cgi ###.
   3568 dnsmasq/nx_edit_apply.cgi0000755000000000000000000000331110512642170014544 0ustar  rootroot#!/usr/bin/perl
   3569 #
   3570 #    DNSMasq Webmin Module - nx_edit_apply.cgi; do the update      
   3571 #    Copyright (C) 2006 by Neil Fisher
   3572 #    
   3573 #    This program is free software; you can redistribute it and/or modify
   3574 #    it under the terms of the GNU General Public License as published by
   3575 #    the Free Software Foundation; either version 2 of the License, or
   3576 #    (at your option) any later version.
   3577 #
   3578 #    This program is distributed in the hope that it will be useful,
   3579 #    but WITHOUT ANY WARRANTY; without even the implied warranty of
   3580 #    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   3581 #    GNU General Public License for more details.
   3582 #
   3583 #    This module inherited from the Webmin Module Template 0.79.1 by tn
   3584 
   3585 do '../web-lib.pl';
   3586 do '../ui-lib.pl';
   3587 do 'dnsmasq-lib.pl';
   3588 
   3589 $|=1;
   3590 &init_config("DNSMasq");
   3591 
   3592 %access=&get_module_acl;
   3593 
   3594 ## put in ACL checks here if needed
   3595 
   3596 
   3597 ## sanity checks
   3598 
   3599 
   3600 ## Insert Output code here
   3601 # read config file
   3602 $config_file = &read_file_lines( $config{config_file} );
   3603 # pass into data structure
   3604 &parse_config_file( \%config, \$config_file );
   3605 # read posted data
   3606 &ReadParse();
   3607 # check for errors in read config
   3608 if( $config{errors} > 0 )
   3609 {
   3610 	my $line= "error.cgi?line=x&type=".$text{listen_addr};
   3611 	&redirect( $line );
   3612 	exit;
   3613 }
   3614 # check for input data errors
   3615 if( $in{from} !~ /^$IPADDR$/ )
   3616 {
   3617 	my $line= "error.cgi?line=".$text{forced_from};
   3618 	$line .= "&type=".$text{err_notip};
   3619 	&redirect( $line );
   3620 	exit;
   3621 }
   3622 # adjust everything to what we got
   3623 #
   3624 my $line="bogus-nxdomain=".$in{from};
   3625 &update( $config{bogus}[$in{idx}]{line}, $line,
   3626 	$config_file, ( $in{used} == 1 ) );
   3627 #
   3628 # write file!!
   3629 &flush_file_lines();
   3630 #
   3631 # re-load basic page
   3632 &redirect( "alias.cgi" );
   3633 
   3634 # 
   3635 # sub-routines
   3636 #
   3637 ### END of nx_edit_apply.cgi ###.
   3638 dnsmasq/user_edit.cgi0000755000000000000000000000417110512343452013676 0ustar  rootroot#!/usr/bin/perl
   3639 #
   3640 #    DNSMasq Webmin Module - vend_edit.cgi;  edit user class
   3641 #    Copyright (C) 2006 by Neil Fisher
   3642 #    
   3643 #    This program is free software; you can redistribute it and/or modify
   3644 #    it under the terms of the GNU General Public License as published by
   3645 #    the Free Software Foundation; either version 2 of the License, or
   3646 #    (at your option) any later version.
   3647 #
   3648 #    This program is distributed in the hope that it will be useful,
   3649 #    but WITHOUT ANY WARRANTY; without even the implied warranty of
   3650 #    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   3651 #    GNU General Public License for more details.
   3652 #
   3653 #    This module inherited from the Webmin Module Template 0.79.1 by tn
   3654 
   3655 do '../web-lib.pl';
   3656 do '../ui-lib.pl';
   3657 do 'dnsmasq-lib.pl';
   3658 
   3659 $|=1;
   3660 &init_config("DNSMasq");
   3661 
   3662 %access=&get_module_acl;
   3663 
   3664 ## put in ACL checks here if needed
   3665 
   3666 
   3667 ## sanity checks
   3668 
   3669 
   3670 ## Insert Output code here
   3671 # read config file
   3672 $config_file = &read_file_lines( $config{config_file} );
   3673 # pass into data structure
   3674 &parse_config_file( \%config, \$config_file );
   3675 # read posted data
   3676 &ReadParse();
   3677 # check for errors in read config
   3678 if( $config{errors} > 0 )
   3679 {
   3680 	&header( "DNSMasq settings", "" );
   3681 	print "<hr><h2>";
   3682 	print $text{warn_errors};
   3683 	print $config{errors};
   3684 	print $text{didnt_apply};
   3685 	print "</h3><hr>\n";
   3686 	&footer( "/", $text{'index'});
   3687 	exit;
   3688 }
   3689 # adjust everything to what we got
   3690 #
   3691 &header( "DNSMasq settings", "" );
   3692 print "<h2>".$text{user_classes}."</h2>";
   3693 print &ui_form_start( "user_edit_apply.cgi", "post" );
   3694 print &ui_hidden( "idx", $in{idx} );
   3695 print $text{in_use}.&ui_yesno_radio( "used",
   3696 			($config{user_class}[$in{idx}]{used})?1:0 );
   3697 print $text{class}. &ui_textbox( "class", 
   3698 			$config{user_class}[$in{idx}]{class}, 60 );
   3699 print "<br>".$text{user}. &ui_textbox( "user", 
   3700 			$config{user_class}[$in{idx}]{user}, 60 );
   3701 print "<br><br>" . &ui_submit( $text{'save_button'} )."<br>";
   3702 print &ui_form_end();
   3703 print "<a href=delete.cgi?idx=".$in{idx}."&what=user_class&where=dhcp.cgi".
   3704 	">".$text{delet}."</a>";
   3705 print "<br><a href=dhcp.cgi>".$text{DHCP_config}."</a>";
   3706 &footer( "/", $text{'index'});
   3707 #
   3708 
   3709 # 
   3710 # sub-routines
   3711 #
   3712 ### END of user_edit.cgi ###.
   3713 dnsmasq/vend_edit.cgi0000755000000000000000000000421010512343567013655 0ustar  rootroot#!/usr/bin/perl
   3714 #
   3715 #    DNSMasq Webmin Module - vend_edit.cgi;  edit vendor class
   3716 #    Copyright (C) 2006 by Neil Fisher
   3717 #    
   3718 #    This program is free software; you can redistribute it and/or modify
   3719 #    it under the terms of the GNU General Public License as published by
   3720 #    the Free Software Foundation; either version 2 of the License, or
   3721 #    (at your option) any later version.
   3722 #
   3723 #    This program is distributed in the hope that it will be useful,
   3724 #    but WITHOUT ANY WARRANTY; without even the implied warranty of
   3725 #    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   3726 #    GNU General Public License for more details.
   3727 #
   3728 #    This module inherited from the Webmin Module Template 0.79.1 by tn
   3729 
   3730 do '../web-lib.pl';
   3731 do '../ui-lib.pl';
   3732 do 'dnsmasq-lib.pl';
   3733 
   3734 $|=1;
   3735 &init_config("DNSMasq");
   3736 
   3737 %access=&get_module_acl;
   3738 
   3739 ## put in ACL checks here if needed
   3740 
   3741 
   3742 ## sanity checks
   3743 
   3744 
   3745 ## Insert Output code here
   3746 # read config file
   3747 $config_file = &read_file_lines( $config{config_file} );
   3748 # pass into data structure
   3749 &parse_config_file( \%config, \$config_file );
   3750 # read posted data
   3751 &ReadParse();
   3752 # check for errors in read config
   3753 if( $config{errors} > 0 )
   3754 {
   3755 	&header( "DNSMasq settings", "" );
   3756 	print "<hr><h2>";
   3757 	print $text{warn_errors};
   3758 	print $config{errors};
   3759 	print $text{didnt_apply};
   3760 	print "</h3><hr>\n";
   3761 	&footer( "/", $text{'index'});
   3762 	exit;
   3763 }
   3764 # adjust everything to what we got
   3765 #
   3766 &header( "DNSMasq settings", "" );
   3767 print "<h2>".$text{vendor_classes}."</h2>";
   3768 print &ui_form_start( "vend_edit_apply.cgi", "post" );
   3769 print &ui_hidden( "idx", $in{idx} );
   3770 print $text{in_use}.&ui_yesno_radio( "used",
   3771 			($config{vendor_class}[$in{idx}]{used})?1:0 );
   3772 print $text{class}. &ui_textbox( "class", 
   3773 			$config{vendor_class}[$in{idx}]{class}, 60 );
   3774 print "<br>".$text{vendor}. &ui_textbox( "vendor", 
   3775 			$config{vendor_class}[$in{idx}]{vendor}, 60 );
   3776 print "<br><br>" . &ui_submit( $text{'save_button'} )."<br>";
   3777 print &ui_form_end();
   3778 print "<a href=delete.cgi?idx=".$in{idx}."&what=vendor_class&where=dhcp.cgi>".
   3779 	$text{delet}."</a>";
   3780 print "<br><a href=dhcp.cgi>".$text{DHCP_config}."</a>";
   3781 &footer( "/", $text{'index'});
   3782 #
   3783 
   3784 # 
   3785 # sub-routines
   3786 #
   3787 ### END of vend_edit.cgi ###.
   3788 dnsmasq/dhcp_apply.cgi0000755000000000000000000000536210512642064014042 0ustar  rootroot#!/usr/bin/perl
   3789 #
   3790 #    DNSMasq Webmin Module - dhcp_apply.cgi; update misc DHCP info     
   3791 #    Copyright (C) 2006 by Neil Fisher
   3792 #    
   3793 #    This program is free software; you can redistribute it and/or modify
   3794 #    it under the terms of the GNU General Public License as published by
   3795 #    the Free Software Foundation; either version 2 of the License, or
   3796 #    (at your option) any later version.
   3797 #
   3798 #    This program is distributed in the hope that it will be useful,
   3799 #    but WITHOUT ANY WARRANTY; without even the implied warranty of
   3800 #    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   3801 #    GNU General Public License for more details.
   3802 #
   3803 #    This module inherited from the Webmin Module Template 0.79.1 by tn
   3804 
   3805 do '../web-lib.pl';
   3806 do '../ui-lib.pl';
   3807 do 'dnsmasq-lib.pl';
   3808 
   3809 $|=1;
   3810 &init_config("DNSMasq");
   3811 
   3812 %access=&get_module_acl;
   3813 
   3814 ## put in ACL checks here if needed
   3815 
   3816 
   3817 ## sanity checks
   3818 
   3819 
   3820 ## Insert Output code here
   3821 # read config file
   3822 $config_file = &read_file_lines( $config{config_file} );
   3823 # pass into data structure
   3824 &parse_config_file( \%config, \$config_file );
   3825 # read posted data
   3826 &ReadParse();
   3827 # check for errors in read config
   3828 if( $config{errors} > 0 )
   3829 {
   3830 	my $line="error.cgi?line=xx&type=".$text{err_configbad};
   3831 	&redirect( $line );
   3832 	exit;
   3833 }
   3834 # check for input data errors
   3835 if( $in{bootp_addr} !~ /^$IPADDR$/ )
   3836 {
   3837 	my $line="error.cgi?line=".$text{bootp_address};
   3838 	$line .= "&type=".$text{err_notip};
   3839 	&redirect( $line );
   3840 	exit;
   3841 }	
   3842 if( $in{bootp_file} !~ /^$FILE$/ )
   3843 {
   3844 	my $line="error.cgi?line=".$text{bootp_file};
   3845 	$line .= "&type=".$text{err_filebad};
   3846 	&redirect( $line );
   3847 	exit;
   3848 }	
   3849 if( $in{bootp_host} !~ /^$NAME$/ )
   3850 {
   3851 	my $line="error.cgi?line=".$text{bootp_host};
   3852 	$line .= "&type=".$text{err_hostbad};
   3853 	&redirect( $line );
   3854 	exit;
   3855 }	
   3856 if( $in{max_leases} !~ /^$NUMBER$/ )
   3857 {
   3858 	my $line="error.cgi?line=".$text{max_leases};
   3859 	$line .= "&type=".$text{err_numbbad};
   3860 	&redirect( $line );
   3861 	exit;
   3862 }	
   3863 if( $in{leasefile} !~ /^$FILE$/ )
   3864 {
   3865 	my $line="error.cgi?line=".$text{leasefile};
   3866 	$line .= "&type=".$text{err_filebad};
   3867 	&redirect( $line );
   3868 	exit;
   3869 }	
   3870 # adjust everything to what we got
   3871 
   3872 #
   3873 # read /etc/ethers
   3874 #
   3875 &update( $config{dhcp_ethers}{line}, "read-ethers", 
   3876 	$config_file, ($in{ethers} == 1) );
   3877 
   3878 #
   3879 # bootp
   3880 #
   3881 my $line="dhcp-boot=".$in{bootp_file}.",".$in{bootp_host};
   3882 $line .= ",".$in{bootp_addr};
   3883 &update( $config{dhcp_boot}{line}, $line,
   3884 	$config_file, ($in{bootp} == 1) );
   3885 #
   3886 # max leases
   3887 #
   3888 &update( $config{dhcp_leasemax}{line}, "dhcp-lease-max=".$in{max_leases},
   3889 	$config_file, ($in{max_leases} != 150) );
   3890 #
   3891 # leases file
   3892 # 
   3893 &update( $config{dhcp_leasefile}{line}, "dhcp-leasefile=".$in{leasefile},
   3894 	$config_file, ($in{useleasefile} == 1) );
   3895 #
   3896 # write file!!
   3897 &flush_file_lines();
   3898 #
   3899 # re-load basic page
   3900 &redirect( "dhcp.cgi" );
   3901 
   3902 # 
   3903 # sub-routines
   3904 #
   3905 ### END of dhcp_apply.cgi ###.
   3906 dnsmasq/user_edit_apply.cgi0000755000000000000000000000355710512642234015112 0ustar  rootroot#!/usr/bin/perl
   3907 #
   3908 #    DNSMasq Webmin Module - user_edit_apply.cgi; do the update      
   3909 #    Copyright (C) 2006 by Neil Fisher
   3910 #    
   3911 #    This program is free software; you can redistribute it and/or modify
   3912 #    it under the terms of the GNU General Public License as published by
   3913 #    the Free Software Foundation; either version 2 of the License, or
   3914 #    (at your option) any later version.
   3915 #
   3916 #    This program is distributed in the hope that it will be useful,
   3917 #    but WITHOUT ANY WARRANTY; without even the implied warranty of
   3918 #    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   3919 #    GNU General Public License for more details.
   3920 #
   3921 #    This module inherited from the Webmin Module Template 0.79.1 by tn
   3922 
   3923 do '../web-lib.pl';
   3924 do '../ui-lib.pl';
   3925 do 'dnsmasq-lib.pl';
   3926 
   3927 $|=1;
   3928 &init_config("DNSMasq");
   3929 
   3930 %access=&get_module_acl;
   3931 
   3932 ## put in ACL checks here if needed
   3933 
   3934 
   3935 ## sanity checks
   3936 
   3937 
   3938 ## Insert Output code here
   3939 # read config file
   3940 $config_file = &read_file_lines( $config{config_file} );
   3941 # pass into data structure
   3942 &parse_config_file( \%config, \$config_file );
   3943 # read posted data
   3944 &ReadParse();
   3945 # check for errors in read config
   3946 if( $config{errors} > 0 )
   3947 {
   3948 	my $line = "error.cgi?line=xx&type=".$text{err_configbad};
   3949 	&redirect( $line );
   3950 	exit;
   3951 }
   3952 # check for input data errors
   3953 if( $in{class} !~ /^$NAME$/ )
   3954 {
   3955 	my $line = "error.cgi?line=".$text{class};
   3956 	$line .= "&type=".$text{err_namebad};
   3957 	&redirect( $line );
   3958 	exit;
   3959 }
   3960 if( $in{user} !~ /^$NAME$/ )
   3961 {
   3962 	my $line = "error.cgi?line=".$text{user};
   3963 	$line .= "&type=".$text{err_namebad};
   3964 	&redirect( $line );
   3965 	exit;
   3966 }
   3967 # adjust everything to what we got
   3968 #
   3969 my $line="dhcp-userclass=".$in{class}.",".$in{user};
   3970 &update( $config{user_class}[$in{idx}]{line}, $line,
   3971 	$config_file, ( $in{used} == 1 ) );
   3972 #
   3973 # write file!!
   3974 &flush_file_lines();
   3975 #
   3976 # re-load basic page
   3977 &redirect( "dhcp.cgi" );
   3978 
   3979 # 
   3980 # sub-routines
   3981 #
   3982 ### END of user_edit_apply.cgi ###.
   3983 dnsmasq/vend_edit_apply.cgi0000755000000000000000000000357310512642243015066 0ustar  rootroot#!/usr/bin/perl
   3984 #
   3985 #    DNSMasq Webmin Module - vend_edit_apply.cgi; do the update      
   3986 #    Copyright (C) 2006 by Neil Fisher
   3987 #    
   3988 #    This program is free software; you can redistribute it and/or modify
   3989 #    it under the terms of the GNU General Public License as published by
   3990 #    the Free Software Foundation; either version 2 of the License, or
   3991 #    (at your option) any later version.
   3992 #
   3993 #    This program is distributed in the hope that it will be useful,
   3994 #    but WITHOUT ANY WARRANTY; without even the implied warranty of
   3995 #    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   3996 #    GNU General Public License for more details.
   3997 #
   3998 #    This module inherited from the Webmin Module Template 0.79.1 by tn
   3999 
   4000 do '../web-lib.pl';
   4001 do '../ui-lib.pl';
   4002 do 'dnsmasq-lib.pl';
   4003 
   4004 $|=1;
   4005 &init_config("DNSMasq");
   4006 
   4007 %access=&get_module_acl;
   4008 
   4009 ## put in ACL checks here if needed
   4010 
   4011 
   4012 ## sanity checks
   4013 
   4014 
   4015 ## Insert Output code here
   4016 # read config file
   4017 $config_file = &read_file_lines( $config{config_file} );
   4018 # pass into data structure
   4019 &parse_config_file( \%config, \$config_file );
   4020 # read posted data
   4021 &ReadParse();
   4022 # check for errors in read config
   4023 if( $config{errors} > 0 )
   4024 {
   4025 	my $line = "error.cgi?line=xx&type=".$text{err_configbad};
   4026 	&redirect( $line );
   4027 	exit;
   4028 }
   4029 # check for input data errors
   4030 if( $in{class} !~ /^$NAME$/  )
   4031 {
   4032 	my $line = "error.cgi?line=".$text{class};
   4033 	$line .= "&type=".$text{err_namebad};
   4034 	&redirect( $line );
   4035 	exit;
   4036 }
   4037 if( $in{vendor} !~ /^$NAME$/  )
   4038 {
   4039 	my $line = "error.cgi?line=".$text{vendor};
   4040 	$line .= "&type=".$text{err_namebad};
   4041 	&redirect( $line );
   4042 	exit;
   4043 }
   4044 # adjust everything to what we got
   4045 #
   4046 my $line="dhcp-vendorclass=".$in{class}.",".$in{vendor};
   4047 &update( $config{vendor_class}[$in{idx}]{line}, $line,
   4048 	$config_file, ( $in{used} == 1 ) );
   4049 #
   4050 # write file!!
   4051 &flush_file_lines();
   4052 #
   4053 # re-load basic page
   4054 &redirect( "dhcp.cgi" );
   4055 
   4056 # 
   4057 # sub-routines
   4058 #
   4059 ### END of vend_edit_apply.cgi ###.
   4060 dnsmasq/error.cgi0000755000000000000000000000302610511350547013044 0ustar  rootroot#!/usr/bin/perl
   4061 #
   4062 #    DNSMasq Webmin Module - error.cgi; report errors
   4063 #    Copyright (C) 2006 by Neil Fisher
   4064 #    
   4065 #    This program is free software; you can redistribute it and/or modify
   4066 #    it under the terms of the GNU General Public License as published by
   4067 #    the Free Software Foundation; either version 2 of the License, or
   4068 #    (at your option) any later version.
   4069 #
   4070 #    This program is distributed in the hope that it will be useful,
   4071 #    but WITHOUT ANY WARRANTY; without even the implied warranty of
   4072 #    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   4073 #    GNU General Public License for more details.
   4074 #
   4075 #    This module inherited from the Webmin Module Template 0.79.1 by tn
   4076 
   4077 do '../web-lib.pl';
   4078 do '../ui-lib.pl';
   4079 do 'dnsmasq-lib.pl';
   4080 
   4081 $|=1;
   4082 &init_config("DNSMasq");
   4083 
   4084 %access=&get_module_acl;
   4085 
   4086 ## put in ACL checks here if needed
   4087 
   4088 
   4089 ## sanity checks
   4090 
   4091 &header($text{'index_title'}, "", "intro", 1, 1, undef,
   4092         "Written by Neil Fisher<BR><A HREF=mailto:neil\@magnecor.com.au>Author</A><BR><A HREF=http://www.authorpage.invalid>Home://page</A>");
   4093 # uses the index_title entry from ./lang/en or appropriate
   4094 
   4095 ## Insert Output code here
   4096 
   4097 # output as web page
   4098 &ReadParse();
   4099 print "<h2>".$text{error_heading}."</h2>";
   4100 print "<br><br>";
   4101 print $text{err_line};
   4102 print $in{line};
   4103 print "<br>\n";
   4104 print $text{err_type};
   4105 print $in{type};
   4106 print "<br><br>\n";
   4107 print $text{err_help};
   4108 &footer("/", $text{'index'});
   4109 # uses the index entry in /lang/en
   4110 
   4111 
   4112 
   4113 ## if subroutines are not in an extra file put them here
   4114 
   4115 
   4116 ### END of error.cgi ###.
   4117