(mirroring) reject non-local pushes if GL_HOSTNAME not set
We previously said all mirroring features are disabled if GL_HOSTNAME is not set. But what if, after mirroring has been setup, and master/slaves defined for a repo, a slave admin fat-fingers the RC file and accidentally comments out GL_HOSTNAME? We might end up violating RULE NUMBER ONE!
This commit is contained in:
parent
37ce28a43b
commit
a3ffc9d8fd
3 changed files with 8 additions and 4 deletions
|
@ -140,8 +140,9 @@ $ENV{GL_REPO}=$repo;
|
|||
my $aa = ($verb =~ $R_COMMANDS ? 'R' : 'W');
|
||||
|
||||
# writes may get redirected under certain conditions
|
||||
if ( $GL_HOSTNAME and $aa eq 'W' and mirror_mode($repo) =~ /^slave of (\S+)/ ) {
|
||||
if ( $aa eq 'W' and mirror_mode($repo) =~ /^slave of (\S+)/ ) {
|
||||
my $master = $1;
|
||||
die "$ABRT GL_HOSTNAME not set; rejecting push to non-local repo\n" unless $GL_HOSTNAME;
|
||||
die "$ABRT $GL_HOSTNAME not the master, please push to $master\n" unless mirror_redirectOK($repo, $GL_HOSTNAME);
|
||||
print STDERR "$GL_HOSTNAME ==== $user ($repo) ===> $master\n";
|
||||
exec("ssh", $master, "USER=$user", "SOC=$ENV{SSH_ORIGINAL_COMMAND}");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue