File tinyca2-exportformat.patch of Package tinyca2

diff -up tinyca2-0.7.6-20070611/lib/CA.pm.export tinyca2-0.7.6-20070611/lib/CA.pm
--- tinyca2-0.7.6-20070611/lib/CA.pm.export	2006-06-29 00:50:41.000000000 +0300
+++ tinyca2-0.7.6-20070611/lib/CA.pm	2008-09-09 10:32:26.000000000 +0300
@@ -1306,8 +1306,8 @@ sub export_crl {
    $ca = $self->{'actca'};
 
    if(not defined($opts)) {
-      $opts->{'outfile'} = "$main->{'exportdir'}/$ca-crl.pem";
-      $opts->{'format'}  = 'PEM';
+      $opts->{'outfile'} = "$main->{'exportdir'}/$ca-crl.der";
+      $opts->{'format'}  = 'DER';
       $opts->{'days'} = $main->{'TCONFIG'}->{'server_ca'}->{'default_crl_days'};
 
       GUI::HELPERS::set_cursor($main, 0);
diff -up tinyca2-0.7.6-20070611/lib/CERT.pm.export tinyca2-0.7.6-20070611/lib/CERT.pm
--- tinyca2-0.7.6-20070611/lib/CERT.pm.export	2006-06-29 00:50:41.000000000 +0300
+++ tinyca2-0.7.6-20070611/lib/CERT.pm	2008-09-09 10:32:26.000000000 +0300
@@ -407,10 +407,10 @@ sub get_export_cert {
       
       $opts->{'parsed'} = $self->parse_cert($main, $opts->{'certname'});
 
-      if((defined($email)) && $email ne '' && $email ne ' ') {
-         $opts->{'outfile'} = "$main->{'exportdir'}/$email-cert.pem";
-      }elsif((defined($cn)) && $cn ne '' && $cn ne ' ') {
+      if((defined($cn)) && $cn ne '' && $cn ne ' ') {
          $opts->{'outfile'} = "$main->{'exportdir'}/$cn-cert.pem";
+      }elsif((defined($email)) && $email ne '' && $email ne ' ') {
+         $opts->{'outfile'} = "$main->{'exportdir'}/$email-cert.pem";
       }else{
          $opts->{'outfile'} = "$main->{'exportdir'}/cert.pem";
       }
diff -up tinyca2-0.7.6-20070611/lib/GUI.pm.export tinyca2-0.7.6-20070611/lib/GUI.pm
--- tinyca2-0.7.6-20070611/lib/GUI.pm.export	2007-03-22 09:52:22.000000000 +0200
+++ tinyca2-0.7.6-20070611/lib/GUI.pm	2008-10-02 11:53:46.000000000 +0300
@@ -1469,21 +1469,21 @@ sub show_crl_export_dialog {
    $hbox = Gtk2::HBox->new(0, 0);
    $box->vbox->add($hbox);
 
-   $format1 = Gtk2::RadioButton->new(undef, _("PEM"));
+   $format1 = Gtk2::RadioButton->new(undef, _("DER"));
    $format1->set_active(1)
-      if(defined($opts->{'format'}) && $opts->{'format'} eq 'PEM');
+      if(defined($opts->{'format'}) && $opts->{'format'} eq 'DER');
    $format1->signal_connect('toggled' =>
      sub{GUI::CALLBACK::toggle_to_var($format1,
-         \$opts->{'format'}, 'PEM', \$opts->{'outfile'}, 
+         \$opts->{'format'}, 'DER', \$opts->{'outfile'}, 
          \$opts->{'format'}, $fileentry)});
    $hbox->add($format1);
 
-   $format2 = Gtk2::RadioButton->new($format1, _("DER"));
+   $format2 = Gtk2::RadioButton->new($format1, _("PEM"));
    $format2->set_active(1)
-      if(defined($opts->{'format'}) && $opts->{'format'} eq 'DER');
+      if(defined($opts->{'format'}) && $opts->{'format'} eq 'PEM');
    $format2->signal_connect('toggled' =>
      sub{GUI::CALLBACK::toggle_to_var($format2,
-         \$opts->{'format'}, 'DER', \$opts->{'outfile'}, 
+         \$opts->{'format'}, 'PEM', \$opts->{'outfile'}, 
          \$opts->{'format'}, $fileentry)});
    $hbox->add($format2);
 
diff -up tinyca2-0.7.6-20070611/lib/KEY.pm.export tinyca2-0.7.6-20070611/lib/KEY.pm
--- tinyca2-0.7.6-20070611/lib/KEY.pm.export	2006-06-29 00:50:41.000000000 +0300
+++ tinyca2-0.7.6-20070611/lib/KEY.pm	2008-09-09 10:32:26.000000000 +0300
@@ -155,10 +155,10 @@ sub get_export_key {
       $opts->{'format'}        = 'PEM';
       $opts->{'friendlyname'}  = '';
 
-      if((defined($email)) && $email ne '' && $email ne ' ') {
-         $opts->{'outfile'} = "$main->{'exportdir'}/$email-key.pem";
-      }elsif((defined($cn)) && $cn ne '' && $cn ne ' ') {
+      if((defined($cn)) && $cn ne '' && $cn ne ' ') {
          $opts->{'outfile'} = "$main->{'exportdir'}/$cn-key.pem";
+      }elsif((defined($email)) && $email ne '' && $email ne ' ') {
+         $opts->{'outfile'} = "$main->{'exportdir'}/$email-key.pem";
       }else{
          $opts->{'outfile'} = "$main->{'exportdir'}/key.pem";
       }
openSUSE Build Service is sponsored by