Commit 66bd2516 authored by jocuri%softhome.net's avatar jocuri%softhome.net

Patch for bug 143490: eliminate unsupported calls from checksetup.pl when…

Patch for bug 143490: eliminate unsupported calls from checksetup.pl when running in Windows; original code by Cedric Caron <cedric.caron@urbanet.ch>; patch by Andrei Benea <abenea@home.ro>; r=vlad,justdave, a=justdave.
parent 4c4edf2e
...@@ -452,13 +452,19 @@ $index_html = 0; ...@@ -452,13 +452,19 @@ $index_html = 0;
END END
if (!LocalVarExists('mysqlpath')) { if (!LocalVarExists('mysqlpath')) {
my $mysql_binaries = `which mysql`; my $mysql_binaries;
if ($^O !~ /MSWin32/i) {
$mysql_binaries = `which mysql`;
if ($mysql_binaries =~ /no mysql/ || $mysql_binaries eq '') { if ($mysql_binaries =~ /no mysql/ || $mysql_binaries eq '') {
# If which didn't find it, just provide a reasonable default # If which didn't find it, just provide a reasonable default
$mysql_binaries = "/usr/bin"; $mysql_binaries = "/usr/bin";
} else { } else {
$mysql_binaries =~ s:/mysql\n$::; $mysql_binaries =~ s:/mysql\n$::;
} }
} else {
# provide a reasonable default for Windows
$mysql_binaries = 'c:\mysql\bin';
}
LocalVar('mysqlpath', <<"END"); LocalVar('mysqlpath', <<"END");
# #
...@@ -467,19 +473,24 @@ if (!LocalVarExists('mysqlpath')) { ...@@ -467,19 +473,24 @@ if (!LocalVarExists('mysqlpath')) {
# Because it's possible that these files aren't in your path, you can specify # Because it's possible that these files aren't in your path, you can specify
# their location here. # their location here.
# Please specify only the directory name, with no trailing slash. # Please specify only the directory name, with no trailing slash.
\$mysqlpath = "$mysql_binaries"; \$mysqlpath = '$mysql_binaries';
END END
} }
if (!LocalVarExists('cvsbin')) { if (!LocalVarExists('cvsbin')) {
my $cvs_executable = `which cvs`; my $cvs_executable;
if ($^O !~ /MSWin32/i) {
$cvs_executable = `which cvs`;
if ($cvs_executable =~ /no cvs/ || $cvs_executable eq '') { if ($cvs_executable =~ /no cvs/ || $cvs_executable eq '') {
# If which didn't find it, just set to blank # If which didn't find it, just set to blank
$cvs_executable = ""; $cvs_executable = "";
} else { } else {
chomp $cvs_executable; chomp $cvs_executable;
} }
} else {
$cvs_executable = "";
}
LocalVar('cvsbin', <<"END"); LocalVar('cvsbin', <<"END");
# #
...@@ -493,7 +504,9 @@ END ...@@ -493,7 +504,9 @@ END
if (!LocalVarExists('interdiffbin')) { if (!LocalVarExists('interdiffbin')) {
my $interdiff_executable = `which interdiff`; my $interdiff_executable;
if ($^O !~ /MSWin32/i) {
$interdiff_executable = `which interdiff`;
if ($interdiff_executable =~ /no interdiff/ || $interdiff_executable eq '') { if ($interdiff_executable =~ /no interdiff/ || $interdiff_executable eq '') {
if (!$silent) { if (!$silent) {
print "\nOPTIONAL NOTE: If you want to "; print "\nOPTIONAL NOTE: If you want to ";
...@@ -508,6 +521,9 @@ if (!LocalVarExists('interdiffbin')) { ...@@ -508,6 +521,9 @@ if (!LocalVarExists('interdiffbin')) {
} else { } else {
chomp $interdiff_executable; chomp $interdiff_executable;
} }
} else {
$interdiff_executable = "";
}
LocalVar('interdiffbin', <<"END"); LocalVar('interdiffbin', <<"END");
...@@ -522,13 +538,18 @@ END ...@@ -522,13 +538,18 @@ END
if (!LocalVarExists('diffpath')) { if (!LocalVarExists('diffpath')) {
my $diff_binaries = `which diff`; my $diff_binaries;
if ($^O !~ /MSWin32/i) {
$diff_binaries = `which diff`;
if ($diff_binaries =~ /no diff/ || $diff_binaries eq '') { if ($diff_binaries =~ /no diff/ || $diff_binaries eq '') {
# If which didn't find it, set to blank # If which didn't find it, set to blank
$diff_binaries = ""; $diff_binaries = "";
} else { } else {
$diff_binaries =~ s:/diff\n$::; $diff_binaries =~ s:/diff\n$::;
} }
} else {
$diff_binaries = "";
}
LocalVar('diffpath', <<"END"); LocalVar('diffpath', <<"END");
...@@ -556,8 +577,14 @@ LocalVar('create_htaccess', <<'END'); ...@@ -556,8 +577,14 @@ LocalVar('create_htaccess', <<'END');
$create_htaccess = 1; $create_htaccess = 1;
END END
my $webservergroup_default;
if ($^O !~ /MSWin32/i) {
$webservergroup_default = 'nobody';
} else {
$webservergroup_default = '';
}
LocalVar('webservergroup', ' LocalVar('webservergroup', <<"END");
# #
# This is the group your web server runs on. # This is the group your web server runs on.
# If you have a windows box, ignore this setting. # If you have a windows box, ignore this setting.
...@@ -569,8 +596,8 @@ LocalVar('webservergroup', ' ...@@ -569,8 +596,8 @@ LocalVar('webservergroup', '
# and you cannot set this up any other way. YOU HAVE BEEN WARNED. # and you cannot set this up any other way. YOU HAVE BEEN WARNED.
# If you set this to anything besides "", you will need to run checksetup.pl # If you set this to anything besides "", you will need to run checksetup.pl
# as root, or as a user who is a member of the specified group. # as root, or as a user who is a member of the specified group.
$webservergroup = "nobody"; \$webservergroup = "$webservergroup_default";
'); END
...@@ -745,6 +772,20 @@ see below are caused by this. ...@@ -745,6 +772,20 @@ see below are caused by this.
EOF EOF
} }
if ($^O =~ /MSWin32/i) {
print <<EOF;
Warning: You have set webservergroup in your localconfig.
Please understand that this does not bring you any security when
running under Windows.
Verify that the file permissions in your Bugzilla directory are
suitable for your system.
Avoid unnecessary write access.
EOF
}
} else { } else {
# Theres no webservergroup, this is very very very very bad. # Theres no webservergroup, this is very very very very bad.
# However, if we're being run on windows, then this option doesn't # However, if we're being run on windows, then this option doesn't
...@@ -1249,7 +1290,8 @@ sub fixPerms { ...@@ -1249,7 +1290,8 @@ sub fixPerms {
} }
} }
if ($my_webservergroup) { if ($^O !~ /MSWin32/i) {
if ($my_webservergroup) {
# Funny! getgrname returns the GID if fed with NAME ... # Funny! getgrname returns the GID if fed with NAME ...
my $webservergid = getgrnam($my_webservergroup) my $webservergid = getgrnam($my_webservergroup)
or die("no such group: $my_webservergroup"); or die("no such group: $my_webservergroup");
...@@ -1278,7 +1320,7 @@ if ($my_webservergroup) { ...@@ -1278,7 +1320,7 @@ if ($my_webservergroup) {
chmod 0771, $datadir; chmod 0771, $datadir;
chown $<, $webservergid, 'graphs'; chown $<, $webservergid, 'graphs';
chmod 0770, 'graphs'; chmod 0770, 'graphs';
} else { } else {
# get current gid from $( list # get current gid from $( list
my $gid = (split " ", $()[0]; my $gid = (split " ", $()[0];
fixPerms('.htaccess', $<, $gid, 022); # glob('*') doesn't catch dotfiles fixPerms('.htaccess', $<, $gid, 022); # glob('*') doesn't catch dotfiles
...@@ -1302,6 +1344,7 @@ if ($my_webservergroup) { ...@@ -1302,6 +1344,7 @@ if ($my_webservergroup) {
chmod 0777, $datadir; chmod 0777, $datadir;
chown $<, $gid, 'graphs'; chown $<, $gid, 'graphs';
chmod 01777, 'graphs'; chmod 01777, 'graphs';
}
} }
########################################################################### ###########################################################################
...@@ -3877,7 +3920,9 @@ if (!GroupDoesExist("canconfirm")) { ...@@ -3877,7 +3920,9 @@ if (!GroupDoesExist("canconfirm")) {
sub bailout { # this is just in case we get interrupted while getting passwd sub bailout { # this is just in case we get interrupted while getting passwd
if ($^O !~ /MSWin32/i) {
system("stty","echo"); # re-enable input echoing system("stty","echo"); # re-enable input echoing
}
exit 1; exit 1;
} }
...@@ -4028,7 +4073,9 @@ if ($sth->rows == 0) { ...@@ -4028,7 +4073,9 @@ if ($sth->rows == 0) {
$SIG{QUIT} = \&bailout; $SIG{QUIT} = \&bailout;
$SIG{TERM} = \&bailout; $SIG{TERM} = \&bailout;
if ($^O !~ /MSWin32/i) {
system("stty","-echo"); # disable input echoing system("stty","-echo"); # disable input echoing
}
while( $pass1 ne $pass2 ) { while( $pass1 ne $pass2 ) {
while( $pass1 eq "" || $pass1 !~ /^[[:print:]]{3,16}$/ ) { while( $pass1 eq "" || $pass1 !~ /^[[:print:]]{3,16}$/ ) {
...@@ -4060,7 +4107,10 @@ if ($sth->rows == 0) { ...@@ -4060,7 +4107,10 @@ if ($sth->rows == 0) {
# Crypt the administrator's password # Crypt the administrator's password
my $cryptedpassword = Crypt($pass1); my $cryptedpassword = Crypt($pass1);
if ($^O !~ /MSWin32/i) {
system("stty","echo"); # re-enable input echoing system("stty","echo"); # re-enable input echoing
}
$SIG{HUP} = 'DEFAULT'; # and remove our interrupt hooks $SIG{HUP} = 'DEFAULT'; # and remove our interrupt hooks
$SIG{INT} = 'DEFAULT'; $SIG{INT} = 'DEFAULT';
$SIG{QUIT} = 'DEFAULT'; $SIG{QUIT} = 'DEFAULT';
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment