Bugzilla – Attachment 12107 Details for
Bug 8745
disallow rebuild_zebra.pl from executing, when run by root user
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Addition of "executed by user" check to warn if execute by root user.
0001-Bug-8745-Disallow-rebuild_zebra.pl-from-executing-wh.patch (text/plain), 1.99 KB, created by
Barry Cannon
on 2012-09-10 14:43:26 UTC
(
hide
)
Description:
Addition of "executed by user" check to warn if execute by root user.
Filename:
MIME Type:
Creator:
Barry Cannon
Created:
2012-09-10 14:43:26 UTC
Size:
1.99 KB
patch
obsolete
>From 341f2c33457ba55208f50f9cf82cfd756eff5697 Mon Sep 17 00:00:00 2001 >From: Barry Cannon <barry@oslo.ie> >Date: Mon, 10 Sep 2012 15:23:29 +0100 >Subject: [PATCH] Bug 8745 - Disallow rebuild_zebra.pl from executing, when run by root user. > >Added a check to warn users of execution as root user. >Added a 'runas-root' switch to allow users to force execution as root user. >--- > misc/migration_tools/rebuild_zebra.pl | 13 +++++++++++-- > 1 files changed, 11 insertions(+), 2 deletions(-) > >diff --git a/misc/migration_tools/rebuild_zebra.pl b/misc/migration_tools/rebuild_zebra.pl >index 1621e84..10d7338 100755 >--- a/misc/migration_tools/rebuild_zebra.pl >+++ b/misc/migration_tools/rebuild_zebra.pl >@@ -38,6 +38,8 @@ my $do_not_clear_zebraqueue; > my $length; > my $where; > my $offset; >+my $runas_root; >+my $run_user = (getpwuid($<))[0]; > my $verbose_logging = 0; > my $zebraidx_log_opt = " -v none,fatal,warn "; > my $result = GetOptions( >@@ -45,7 +47,7 @@ my $result = GetOptions( > 'r|reset' => \$reset, > 's' => \$skip_export, > 'k' => \$keep_export, >- 'I|skip-index' => \$skip_index, >+ 'I|skip-index' => \$skip_index, > 'nosanitize' => \$nosanitize, > 'b' => \$biblios, > 'noxml' => \$noxml, >@@ -60,14 +62,21 @@ my $result = GetOptions( > 'length:i' => \$length, > 'offset:i' => \$offset, > 'v+' => \$verbose_logging, >+ 'runas-root' => \$runas_root, > ); > >- > if (not $result or $want_help) { > print_usage(); > exit 0; > } > >+if(not $runas_root && $run_user eq 'root') { >+ my $msg = "Warning: You are running this script as the user 'root'.\n"; >+ $msg .= "If this is intentional you must explicitly specify this using the -runas-root switch\n"; >+ $msg .= "Please do '$0 --help' to see usage.\n"; >+ die $msg; >+} >+ > if (not $biblios and not $authorities) { > my $msg = "Must specify -b or -a to reindex bibs or authorities\n"; > $msg .= "Please do '$0 --help' to see usage.\n"; >-- >1.7.2.5 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 8745
:
12107
|
13274
|
13477
|
17116
|
17117
|
17118
|
17266
|
17267