|
Lines 1-4
Link Here
|
| 1 |
#!@@@kolab_prefix@@@/bin/perl |
1 |
#!/usr/bin/perl |
| 2 |
|
2 |
|
| 3 |
# (c) 2003 Tassilo Erlewein <tassilo.erlewein@erfrakon.de> |
3 |
# (c) 2003 Tassilo Erlewein <tassilo.erlewein@erfrakon.de> |
| 4 |
# (c) 2003 Martin Konold <martin.konold@erfrakon.de> |
4 |
# (c) 2003 Martin Konold <martin.konold@erfrakon.de> |
|
Lines 25-36
Link Here
|
| 25 |
use vars qw($opt_v $opt_o $opt_l); |
25 |
use vars qw($opt_v $opt_o $opt_l); |
| 26 |
|
26 |
|
| 27 |
getopts('vol:'); |
27 |
getopts('vol:'); |
| 28 |
my $kolab_prefix="@@@kolab_prefix@@@"; |
|
|
| 29 |
my %kolab_config; |
28 |
my %kolab_config; |
| 30 |
my %configdata=(); |
29 |
my %configdata=(); |
| 31 |
my %haschanged=(); |
30 |
my %haschanged=(); |
| 32 |
my $postmap="$kolab_prefix/sbin/postmap"; |
31 |
my $postmap="/usr/sbin/postmap"; |
| 33 |
my $newaliases="$kolab_prefix/sbin/newaliases"; |
32 |
my $newaliases="/usr/sbin/newaliases"; |
| 34 |
my $conn; |
33 |
my $conn; |
| 35 |
my $server; |
34 |
my $server; |
| 36 |
my $reinit=0; |
35 |
my $reinit=0; |
|
Lines 57-104
Link Here
|
| 57 |
sub PROTOCOLOP_EXTENDEDRESP () { 0x19 } |
56 |
sub PROTOCOLOP_EXTENDEDRESP () { 0x19 } |
| 58 |
|
57 |
|
| 59 |
my %config_files = ( |
58 |
my %config_files = ( |
| 60 |
"$kolab_prefix/etc/kolab/session_vars.php.template" => "$kolab_prefix/var/kolab/www/admin/include/session_vars.php", |
59 |
"/etc/kolab/session_vars.php.template" => "/var/www/localhost/htdocs/admin/include/session_vars.php", |
| 61 |
"$kolab_prefix/etc/kolab/main.cf.template" => "$kolab_prefix/etc/postfix/main.cf", |
60 |
"/etc/kolab/main.cf.template" => "/etc/postfix/main.cf", |
| 62 |
"$kolab_prefix/etc/kolab/master.cf.template" => "$kolab_prefix/etc/postfix/master.cf", |
61 |
"/etc/kolab/master.cf.template" => "/etc/postfix/master.cf", |
| 63 |
"$kolab_prefix/etc/kolab/saslauthd.conf.template" => "$kolab_prefix/etc/sasl/saslauthd.conf", |
62 |
"/etc/kolab/saslauthd.conf.template" => "/etc/sasl2/saslauthd.conf", |
| 64 |
"$kolab_prefix/etc/kolab/imapd.conf.template" => "$kolab_prefix/etc/imapd/imapd.conf", |
63 |
"/etc/kolab/imapd.conf.template" => "/etc/imapd.conf", |
| 65 |
"$kolab_prefix/etc/kolab/httpd.conf.template" => "$kolab_prefix/etc/apache/apache.conf", |
64 |
"/etc/kolab/httpd.conf.template" => "/etc/apache2/conf/apache2.conf", |
| 66 |
"$kolab_prefix/etc/kolab/legacy.conf.template" => "$kolab_prefix/etc/apache/legacy.conf", |
65 |
"/etc/kolab/legacy.conf.template" => "/etc/apache2/conf/legacy.conf", |
| 67 |
"$kolab_prefix/etc/kolab/php.ini.template" => "$kolab_prefix/etc/apache/php.ini", |
66 |
"/etc/kolab/php.ini.template" => "/etc/apache2/conf/php.ini", |
| 68 |
"$kolab_prefix/etc/kolab/proftpd.conf.template" => "$kolab_prefix/etc/proftpd/proftpd.conf", |
67 |
"/etc/kolab/proftpd.conf.template" => "/etc/proftpd/proftpd.conf", |
| 69 |
"$kolab_prefix/etc/kolab/slapd.conf.template" => "$kolab_prefix/etc/openldap/slapd.conf"); |
68 |
"/etc/kolab/slapd.conf.template" => "/etc/openldap/slapd.conf"); |
| 70 |
|
69 |
|
| 71 |
my %permissions = ( |
70 |
my %permissions = ( |
| 72 |
"$kolab_prefix/var/kolab/www/admin/include/session_vars.php" => 0640, |
71 |
"/var/www/localhost/htdocs/admin/include/session_vars.php" => 0640, |
| 73 |
"$kolab_prefix/etc/postfix/main.cf" => 0640, |
72 |
"/etc/postfix/main.cf" => 0640, |
| 74 |
"$kolab_prefix/etc/postfix/master.cf" => 0640, |
73 |
"/etc/postfix/master.cf" => 0640, |
| 75 |
"$kolab_prefix/etc/sasl/saslauthd.conf" => 0600, |
74 |
"/etc/sasl2/saslauthd.conf" => 0600, |
| 76 |
"$kolab_prefix/etc/imapd/imapd.conf" => 0640, |
75 |
"/etc/imapd/imapd.conf" => 0640, |
| 77 |
"$kolab_prefix/etc/apache/apache.conf" => 0640, |
76 |
"/etc/apache2/conf/apache2.conf" => 0640, |
| 78 |
"$kolab_prefix/etc/apache/legacy.conf" => 0640, |
77 |
"/etc/apache2/conf/legacy.conf" => 0640, |
| 79 |
"$kolab_prefix/etc/apache/php.ini" => 0640, |
78 |
"/etc/apache2/conf/php.ini" => 0640, |
| 80 |
"$kolab_prefix/etc/proftpd/proftpd.conf" => 0640, |
79 |
"/etc/proftpd/proftpd.conf" => 0640, |
| 81 |
"$kolab_prefix/etc/openldap/slapd.conf" => 0640, |
80 |
"/etc/openldap/slapd.conf" => 0640, |
| 82 |
"$kolab_prefix/etc/postfix/transport" => 0640, |
81 |
"/etc/postfix/transport" => 0640, |
| 83 |
"$kolab_prefix/etc/imapd/cyrus.conf" => 0640, |
82 |
"/etc/cyrus.conf" => 0640, |
| 84 |
"$kolab_prefix/etc/imapd/imapd.group" => 0640, |
83 |
"/etc/cyrusimapd/imapd.group" => 0640, |
| 85 |
"$kolab_prefix/etc/postfix/virtual" => 0640); |
84 |
"/etc/postfix/virtual" => 0640); |
| 86 |
|
85 |
|
| 87 |
my %ownership = ( |
86 |
my %ownership = ( |
| 88 |
"$kolab_prefix/var/kolab/www/admin/include/session_vars.php" => "kolab:kolab-n", |
87 |
"/var/www/localhost/htdocs/admin/include/session_vars.php" => "kolab:kolab", |
| 89 |
"$kolab_prefix/etc/postfix/main.cf" => "root:root", |
88 |
"/etc/postfix/main.cf" => "root:root", |
| 90 |
"$kolab_prefix/etc/postfix/master.cf" => "root:root", |
89 |
"/etc/postfix/master.cf" => "root:root", |
| 91 |
"$kolab_prefix/etc/sasl/saslauthd.conf" => "kolab:kolab", |
90 |
"/etc/sasl2/saslauthd.conf" => "kolab:kolab", |
| 92 |
"$kolab_prefix/etc/imapd/imapd.conf" => "kolab:kolab-r", |
91 |
"/etc/imapd.conf" => "kolab:kolab", |
| 93 |
"$kolab_prefix/etc/apache/apache.conf" => "kolab:kolab-n", |
92 |
"/etc/apache2/conf/apache2.conf" => "kolab:kolab", |
| 94 |
"$kolab_prefix/etc/apache/legacy.conf" => "kolab:kolab-n", |
93 |
"/etc/apache2/conf/legacy.conf" => "kolab:kolab", |
| 95 |
"$kolab_prefix/etc/apache/php.ini" => "kolab:kolab-n", |
94 |
"/etc/apache2/conf/php.ini" => "kolab:kolab", |
| 96 |
"$kolab_prefix/etc/proftpd/proftpd.conf" => "kolab:kolab-n", |
95 |
"/etc/proftpd/proftpd.conf" => "kolab:kolab", |
| 97 |
"$kolab_prefix/etc/openldap/slapd.conf" => "kolab:kolab", |
96 |
"/etc/openldap/slapd.conf" => "kolab:kolab", |
| 98 |
"$kolab_prefix/etc/postfix/transport" => "root:root", |
97 |
"/etc/postfix/transport" => "root:root", |
| 99 |
"$kolab_prefix/etc/imapd/cyrus.conf" => "kolab:kolab", |
98 |
"/etc/cyrus.conf" => "kolab:kolab", |
| 100 |
"$kolab_prefix/etc/imapd/imapd.group" => "kolab:kolab-r", |
99 |
"/etc/cyrusimapd/imapd.group" => "kolab:kolab", |
| 101 |
"$kolab_prefix/etc/postfix/virtual" => "root:root"); |
100 |
"/etc/postfix/virtual" => "root:root"); |
| 102 |
|
101 |
|
| 103 |
|
102 |
|
| 104 |
|
103 |
|
|
Lines 284-307
Link Here
|
| 284 |
} |
283 |
} |
| 285 |
|
284 |
|
| 286 |
my $template = IO::File->new($templ, "r") || die "could not open $templ"; |
285 |
my $template = IO::File->new($templ, "r") || die "could not open $templ"; |
| 287 |
my $config = IO::File->new($kolab_prefix."/etc/kolab/.tmp", "w+", 0600) || die "could not open $conf"; |
286 |
my $config = IO::File->new("/etc/kolab/.tmp", "w+", 0600) || die "could not open $conf"; |
| 288 |
|
287 |
|
| 289 |
fixup($kolab_prefix."/etc/kolab/.tmp", $conf); |
288 |
fixup("/etc/kolab/.tmp", $conf); |
| 290 |
|
289 |
|
| 291 |
while (<$template>) { |
290 |
while (<$template>) { |
| 292 |
if (/\@{3}(\S+)\@{3}/) { |
291 |
if (/\@{3}(\S+?)\@{3}/) { |
| 293 |
if ($configdata{$1}) { |
292 |
if ($configdata{$1}) { |
| 294 |
s/\@{3}(\S+)\@{3}/$configdata{$1}/g; |
293 |
s/\@{3}(\S+?)\@{3}/$configdata{$1}/g; |
| 295 |
} else { |
294 |
} else { |
| 296 |
dolog("no replacement for substitute $1"); |
295 |
dolog("no replacement for substitute $1"); |
| 297 |
s/\@{3}(\S+)\@{3}//g; |
296 |
s/\@{3}(\S+?)\@{3}//g; |
| 298 |
} |
297 |
} |
| 299 |
} |
298 |
} |
| 300 |
print $config $_; |
299 |
print $config $_; |
| 301 |
} |
300 |
} |
| 302 |
undef $template; |
301 |
undef $template; |
| 303 |
undef $config; |
302 |
undef $config; |
| 304 |
move($kolab_prefix."/etc/kolab/.tmp", $conf); |
303 |
move("/etc/kolab/.tmp", $conf); |
| 305 |
|
304 |
|
| 306 |
# find all copies of config files |
305 |
# find all copies of config files |
| 307 |
foreach $mask (keys %ownership) { |
306 |
foreach $mask (keys %ownership) { |
|
Lines 363-369
Link Here
|
| 363 |
|
362 |
|
| 364 |
$configdata{'legacy-mode'} = "# no legacy configuration"; |
363 |
$configdata{'legacy-mode'} = "# no legacy configuration"; |
| 365 |
if ($configdata{'apache-http'} =~ /true/i) { |
364 |
if ($configdata{'apache-http'} =~ /true/i) { |
| 366 |
$configdata{'legacy-mode'} = "Include \"$kolab_prefix/etc/apache/legacy.conf\""; |
365 |
$configdata{'legacy-mode'} = "Include \"/etc/apache2/conf/legacy.conf\""; |
| 367 |
} |
366 |
} |
| 368 |
$configdata{'fqdn'} = `hostname -f`; |
367 |
$configdata{'fqdn'} = `hostname -f`; |
| 369 |
chomp($configdata{'fqdn'}); |
368 |
chomp($configdata{'fqdn'}); |
|
Lines 373-381
Link Here
|
| 373 |
} |
372 |
} |
| 374 |
|
373 |
|
| 375 |
# put together the transport map for postfix |
374 |
# put together the transport map for postfix |
| 376 |
my $configname="$kolab_prefix/etc/postfix/transport"; |
375 |
my $configname="/etc/postfix/transport"; |
| 377 |
copy($configname, $configname.".old"); |
376 |
copy($configname, $configname.".old"); |
| 378 |
copy("$kolab_prefix/etc/kolab/transport.template", $configname); |
377 |
copy("/etc/kolab/transport.template", $configname); |
| 379 |
fixup($configname, $configname); |
378 |
fixup($configname, $configname); |
| 380 |
|
379 |
|
| 381 |
my $transport = IO::File->new($configname, "a") |
380 |
my $transport = IO::File->new($configname, "a") |
|
Lines 394-400
Link Here
|
| 394 |
} |
393 |
} |
| 395 |
undef $ldapobject; |
394 |
undef $ldapobject; |
| 396 |
undef $transport; |
395 |
undef $transport; |
| 397 |
system("$postmap $kolab_prefix/etc/postfix/transport"); |
396 |
system("$postmap /etc/postfix/transport"); |
| 398 |
if (!$opt_o) { |
397 |
if (!$opt_o) { |
| 399 |
if (-f $configname.".old") { |
398 |
if (-f $configname.".old") { |
| 400 |
my $rc = `diff -q $configname $configname.old`; |
399 |
my $rc = `diff -q $configname $configname.old`; |
|
Lines 406-433
Link Here
|
| 406 |
} else { $haschanged{'postfix'}=1; } |
405 |
} else { $haschanged{'postfix'}=1; } |
| 407 |
} |
406 |
} |
| 408 |
|
407 |
|
| 409 |
my $cyrustemplate = IO::File->new("$kolab_prefix/etc/kolab/cyrus.conf.template","r") |
408 |
my $cyrustemplate = IO::File->new("/etc/kolab/cyrus.conf.template","r") |
| 410 |
|| die "could not open imapd cyrus.conf template"; |
409 |
|| die "could not open imapd cyrus.conf template"; |
| 411 |
$configname = "$kolab_prefix/etc/imapd/cyrus.conf"; |
410 |
$configname = "/etc/cyrus.conf"; |
| 412 |
copy($configname, $configname.".old"); |
411 |
copy($configname, $configname.".old"); |
| 413 |
$opt_v && printf "creating new $configname from cyrus.conf.template\n"; |
412 |
$opt_v && printf "creating new $configname from cyrus.conf.template\n"; |
| 414 |
my $cyrusconf = IO::File->new($configname,"w") || die "could not open $configname"; |
413 |
my $cyrusconf = IO::File->new($configname,"w") || die "could not open $configname"; |
| 415 |
fixup($configname, $configname); |
414 |
fixup($configname, $configname); |
| 416 |
while (<$cyrustemplate>) { |
415 |
while (<$cyrustemplate>) { |
| 417 |
if (/\@{3}cyrus-imap\@{3}/ && ($configdata{"cyrus-imap"} =~ /true/i)) { |
416 |
if (/\@{3}cyrus-imap\@{3}/ && ($configdata{"cyrus-imap"} =~ /true/i)) { |
| 418 |
$_ = "imap cmd=\"imapd -C $kolab_prefix/etc/imapd/imapd.conf\" listen=\"143\" prefork=0\n"; |
417 |
$_ = "imap cmd=\"imapd -C /etc/imapd.conf\" listen=\"143\" prefork=0\n"; |
| 419 |
} |
418 |
} |
| 420 |
elsif (/\@{3}cyrus-pop3\@{3}/ && ($configdata{"cyrus-pop3"} =~ /true/i)) { |
419 |
elsif (/\@{3}cyrus-pop3\@{3}/ && ($configdata{"cyrus-pop3"} =~ /true/i)) { |
| 421 |
$_ = "pop3 cmd=\"pop3d -C $kolab_prefix/etc/imapd/imapd.conf\" listen=\"110\" prefork=0\n"; |
420 |
$_ = "pop3 cmd=\"pop3d -C /etc/imapd.conf\" listen=\"110\" prefork=0\n"; |
| 422 |
} |
421 |
} |
| 423 |
elsif (/\@{3}cyrus-imaps\@{3}/ && ($configdata{"cyrus-imaps"} =~ /true/i)) { |
422 |
elsif (/\@{3}cyrus-imaps\@{3}/ && ($configdata{"cyrus-imaps"} =~ /true/i)) { |
| 424 |
$_ = "imaps cmd=\"imapd -s -C $kolab_prefix/etc/imapd/imapd.conf\" listen=\"993\" prefork=0\n"; |
423 |
$_ = "imaps cmd=\"imapd -s -C /etc/imapd.conf\" listen=\"993\" prefork=0\n"; |
| 425 |
} |
424 |
} |
| 426 |
elsif (/\@{3}cyrus-pop3s\@{3}/ && ($configdata{"cyrus-pop3s"} =~ /true/i)) { |
425 |
elsif (/\@{3}cyrus-pop3s\@{3}/ && ($configdata{"cyrus-pop3s"} =~ /true/i)) { |
| 427 |
$_ = "pop3s cmd=\"pop3d -s -C $kolab_prefix/etc/imapd/imapd.conf\" listen=\"995\" prefork=0\n"; |
426 |
$_ = "pop3s cmd=\"pop3d -s -C /etc/imapd.conf\" listen=\"995\" prefork=0\n"; |
| 428 |
} |
427 |
} |
| 429 |
elsif (/\@{3}cyrus-sieve\@{3}/ && ($configdata{"cyrus-sieve"} =~ /true/i)) { |
428 |
elsif (/\@{3}cyrus-sieve\@{3}/ && ($configdata{"cyrus-sieve"} =~ /true/i)) { |
| 430 |
$_ = "sieve cmd=\"timsieved -C $kolab_prefix/etc/imapd/imapd.conf\" listen=\"2000\" prefork=0"; |
429 |
$_ = "sieve cmd=\"timsieved -C /etc/imapd.conf\" listen=\"2000\" prefork=0"; |
| 431 |
} |
430 |
} |
| 432 |
$_ =~ s/\@{3}.*\@{3}//; |
431 |
$_ =~ s/\@{3}.*\@{3}//; |
| 433 |
print $cyrusconf $_; |
432 |
print $cyrusconf $_; |
|
Lines 446-454
Link Here
|
| 446 |
} |
445 |
} |
| 447 |
|
446 |
|
| 448 |
# collect group information from LDAP |
447 |
# collect group information from LDAP |
| 449 |
$configname = "$kolab_prefix/etc/imapd/imapd.group"; |
448 |
$configname = "/etc/cyrusimapd/imapd.group"; |
| 450 |
copy($configname, $configname.".old"); |
449 |
copy($configname, $configname.".old"); |
| 451 |
copy("$kolab_prefix/etc/kolab/imapd.group.template", $configname); |
450 |
copy("/etc/kolab/imapd.group.template", $configname); |
| 452 |
fixup($configname, $configname); |
451 |
fixup($configname, $configname); |
| 453 |
my $groupconf = IO::File->new($configname, "a") |
452 |
my $groupconf = IO::File->new($configname, "a") |
| 454 |
|| die "could not write to $configname"; |
453 |
|| die "could not write to $configname"; |
|
Lines 560-566
Link Here
|
| 560 |
} |
559 |
} |
| 561 |
} |
560 |
} |
| 562 |
# first reset current acl |
561 |
# first reset current acl |
| 563 |
my @acl = `$kolab_prefix/etc/kolab/workaround.sh $cyrfolder $configdata{'bind_pw'} | sed -e /localhost/d`; |
562 |
my @acl = `/etc/kolab/workaround.sh $cyrfolder $configdata{'bind_pw'} | sed -e /localhost/d`; |
| 564 |
foreach (@acl) { |
563 |
foreach (@acl) { |
| 565 |
$_ = trim($_); |
564 |
$_ = trim($_); |
| 566 |
(my $user, ) = split / /; |
565 |
(my $user, ) = split / /; |
|
Lines 597-604
Link Here
|
| 597 |
|
596 |
|
| 598 |
# find aliases and put together the virtual map for postfix |
597 |
# find aliases and put together the virtual map for postfix |
| 599 |
# also fill up aliases |
598 |
# also fill up aliases |
| 600 |
$configname = "$kolab_prefix/etc/postfix/virtual"; |
599 |
$configname = "/etc/postfix/virtual"; |
| 601 |
copy("$kolab_prefix/etc/kolab/virtual.template",$configname); |
600 |
copy("/etc/kolab/virtual.template",$configname); |
| 602 |
fixup($configname, $configname); |
601 |
fixup($configname, $configname); |
| 603 |
my $virtual = IO::File->new($configname, "a") || die "could not write to $configname"; |
602 |
my $virtual = IO::File->new($configname, "a") || die "could not write to $configname"; |
| 604 |
$mesg = $ldap->search(base=> $configdata{'base_dn'}, scope=> 'sub', filter=> '(mail=*)'); |
603 |
$mesg = $ldap->search(base=> $configdata{'base_dn'}, scope=> 'sub', filter=> '(mail=*)'); |
|
Lines 636-669
Link Here
|
| 636 |
# trigger server config reload |
635 |
# trigger server config reload |
| 637 |
if ($haschanged{'slapd'}) { |
636 |
if ($haschanged{'slapd'}) { |
| 638 |
dolog("restarting openldap"); |
637 |
dolog("restarting openldap"); |
| 639 |
system("$kolab_prefix/etc/rc.d/rc.openldap restart"); |
638 |
system("/etc/init.d/slapd restart"); |
| 640 |
} |
639 |
} |
| 641 |
if($haschanged{'saslauthd'}) { |
640 |
if($haschanged{'saslauthd'}) { |
| 642 |
dolog("restarting saslauthd"); |
641 |
dolog("restarting saslauthd"); |
| 643 |
system("$kolab_prefix/etc/rc.d/rc.sasl stop; sleep 1; $kolab_prefix/sbin/saslauthd -a ldap -n 5"); |
642 |
system("/etc/init.d/saslauthd restart "); # stop; sleep 1; /sbin/saslauthd -a ldap -n 5"); |
| 644 |
} |
643 |
} |
| 645 |
if ($haschanged{'apache'}) { |
644 |
if ($haschanged{'apache'}) { |
| 646 |
dolog("reloading apache"); |
645 |
dolog("reloading apache"); |
| 647 |
system("$kolab_prefix/sbin/apachectl graceful"); |
646 |
system("/etc/init.d/apache2 reload"); |
| 648 |
} |
647 |
} |
| 649 |
if ($haschanged{'postfix'}) { |
648 |
if ($haschanged{'postfix'}) { |
| 650 |
dolog("reloading postfix"); |
649 |
dolog("reloading postfix"); |
| 651 |
system("$kolab_prefix/sbin/postfix reload"); |
650 |
system("/usr/sbin/postfix reload"); |
| 652 |
} |
651 |
} |
| 653 |
if ($haschanged{'imapd'}) { |
652 |
if ($haschanged{'imapd'}) { |
| 654 |
dolog("restarting imapd"); |
653 |
dolog("restarting imapd"); |
| 655 |
system("$kolab_prefix/etc/rc.d/rc.imapd restart"); |
654 |
system("/etc/init.d/cyrus restart"); |
| 656 |
} |
655 |
} |
| 657 |
if ($configdata{'proftpd-ftp'} =~ /true/i) { |
656 |
if ($configdata{'proftpd-ftp'} =~ /true/i) { |
| 658 |
dolog("make sure proftpd is running"); |
657 |
dolog("make sure proftpd is running"); |
| 659 |
system("$kolab_prefix/etc/rc.d/rc.proftpd start"); |
658 |
system("/etc/init.d/proftpd start"); |
| 660 |
if ($haschanged{'proftpd'}) { |
659 |
if ($haschanged{'proftpd'}) { |
| 661 |
dolog("reloading proftpd"); |
660 |
dolog("reloading proftpd"); |
| 662 |
kill("SIGHUP",`cat $kolab_prefix/var/proftpd/proftpd.pid`); |
661 |
kill("SIGHUP",`cat /var/run/proftpd.pid`); |
| 663 |
} |
662 |
} |
| 664 |
} else { |
663 |
} else { |
| 665 |
dolog("make sure proftpd isn't running"); |
664 |
dolog("make sure proftpd isn't running"); |
| 666 |
system("$kolab_prefix/etc/rc.d/rc.proftpd stop"); |
665 |
system("/etc/init.d/proftpd stop"); |
| 667 |
} |
666 |
} |
| 668 |
} |
667 |
} |
| 669 |
|
668 |
|
|
Lines 673-684
Link Here
|
| 673 |
################ |
672 |
################ |
| 674 |
|
673 |
|
| 675 |
openlog("kolab", 'cons, pid', 'user'); |
674 |
openlog("kolab", 'cons, pid', 'user'); |
| 676 |
my $pidfile = IO::File->new("$kolab_prefix/var/kolab/kolab.pid", "w+") |
675 |
my $pidfile = IO::File->new("/var/run/kolab.pid", "w+") |
| 677 |
|| die "could not open pid file"; |
676 |
|| die "could not open pid file"; |
| 678 |
print $pidfile $$; |
677 |
print $pidfile $$; |
| 679 |
undef $pidfile; |
678 |
undef $pidfile; |
| 680 |
|
679 |
|
| 681 |
my $kolab_config = $kolab_prefix."/etc/kolab/kolab.conf"; |
680 |
my $kolab_config = "/etc/kolab/kolab.conf"; |
| 682 |
my $fd = IO::File->new($kolab_config, "r") || die "could not open $kolab_config"; |
681 |
my $fd = IO::File->new($kolab_config, "r") || die "could not open $kolab_config"; |
| 683 |
foreach (<$fd>) { |
682 |
foreach (<$fd>) { |
| 684 |
if (/(.*) : (.*)/) { $kolab_config{$1} = $2; } |
683 |
if (/(.*) : (.*)/) { $kolab_config{$1} = $2; } |
|
Lines 688-694
Link Here
|
| 688 |
$configdata{'bind_pw'} = $kolab_config{'bind_pw'} || die "could not read bind_pw from $kolab_config"; |
687 |
$configdata{'bind_pw'} = $kolab_config{'bind_pw'} || die "could not read bind_pw from $kolab_config"; |
| 689 |
|
688 |
|
| 690 |
#martin |
689 |
#martin |
| 691 |
my $hashcmd = $kolab_prefix."/sbin/slappasswd -s ".$kolab_config{'bind_pw'}; |
690 |
my $hashcmd = "/usr/sbin/slappasswd -s ".$kolab_config{'bind_pw'}; |
| 692 |
$configdata{'bind_pw_hash'} = `$hashcmd`; |
691 |
$configdata{'bind_pw_hash'} = `$hashcmd`; |
| 693 |
chomp($configdata{'bind_pw_hash'}); |
692 |
chomp($configdata{'bind_pw_hash'}); |
| 694 |
|
693 |
|