2 require 'mailboxes-lib.pl';
4 # acl_security_form(&options)
5 # Output HTML for editing security options for the sendmail module
8 # Users whose mail can be read
9 print "<tr> <td valign=top><b>$text{'acl_read'}</b></td> <td colspan=3>\n";
10 printf "<input type=radio name=mmode value=0 %s> $text{'acl_none'}\n",
11 $_[0]->{'mmode'} == 0 ? "checked" : "";
13 printf "<input type=radio name=mmode value=4 %s> $text{'acl_same'}\n",
14 $_[0]->{'mmode'} == 4 ? "checked" : "";
16 printf "<input type=radio name=mmode value=1 %s> $text{'acl_all'}<br>\n",
17 $_[0]->{'mmode'} == 1 ? "checked" : "";
19 printf "<input type=radio name=mmode value=2 %s> $text{'acl_users'}\n",
20 $_[0]->{'mmode'} == 2 ? "checked" : "";
21 printf "<input name=musers size=40 value='%s'> %s<br>\n",
22 $_[0]->{'mmode'} == 2 ? $_[0]->{'musers'} : "",
23 &user_chooser_button("musers", 1);
25 printf "<input type=radio name=mmode value=3 %s> $text{'acl_userse'}\n",
26 $_[0]->{'mmode'} == 3 ? "checked" : "";
27 printf "<input name=muserse size=40 value='%s'> %s<br>\n",
28 $_[0]->{'mmode'} == 3 ? $_[0]->{'musers'} : "",
29 &user_chooser_button("muserse", 1);
31 printf "<input type=radio name=mmode value=5 %s> $text{'acl_usersg'}\n",
32 $_[0]->{'mmode'} == 5 ? "checked" : "";
33 printf "<input name=musersg size=30 value='%s'> %s\n",
34 $_[0]->{'mmode'} == 5 ? join(" ", map { scalar(getgrgid($_)) }
35 split(/\s+/, $_[0]->{'musers'})) : "",
36 &group_chooser_button("musersg", 1);
37 printf "<input type=checkbox name=msec value=1 %s> %s<br>\n",
38 $_[0]->{'msec'} ? "checked" : "", $text{'acl_sec'};
40 printf "<input type=radio name=mmode value=7 %s> $text{'acl_usersu'}\n",
41 $_[0]->{'mmode'} == 7 ? "checked" : "";
42 printf "<input name=musersu1 size=6 value='%s'> -\n",
43 $_[0]->{'mmode'} == 7 ? $_[0]->{'musers'} : "";
44 printf "<input name=musersu2 size=6 value='%s'><br>\n",
45 $_[0]->{'mmode'} == 7 ? $_[0]->{'musers2'} : "";
47 printf "<input type=radio name=mmode value=6 %s> $text{'acl_usersm'}\n",
48 $_[0]->{'mmode'} == 6 ? "checked" : "";
49 printf "<input name=musersm size=15 value='%s'></td> </tr>\n",
50 $_[0]->{'mmode'} == 6 ? $_[0]->{'musers'} : "";
52 # Directory for arbitrary files
53 print "<tr> <td valign=top><b>$text{'acl_dir'}</b></td> <td colspan=3>\n";
54 print &ui_opt_textbox("dir", $_[0]->{'dir'}, 40, $text{'acl_dirauto'}."<br>");
55 print "</td> </tr>\n";
57 # Allowed From: addresses
58 print "<tr> <td valign=top><b>$text{'acl_from'}</b></td> <td colspan=3>\n";
59 printf "<input type=radio name=fmode value=0 %s> $text{'acl_any'}<br>\n",
60 $_[0]->{'fmode'} == 0 ? "checked" : "";
61 printf "<input type=radio name=fmode value=1 %s> $text{'acl_fdoms'}\n",
62 $_[0]->{'fmode'} == 1 ? "checked" : "";
63 printf "<input name=fdoms size=40 value='%s'><br>\n",
64 $_[0]->{'fmode'} == 1 ? $_[0]->{'from'} : '';
65 printf "<input type=radio name=fmode value=2 %s> $text{'acl_faddrs'}\n",
66 $_[0]->{'fmode'} == 2 ? "checked" : "";
67 printf "<input name=faddrs size=40 value='%s'><br>\n",
68 $_[0]->{'fmode'} == 2 ? $_[0]->{'from'} : '';
69 printf "<input type=radio name=fmode value=3 %s> $text{'acl_fdom'}\n",
70 $_[0]->{'fmode'} == 3 ? "checked" : "";
71 printf "<input name=fdom size=20 value='%s'><br>\n",
72 $_[0]->{'fmode'} == 3 ? $_[0]->{'from'} : '';
73 print "</td> </tr>\n";
75 print "<tr> <td><b>$text{'acl_fromname'}</b></td>\n";
76 print "<td colspan=3><input name=fromname size=40 ",
77 "value='$_[0]->{'fromname'}'></td> </tr>\n";
79 print "<tr> <td><b>$text{'acl_attach'}</b></td> <td colspan=3>\n";
80 printf "<input type=radio name=attach_def value=1 %s> %s\n",
81 $_[0]->{'attach'}<0 ? 'checked' : '', $text{'acl_unlimited'};
82 printf "<input type=radio name=attach_def value=0 %s>\n",
83 $_[0]->{'attach'}<0 ? '' : 'checked';
84 printf "<input name=attach size=5 value='%s'> kB\n",
85 $_[0]->{'attach'}<0 ? '' : $_[0]->{'attach'};
86 print "</td> </tr>\n";
88 print "<tr> <td><b>$text{'acl_canattach'}</b></td>\n";
89 printf "<td colspan=3><input type=radio name=canattach value=1 %s> %s\n",
90 $_[0]->{'canattach'} ? 'checked' : '', $text{'yes'};
91 printf "<input type=radio name=canattach value=0 %s> %s</td> </tr>\n",
92 $_[0]->{'canattach'} ? '' : 'checked', $text{'no'};
94 print "<tr> <td><b>$text{'acl_candetach'}</b></td>\n";
95 printf "<td colspan=3><input type=radio name=candetach value=1 %s> %s\n",
96 $_[0]->{'candetach'} ? 'checked' : '', $text{'yes'};
97 printf "<input type=radio name=candetach value=0 %s> %s</td> </tr>\n",
98 $_[0]->{'candetach'} ? '' : 'checked', $text{'no'};
101 # acl_security_save(&options)
102 # Parse the form for security options for the sendmail module
103 sub acl_security_save
105 $_[0]->{'mmode'} = $in{'mmode'};
106 $_[0]->{'musers'} = $in{'mmode'} == 2 ? $in{'musers'} :
107 $in{'mmode'} == 3 ? $in{'muserse'} :
108 $in{'mmode'} == 5 ? join(" ", map { scalar(getgrnam($_)) }
109 split(/\s+/, $in{'musersg'})) :
110 $in{'mmode'} == 6 ? $in{'musersm'} :
111 $in{'mmode'} == 7 ? $in{'musersu1'} : "";
112 $_[0]->{'musers2'} = $in{'mmode'} == 7 ? $in{'musersu2'} : "";
113 $_[0]->{'msec'} = $in{'msec'};
114 $_[0]->{'fmode'} = $in{'fmode'};
115 $_[0]->{'from'} = $in{'fmode'} == 0 ? undef :
116 $in{'fmode'} == 1 ? $in{'fdoms'} :
117 $in{'fmode'} == 2 ? $in{'faddrs'} : $in{'fdom'};
118 $_[0]->{'fromname'} = $in{'fromname'};
119 $_[0]->{'attach'} = $in{'attach_def'} ? -1 : $in{'attach'};
120 $_[0]->{'canattach'} = $in{'canattach'};
121 $_[0]->{'candetach'} = $in{'candetach'};
122 $_[0]->{'dir'} = $in{'dir_def'} ? undef : $in{'dir'};