HEX
Server: Apache/2
System: Linux nexus-01 4.18.0-553.146.1.el8_10.x86_64 #1 SMP Tue Jul 21 03:06:01 EDT 2026 x86_64
User: aglcoke (1118)
PHP: 8.2.32
Disabled: mail,exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Upload Files
File: //usr/local/cwaf/web/webmin/cwaf/delete-module.pl
#!/usr/bin/perl
# delete-module.pl
# Delete a single module file

# Check arguments
$nodeps = 0;
while($ARGV[0] eq "--acl") {
	shift(@ARGV);
	push(@grant, shift(@ARGV));
	}
if (@ARGV > 2 || !@ARGV) {
	die "usage: delete-module.pl [--acl user]* <module_name> [config_directory]";
	}
$file = $ARGV[0];
$config = $ARGV[1] ? $ARGV[1] : "/etc/webmin";
#-r $file || die "$file does not exist";
open(CONF, "$config/miniserv.conf") ||
	die "Failed to read $config/miniserv.conf - maybe $config is not a Webmin config directory";
while(<CONF>) {
	s/\r|\n//g;
	if (/^root=(.*)/) {
		$root = $1;
		}
	}
close(CONF);
-d $root || die "Webmin directory $root does not exist";
chop($var = `cat $config/var-path`);

# Set up webmin environment
$ENV{'WEBMIN_CONFIG'} = $config;
$ENV{'WEBMIN_VAR'} = $var;
$no_acl_check++;
chdir($root);
$0 = "$root/delete-module.pl";
eval "use WebminCore;";
&init_config();

# Delete it, using the standard function
&foreign_require("webmin", "webmin-lib.pl");
if (@grant) {
	$newusers = \@grant;
	}
else {
	$newusers = &webmin::get_newmodule_users();
	$newusers ||= [ "root", "admin" ];
	}
my $rv = &webmin::delete_webmin_module($file, $newusers);
if($rv) {
  print "Deleted: $rv\n"
} else {
  print "Delete of module '$file' failed.\n"
}