[Bps-public-commit] rt-authen-externalauth branch, master, updated. 0.11-8-g857dcc5

Thomas Sibley trs at bestpractical.com
Fri Oct 26 15:58:41 EDT 2012


The branch, master has been updated
       via  857dcc53caf42c6da9d314357cc48e77c45fc0d0 (commit)
       via  a33d1b6bcd29b7594b3bbb562e950fd15c93c7f1 (commit)
       via  fe97ee4c7395fca62c90d516764604c800deda6c (commit)
       via  61fd793d7eb1b756ca90a5b259a3af7e9595c742 (commit)
      from  a023a97bbd60e68f7ea20d527e0e1fb7952b7ddf (commit)

Summary of changes:
 ChangeLog                                       |   5 ++
 MANIFEST                                        |   2 +
 MANIFEST.SKIP                                   |  64 ++++++++++++++
 META.yml                                        |   2 +-
 html/Callbacks/ExternalAuth/autohandler/Session |   1 +
 inc/Module/Install/RTx.pm                       |  30 ++-----
 inc/Module/Install/ReadmeFromPod.pm             | 112 +++++++++++++++++++++---
 lib/RT/Authen/ExternalAuth.pm                   |   2 +-
 xt/ldap.t                                       |   6 +-
 xt/ldap_escaping.t                              |   1 +
 xt/ldap_group.t                                 |   1 +
 xt/ldap_privileged.t                            |   6 +-
 12 files changed, 190 insertions(+), 42 deletions(-)
 create mode 100644 MANIFEST.SKIP

- Log -----------------------------------------------------------------
commit 61fd793d7eb1b756ca90a5b259a3af7e9595c742
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Fri Oct 26 11:38:38 2012 -0700

    Update M::I::RTx

diff --git a/inc/Module/Install/RTx.pm b/inc/Module/Install/RTx.pm
index 73b9cda..2eba7ad 100644
--- a/inc/Module/Install/RTx.pm
+++ b/inc/Module/Install/RTx.pm
@@ -8,7 +8,7 @@ no warnings 'once';
 
 use Module::Install::Base;
 use base 'Module::Install::Base';
-our $VERSION = '0.29';
+our $VERSION = '0.29_02';
 
 use FindBin;
 use File::Glob     ();
@@ -129,18 +129,7 @@ install ::
 
     my %has_etc;
     if ( File::Glob::bsd_glob("$FindBin::Bin/etc/schema.*") ) {
-
-        # got schema, load factory module
         $has_etc{schema}++;
-        $self->load('RTxFactory');
-        $self->postamble(<< ".");
-factory ::
-\t\$(NOECHO) \$(PERL) -Ilib -I"$local_lib_path" -I"$lib_path" -Minc::Module::Install -e"RTxFactory(qw($RTx $name))"
-
-dropdb ::
-\t\$(NOECHO) \$(PERL) -Ilib -I"$local_lib_path" -I"$lib_path" -Minc::Module::Install -e"RTxFactory(qw($RTx $name drop))"
-
-.
     }
     if ( File::Glob::bsd_glob("$FindBin::Bin/etc/acl.*") ) {
         $has_etc{acl}++;
@@ -164,28 +153,19 @@ dropdb ::
         print "For first-time installation, type 'make initdb'.\n";
         my $initdb = '';
         $initdb .= <<"." if $has_etc{schema};
-\t\$(NOECHO) \$(PERL) -Ilib -I"$local_lib_path" -I"$lib_path" -Minc::Module::Install -e"RTxInitDB(qw(schema))"
+\t\$(NOECHO) \$(PERL) -Ilib -I"$local_lib_path" -I"$lib_path" -Minc::Module::Install -e"RTxInitDB(qw(schema \$(NAME) \$(VERSION)))"
 .
         $initdb .= <<"." if $has_etc{acl};
-\t\$(NOECHO) \$(PERL) -Ilib -I"$local_lib_path" -I"$lib_path" -Minc::Module::Install -e"RTxInitDB(qw(acl))"
+\t\$(NOECHO) \$(PERL) -Ilib -I"$local_lib_path" -I"$lib_path" -Minc::Module::Install -e"RTxInitDB(qw(acl \$(NAME) \$(VERSION)))"
 .
         $initdb .= <<"." if $has_etc{initialdata};
-\t\$(NOECHO) \$(PERL) -Ilib -I"$local_lib_path" -I"$lib_path" -Minc::Module::Install -e"RTxInitDB(qw(insert))"
+\t\$(NOECHO) \$(PERL) -Ilib -I"$local_lib_path" -I"$lib_path" -Minc::Module::Install -e"RTxInitDB(qw(insert \$(NAME) \$(VERSION)))"
 .
         $self->postamble("initdb ::\n$initdb\n");
         $self->postamble("initialize-database ::\n$initdb\n");
     }
 }
 
-sub RTxInit {
-    unshift @INC, substr( delete( $INC{'RT.pm'} ), 0, -5 ) if $INC{'RT.pm'};
-    require RT;
-    RT::LoadConfig();
-    RT::ConnectToDatabase();
-
-    die "Cannot load RT" unless $RT::Handle and $RT::DatabaseType;
-}
-
 # stolen from RT::Handle so we work on 3.6 (cmp_versions came in with 3.8)
 { my %word = (
     a     => -4,
@@ -228,4 +208,4 @@ sub requires_rt {
 
 __END__
 
-#line 348
+#line 328
diff --git a/inc/Module/Install/ReadmeFromPod.pm b/inc/Module/Install/ReadmeFromPod.pm
index 348531e..fb7075f 100644
--- a/inc/Module/Install/ReadmeFromPod.pm
+++ b/inc/Module/Install/ReadmeFromPod.pm
@@ -7,29 +7,119 @@ use warnings;
 use base qw(Module::Install::Base);
 use vars qw($VERSION);
 
-$VERSION = '0.12';
+$VERSION = '0.18';
 
 sub readme_from {
   my $self = shift;
   return unless $self->is_admin;
 
-  my $file = shift || $self->_all_from
+  # Input file
+  my $in_file  = shift || $self->_all_from
     or die "Can't determine file to make readme_from";
-  my $clean = shift;
 
-  print "Writing README from $file\n";
+  # Get optional arguments
+  my ($clean, $format, $out_file, $options);
+  my $args = shift;
+  if ( ref $args ) {
+    # Arguments are in a hashref
+    if ( ref($args) ne 'HASH' ) {
+      die "Expected a hashref but got a ".ref($args)."\n";
+    } else {
+      $clean    = $args->{'clean'};
+      $format   = $args->{'format'};
+      $out_file = $args->{'output_file'};
+      $options  = $args->{'options'};
+    }
+  } else {
+    # Arguments are in a list
+    $clean    = $args;
+    $format   = shift;
+    $out_file = shift;
+    $options  = \@_;
+  }
+
+  # Default values;
+  $clean  ||= 0;
+  $format ||= 'txt';
+
+  # Generate README
+  print "readme_from $in_file to $format\n";
+  if ($format =~ m/te?xt/) {
+    $out_file = $self->_readme_txt($in_file, $out_file, $options);
+  } elsif ($format =~ m/html?/) {
+    $out_file = $self->_readme_htm($in_file, $out_file, $options);
+  } elsif ($format eq 'man') {
+    $out_file = $self->_readme_man($in_file, $out_file, $options);
+  } elsif ($format eq 'pdf') {
+    $out_file = $self->_readme_pdf($in_file, $out_file, $options);
+  }
 
-  require Pod::Text;
-  my $parser = Pod::Text->new();
-  open README, '> README' or die "$!\n";
-  $parser->output_fh( *README );
-  $parser->parse_file( $file );
   if ($clean) {
-    $self->clean_files('README');
+    $self->clean_files($out_file);
   }
+
   return 1;
 }
 
+
+sub _readme_txt {
+  my ($self, $in_file, $out_file, $options) = @_;
+  $out_file ||= 'README';
+  require Pod::Text;
+  my $parser = Pod::Text->new( @$options );
+  open my $out_fh, '>', $out_file or die "Could not write file $out_file:\n$!\n";
+  $parser->output_fh( *$out_fh );
+  $parser->parse_file( $in_file );
+  close $out_fh;
+  return $out_file;
+}
+
+
+sub _readme_htm {
+  my ($self, $in_file, $out_file, $options) = @_;
+  $out_file ||= 'README.htm';
+  require Pod::Html;
+  Pod::Html::pod2html(
+    "--infile=$in_file",
+    "--outfile=$out_file",
+    @$options,
+  );
+  # Remove temporary files if needed
+  for my $file ('pod2htmd.tmp', 'pod2htmi.tmp') {
+    if (-e $file) {
+      unlink $file or warn "Warning: Could not remove file '$file'.\n$!\n";
+    }
+  }
+  return $out_file;
+}
+
+
+sub _readme_man {
+  my ($self, $in_file, $out_file, $options) = @_;
+  $out_file ||= 'README.1';
+  require Pod::Man;
+  my $parser = Pod::Man->new( @$options );
+  $parser->parse_from_file($in_file, $out_file);
+  return $out_file;
+}
+
+
+sub _readme_pdf {
+  my ($self, $in_file, $out_file, $options) = @_;
+  $out_file ||= 'README.pdf';
+  eval { require App::pod2pdf; }
+    or die "Could not generate $out_file because pod2pdf could not be found\n";
+  my $parser = App::pod2pdf->new( @$options );
+  $parser->parse_from_file($in_file);
+  open my $out_fh, '>', $out_file or die "Could not write file $out_file:\n$!\n";
+  select $out_fh;
+  $parser->output;
+  select STDOUT;
+  close $out_fh;
+  return $out_file;
+}
+
+
 sub _all_from {
   my $self = shift;
   return unless $self->admin->{extensions};
@@ -44,5 +134,5 @@ sub _all_from {
 
 __END__
 
-#line 112
+#line 254
 

commit fe97ee4c7395fca62c90d516764604c800deda6c
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Fri Oct 26 12:34:07 2012 -0700

    Tests: Add to LDAP the base DN under which we search for users/groups
    
    Net::LDAP::Server::Test versions after 0.14 started, correctly,
    returning "No such object" if the search base didn't exist.  Previously
    it didn't care if the base existed or not.

diff --git a/xt/ldap.t b/xt/ldap.t
index 0d6c2d4..43809e4 100644
--- a/xt/ldap.t
+++ b/xt/ldap.t
@@ -17,7 +17,8 @@ ok( my $server = Net::LDAP::Server::Test->new( $ldap_port, auto_schema => 1 ),
 my $ldap = Net::LDAP->new("localhost:$ldap_port");
 $ldap->bind();
 my $username = "testuser";
-my $dn       = "uid=$username,dc=bestpractical,dc=com";
+my $base     = "dc=bestpractical,dc=com";
+my $dn       = "uid=$username,$base";
 my $entry    = {
     cn           => $username,
     mail         => "$username\@invalid.tld",
@@ -25,6 +26,7 @@ my $entry    = {
     objectClass  => 'User',
     userPassword => 'password',
 };
+$ldap->add( $base );
 $ldap->add( $dn, attr => [%$entry] );
 
 RT->Config->Set( ExternalAuthPriority        => ['My_LDAP'] );
@@ -37,7 +39,7 @@ RT->Config->Set(
         'My_LDAP' => {
             'type'            => 'ldap',
             'server'          => "127.0.0.1:$ldap_port",
-            'base'            => 'dc=bestpractical,dc=com',
+            'base'            => $base,
             'filter'          => '(objectClass=*)',
             'd_filter'        => '()',
             'tls'             => 0,
diff --git a/xt/ldap_escaping.t b/xt/ldap_escaping.t
index ef8a59b..0fbb02c 100644
--- a/xt/ldap_escaping.t
+++ b/xt/ldap_escaping.t
@@ -20,6 +20,7 @@ $ldap->bind();
 my $users_dn = "ou=users,dc=bestpractical,dc=com";
 my $group_dn = "cn=test group,ou=groups,dc=bestpractical,dc=com";
 
+$ldap->add($users_dn);
 $ldap->add(
     "cn=Smith\\, John,$users_dn",
     attr => [
diff --git a/xt/ldap_group.t b/xt/ldap_group.t
index 624b2e4..a5d0e64 100644
--- a/xt/ldap_group.t
+++ b/xt/ldap_group.t
@@ -25,6 +25,7 @@ $ldap->bind();
 my $users_dn = "ou=users,dc=bestpractical,dc=com";
 my $group_dn = "cn=test group,ou=groups,dc=bestpractical,dc=com";
 
+$ldap->add($users_dn);
 for (1 .. 3) {
     my $uid = "testuser$_";
     my $entry    = {
diff --git a/xt/ldap_privileged.t b/xt/ldap_privileged.t
index cde9bbe..ee27a36 100644
--- a/xt/ldap_privileged.t
+++ b/xt/ldap_privileged.t
@@ -16,7 +16,8 @@ ok( my $server = Net::LDAP::Server::Test->new( $ldap_port, auto_schema => 1 ),
 my $ldap = Net::LDAP->new("localhost:$ldap_port");
 $ldap->bind();
 my $username = "testuser";
-my $dn       = "uid=$username,dc=bestpractical,dc=com";
+my $base     = "dc=bestpractical,dc=com";
+my $dn       = "uid=$username,$base";
 my $entry    = {
     cn           => $username,
     mail         => "$username\@invalid.tld",
@@ -24,6 +25,7 @@ my $entry    = {
     objectClass  => 'User',
     userPassword => 'password',
 };
+$ldap->add( $base );
 $ldap->add( $dn, attr => [%$entry] );
 
 RT->Config->Set( ExternalAuthPriority        => ['My_LDAP'] );
@@ -36,7 +38,7 @@ RT->Config->Set(
         'My_LDAP' => {
             'type'            => 'ldap',
             'server'          => "127.0.0.1:$ldap_port",
-            'base'            => 'dc=bestpractical,dc=com',
+            'base'            => $base,
             'filter'          => '(objectClass=*)',
             'tls'             => 0,
             'net_ldap_args'   => [ version => 3 ],

commit a33d1b6bcd29b7594b3bbb562e950fd15c93c7f1
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Fri Oct 26 12:46:15 2012 -0700

    Redirect correctly on RT 4.0.8, 3.8.15, and the 2012-10-25 security patches
    
    The NextPage session stash started storing hashrefs instead of strings.
    This manifested as redirects to /HASH(0xDEADBEEF) instead of the proper
    destination.  Older and unpatched RTs will continue to work correctly
    due to the "if ref $next" check.

diff --git a/html/Callbacks/ExternalAuth/autohandler/Session b/html/Callbacks/ExternalAuth/autohandler/Session
index e8ef014..e4020ba 100644
--- a/html/Callbacks/ExternalAuth/autohandler/Session
+++ b/html/Callbacks/ExternalAuth/autohandler/Session
@@ -7,6 +7,7 @@ if (   $m->request_comp->path eq '/NoAuth/Login.html'
     && $ARGS{next} )
 {
     my $next = delete $session{'NextPage'}->{ $ARGS{'next'} };
+       $next = $next->{'url'} if ref $next;
     RT::Interface::Web::Redirect( $next || RT->Config->Get('WebURL') );
 }
 </%init>

commit 857dcc53caf42c6da9d314357cc48e77c45fc0d0
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Fri Oct 26 12:56:41 2012 -0700

    Version 0.12

diff --git a/ChangeLog b/ChangeLog
index 2897c9c..be324da 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+0.12	2012-10-26	Thomas Sibley
+	* Redirect correctly after login on RT 4.0.8, 3.8.15, and the 2012-10-25 security patches
+	* Added "group_scope" as a configurable option.
+	* Tests: Add to LDAP the base DN under which we search for users/groups
+
 0.11    2012-07-03  Alex Vandiver
 	* Obfuscate passwords in RT's System Configuration page
 	* Set an empty CurrentUser on failure, instead of removing it entirely
diff --git a/MANIFEST b/MANIFEST
index 5fe7c31..1c0813d 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -25,10 +25,12 @@ lib/RT/Authen/ExternalAuth/LDAP.pm
 LICENSE
 Makefile.PL
 MANIFEST			This list of files
+MANIFEST.SKIP
 META.yml
 README
 xt/ldap.t
 xt/ldap_escaping.t
 xt/ldap_group.t
 xt/ldap_privileged.t
+xt/obfuscate-password.t
 xt/sqlite.t
diff --git a/MANIFEST.SKIP b/MANIFEST.SKIP
new file mode 100644
index 0000000..9163905
--- /dev/null
+++ b/MANIFEST.SKIP
@@ -0,0 +1,64 @@
+
+#!start included /opt/perlbrew/perls/perl-5.14.1/lib/5.14.1/ExtUtils/MANIFEST.SKIP
+# Avoid version control files.
+\bRCS\b
+\bCVS\b
+\bSCCS\b
+,v$
+\B\.svn\b
+\B\.git\b
+\B\.gitignore\b
+\b_darcs\b
+\B\.cvsignore$
+
+# Avoid VMS specific MakeMaker generated files
+\bDescrip.MMS$
+\bDESCRIP.MMS$
+\bdescrip.mms$
+
+# Avoid Makemaker generated and utility files.
+\bMANIFEST\.bak
+\bMakefile$
+\bblib/
+\bMakeMaker-\d
+\bpm_to_blib\.ts$
+\bpm_to_blib$
+\bblibdirs\.ts$         # 6.18 through 6.25 generated this
+
+# Avoid Module::Build generated and utility files.
+\bBuild$
+\b_build/
+\bBuild.bat$
+\bBuild.COM$
+\bBUILD.COM$
+\bbuild.com$
+
+# Avoid temp and backup files.
+~$
+\.old$
+\#$
+\b\.#
+\.bak$
+\.tmp$
+\.#
+\.rej$
+
+# Avoid OS-specific files/dirs
+# Mac OSX metadata
+\B\.DS_Store
+# Mac OSX SMB mount metadata files
+\B\._
+
+# Avoid Devel::Cover and Devel::CoverX::Covered files.
+\bcover_db\b
+\bcovered\b
+
+# Avoid MYMETA files
+^MYMETA\.
+#!end included /opt/perlbrew/perls/perl-5.14.1/lib/5.14.1/ExtUtils/MANIFEST.SKIP
+
+
+^xt/tmp/ports
+\.tar\.gz$
+\.sw[op]$
+^\.tags
diff --git a/META.yml b/META.yml
index bc9f5ec..ac8de1c 100644
--- a/META.yml
+++ b/META.yml
@@ -33,4 +33,4 @@ requires:
   Net::SSLeay: 0
 resources:
   license: http://opensource.org/licenses/gpl-license.php
-version: 0.11
+version: 0.12
diff --git a/lib/RT/Authen/ExternalAuth.pm b/lib/RT/Authen/ExternalAuth.pm
index 1425d86..6dba7e2 100644
--- a/lib/RT/Authen/ExternalAuth.pm
+++ b/lib/RT/Authen/ExternalAuth.pm
@@ -1,6 +1,6 @@
 package RT::Authen::ExternalAuth;
 
-our $VERSION = '0.11';
+our $VERSION = '0.12';
 
 =head1 NAME
 

-----------------------------------------------------------------------



More information about the Bps-public-commit mailing list