perl-test-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s.@apache.org
Subject svn commit: r1054309 - in /perl/Apache-Test/trunk: Changes lib/Apache/TestSSLCA.pm
Date Sat, 01 Jan 2011 23:10:57 GMT
Author: sf
Date: Sat Jan  1 23:10:57 2011
New Revision: 1054309

URL: http://svn.apache.org/viewvc?rev=1054309&view=rev
Log:
Add support for RFC2253 DN string format to dn_oneline in Apache::TestSSLCA

Modified:
    perl/Apache-Test/trunk/Changes
    perl/Apache-Test/trunk/lib/Apache/TestSSLCA.pm

Modified: perl/Apache-Test/trunk/Changes
URL: http://svn.apache.org/viewvc/perl/Apache-Test/trunk/Changes?rev=1054309&r1=1054308&r2=1054309&view=diff
==============================================================================
--- perl/Apache-Test/trunk/Changes (original)
+++ perl/Apache-Test/trunk/Changes Sat Jan  1 23:10:57 2011
@@ -8,6 +8,9 @@ Changes - Apache::Test change logfile
 
 =item 1.35-dev
 
+Add support for RFC2253 DN string format to dn_oneline in Apache::TestSSLCA
+[Stefan Fritsch]
+
 Make Apache::Test::sok() compatible with the -withtestmore option
 [Torsten Foertsch]
 

Modified: perl/Apache-Test/trunk/lib/Apache/TestSSLCA.pm
URL: http://svn.apache.org/viewvc/perl/Apache-Test/trunk/lib/Apache/TestSSLCA.pm?rev=1054309&r1=1054308&r2=1054309&view=diff
==============================================================================
--- perl/Apache-Test/trunk/lib/Apache/TestSSLCA.pm (original)
+++ perl/Apache-Test/trunk/lib/Apache/TestSSLCA.pm Sat Jan  1 23:10:57 2011
@@ -145,17 +145,29 @@ sub dn_vars {
 }
 
 sub dn_oneline {
-    my($dn) = @_;
+    my($dn, $rfc2253) = @_;
 
     unless (ref $dn) {
         $dn = dn($dn);
     }
 
     my $string = "";
+    my @parts = (qw(C ST L O OU CN), $email_field);
+    @parts = reverse @parts if $rfc2253;
 
-    for my $k ((qw(C ST L O OU CN), $email_field)) {
+    for my $k (@parts) {
         next unless $dn->{$k};
-        $string .= "/$k=$dn->{$k}";
+        if ($rfc2253) {
+            my $tmp = $dn->{$k};
+            $tmp =~ s{([,+"\\<>;])}{\\$1}g;
+            $tmp =~ s{^([ #])}{\\$1};
+            $tmp =~ s{ $}{\\ };
+            $string .= "," if $string;
+            $string .= "$k=$tmp";
+        }
+        else {
+            $string .= "/$k=$dn->{$k}";
+        }
     }
 
     $string;



Mime
View raw message