You are viewing a plain text version of this content. The canonical link for it is here.
Posted to test-commits@perl.apache.org by sf...@apache.org on 2011/01/02 00:10:57 UTC

svn commit: r1054309 - in /perl/Apache-Test/trunk: Changes lib/Apache/TestSSLCA.pm

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;