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: //proc/thread-self/root/usr/share/webmin/sendmail/save_generic.cgi
#!/usr/bin/perl
# save_generic.cgi
# Save, create or delete an outgoing address mapping

require './sendmail-lib.pl';
require './generics-lib.pl';
&ReadParse();
$access{'omode'} || &error($text{'gsave_ecannot'});
$conf = &get_sendmailcf();
$gfile = &generics_file($conf);
&lock_file($gfile);
($gdbm, $gdbmtype) = &generics_dbm($conf);
@gens = &list_generics($gfile);
if (!$in{'new'}) {
	$g = $gens[$in{'num'}];
	&can_edit_generic($g) ||
		&error($text{'gsave_ecannot2'});
	}

if ($in{'delete'}) {
	# delete some mapping
	$logg = $g;
	&delete_generic($g, $gfile, $gdbm, $gdbmtype);
	}
else {
	# Saving or creating.. check inputs
	&error_setup($text{'gsave_err'});
	$in{'from'} =~ /^\S+$/ ||
		&error(&text('gsave_efrom', $in{'from'}));
	$access{'omode'} == 1 || $in{'from'} =~ /$access{'oaddrs'}/ ||
		&error(&text('gsave_ematch', $access{'oaddrs'}));
	$in{'to'} =~ /^\S+\@[a-z0-9\.\-\_]+$/i ||
		&error(&text('gsave_eto', $in{'to'}));
	if ($in{'new'} || lc($in{'from'}) ne lc($g->{'from'})) {
		($same) = grep { lc($_->{'from'}) eq lc($in{'from'}) }
			       @gens;
		$same && &error(&text('gsave_ealready', $in{'from'}));
		}
	$newg{'from'} = $in{'from'};
	$newg{'to'} = $in{'to'};
	$newg{'cmt'} = $in{'cmt'};
	&can_edit_generic(\%newg) ||
		&error($text{'gsave_ecannot3'});
	if ($in{'new'}) {
		&create_generic(\%newg, $gfile, $gdbm, $gdbmtype);
		}
	else {
		&modify_generic($g, \%newg, $gfile, $gdbm, $gdbmtype);
		}
	$logg = \%newg;
	}
&unlock_file($gfile);
&webmin_log($in{'delete'} ? 'delete' : $in{'new'} ? 'create' : 'modify',
	    "generic", $logg->{'from'}, $logg);
&redirect("list_generics.cgi");