3 # A form for editing options set with the 'O foo=bar' directive,
6 require './sendmail-lib.pl';
7 $access{'opts'} || &error($text{'opts_ecannot'});
8 &ui_print_header(undef, $text{'opts_title'}, "");
10 # Get config and start form
11 $conf = &get_sendmailcf();
12 $ver = &check_sendmail_version($conf);
13 $default = $text{'opts_default'};
14 print &ui_form_start("save_opts.cgi", "post");
15 print &ui_table_start($text{'opts_title'}, "width=100%", 4);
17 # Smart host for outgoing mail
18 ($dsstr, $ds) = &find_type2("D", "S", $conf);
19 print &ui_table_row(&hlink($text{'opts_ds'}, "opt_DS"),
20 &ui_opt_textbox("DS", $ds, 40, $text{'opts_direct'}), 3);
22 # Host for unqualified names
23 ($drstr, $dr) = &find_type2("D", "R", $conf);
24 print &ui_table_row(&hlink($text{'opts_dr'}, "opt_DR"),
25 &ui_opt_textbox("DR", $dr, 40, $text{'opts_local'}), 3);
27 # Host for local users
28 ($dhstr, $dh) = &find_type2("D", "H", $conf);
29 print &ui_table_row(&hlink($text{'opts_dh'}, "opt_DH"),
30 &ui_opt_textbox("DH", $dh, 40, $text{'opts_local'}), 3);
32 # Queuing / delivery mode
33 ($dmstr, $dm) = &find_option("DeliveryMode", $conf);
34 @dmodes = ('background', 'queue-only', 'interactive', 'deferred');
36 ($dmode) = grep { substr($_, 0, 1) eq substr($dm, 0, 1) } @dmodes;
38 print &ui_table_row(&hlink($text{'opts_dmode'}, "opt_dmode"),
39 &ui_radio("DeliveryMode", $dmode,
40 [ [ '', $text{'default'} ],
41 map { [ $_, $text{"opts_".$_} ] } @dmodes ]), 3);
44 ($qsostr, $qso) = &find_option("QueueSortOrder", $conf);
45 @qsmodes = ('priority', 'host', 'time');
47 ($qsorder) = grep { substr($_, 0, 1) eq substr($qso, 0, 1) } @qsmodes;
49 print &ui_table_row(&hlink($text{'opts_qso'}, "opt_qso"),
50 &ui_radio("QueueSortOrder", $qsorder,
51 [ [ '', $text{'default'} ],
52 map { [ $_, $text{"opts_".$_} ] } @qsmodes ]), 3);
54 &option_input($text{'opts_queuela'}, "QueueLA", $conf, $default, 6);
55 &option_input($text{'opts_refusela'}, "RefuseLA", $conf, $default,6);
57 &option_input($text{'opts_maxch'}, "MaxDaemonChildren",
59 &option_input($text{'opts_throttle'}, "ConnectionRateThrottle",
62 &option_input($text{'opts_minqueueage'}, "MinQueueAge",
64 &option_input($text{'opts_runsize'}, "MaxQueueRunSize", $conf, $default, 8);
66 &option_input($text{'opts_queuereturn'}, "Timeout.queuereturn",
68 &option_input($text{'opts_queuewarn'}, "Timeout.queuewarn",
71 &option_input($text{'opts_queue'}, "QueueDirectory", $conf, $default, 35);
73 &option_input($text{'opts_postmaster'}, "PostMasterCopy",
74 $conf, "Postmaster", 35);
76 &option_input($text{'opts_forward'}, "ForwardPath", $conf, $default, 35);
78 &option_input($text{'opts_minfree'}, "MinFreeBlocks",
79 $conf, $default, 8, $text{'opts_blocks'});
80 &option_input($text{'opts_maxmessage'}, "MaxMessageSize",
81 $conf, $default, 10, $text{'opts_bytes'});
83 &option_input($text{'opts_loglevel'}, "LogLevel", $conf, $default, 4);
84 ($vstr, $v) = &find_option("SendMimeErrors", $conf);
85 print &ui_table_row(&hlink($text{'opts_mimebounce'}, "opt_SendMimeErrors"),
86 &ui_radio("SendMimeErrors", $v eq "True" ? "True" : "False",
87 [ [ "True", $text{'yes'} ],
88 [ "False", $text{'no'} ] ]));
90 ($gstr, $g) = &find_option("MatchGECOS", $conf);
91 print &ui_table_row(&hlink($text{'opts_gecos'}, "opt_MatchGECOS"),
92 &ui_radio("MatchGECOS", $v eq "True" ? "True" : "False",
93 [ [ "True", $text{'yes'} ],
94 [ "False", $text{'no'} ] ]));
95 &option_input($text{'opts_hops'}, "MaxHopCount", $conf, $default, 4);
98 &option_input($text{'opts_maxrcpt'}, "MaxRecipientsPerMessage",
100 &option_input($text{'opts_maxbad'}, "BadRcptThrottle",
104 ($bstr, $b) = &find_option("DontBlameSendmail", $conf);
105 print &ui_table_row(&hlink($text{'opts_blame'}, "opt_DontBlameSendmail"),
106 &ui_radio("DontBlameSendmail_def", $b ? 0 : 1,
107 [ [ 1, $text{'default'} ],
108 [ 0, $text{'opts_selected'} ] ])."<br>".
109 &ui_select("DontBlameSendmail",
110 [ split(/[\s,]+/, $b) ],
112 "$_->[0] (".(length($_->[1]) > 40 ? substr($_->[1], 0, 40)."..." : $_->[1]).")" ] } &list_dontblames() ],
115 print &ui_table_end();
116 print &ui_form_end([ [ undef, $text{'opts_save'} ] ]);
118 &ui_print_footer("", $text{'index_return'});
120 # option_input(desc, name, &config, default, size, units)
123 local ($vstr, $v) = &find_option($_[1], $_[2]);
124 print &ui_table_row(&hlink($_[0], "opt_".$_[1]),
125 &ui_opt_textbox($_[1], $v, $_[4], $_[3])." ".$_[5],
129 # options_input(desc, name, &config, default, size, units)
132 local @vals = &find_options($_[1], $_[2]);
133 print &ui_table_row(&hlink($_[0], "opt_".$_[1]),
134 &ui_radio("$_[1]_def", @vals ? 0 : 1,
135 [ [ 1, $_[3] ], [ 0, $text{'opts_below'} ] ])."<br>".
136 &ui_textarea($_[1], join("\n", map { $_->[1] } @vals), 3, $_[4]),