Server IP : 195.201.23.43 / Your IP : 3.145.164.105 Web Server : Apache System : Linux webserver2.vercom.be 5.4.0-192-generic #212-Ubuntu SMP Fri Jul 5 09:47:39 UTC 2024 x86_64 User : kdecoratie ( 1041) PHP Version : 7.1.33-63+ubuntu20.04.1+deb.sury.org+1 Disable Function : 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, MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /usr/share/webmin/init/ |
Upload File : |
#!/usr/bin/perl # save_startscript.cgi # saves modifications to the StartupItems/script/script or # the StartupItems/script/StartupItems.plist # Even though it would be MUCH faster to pass the file to be edited # in the form, forms are filled out by the browser, not the server. # # A malicious user could manipulate the form to write to # any file they darned well please. While a user who has webmin access # to the bootup scripts could do a fair amount of damage anyway, I still # would rather limit the possible files the cgi will write to to the # actual bootup scripts. # Written by Michael A. Peters <mpeters@mac.com> for # webmin init module, based on save_local.cgi of same # module. Written for Darwin/OS X. require './init-lib.pl'; require './hostconfig-lib.pl'; use File::Basename; $access{'bootup'} == 1 || &error("You are not allowed to edit the bootup script"); &ReadParse(); $action=$in{'action'}; if ( $in{'plist'} ne "" ) { $in{'plist'} =~ s/\r//g; $towrite = $in{'plist'}; %temphash = &hostconfig_gather(startscript); $tempfile = $temphash{"$action"}; $dir = dirname("$tempfile"); $file = "$dir/$config{'plist'}"; $redirect = "edit_hostconfig.cgi?0+$action"; -e $file || &error("$file doesn't seem to exist"); } elsif ( $in{'startup'} ne "" ) { $in{'startup'} =~ s/\r//g; $towrite = $in{'startup'}; %temphash = &hostconfig_gather(startscript); $file = $temphash{"$action"}; $redirect = "edit_hostconfig.cgi?0+$action"; -e $file || &error("$file doesn't seem to exist"); } elsif ( $in{'hostconfig'} ne "" ) { $in{'hostconfig'} =~ s/\r//g; $towrite = $in{'hostconfig'}; $file = $config{'hostconfig'}; $redirect = "edit_hostconfig.cgi?2"; } else { &error("I do not know what you want me to do"); } &lock_file($file); &open_tempfile(LOCAL, "> $file"); &print_tempfile(LOCAL, $towrite); &close_tempfile(LOCAL); &unlock_file($file); &webmin_log("startup", undef, undef, \%in); &redirect("$redirect");Private