HEX
Server: Apache
System: Linux vps-cdc32557.vps.ovh.ca 5.15.0-156-generic #166-Ubuntu SMP Sat Aug 9 00:02:46 UTC 2025 x86_64
User: hanode (1017)
PHP: 7.4.33
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: //usr/share/webmin/dhcpd/delete_all.cgi
#!/usr/bin/perl
# delete_all.cgi
# Delete a subnet, shared network or host

require './dhcpd-lib.pl';
require './params-lib.pl';
&ReadParse();
if ($in{'cancel'}) {
	&redirect("");
	exit;
	}
&lock_all_files();
$par = &get_parent_config();
foreach $i ($in{'sidx'}, $in{'uidx'}) {
	if ($i ne "") {
		$par = $par->{'members'}->[$i];
		}
	}
$parconf = $par->{'members'};
$to_del = $parconf->[$in{'idx'}];
@host = &find("host", $to_del->{'members'});
@group = &find("group", $to_del->{'members'});
@subn = &find("subnet", $to_del->{'members'});

# check acls
%access = &get_module_acl();
&error_setup($text{'eacl_aviol'});
if ($to_del->{'name'} eq "group") {
	&error("$text{'eacl_np'} $text{'eacl_pdg'}")
		if !&can('rw', \%access, $to_del, 1);
	}
elsif ($to_del->{'name'} eq "subnet") {
	$type = 'sub';
	&error("$text{'eacl_np'} $text{'eacl_pds'}")
		if !&can('rw', \%access, $to_del, 1);
	foreach $g (@group) {
		&error("$text{'eacl_np'} $text{'eacl_pdg'}")
			if !&can('rw', \%access, $g, 1);
		}
	}
elsif ($to_del->{'name'} eq "shared-network") {
	&error("$text{'eacl_np'} $text{'eacl_pdn'}")
		if !&can('rw', \%access, $to_del, 1);
	foreach $s (@subn) {
		&error("$text{'eacl_np'} $text{'eacl_pds'}")
			if !&can('rw', \%access, $s, 1);
		}
	foreach $g (@group) {
		&error("$text{'eacl_np'} $text{'eacl_pdg'}")
			if !&can('rw', \%access, $g, 1);
		}
	}
else {
	&error($text{'cdel_eunknown'});
	}

foreach $h (@host) {
	&error("$text{'eacl_np'} $text{'eacl_pdh'}")
		if !&can('rw', \%access, $h, 1);
	}

if ($type) {
	&drop_dhcpd_acl($type, \%access, $to_del);
	}
&save_directive($par, [ $to_del ], [ ], 0);
&flush_file_lines();
&unlock_all_files();
if ($to_del->{'name'} eq "group") {
	@count = &find("host", $group->{'members'});
	&webmin_log('delete', 'group', join(",", map { $_->{'values'}->[0] } @count), \%in);
	}
elsif ($to_del->{'name'} eq "subnet") {
	&webmin_log('delete', 'subnet', "$sub->{'values'}->[0]/$sub->{'values'}->[2]", \%in);
	}
elsif ($to_del->{'name'} eq "shared") {
	&webmin_log('delete', 'shared', $sha->{'values'}->[0], \%in);
	}

&redirect("");