line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Mail::Toaster::Setup::Vpopmail; |
2
|
2
|
|
|
2
|
|
8
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
57
|
|
3
|
2
|
|
|
2
|
|
8
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
82
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
our $VERSION = '5.50'; |
6
|
|
|
|
|
|
|
|
7
|
2
|
|
|
2
|
|
7
|
use Carp; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
139
|
|
8
|
2
|
|
|
2
|
|
9
|
use English '-no_match_vars'; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
13
|
|
9
|
2
|
|
|
2
|
|
665
|
use Params::Validate ':all'; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
289
|
|
10
|
|
|
|
|
|
|
|
11
|
2
|
|
|
2
|
|
9
|
use lib 'lib'; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
15
|
|
12
|
2
|
|
|
2
|
|
193
|
use parent 'Mail::Toaster::Base'; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
17
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub install { |
15
|
0
|
|
|
0
|
0
|
0
|
my $self = shift; |
16
|
0
|
|
|
|
|
0
|
my %p = validate( @_, { $self->get_std_opts } ); |
17
|
|
|
|
|
|
|
|
18
|
0
|
0
|
|
|
|
0
|
return $p{test_ok} if defined $p{test_ok}; # for testing |
19
|
|
|
|
|
|
|
|
20
|
0
|
0
|
|
|
|
0
|
if ( !$self->conf->{'install_vpopmail'} ) { |
21
|
0
|
|
|
|
|
0
|
$self->audit( "vpopmail: installing, skipping (disabled)" ); |
22
|
0
|
|
|
|
|
0
|
return; |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
0
|
|
0
|
|
|
0
|
my $version = $self->conf->{install_vpopmail} || '5.4.33'; |
26
|
|
|
|
|
|
|
|
27
|
0
|
0
|
|
|
|
0
|
if ( $OSNAME eq "freebsd" ) { |
28
|
|
|
|
|
|
|
# always install the port version, so subsequent ports will |
29
|
|
|
|
|
|
|
# find it registered in the ports db. |
30
|
0
|
|
|
|
|
0
|
$self->install_freebsd_port; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
0
|
0
|
|
|
|
0
|
if ( $version ne 'port' ) { |
34
|
0
|
|
|
|
|
0
|
$self->install_from_source( %p ); |
35
|
|
|
|
|
|
|
}; |
36
|
|
|
|
|
|
|
|
37
|
0
|
|
|
|
|
0
|
return $self->post_install; |
38
|
|
|
|
|
|
|
}; |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub install_freebsd_port { |
41
|
0
|
|
|
0
|
0
|
0
|
my $self = shift; |
42
|
0
|
|
|
|
|
0
|
my %p = validate( @_, { $self->get_std_opts },); |
43
|
|
|
|
|
|
|
|
44
|
0
|
|
|
|
|
0
|
my $conf = $self->conf; |
45
|
0
|
|
|
|
|
0
|
my $version = $conf->{'install_vpopmail'}; |
46
|
|
|
|
|
|
|
|
47
|
0
|
0
|
|
|
|
0
|
return $p{test_ok} if defined $p{test_ok}; # for testing only |
48
|
|
|
|
|
|
|
|
49
|
0
|
|
|
|
|
0
|
my @defs = 'LOGLEVEL="p"'; |
50
|
|
|
|
|
|
|
|
51
|
0
|
0
|
|
|
|
0
|
my $learn = $conf->{vpopmail_learn_passwords} ? 'SET' : 'UNSET'; |
52
|
0
|
0
|
|
|
|
0
|
my $ip_alias = $conf->{vpopmail_ip_alias_domains} ? 'SET' : 'UNSET'; |
53
|
0
|
0
|
|
|
|
0
|
my $qmail_ext= $conf->{vpopmail_qmail_ext} ? 'SET' : 'UNSET'; |
54
|
0
|
0
|
|
|
|
0
|
my $single_dom=$conf->{vpopmail_disable_many_domains} ? 'SET' : 'UNSET'; |
55
|
0
|
0
|
|
|
|
0
|
my $maildrop = $conf->{vpopmail_maildrop} ? 'SET' : 'UNSET'; |
56
|
0
|
0
|
|
|
|
0
|
my $mysql = $conf->{'vpopmail_mysql'} ? 'SET' : 'UNSET'; |
57
|
0
|
0
|
|
|
|
0
|
my $roaming = $conf->{vpopmail_roaming_users} ? 'SET' : 'UNSET'; |
58
|
0
|
|
|
|
|
0
|
my $mysql_rep= my $mysql_lim = my $sql_log = my $valias = 'UNSET'; |
59
|
0
|
0
|
|
|
|
0
|
my $auth_log = $conf->{vpopmail_auth_logging} ? 'SET' : 'UNSET'; |
60
|
|
|
|
|
|
|
|
61
|
0
|
0
|
0
|
|
|
0
|
if ( $roaming eq 'SET' && $conf->{vpopmail_relay_clear_minutes} ) { |
62
|
0
|
|
|
|
|
0
|
push @defs, 'RELAYCLEAR='.$conf->{vpopmail_relay_clear_minutes}; |
63
|
|
|
|
|
|
|
}; |
64
|
|
|
|
|
|
|
|
65
|
0
|
0
|
|
|
|
0
|
if ( $mysql eq 'SET' ) { |
66
|
0
|
0
|
|
|
|
0
|
$self->error( "vpopmail_mysql is enabled but install_mysql is not. Please correct your settings" ) if ! $conf->{install_mysql}; |
67
|
0
|
0
|
|
|
|
0
|
$mysql_rep = 'SET' if $conf->{vpopmail_mysql_replication}; |
68
|
0
|
0
|
|
|
|
0
|
$mysql_lim = 'SET' if $conf->{vpopmail_mysql_limits}; |
69
|
0
|
0
|
|
|
|
0
|
$valias = 'SET' if $conf->{vpopmail_valias}; |
70
|
0
|
0
|
|
|
|
0
|
$sql_log = 'SET' if $conf->{vpopmail_mysql_logging}; |
71
|
|
|
|
|
|
|
}; |
72
|
|
|
|
|
|
|
|
73
|
0
|
0
|
|
|
|
0
|
$self->freebsd->install_port( 'vpopmail', |
74
|
|
|
|
|
|
|
flags => join( ',', @defs ), |
75
|
|
|
|
|
|
|
options => "# installed by Mail::Toaster |
76
|
|
|
|
|
|
|
# Options for vpopmail-5.4.32_3 |
77
|
|
|
|
|
|
|
_OPTIONS_READ=vpopmail-5.4.32_3 |
78
|
|
|
|
|
|
|
_FILE_COMPLETE_OPTIONS_LIST=AUTH_LOG CLEAR_PASSWD DOCS DOMAIN_QUOTAS FILE_LOCKING FILE_SYNC FPIC IP_ALIAS LDAP LDAP_SASL LEARN_PASSWORDS MAILDROP MD5_PASSWORDS MYSQL MYSQL_LIMITS MYSQL_REPLICATION ONCHANGE_SCRIPT ORACLE PASSWD PGSQL QMAIL_EXT ROAMING SEEKABLE SINGLE_DOMAIN SMTP_AUTH_PATCH SPAMASSASSIN SPAMFOLDER SQL_LOG SQL_LOG_TRIM SUID_VCHKPW SYBASE USERS_BIG_DIR VALIAS |
79
|
|
|
|
|
|
|
OPTIONS_FILE_$auth_log+=AUTH_LOG |
80
|
|
|
|
|
|
|
OPTIONS_FILE_SET+=CLEAR_PASSWD |
81
|
|
|
|
|
|
|
OPTIONS_FILE_SET+=DOCS |
82
|
|
|
|
|
|
|
OPTIONS_FILE_UNSET+=DOMAIN_QUOTAS |
83
|
|
|
|
|
|
|
OPTIONS_FILE_SET+=FILE_LOCKING |
84
|
|
|
|
|
|
|
OPTIONS_FILE_UNSET+=FILE_SYNC |
85
|
|
|
|
|
|
|
OPTIONS_FILE_SET+=FPIC |
86
|
|
|
|
|
|
|
OPTIONS_FILE_$ip_alias+=IP_ALIAS |
87
|
|
|
|
|
|
|
OPTIONS_FILE_UNSET+=LDAP |
88
|
|
|
|
|
|
|
OPTIONS_FILE_UNSET+=LDAP_SASL |
89
|
|
|
|
|
|
|
OPTIONS_FILE_$learn+=LEARN_PASSWORDS |
90
|
|
|
|
|
|
|
OPTIONS_FILE_$maildrop+=MAILDROP |
91
|
|
|
|
|
|
|
OPTIONS_FILE_SET+=MD5_PASSWORDS |
92
|
|
|
|
|
|
|
OPTIONS_FILE_$mysql+=MYSQL |
93
|
|
|
|
|
|
|
OPTIONS_FILE_$mysql_lim+=MYSQL_LIMITS |
94
|
|
|
|
|
|
|
OPTIONS_FILE_$mysql_rep+=MYSQL_REPLICATION |
95
|
|
|
|
|
|
|
OPTIONS_FILE_UNSET+=ONCHANGE_SCRIPT |
96
|
|
|
|
|
|
|
OPTIONS_FILE_UNSET+=ORACLE |
97
|
|
|
|
|
|
|
OPTIONS_FILE_UNSET+=PASSWD |
98
|
|
|
|
|
|
|
OPTIONS_FILE_UNSET+=PGSQL |
99
|
|
|
|
|
|
|
OPTIONS_FILE_$qmail_ext+=QMAIL_EXT |
100
|
|
|
|
|
|
|
OPTIONS_FILE_$roaming+=ROAMING |
101
|
|
|
|
|
|
|
OPTIONS_FILE_SET+=SEEKABLE |
102
|
|
|
|
|
|
|
OPTIONS_FILE_$single_dom+=SINGLE_DOMAIN |
103
|
|
|
|
|
|
|
OPTIONS_FILE_UNSET+=SMTP_AUTH_PATCH |
104
|
|
|
|
|
|
|
OPTIONS_FILE_UNSET+=SPAMASSASSIN |
105
|
|
|
|
|
|
|
OPTIONS_FILE_UNSET+=SPAMFOLDER |
106
|
|
|
|
|
|
|
OPTIONS_FILE_$sql_log+=SQL_LOG |
107
|
|
|
|
|
|
|
OPTIONS_FILE_UNSET+=SQL_LOG_TRIM |
108
|
|
|
|
|
|
|
OPTIONS_FILE_UNSET+=SUID_VCHKPW |
109
|
|
|
|
|
|
|
OPTIONS_FILE_UNSET+=SYBASE |
110
|
|
|
|
|
|
|
OPTIONS_FILE_SET+=USERS_BIG_DIR |
111
|
|
|
|
|
|
|
OPTIONS_FILE_$valias+=VALIAS |
112
|
|
|
|
|
|
|
", |
113
|
|
|
|
|
|
|
) or return; |
114
|
|
|
|
|
|
|
|
115
|
0
|
|
|
|
|
0
|
my $vpopdir = $self->get_vpop_dir; |
116
|
0
|
|
|
|
|
0
|
my $docroot = $self->conf->{'toaster_http_docs'}; |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
# add a symlink so docs are web browsable |
119
|
0
|
0
|
0
|
|
|
0
|
if ( -d $docroot && ! -e "$docroot/vpopmail" ) { |
120
|
0
|
0
|
|
|
|
0
|
if ( -d "$vpopdir/doc/man_html" ) { |
121
|
0
|
|
|
|
|
0
|
symlink "$vpopdir/doc/man_html", "$docroot/vpopmail"; |
122
|
|
|
|
|
|
|
} |
123
|
|
|
|
|
|
|
} |
124
|
|
|
|
|
|
|
} |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
sub install_from_source { |
127
|
0
|
|
|
0
|
0
|
0
|
my $self = shift; |
128
|
0
|
|
|
|
|
0
|
my %p = validate( @_, { $self->get_std_opts },); |
129
|
|
|
|
|
|
|
|
130
|
0
|
|
|
|
|
0
|
my $conf = $self->conf; |
131
|
0
|
|
0
|
|
|
0
|
my $version = $conf->{'install_vpopmail'} || "5.4.33"; |
132
|
0
|
|
|
|
|
0
|
my $package = "vpopmail-$version"; |
133
|
0
|
|
|
|
|
0
|
my $vpopdir = $self->get_vpop_dir; |
134
|
|
|
|
|
|
|
|
135
|
0
|
|
|
|
|
0
|
$self->create_user(); # add the vpopmail user/group |
136
|
0
|
|
0
|
|
|
0
|
my $uid = getpwnam( $conf->{'vpopmail_user'} || "vpopmail" ); |
137
|
0
|
|
0
|
|
|
0
|
my $gid = getgrnam( $conf->{'vpopmail_group'} || "vchkpw" ); |
138
|
|
|
|
|
|
|
|
139
|
0
|
|
|
|
|
0
|
my $installed = $self->installed_version(); |
140
|
|
|
|
|
|
|
|
141
|
0
|
0
|
0
|
|
|
0
|
if ( $installed && $installed eq $version ) { |
142
|
|
|
|
|
|
|
$self->util->yes_or_no( |
143
|
|
|
|
|
|
|
"Do you want to reinstall vpopmail with the same version?", |
144
|
|
|
|
|
|
|
timeout => 60, |
145
|
0
|
0
|
|
|
|
0
|
) or do { |
146
|
0
|
|
|
|
|
0
|
$self->post_install(); |
147
|
0
|
|
|
|
|
0
|
return 1; |
148
|
|
|
|
|
|
|
}; |
149
|
|
|
|
|
|
|
} |
150
|
|
|
|
|
|
|
|
151
|
0
|
|
|
|
|
0
|
my $conf_args; |
152
|
0
|
|
|
|
|
0
|
foreach ( qw/ rebuild_tcpserver_file ip_alias_domains valias mysql_logging |
153
|
|
|
|
|
|
|
qmail_ext learn_passwords mysql / ) { |
154
|
0
|
|
|
|
|
0
|
my $mt_setting = 'vpopmail_' . $_; |
155
|
0
|
|
|
|
|
0
|
my $conf_arg = "--enable-$_"; |
156
|
0
|
|
|
|
|
0
|
$conf_arg =~ s/_/-/g; |
157
|
0
|
0
|
|
|
|
0
|
my $r = $conf->{$mt_setting} ? 'yes' : 'no'; |
158
|
0
|
|
|
|
|
0
|
$conf_args .= " $conf_arg=$r"; |
159
|
0
|
|
|
|
|
0
|
print "$conf_arg=$r\n"; |
160
|
|
|
|
|
|
|
}; |
161
|
|
|
|
|
|
|
|
162
|
0
|
0
|
|
|
|
0
|
if ( ! $self->is_newer( min => "5.3.30", cur => $version ) ) { |
163
|
0
|
0
|
|
|
|
0
|
if ( defined $conf->{'vpopmail_default_quota'} ) { |
164
|
|
|
|
|
|
|
$conf_args .= |
165
|
0
|
|
|
|
|
0
|
" --enable-defaultquota=".$conf->{'vpopmail_default_quota'}; |
166
|
0
|
|
|
|
|
0
|
print "default quota: ".$conf->{'vpopmail_default_quota'}."\n"; |
167
|
|
|
|
|
|
|
} |
168
|
|
|
|
|
|
|
else { |
169
|
0
|
|
|
|
|
0
|
$conf_args .= " --enable-defaultquota=100000000S,10000C"; |
170
|
0
|
|
|
|
|
0
|
print "default quota: 100000000S,10000C\n"; |
171
|
|
|
|
|
|
|
} |
172
|
|
|
|
|
|
|
} |
173
|
|
|
|
|
|
|
|
174
|
0
|
|
|
|
|
0
|
$conf_args .= $self->roaming_users(); |
175
|
|
|
|
|
|
|
|
176
|
0
|
0
|
0
|
|
|
0
|
if ( $OSNAME eq "darwin" && !-d "/usr/local/mysql" |
|
|
|
0
|
|
|
|
|
177
|
|
|
|
|
|
|
&& -d "/opt/local/include/mysql" ) { |
178
|
0
|
|
|
|
|
0
|
$conf_args .= " --enable-incdir=/opt/local/include/mysql"; |
179
|
0
|
|
|
|
|
0
|
$conf_args .= " --enable-libdir=/opt/local/lib/mysql"; |
180
|
|
|
|
|
|
|
} |
181
|
|
|
|
|
|
|
|
182
|
0
|
|
|
|
|
0
|
my $tcprules = $self->util->find_bin( "tcprules", verbose=>0 ); |
183
|
0
|
|
|
|
|
0
|
$conf_args .= " --enable-tcprules-prog=$tcprules"; |
184
|
|
|
|
|
|
|
|
185
|
0
|
|
0
|
|
|
0
|
my $src = $conf->{'toaster_src_dir'} || "/usr/local/src"; |
186
|
|
|
|
|
|
|
|
187
|
0
|
|
|
|
|
0
|
$self->util->cwd_source_dir( "$src/mail" ); |
188
|
|
|
|
|
|
|
|
189
|
0
|
|
|
|
|
0
|
my $tarball = "$package.tar.gz"; |
190
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
# save having to download it again |
192
|
0
|
0
|
|
|
|
0
|
if ( -e "/usr/ports/distfiles/vpopmail-$version.tar.gz" ) { |
193
|
0
|
|
|
|
|
0
|
copy( |
194
|
|
|
|
|
|
|
"/usr/ports/distfiles/vpopmail-$version.tar.gz", |
195
|
|
|
|
|
|
|
"/usr/local/src/mail/" |
196
|
|
|
|
|
|
|
); |
197
|
|
|
|
|
|
|
} |
198
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
$self->util->sources_get( |
200
|
|
|
|
|
|
|
'package' => $package, |
201
|
0
|
|
|
|
|
0
|
site => "http://" . $conf->{'toaster_sf_mirror'}, |
202
|
|
|
|
|
|
|
path => "/vpopmail", |
203
|
|
|
|
|
|
|
); |
204
|
|
|
|
|
|
|
|
205
|
0
|
0
|
|
|
|
0
|
if ( -d $package ) { |
206
|
0
|
0
|
|
|
|
0
|
$self->util->source_warning( |
207
|
|
|
|
|
|
|
package => $package, |
208
|
|
|
|
|
|
|
src => "$src/mail", |
209
|
|
|
|
|
|
|
) or return; |
210
|
|
|
|
|
|
|
} |
211
|
|
|
|
|
|
|
|
212
|
0
|
0
|
|
|
|
0
|
$self->util->extract_archive( $tarball ) or die; |
213
|
|
|
|
|
|
|
|
214
|
0
|
0
|
|
|
|
0
|
if ( $conf->{vpopmail_mysql} ) { |
215
|
0
|
|
|
|
|
0
|
$conf_args .= $self->mysql_options(); |
216
|
|
|
|
|
|
|
}; |
217
|
0
|
|
|
|
|
0
|
$conf_args .= $self->logging(); |
218
|
0
|
|
|
|
|
0
|
$conf_args .= $self->default_domain($version); |
219
|
0
|
|
|
|
|
0
|
$conf_args .= $self->etc_passwd(); |
220
|
|
|
|
|
|
|
|
221
|
|
|
|
|
|
|
# in case someone updates their toaster and not their config file |
222
|
0
|
0
|
0
|
|
|
0
|
if ( defined $conf->{'vpopmail_qmail_ext'} |
223
|
|
|
|
|
|
|
&& $conf->{'vpopmail_qmail_ext'} ) { |
224
|
0
|
|
|
|
|
0
|
$conf_args .= " --enable-qmail-ext=y"; |
225
|
0
|
|
|
|
|
0
|
print "qmail extensions: yes\n"; |
226
|
|
|
|
|
|
|
} |
227
|
0
|
0
|
|
|
|
0
|
if ( defined $conf->{'vpopmail_maildrop'} ) { |
228
|
0
|
|
|
|
|
0
|
$conf_args .= " --enable-maildrop=y"; |
229
|
|
|
|
|
|
|
}; |
230
|
|
|
|
|
|
|
|
231
|
0
|
|
|
|
|
0
|
print "fixup for longer passwords\n"; |
232
|
0
|
|
|
|
|
0
|
system "sed -i -Ee '/^pw_clear_passwd char(/s/16/128/' vmysql.h"; |
233
|
0
|
|
|
|
|
0
|
system "sed -i -Ee '/^pw_passwd char(/s/40/128/' vmysql.h"; |
234
|
|
|
|
|
|
|
|
235
|
0
|
|
|
|
|
0
|
chdir($package); |
236
|
0
|
|
|
|
|
0
|
print "running configure with $conf_args\n\n"; |
237
|
|
|
|
|
|
|
|
238
|
0
|
|
|
|
|
0
|
$self->util->syscmd( "./configure $conf_args", verbose => 0 ); |
239
|
0
|
|
|
|
|
0
|
$self->util->syscmd( "make", verbose => 0 ); |
240
|
0
|
|
|
|
|
0
|
$self->util->syscmd( "make install-strip", verbose => 0 ); |
241
|
|
|
|
|
|
|
|
242
|
0
|
0
|
|
|
|
0
|
if ( -e "vlimits.h" ) { |
243
|
|
|
|
|
|
|
# this was for a bug in vpopmail 5.4.?(1-2) installer |
244
|
0
|
|
|
|
|
0
|
$self->util->syscmd( "cp vlimits.h $vpopdir/include/", verbose => 0); |
245
|
|
|
|
|
|
|
} |
246
|
|
|
|
|
|
|
|
247
|
0
|
|
|
|
|
0
|
return 1; |
248
|
|
|
|
|
|
|
} |
249
|
|
|
|
|
|
|
|
250
|
|
|
|
|
|
|
sub default_domain { |
251
|
0
|
|
|
0
|
0
|
0
|
my $self = shift; |
252
|
0
|
|
|
|
|
0
|
my $version = shift; |
253
|
|
|
|
|
|
|
|
254
|
0
|
|
|
|
|
0
|
my $default_domain; |
255
|
|
|
|
|
|
|
|
256
|
0
|
0
|
|
|
|
0
|
if ( defined $self->conf->{'vpopmail_default_domain'} ) { |
257
|
0
|
|
|
|
|
0
|
$default_domain = $self->conf->{'vpopmail_default_domain'}; |
258
|
|
|
|
|
|
|
} |
259
|
|
|
|
|
|
|
else { |
260
|
0
|
0
|
|
|
|
0
|
$self->util->yes_or_no( "Do you want to use a default domain? " ) or do { |
261
|
0
|
|
|
|
|
0
|
print "default domain: NONE SELECTED.\n"; |
262
|
0
|
|
|
|
|
0
|
return ''; |
263
|
|
|
|
|
|
|
}; |
264
|
|
|
|
|
|
|
|
265
|
0
|
|
|
|
|
0
|
$default_domain = $self->util->ask("your default domain"); |
266
|
|
|
|
|
|
|
}; |
267
|
|
|
|
|
|
|
|
268
|
0
|
0
|
|
|
|
0
|
if ( ! $default_domain ) { |
269
|
0
|
|
|
|
|
0
|
print "default domain: NONE SELECTED.\n"; |
270
|
0
|
|
|
|
|
0
|
return ''; |
271
|
|
|
|
|
|
|
}; |
272
|
|
|
|
|
|
|
|
273
|
0
|
0
|
|
|
|
0
|
if ( $self->is_newer( min => "5.3.22", cur => $version ) ) { |
274
|
0
|
|
|
|
|
0
|
my $vpopetc = $self->get_vpop_etc; |
275
|
0
|
|
|
|
|
0
|
$self->util->file_write( "$vpopetc/defaultdomain", |
276
|
|
|
|
|
|
|
lines => [ $default_domain ], |
277
|
|
|
|
|
|
|
verbose => 0, |
278
|
|
|
|
|
|
|
); |
279
|
|
|
|
|
|
|
|
280
|
|
|
|
|
|
|
$self->util->chown( "$vpopetc/defaultdomain", |
281
|
|
|
|
|
|
|
uid => $self->conf->{'vpopmail_user'} || "vpopmail", |
282
|
0
|
|
0
|
|
|
0
|
gid => $self->conf->{'vpopmail_group'} || "vchkpw", |
|
|
|
0
|
|
|
|
|
283
|
|
|
|
|
|
|
); |
284
|
|
|
|
|
|
|
|
285
|
0
|
|
|
|
|
0
|
return ''; |
286
|
|
|
|
|
|
|
} |
287
|
|
|
|
|
|
|
|
288
|
0
|
|
|
|
|
0
|
print "default domain: $default_domain\n"; |
289
|
0
|
|
|
|
|
0
|
return " --enable-default-domain=$default_domain"; |
290
|
|
|
|
|
|
|
}; |
291
|
|
|
|
|
|
|
|
292
|
|
|
|
|
|
|
sub vpopmail_etc { |
293
|
0
|
|
|
0
|
0
|
0
|
my $self = shift; |
294
|
0
|
|
|
|
|
0
|
my %p = validate( @_, { $self->get_std_opts } ); |
295
|
|
|
|
|
|
|
|
296
|
0
|
|
|
|
|
0
|
my $vetc = $self->get_vpop_etc; |
297
|
|
|
|
|
|
|
|
298
|
0
|
0
|
|
|
|
0
|
mkpath( $vetc, oct('0775') ) if ! -d $vetc; |
299
|
|
|
|
|
|
|
|
300
|
0
|
0
|
|
|
|
0
|
if ( -d $vetc ) { |
301
|
0
|
|
|
|
|
0
|
print "$vetc already exists.\n"; |
302
|
|
|
|
|
|
|
} |
303
|
|
|
|
|
|
|
else { |
304
|
0
|
|
|
|
|
0
|
print "creating $vetc\n"; |
305
|
0
|
0
|
|
|
|
0
|
mkdir( $vetc, oct('0775') ) or carp "failed to create $vetc: $!\n"; |
306
|
|
|
|
|
|
|
} |
307
|
|
|
|
|
|
|
|
308
|
0
|
|
|
|
|
0
|
$self->setup->tcp_smtp( etc_dir => $vetc ); |
309
|
0
|
|
|
|
|
0
|
$self->setup->tcp_smtp_cdb( etc_dir => $vetc ); |
310
|
|
|
|
|
|
|
} |
311
|
|
|
|
|
|
|
|
312
|
|
|
|
|
|
|
sub etc_passwd { |
313
|
0
|
|
|
0
|
0
|
0
|
my $self = shift; |
314
|
|
|
|
|
|
|
|
315
|
0
|
0
|
|
|
|
0
|
unless ( defined $self->conf->{'vpopmail_etc_passwd'} ) { |
316
|
0
|
|
|
|
|
0
|
print "\t\t CAUTION!! CAUTION!! |
317
|
|
|
|
|
|
|
|
318
|
|
|
|
|
|
|
The system user account feature is NOT compatible with qmail-smtpd-chkusr. |
319
|
|
|
|
|
|
|
If you selected that option in the qmail build, you should not answer |
320
|
|
|
|
|
|
|
yes here. If you are unsure, select (n).\n"; |
321
|
|
|
|
|
|
|
|
322
|
0
|
0
|
|
|
|
0
|
if ( $self->util->yes_or_no( "Do system users (/etc/passwd) get mail? (n) ")) { |
323
|
0
|
|
|
|
|
0
|
print "system password accounts: yes\n"; |
324
|
0
|
|
|
|
|
0
|
return " --enable-passwd"; |
325
|
|
|
|
|
|
|
} |
326
|
|
|
|
|
|
|
} |
327
|
|
|
|
|
|
|
|
328
|
0
|
0
|
|
|
|
0
|
if ( $self->conf->{'vpopmail_etc_passwd'} ) { |
329
|
0
|
|
|
|
|
0
|
print "system password accounts: yes\n"; |
330
|
0
|
|
|
|
|
0
|
return " --enable-passwd"; |
331
|
|
|
|
|
|
|
} |
332
|
|
|
|
|
|
|
|
333
|
0
|
|
|
|
|
0
|
print "system password accounts: no\n"; |
334
|
|
|
|
|
|
|
}; |
335
|
|
|
|
|
|
|
|
336
|
|
|
|
|
|
|
sub get_vpop_etc { |
337
|
0
|
|
|
0
|
0
|
0
|
my $self = shift; |
338
|
0
|
|
|
|
|
0
|
my $base = $self->get_vpop_dir; |
339
|
0
|
|
|
|
|
0
|
return "$base/etc"; |
340
|
|
|
|
|
|
|
}; |
341
|
|
|
|
|
|
|
|
342
|
|
|
|
|
|
|
sub get_vpop_dir { |
343
|
3
|
|
|
3
|
0
|
3
|
my $self = shift; |
344
|
3
|
|
50
|
|
|
37
|
return $self->{conf}{vpopmail_home_dir} || '/usr/local/vpopmail'; |
345
|
|
|
|
|
|
|
}; |
346
|
|
|
|
|
|
|
|
347
|
|
|
|
|
|
|
sub installed_version { |
348
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
349
|
|
|
|
|
|
|
|
350
|
0
|
|
|
|
|
|
my $vpopdir = $self->get_vpop_dir; |
351
|
0
|
0
|
|
|
|
|
return if ! -x "$vpopdir/bin/vpasswd"; |
352
|
|
|
|
|
|
|
|
353
|
0
|
|
|
|
|
|
my $installed = `$vpopdir/bin/vpasswd -v | head -1 | cut -f2 -d" "`; |
354
|
0
|
|
|
|
|
|
chop $installed; |
355
|
0
|
|
|
|
|
|
$self->alert( "vpopmail version $installed installed." ); |
356
|
0
|
|
|
|
|
|
return $installed; |
357
|
|
|
|
|
|
|
} |
358
|
|
|
|
|
|
|
|
359
|
|
|
|
|
|
|
sub logging { |
360
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
361
|
|
|
|
|
|
|
|
362
|
0
|
|
|
|
|
|
my $conf = $self->conf; |
363
|
0
|
0
|
0
|
|
|
|
if ( defined $conf->{vpopmail_logging} && $conf->{vpopmail_logging} ) { |
364
|
0
|
0
|
|
|
|
|
if ( $conf->{'vpopmail_logging_verbose'} ) { |
365
|
0
|
|
|
|
|
|
print "logging: verbose with failed passwords\n"; |
366
|
0
|
|
|
|
|
|
return " --enable-logging=v"; |
367
|
|
|
|
|
|
|
} |
368
|
|
|
|
|
|
|
|
369
|
0
|
|
|
|
|
|
print "logging: everything\n"; |
370
|
0
|
|
|
|
|
|
return " --enable-logging=y"; |
371
|
|
|
|
|
|
|
} |
372
|
|
|
|
|
|
|
|
373
|
0
|
0
|
|
|
|
|
if ( ! $self->util->yes_or_no( "Do you want logging enabled? (y) ")) { |
374
|
0
|
|
|
|
|
|
return " --enable-logging=p"; |
375
|
|
|
|
|
|
|
}; |
376
|
|
|
|
|
|
|
|
377
|
0
|
0
|
|
|
|
|
if ( $self->util->yes_or_no( "Do you want verbose logging? (y) ")) { |
378
|
0
|
|
|
|
|
|
print "logging: verbose\n"; |
379
|
0
|
|
|
|
|
|
return " --enable-logging=v"; |
380
|
|
|
|
|
|
|
} |
381
|
|
|
|
|
|
|
|
382
|
0
|
|
|
|
|
|
print "logging: verbose with failed passwords\n"; |
383
|
0
|
|
|
|
|
|
return " --enable-logging=p"; |
384
|
|
|
|
|
|
|
}; |
385
|
|
|
|
|
|
|
|
386
|
|
|
|
|
|
|
sub post_install { |
387
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
388
|
0
|
|
|
|
|
|
$self->vpopmail_etc; |
389
|
0
|
|
|
|
|
|
$self->mysql_privs; |
390
|
0
|
0
|
|
|
|
|
$self->util->install_module( "vpopmail" ) if $self->{conf}{install_ezmlm_cgi}; |
391
|
0
|
|
|
|
|
|
print "vpopmail: complete.\n"; |
392
|
0
|
|
|
|
|
|
return 1; |
393
|
|
|
|
|
|
|
}; |
394
|
|
|
|
|
|
|
|
395
|
|
|
|
|
|
|
sub roaming_users { |
396
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
397
|
|
|
|
|
|
|
|
398
|
0
|
|
|
|
|
|
my $roaming = $self->conf->{'vpopmail_roaming_users'}; |
399
|
|
|
|
|
|
|
|
400
|
0
|
0
|
0
|
|
|
|
if ( defined $roaming && !$roaming ) { |
401
|
0
|
|
|
|
|
|
print "roaming users: no\n"; |
402
|
0
|
|
|
|
|
|
return " --enable-roaming-users=n"; |
403
|
|
|
|
|
|
|
} |
404
|
|
|
|
|
|
|
|
405
|
|
|
|
|
|
|
# default to enabled |
406
|
0
|
0
|
|
|
|
|
if ( !defined $self->conf->{'vpopmail_roaming_users'} ) { |
407
|
0
|
|
|
|
|
|
print "roaming users: value not set?!\n"; |
408
|
|
|
|
|
|
|
} |
409
|
|
|
|
|
|
|
|
410
|
0
|
|
|
|
|
|
print "roaming users: yes\n"; |
411
|
|
|
|
|
|
|
|
412
|
0
|
|
|
|
|
|
my $min = $self->conf->{'vpopmail_relay_clear_minutes'}; |
413
|
0
|
0
|
0
|
|
|
|
if ( $min && $min ne 180 ) { |
414
|
0
|
|
|
|
|
|
print "roaming user minutes: $min\n"; |
415
|
0
|
|
|
|
|
|
return " --enable-roaming-users=y" . |
416
|
|
|
|
|
|
|
" --enable-relay-clear-minutes=$min"; |
417
|
|
|
|
|
|
|
}; |
418
|
0
|
|
|
|
|
|
return " --enable-roaming-users=y"; |
419
|
|
|
|
|
|
|
}; |
420
|
|
|
|
|
|
|
|
421
|
|
|
|
|
|
|
sub test { |
422
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
423
|
0
|
|
|
|
|
|
my %p = validate( @_, { $self->get_std_opts },); |
424
|
|
|
|
|
|
|
|
425
|
0
|
0
|
|
|
|
|
return $p{test_ok} if defined $p{test_ok}; |
426
|
|
|
|
|
|
|
|
427
|
0
|
|
|
|
|
|
print "do vpopmail directories exist...\n"; |
428
|
0
|
|
|
|
|
|
my $vpdir = $self->conf->{'vpopmail_home_dir'}; |
429
|
0
|
|
|
|
|
|
foreach ( "", "bin", "domains", "etc/", "include", "lib" ) { |
430
|
0
|
|
|
|
|
|
$self->setup->test->pretty(" $vpdir/$_", -d "$vpdir/$_" ); |
431
|
|
|
|
|
|
|
} |
432
|
|
|
|
|
|
|
|
433
|
0
|
|
|
|
|
|
print "checking vpopmail binaries...\n"; |
434
|
0
|
|
|
|
|
|
foreach ( |
435
|
|
|
|
|
|
|
qw/ |
436
|
|
|
|
|
|
|
clearopensmtp vaddaliasdomain vadddomain |
437
|
|
|
|
|
|
|
valias vadduser vchkpw |
438
|
|
|
|
|
|
|
vchangepw vconvert vdeldomain |
439
|
|
|
|
|
|
|
vdelivermail vdeloldusers vdeluser |
440
|
|
|
|
|
|
|
vdominfo vipmap vkill |
441
|
|
|
|
|
|
|
vmkpasswd vmoddomlimits vmoduser |
442
|
|
|
|
|
|
|
vpasswd vpopbull vqmaillocal |
443
|
|
|
|
|
|
|
vsetuserquota vuserinfo / |
444
|
|
|
|
|
|
|
) |
445
|
|
|
|
|
|
|
{ |
446
|
0
|
|
|
|
|
|
$self->setup->test->pretty(" $_", -x "$vpdir/bin/$_" ); |
447
|
|
|
|
|
|
|
} |
448
|
|
|
|
|
|
|
|
449
|
0
|
|
|
|
|
|
print "do vpopmail libs exist...\n"; |
450
|
0
|
|
|
|
|
|
foreach ("$vpdir/lib/libvpopmail.a") { |
451
|
0
|
|
|
|
|
|
$self->setup->test->pretty(" $_", -e $_ ); |
452
|
|
|
|
|
|
|
} |
453
|
|
|
|
|
|
|
|
454
|
0
|
|
|
|
|
|
print "do vpopmail includes exist...\n"; |
455
|
0
|
|
|
|
|
|
foreach (qw/ config.h vauth.h vlimits.h vpopmail.h vpopmail_config.h /) { |
456
|
0
|
|
|
|
|
|
$self->setup->test->pretty(" include/$_", -e "$vpdir/include/$_" ); |
457
|
|
|
|
|
|
|
} |
458
|
|
|
|
|
|
|
|
459
|
0
|
|
|
|
|
|
print "checking vpopmail etc files...\n"; |
460
|
0
|
|
|
|
|
|
my @vpetc = qw/ inc_deps lib_deps tcp.smtp tcp.smtp.cdb vlimits.default /; |
461
|
0
|
0
|
|
|
|
|
push @vpetc, 'vpopmail.mysql' if $self->conf->{'vpopmail_mysql'}; |
462
|
|
|
|
|
|
|
|
463
|
0
|
|
|
|
|
|
foreach ( @vpetc ) { |
464
|
0
|
|
0
|
|
|
|
$self->setup->test->pretty(" $_", (-e "$vpdir/etc/$_" && -s "$vpdir/etc/$_" )); |
465
|
|
|
|
|
|
|
} |
466
|
|
|
|
|
|
|
} |
467
|
|
|
|
|
|
|
|
468
|
|
|
|
|
|
|
sub create_user { |
469
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
470
|
0
|
|
|
|
|
|
my %p = validate( @_, { $self->get_std_opts } ); |
471
|
|
|
|
|
|
|
|
472
|
0
|
|
|
|
|
|
my $vpopdir = $self->get_vpop_dir; |
473
|
0
|
|
0
|
|
|
|
my $vpuser = $self->conf->{vpopmail_user} || 'vpopmail'; |
474
|
0
|
|
0
|
|
|
|
my $vpgroup = $self->conf->{vpopmail_group} || 'vchkpw'; |
475
|
|
|
|
|
|
|
|
476
|
0
|
|
|
|
|
|
my $uid = getpwnam($vpuser); |
477
|
0
|
|
|
|
|
|
my $gid = getgrnam($vpgroup); |
478
|
|
|
|
|
|
|
|
479
|
0
|
0
|
0
|
|
|
|
if ( !$uid || !$gid ) { |
480
|
0
|
|
|
|
|
|
$self->group_add( $vpgroup, "89" ); |
481
|
0
|
|
|
|
|
|
$self->user_add( $vpuser, 89, 89, homedir => $vpopdir ); |
482
|
|
|
|
|
|
|
} |
483
|
|
|
|
|
|
|
|
484
|
0
|
|
|
|
|
|
$uid = getpwnam($vpuser); |
485
|
0
|
|
|
|
|
|
$gid = getgrnam($vpgroup); |
486
|
|
|
|
|
|
|
|
487
|
0
|
0
|
0
|
|
|
|
return $self->error( "failed to add vpopmail user or group!") |
488
|
|
|
|
|
|
|
if ( !$uid || !$gid ); |
489
|
|
|
|
|
|
|
|
490
|
0
|
|
|
|
|
|
return 1; |
491
|
|
|
|
|
|
|
} |
492
|
|
|
|
|
|
|
|
493
|
|
|
|
|
|
|
sub mysql_options { |
494
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
495
|
0
|
|
|
|
|
|
my $mysql_repl = $self->conf->{vpopmail_mysql_replication}; |
496
|
0
|
|
0
|
|
|
|
my $my_write = $self->conf->{vpopmail_mysql_repl_master} || 'localhost'; |
497
|
0
|
|
0
|
|
|
|
my $db = $self->conf->{vpopmail_mysql_database} || 'vpopmail'; |
498
|
|
|
|
|
|
|
|
499
|
0
|
|
|
|
|
|
my $opts; |
500
|
0
|
0
|
|
|
|
|
if ( $self->conf->{vpopmail_mysql_limits} ) { |
501
|
0
|
|
|
|
|
|
print "mysql qmailadmin limits: yes\n"; |
502
|
0
|
|
|
|
|
|
$opts .= " --enable-mysql-limits=y"; |
503
|
|
|
|
|
|
|
} |
504
|
|
|
|
|
|
|
|
505
|
0
|
0
|
|
|
|
|
if ( $mysql_repl ) { |
506
|
0
|
|
|
|
|
|
$opts .= " --enable-mysql-replication=y"; |
507
|
0
|
|
|
|
|
|
print "mysql replication: yes\n"; |
508
|
0
|
|
|
|
|
|
print " replication master: $my_write\n"; |
509
|
|
|
|
|
|
|
} |
510
|
|
|
|
|
|
|
|
511
|
0
|
0
|
|
|
|
|
if ( $self->conf->{vpopmail_disable_many_domains} ) { |
512
|
0
|
|
|
|
|
|
$opts .= " --disable-many-domains"; |
513
|
|
|
|
|
|
|
} |
514
|
|
|
|
|
|
|
|
515
|
0
|
|
|
|
|
|
return $opts; |
516
|
|
|
|
|
|
|
} |
517
|
|
|
|
|
|
|
|
518
|
|
|
|
|
|
|
sub mysql_privs { |
519
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
520
|
0
|
|
|
|
|
|
my %p = validate( @_, { $self->get_std_opts },); |
521
|
|
|
|
|
|
|
|
522
|
0
|
0
|
|
|
|
|
if ( !$self->conf->{'vpopmail_mysql'} ) { |
523
|
0
|
|
|
|
|
|
print "vpopmail mysql_privs: mysql support not selected\n"; |
524
|
0
|
|
|
|
|
|
return; |
525
|
|
|
|
|
|
|
} |
526
|
|
|
|
|
|
|
|
527
|
0
|
|
|
|
|
|
my $mysql_repl = $self->conf->{vpopmail_mysql_replication}; |
528
|
0
|
|
0
|
|
|
|
my $my_write = $self->conf->{vpopmail_mysql_repl_master} || 'localhost'; |
529
|
0
|
|
0
|
|
|
|
my $my_write_port = $self->conf->{vpopmail_mysql_repl_master_port} || 3306; |
530
|
0
|
|
0
|
|
|
|
my $my_read = $self->conf->{vpopmail_mysql_repl_slave} || 'localhost'; |
531
|
0
|
|
0
|
|
|
|
my $my_read_port = $self->conf->{vpopmail_mysql_repl_slave_port} || 3306; |
532
|
0
|
|
0
|
|
|
|
my $db = $self->conf->{vpopmail_mysql_database} || 'vpopmail'; |
533
|
|
|
|
|
|
|
|
534
|
0
|
|
0
|
|
|
|
my $user = $self->conf->{'vpopmail_mysql_user'} || $self->conf->{vpopmail_mysql_repl_user}; |
535
|
0
|
|
0
|
|
|
|
my $pass = $self->conf->{'vpopmail_mysql_pass'} || $self->conf->{vpopmail_mysql_repl_pass}; |
536
|
|
|
|
|
|
|
|
537
|
0
|
|
|
|
|
|
my $vpopdir = $self->get_vpop_dir; |
538
|
|
|
|
|
|
|
|
539
|
0
|
|
|
|
|
|
my @lines = "$my_read|0|$user|$pass|$db"; |
540
|
0
|
0
|
|
|
|
|
if ($mysql_repl) { |
541
|
0
|
|
|
|
|
|
push @lines, "$my_write|$my_write_port|$user|$pass|$db"; |
542
|
|
|
|
|
|
|
} |
543
|
|
|
|
|
|
|
else { |
544
|
0
|
|
|
|
|
|
push @lines, "$my_read|$my_read_port|$user|$pass|$db"; |
545
|
|
|
|
|
|
|
} |
546
|
|
|
|
|
|
|
|
547
|
0
|
|
|
|
|
|
$self->util->file_write( "$vpopdir/etc/vpopmail.mysql", |
548
|
|
|
|
|
|
|
lines => \@lines, |
549
|
|
|
|
|
|
|
verbose => 1, |
550
|
|
|
|
|
|
|
); |
551
|
|
|
|
|
|
|
|
552
|
0
|
|
0
|
|
|
|
my $dot = $self->mysql->parse_dot_file( ".my.cnf", "[mysql]", 0 ) |
553
|
|
|
|
|
|
|
|| { user => $user, pass => $pass, host => $my_write, db => $db }; |
554
|
|
|
|
|
|
|
|
555
|
0
|
|
|
|
|
|
my ( $dbh, $dsn, $drh ) = $self->mysql->connect( $dot, 1 ); |
556
|
0
|
0
|
|
|
|
|
if ( !$dbh ) { |
557
|
0
|
|
|
|
|
|
$dot = { user => 'root', pass => '', host => $my_write }; |
558
|
0
|
|
|
|
|
|
( $dbh, $dsn, $drh ) = $self->mysql->connect( $dot, 1 ); |
559
|
|
|
|
|
|
|
}; |
560
|
|
|
|
|
|
|
|
561
|
0
|
0
|
|
|
|
|
if ( !$dbh ) { |
562
|
0
|
|
|
|
|
|
print <<"EOMYSQLGRANT"; |
563
|
|
|
|
|
|
|
|
564
|
|
|
|
|
|
|
WARNING: I couldn't connect to your database server! If this is a new install, |
565
|
|
|
|
|
|
|
you will need to connect to your database server and run this command manually: |
566
|
|
|
|
|
|
|
|
567
|
|
|
|
|
|
|
mysql -u root -h $my_write -p |
568
|
|
|
|
|
|
|
CREATE DATABASE $db; |
569
|
|
|
|
|
|
|
GRANT ALL PRIVILEGES ON $db.* TO $user\@'$my_write' IDENTIFIED BY '$pass'; |
570
|
|
|
|
|
|
|
use $db; |
571
|
|
|
|
|
|
|
CREATE TABLE relay ( ip_addr char(18) NOT NULL default '', |
572
|
|
|
|
|
|
|
timestamp char(12) default NULL, name char(64) default NULL, |
573
|
|
|
|
|
|
|
PRIMARY KEY (ip_addr)) PACK_KEYS=1; |
574
|
|
|
|
|
|
|
ALTER TABLE vpopmail MODIFY pw_clear_passwd VARCHAR(128); |
575
|
|
|
|
|
|
|
ALTER TABLE vpopmail MODIFY pw_passwd VARCHAR(128); |
576
|
|
|
|
|
|
|
quit; |
577
|
|
|
|
|
|
|
|
578
|
|
|
|
|
|
|
If this is an upgrade and you already use MySQL authentication, |
579
|
|
|
|
|
|
|
then you can safely ignore this warning. |
580
|
|
|
|
|
|
|
|
581
|
|
|
|
|
|
|
EOMYSQLGRANT |
582
|
0
|
|
|
|
|
|
return; |
583
|
|
|
|
|
|
|
} |
584
|
|
|
|
|
|
|
|
585
|
0
|
|
|
|
|
|
my $query = "use $db"; |
586
|
0
|
|
|
|
|
|
my $sth = $self->mysql->query( $dbh, $query, 1 ); |
587
|
0
|
0
|
|
|
|
|
if ( !$sth->errstr ) { |
588
|
0
|
|
|
|
|
|
$self->audit( "vpopmail: database setup, ok (exists)" ); |
589
|
0
|
|
|
|
|
|
$sth->finish; |
590
|
0
|
|
|
|
|
|
return 1; |
591
|
|
|
|
|
|
|
} |
592
|
|
|
|
|
|
|
|
593
|
0
|
|
|
|
|
|
print "vpopmail: no vpopmail database, creating it now...\n"; |
594
|
0
|
|
|
|
|
|
$query = "CREATE DATABASE $db"; |
595
|
0
|
|
|
|
|
|
$sth = $self->mysql->query( $dbh, $query ); |
596
|
|
|
|
|
|
|
|
597
|
0
|
|
|
|
|
|
print "vpopmail: granting privileges to $user\n"; |
598
|
0
|
|
|
|
|
|
$query = |
599
|
|
|
|
|
|
|
"GRANT ALL PRIVILEGES ON $db.* TO $user\@'$my_write' IDENTIFIED BY '$pass'"; |
600
|
0
|
|
|
|
|
|
$sth = $self->mysql->query( $dbh, $query ); |
601
|
|
|
|
|
|
|
|
602
|
0
|
|
|
|
|
|
print "vpopmail: creating the relay table.\n"; |
603
|
0
|
|
|
|
|
|
$query = "CREATE TABLE $db.relay ( ip_addr char(18) NOT NULL default '', timestamp char(12) default NULL, name char(64) default NULL, PRIMARY KEY (ip_addr)) PACK_KEYS=1"; |
604
|
0
|
|
|
|
|
|
$sth = $self->mysql->query( $dbh, $query ); |
605
|
0
|
|
|
|
|
|
$self->audit( "vpopmail: databases created, ok" ); |
606
|
0
|
|
|
|
|
|
$sth = $self->mysql->query( $dbh, "ALTER TABLE vpopmail MODIFY pw_clear_passwd VARCHAR(128)" ); |
607
|
0
|
|
|
|
|
|
$sth = $self->mysql->query( $dbh, "ALTER TABLE vpopmail MODIFY pw_passwd VARCHAR(128)" ); |
608
|
|
|
|
|
|
|
|
609
|
0
|
|
|
|
|
|
$sth->finish; |
610
|
|
|
|
|
|
|
|
611
|
0
|
|
|
|
|
|
return 1; |
612
|
|
|
|
|
|
|
} |
613
|
|
|
|
|
|
|
|
614
|
|
|
|
|
|
|
1; |