Annotation of embedaddon/dnsmasq/contrib/webmin/dnsmasq.wbm, revision 1.1.1.1

1.1       misho       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^zøȰܞħL}1O`By{{H@0E1F,D)~dH!%̑rґYm_61ɓgw4+3&,;\ZTEL{Z
                      7: 5jS?Έ;dnsmasq/images/template.gif0000644000000000000000000000356006771443034015005 0ustar  rootrootGIF89a&0UUU999rrr!Made with GIMP,&0     8AZdiӠhksh߶L|G,rY̥q0     Ԓ0-]%6AkX=Q}~T{Moa-W~~x,vuc&$xa4eSyu`g$bͽ~ʣ    `lˁj\QԸꪀ>"{9ۗ&FḃYWͳ?QdƌJf)hcv'w+#1|XgO-ahB(`DZڄU.EbP       FKD[B<
                      8: [Ŝ"JÞi0*a-VI@
                      9: \(I
                     10: /*!0@*>Lhp20:v6V.᧲.Ԛa&9M$bE\
                     11: 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:(܆N۬n/{'^yyS&U洦gj5ۃ-,䮳%K5;[~&,|ӌJ:uzA࠿d^8)W1ʩz)nj. zÇ9scm%Z[=Sy\ So]5E_]K[+uO5Sn3
                     12: bM Ēܶэ5rmBN!-?58Ŕ
hOk~
}3^Q8Yκi{=8'r;+pڛͻz*r4[0k&<#/$q;֜tŅ" C
Mtv0_+PI    7 >⁲$*F,N|H}t&>YxT7s=X!ZÓJsؿd;v尋F`%-xG#6..O8xdH!D춨XjXϢV>q7c @<2_V1X^F p\2)Ѹ'OEf'$Gce˲eҐٛD/rI4ڥ@,+'6dlTT(7!@*:!,&ɴ<      }h&iRUiџηibkCfPM~O('%Sfxy:5&v*_I6m=Hn$z4Z(Q\e>5
DnRۘj&4W百5%&Gi:fXJQ-IXq":xFS|`Hɔj--{
                     13: DGjRv-[rzhhGKҚiWֺ6{lgKڢ ͭnwk\
pEr=ߒ:}t+R5.K;dnsmasq/images/up.gif0000644000000000000000000000014710506373750013612 0ustar  rootrootGIF89arrr!Made with GIMP!&
                     14: ,&
                     15: |'Io|b%eRG;Ssf;dnsmasq/images/down.gif0000644000000000000000000000015410506373750014133 0ustar  rootrootGIF89arrr!Made with GIMP!&
                     16: ,+@"IUieJbAIm.dN;dnsmasq/images/gap.gif0000644000000000000000000000011110506375201013715 0ustar  rootrootGIF89a!Made with GIMP!&
                     17: ,ڋ>;dnsmasq/module.info0000644000000000000000000000014210501433425013356 0ustar  rootrootname=DNSMasq
                     18: desc=DNSMasq integrated DNS & DHCP servers
                     19: os_support=
                     20: depends=0.77
                     21: category=servers
                     22: dnsmasq/index.cgi0000755000000000000000000000753110512641067013030 0ustar  rootroot#!/usr/bin/perl
                     23: #
                     24: #    DNSMasq Webmin Module - index.cgi; basic DNS config     
                     25: #    Copyright (C) 2006 by Neil Fisher
                     26: #    
                     27: #    This program is free software; you can redistribute it and/or modify
                     28: #    it under the terms of the GNU General Public License as published by
                     29: #    the Free Software Foundation; either version 2 of the License, or
                     30: #    (at your option) any later version.
                     31: #
                     32: #    This program is distributed in the hope that it will be useful,
                     33: #    but WITHOUT ANY WARRANTY; without even the implied warranty of
                     34: #    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
                     35: #    GNU General Public License for more details.
                     36: #
                     37: #    This module inherited from the Webmin Module Template 0.79.1 by tn
                     38: 
                     39: do '../web-lib.pl';
                     40: do '../ui-lib.pl';
                     41: do 'dnsmasq-lib.pl';
                     42: 
                     43: $|=1;
                     44: &init_config("DNSMasq");
                     45: 
                     46: %access=&get_module_acl;
                     47: 
                     48: ## put in ACL checks here if needed
                     49: 
                     50: 
                     51: ## sanity checks
                     52: 
                     53: &header($text{'index_title'}, "", "intro", 1, 1, undef,
                     54:         "Written by Neil Fisher<BR><A HREF=mailto:neil\@magnecor.com.au>Author</A><BR><A HREF=http://www.authorpage.invalid>Home://page</A>");
                     55: # uses the index_title entry from ./lang/en or appropriate
                     56: 
                     57: ## Insert Output code here
                     58: # read config file
                     59: $config_file = &read_file_lines( $config{config_file} );
                     60: # pass into data structure
                     61: 
                     62: 
                     63: # output as web page
                     64: 
                     65: 
                     66: &header( "DNSMasq settings", "" );
                     67: &parse_config_file( \%config, \$config_file );
                     68: print "<hr>\n";
                     69: if( $config{errors} > 0 )
                     70: {
                     71:        print "<h3>WARNING: found ";
                     72:        print $config{errors};
                     73:        print "errors in config file!</h3><br>\n";
                     74: }
                     75: print &ui_form_start( 'basic_apply.cgi', "post" );
                     76: print "<br>\n";
                     77: print "<h2>$text{'DNS_settings'}</h2>";
                     78: print "<br><br>\n";
                     79: print $text{'local_domain'};
                     80: print &ui_textbox( "local_domain", $config{domain}{domain}, 32 );
                     81: print "<br><br>\n";
                     82: print $text{'domain_needed'};
                     83: print &ui_yesno_radio( "domain_needed", ($config{domain_needed}{used})?1:0 );
                     84: print "<br><br>\n";
                     85: print $text{'expand_hosts'};
                     86: print &ui_yesno_radio( "expand_hosts", ($config{expand_hosts}{used})?1:0 );
                     87: print "<br><br>\n";
                     88: print $text{'bogus_priv'};
                     89: print &ui_yesno_radio( "bogus_priv", ($config{bogus_priv}{used})?0:1 );
                     90: print "<br><br>\n";
                     91: print $text{'filterwin2k'};
                     92: print &ui_yesno_radio( "filterwin2k", ($config{filterwin2k}{used})?1:0 );
                     93: print "<br><br>\n";
                     94: print $text{'hosts'};
                     95: print &ui_yesno_radio( "hosts", ($config{no_hosts}{used}?0:1) );
                     96: print "<br>\n";
                     97: print $text{'xhosts'};
                     98: print &ui_yesno_radio( "xhosts", ($config{addn_hosts}{used}?1:0) );
                     99: print "<br>\n";
                    100: print $text{'xhostsfile'};
                    101: print &ui_textbox( "addn_hosts", $config{addn_hosts}{file}, 40 );
                    102: print "<br><br>\n";
                    103: print $text{'neg_cache'};
                    104: print &ui_yesno_radio( "neg_cache", ($config{neg_cache}{used}?0:1) );
                    105: print "<br><br>\n";
                    106: print $text{'cache_size'};
                    107: print &ui_yesno_radio( "cache_size", ($config{cache_size}{used}?1:0) );
                    108: print "<br>\n";
                    109: print $text{'cust_cache_size'};
                    110: print &ui_textbox( "cust_cache_size", $config{cache_size}{size}, 40 );
                    111: print "<br><br>\n";
                    112: print $text{'log_queries'};
                    113: print &ui_yesno_radio( "log_queries", ($config{log_queries}{used}?1:0) );
                    114: print "<br><br>\n";
                    115: print $text{'local_ttl'};
                    116: print &ui_yesno_radio( "local_ttl", ($config{local_ttl}{used}?1:0) );
                    117: print "<br>\n";
                    118: print $text{'ttl'};
                    119: print &ui_textbox( "ttl", $config{local_ttl}{ttl}, 40 );
                    120: print "<br><br>\n";
                    121: print &ui_submit( $text{'save_button'} );
                    122: print &ui_form_end( );
                    123: print "<hr>";
                    124: print "<a href=\"servers.cgi\">";
                    125: print $text{'servers_config'};
                    126: print "</a><br>";
                    127: print "<a href=\"iface.cgi\">";
                    128: print $text{'iface_config'};
                    129: print "</a><br>";
                    130: print "<a href=\"alias.cgi\">";
                    131: print $text{'alias_config'};
                    132: print "</a><br>";
                    133: print "<hr>";
                    134: print "<a href=\"dhcp.cgi\">";
                    135: print $text{'DHCP_config'};
                    136: print "</a><br>";
                    137: print "<hr>";
                    138: print "<a href=\"restart.cgi\">";
                    139: print $text{'restart'};
                    140: print "</a><br>";
                    141: &footer("/", $text{'index'});
                    142: # uses the index entry in /lang/en
                    143: 
                    144: 
                    145: 
                    146: ## if subroutines are not in an extra file put them here
                    147: 
                    148: 
                    149: ### END of index.cgi ###.
                    150: dnsmasq/acl_security.pl0000644000000000000000000000056107000420647014246 0ustar  rootroot
                    151: # acl_security_form(&options)
                    152: # Output HTML for editing security options for the apache module
                    153: sub acl_security_form
                    154: {
                    155: 
                    156: ## Here you have to fill in the code for output
                    157: 
                    158: }
                    159: 
                    160: # acl_security_save(&options)
                    161: # Parse the form for security options for the apache module
                    162: sub acl_security_save
                    163: {
                    164: 
                    165: ## here you have to fill in the handling code for the saving the ACL
                    166: 
                    167: }
                    168: 
                    169: ### END.dnsmasq/lang/0000755000000000000000000000000010512641175012145 5ustar  rootrootdnsmasq/lang/en0000644000000000000000000000766610512637344012514 0ustar  rootroot
                    170: lang=en
                    171: author=Neil Fisher
                    172: module_author=Neil Fisher
                    173: homepage=www.nonexistent.invalid
                    174: copyright=(C) 2006 by Neil Fisher <neil@magnecor.com.au>
                    175: license=GPL
                    176: 
                    177: index_title=DNSMasq - integrated DNS and DHCP servers
                    178: DNS_settings=Basic DNS settings
                    179: DHCP_settings=DHCP settings
                    180: DNS_servers=DNS Upstream Servers Configuration
                    181: iface_settings=Network Interface Settings
                    182: alias_settings=Alias / Redirect Settings
                    183: local_domain=Local domain name 
                    184: domain_needed=Only forward names with a domain part 
                    185: expand_hosts=Add local domain name to DHCP leases & hosts in /etc/hosts 
                    186: bogus_priv=Allow unresolved reverse lookups on local network to propogate out 
                    187: filterwin2k=Prevent windows SOA & SRV requests propogating out
                    188: resolv=Read /etc/resolv.conf 
                    189: poll=poll resolv.conf file 
                    190: resolv_file_explicit=Use non-standard resolv.conf file
                    191: resolv_file=non-standard resolv.conf file to use
                    192: strict_order=Always use nameservers in order provided
                    193: hosts=Read /etc/hosts file
                    194: xhosts=Use additional hosts file
                    195: xhostsfile=File to use for additional hosts
                    196: neg_cache=Cache negative responses
                    197: log_queries=Log each DNS lookup
                    198: cache_size=Use custom cache size
                    199: cust_cache_size=Custom cache size to use
                    200: local_ttl=Use specified local Time-To-Live
                    201: ttl=Local TTL
                    202: dynamic=Defined in resolv.conf file
                    203: domain=For domain
                    204: address=IP address
                    205: in_use=In use
                    206: used=In Use
                    207: not_used=Defined only (not used)
                    208: in_file=Defined in config file
                    209: new_dns_serv=Add new upstream server to config file
                    210: save_button=Save
                    211: servers_config=Configure upstream DNS Servers
                    212: alias_config=Configure Forced Domains and Alias responses
                    213: iface_config=Configure network interfaces
                    214: DHCP_config=Configure DHCP
                    215: restart=Restart DNSmasq
                    216: restarting=Trying to restart DNSmasq. Script messages are:
                    217: srv_edit=Edit upstream DNS server
                    218: srv_named=For specific domain
                    219: srv_name=Specific domain
                    220: srv_addr=Server address
                    221: delet=Delete
                    222: iface=Interface
                    223: xiface=Except Interface
                    224: listen=Listen on
                    225: new_iface=Add new interface
                    226: iface_listen=Interface to listen on
                    227: xiface_listen=Except interfaces
                    228: listen_addr=Listen Address
                    229: new_addr=Add new address
                    230: edit_iface=Edit interface
                    231: iface_name=Interface name
                    232: edit_xiface=Edit except interface
                    233: listen_name=Listen address
                    234: edit_listen=Edit listen address
                    235: xiface_name=Except interface name
                    236: bind_iface=Bind to individual interfaces instead of wildcard address
                    237: forced=Forced domain responses
                    238: nx=Forced NXDOMAIN IP addresses
                    239: alias=Aliased IP addresses
                    240: forced_domain=Domain name
                    241: forced_ip=To IP address
                    242: forced_from=From IP address
                    243: forced_mask=Netmask
                    244: forced_mask_used=Use a netmask
                    245: forced_add=Add new forced domain
                    246: alias_add=Add new alias
                    247: nx_add=Add new forced NXDOMAIN
                    248: forced_edit=Edit forced domain reponse
                    249: alias_edit=Edit IP address alias
                    250: nx_edit=Edit Forced NXDOMAIN response
                    251: net_id=Network/Client ID
                    252: timed=Use a lease time
                    253: leasetime=Lease time
                    254: dhcp_range=DHCP IP address ranges
                    255: range_edit=Edit DHCP range
                    256: range_add=Add new DHCP range
                    257: ided=Network ID
                    258: id=Network ID to use
                    259: hosts=Specific Hosts
                    260: host_add=Add a new host specification
                    261: vendor_classes=Vendor Class Specification
                    262: user_classes=User Class Specification
                    263: vendor=Vendor
                    264: user=User
                    265: class=Class
                    266: vend_add=Add new vendor class
                    267: user_add=Add new user class
                    268: read_ethers=Read /etc/ethers for lease info
                    269: misc=Miscellaneous DHCP options
                    270: dhcp_options=Non-standard DHCP options
                    271: dhcp_option=Option
                    272: dhcp_add=Add new option
                    273: edit_host=Edit DHCP host specification
                    274: edit_opt=Edit DHCP options
                    275: opt_spec=DHCP option specification
                    276: use_bootp=Use BOOTP (network boot)
                    277: bootp_host=Hostname
                    278: bootp_file=File
                    279: bootp_address=IP Address
                    280: max_leases=Maximum number of leases to grant
                    281: leasefile=Use a nonstandard lease file
                    282: lfikletouse=Nonstandard leasefile to use
                    283: error_heading=Warning - ERROR!!!!
                    284: err_line=Error in line: 
                    285: err_type=Type of error is:
                    286: err_help=Try going back and retyping the offending information
                    287: err_notip=Not a valid IP address
                    288: err_notmask=Not a valid netmask
                    289: err_nottime=not a valid time
                    290: err_configbad=Configuration file has an error
                    291: err_filebad=Bad file name
                    292: err_hostbad=Bad host name
                    293: err_numbbad=Bad number
                    294: err_domainbad=Bad domain
                    295: err_namebad=Bad name
                    296: dnsmasq/lang/en~0000644000000000000000000000034407076651262012702 0ustar  rootroot
                    297: lang=en
                    298: author=Name of language file author here
                    299: module_author=Writers name here
                    300: homepage=modules homepage url here
                    301: copyright=(C) YYYY by author <email@author.any>
                    302: license=GPL
                    303: 
                    304: your_message=here you have to write your messages
                    305: dnsmasq/.index.cgi.swp0000644000000000000000000003000010475225557013710 0ustar  rootrootb0VIM 6.3R+DB#staffupstairs.localnet~staff/template/index.cgi3210#"! Utp&I&&ad$\  IVU


R
Q
=
7


&

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

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>