[tinyca2] Added tinyca2 patches

Paul Wouters pwouters at fedoraproject.org
Wed Oct 16 16:47:47 UTC 2013


commit dc7402e8b24b21bac39dca8680a2f8c7948b88d9
Author: Paul Wouters <pwouters at redhat.com>
Date:   Wed Oct 16 12:47:33 2013 -0400

    Added tinyca2 patches

 .gitignore                  |    2 +-
 sources                     |    1 +
 tinyca2-cleanup.patch       |   39 ++++++++++++
 tinyca2-defaults.patch      |   50 +++++++++++++++
 tinyca2-deprecated.patch    |   66 ++++++++++++++++++++
 tinyca2-english.patch       |   72 +++++++++++++++++++++
 tinyca2-exportformat.patch  |   79 +++++++++++++++++++++++
 tinyca2-install-langs.patch |   19 ++++++
 tinyca2-sv.patch            |   47 ++++++++++++++
 tinyca2-use_io_select.patch |  144 +++++++++++++++++++++++++++++++++++++++++++
 10 files changed, 518 insertions(+), 1 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index 93f733d..2ce2bb3 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1 @@
-tinyca2-0.7.5.tar.bz2
+/tinyca2-0.7.6-20070611.tar.bz2
diff --git a/sources b/sources
new file mode 100644
index 0000000..97bb568
--- /dev/null
+++ b/sources
@@ -0,0 +1 @@
+2ac19da186c0d3a9f25166bd93383d82  tinyca2-0.7.6-20070611.tar.bz2
diff --git a/tinyca2-cleanup.patch b/tinyca2-cleanup.patch
new file mode 100644
index 0000000..cfeea3b
--- /dev/null
+++ b/tinyca2-cleanup.patch
@@ -0,0 +1,39 @@
+diff -up tinyca2-0.7.6-20070611/lib/GUI.pm.cleanup tinyca2-0.7.6-20070611/lib/GUI.pm
+--- tinyca2-0.7.6-20070611/lib/GUI.pm.cleanup	2007-03-22 09:52:22.000000000 +0200
++++ tinyca2-0.7.6-20070611/lib/GUI.pm	2011-03-18 10:05:56.000000000 +0200
+@@ -1263,7 +1263,7 @@ sub show_req_dialog {
+    # table for request data
+    my $cc=0;
+    my $ous = 1;
+-   if(defined($opts->{'OU'})) {
++   if(defined($opts->{'OU'}) and defined @{$opts->{'OU'}}) {
+       $ous = @{$opts->{'OU'}} - 1;
+    }
+    $reqtable = Gtk2::Table->new(1, 13 + $ous, 0);
+@@ -1311,7 +1311,7 @@ sub show_req_dialog {
+          _("Organization Name (eg. company):"),
+          \$opts->{'O'}, $reqtable, 10, 1);
+ 
+-   if(defined($opts->{'OU'})) {
++   if(defined($opts->{'OU'}) and defined @{$opts->{'OU'}}) {
+       foreach my $ou (@{$opts->{'OU'}}) {
+          $entry = GUI::HELPERS::entry_to_table(
+                _("Organizational Unit Name (eg. section):"),
+@@ -2545,7 +2545,7 @@ sub about {
+       return;
+     }
+    
+-   $aboutdialog->set_name("TinyCA2");
++   $aboutdialog->set_program_name("TinyCA2");
+    $aboutdialog->set_version($main->{'version'});
+    $aboutdialog->set_copyright("2002-2006 Stephan Martin");
+    $aboutdialog->set_license("GNU Public License (GPL)");
+@@ -2558,6 +2558,8 @@ sub about {
+          _("French: Thibault Le Meur <Thibault.Lemeur\@supelec.fr>"));
+ 
+    $aboutdialog->show_all();
++   $aboutdialog->run;
++   $aboutdialog->destroy;
+ 
+    return;
+ }
diff --git a/tinyca2-defaults.patch b/tinyca2-defaults.patch
new file mode 100644
index 0000000..0ca2e99
--- /dev/null
+++ b/tinyca2-defaults.patch
@@ -0,0 +1,50 @@
+diff -up tinyca2-0.7.6-20070611/tinyca2.defaults tinyca2-0.7.6-20070611/tinyca2
+--- tinyca2-0.7.6-20070611/tinyca2.defaults	2007-03-22 09:52:22.000000000 +0200
++++ tinyca2-0.7.6-20070611/tinyca2	2011-03-18 09:57:09.000000000 +0200
+@@ -18,7 +18,7 @@
+ # along with this program; if not, write to the Free Software
+ # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
+ 
+-BEGIN { unshift(@INC, './lib'); # put here the location of the modules
++BEGIN { unshift(@INC, '/usr/share/tinyca2'); # put here the location of the modules
+ }
+ 
+ use strict;
+@@ -62,7 +62,7 @@ sub usage
+ print STDERR "To administer more than one CA, call \"tinyca2 --ManageCA\"\n\n";
+ 
+ setlocale(LC_MESSAGES, "");
+-bindtextdomain("tinyca2", "./locale/");
++bindtextdomain("tinyca2", "/usr/share/locale/");
+ textdomain("tinyca2");
+ 
+ # https://bugs.gentoo.org/show_bug.cgi?id=78576
+@@ -99,7 +99,7 @@ if(not -x $init->{'tarbin'}) {
+ }
+ 
+ # directory with the templates
+-$init->{'templatedir'} = "./templates";
++$init->{'templatedir'} = "/etc/tinyca2";
+ 
+ if(not -d $init->{'templatedir'}) {
+    print gettext("Can't find templatedir.\n");
+@@ -108,8 +108,17 @@ if(not -d $init->{'templatedir'}) {
+ }
+ 
+ # location for CA files
+-$init->{'basedir'}   = $ENV{HOME}."/.TinyCA";
+-$init->{'exportdir'} = $ENV{HOME};
++if( exists $ENV{'TINYCA_BASEDIR'}) {
++    $init->{'basedir'}   = $ENV{'TINYCA_BASEDIR'}
++} else {
++    $init->{'basedir'}   = $ENV{HOME}."/.TinyCA";
++}
++
++if( exists $ENV{'TINYCA_EXPORTDIR'}) {
++    $init->{'exportdir'} = $ENV{'TINYCA_EXPORTDIR'};
++} else {
++    $init->{'exportdir'} = $ENV{HOME};
++}
+ 
+ umask(0077);
+ 
diff --git a/tinyca2-deprecated.patch b/tinyca2-deprecated.patch
new file mode 100644
index 0000000..78e8280
--- /dev/null
+++ b/tinyca2-deprecated.patch
@@ -0,0 +1,66 @@
+diff -up tinyca2-0.7.6-20070611/lib/GUI.pm.deprecated tinyca2-0.7.6-20070611/lib/GUI.pm
+--- tinyca2-0.7.6-20070611/lib/GUI.pm.deprecated	2013-07-28 21:43:16.930982376 +0300
++++ tinyca2-0.7.6-20070611/lib/GUI.pm	2013-07-28 21:45:11.976840873 +0300
+@@ -992,7 +992,7 @@ sub create_detail_tree {
+    $piter = $store->append($root);
+    $store->set($piter, 0 => $t);
+ 
+-   for my $l qw(CN EMAIL O OU C ST L) {
++   for my $l (qw(CN EMAIL O OU C ST L)) {
+       if(defined($parsed->{$l})) {
+          if($l eq "OU") {
+             foreach my $ou (@{$parsed->{'OU'}}) {
+@@ -1017,7 +1017,7 @@ sub create_detail_tree {
+       $piter = $store->append($root);
+       $store->set($piter, 0 => $t);
+ 
+-      for my $l qw(CN EMAIL O OU C ST L) {
++      for my $l (qw(CN EMAIL O OU C ST L)) {
+          if(defined($parsed->{'ISSUERDN'}->{$l})) {
+             if($l eq "OU") {
+                foreach my $ou (@{$parsed->{'ISSUERDN'}->{'OU'}}) {
+@@ -1043,7 +1043,7 @@ sub create_detail_tree {
+       $piter = $store->append($root);
+       $store->set($piter, 0 => $t);
+ 
+-      for my $l qw(STATUS NOTBEFORE NOTAFTER) {
++      for my $l (qw(STATUS NOTBEFORE NOTAFTER)) {
+          if(defined($parsed->{$l})) {
+             $citer = $store->append($piter);
+             $store->set($citer, 
+@@ -1059,7 +1059,7 @@ sub create_detail_tree {
+    $store->set($piter, 0 => $t);
+ 
+ 
+-   for my $l qw(STATUS SERIAL KEYSIZE PK_ALGORITHM SIG_ALGORITHM TYPE) {
++   for my $l (qw(STATUS SERIAL KEYSIZE PK_ALGORITHM SIG_ALGORITHM TYPE)) {
+       if(defined($parsed->{$l})) {
+          $citer = $store->append($piter);
+          $store->set($citer, 
+@@ -1074,7 +1074,7 @@ sub create_detail_tree {
+       $piter = $store->append($root);
+       $store->set($piter, 0 => $t);
+ 
+-      for my $l qw(FINGERPRINTMD5 FINGERPRINTSHA1) {
++      for my $l (qw(FINGERPRINTMD5 FINGERPRINTSHA1)) {
+          if(defined($parsed->{$l})) {
+             $citer = $store->append($piter);
+             $store->set($citer, 
+@@ -1263,7 +1263,7 @@ sub show_req_dialog {
+    # table for request data
+    my $cc=0;
+    my $ous = 1;
+-   if(defined($opts->{'OU'}) and defined @{$opts->{'OU'}}) {
++   if(defined($opts->{'OU'}) and @{$opts->{'OU'}}) {
+       $ous = @{$opts->{'OU'}} - 1;
+    }
+    $reqtable = Gtk2::Table->new(1, 13 + $ous, 0);
+@@ -1311,7 +1311,7 @@ sub show_req_dialog {
+          _("Organization Name (eg. company):"),
+          \$opts->{'O'}, $reqtable, 10, 1);
+ 
+-   if(defined($opts->{'OU'}) and defined @{$opts->{'OU'}}) {
++   if(defined($opts->{'OU'}) and @{$opts->{'OU'}}) {
+       foreach my $ou (@{$opts->{'OU'}}) {
+          $entry = GUI::HELPERS::entry_to_table(
+                _("Organizational Unit Name (eg. section):"),
diff --git a/tinyca2-english.patch b/tinyca2-english.patch
new file mode 100644
index 0000000..4351899
--- /dev/null
+++ b/tinyca2-english.patch
@@ -0,0 +1,72 @@
+diff -up tinyca2-0.7.6-20070611/lib/GUI.pm.english tinyca2-0.7.6-20070611/lib/GUI.pm
+--- tinyca2-0.7.6-20070611/lib/GUI.pm.english	2011-03-18 10:10:50.000000000 +0200
++++ tinyca2-0.7.6-20070611/lib/GUI.pm	2011-03-18 10:13:26.000000000 +0200
+@@ -2660,7 +2660,7 @@ sub show_req_date_warning {
+ 
+    my ($box, $button_ok, $button_cancel, $t);
+ 
+-   $t = _("The Certificate will be longer valid than your CA!");
++   $t = _("The Certificate will be valid longer than its CA!");
+    $t .= "\n";
+    $t .= _("This may cause problems with some software!!");
+ 
+diff -up tinyca2-0.7.6-20070611/po/cs.po.english tinyca2-0.7.6-20070611/po/cs.po
+--- tinyca2-0.7.6-20070611/po/cs.po.english	2007-06-11 14:39:32.000000000 +0300
++++ tinyca2-0.7.6-20070611/po/cs.po	2011-03-18 10:15:00.000000000 +0200
+@@ -1266,7 +1266,7 @@ msgid "if the corresponding certificate 
+ msgstr "pokud odpovídající certifikát je stále platný"
+ 
+ #: ../lib/GUI.pm:2661
+-msgid "The Certificate will be longer valid than your CA!"
++msgid "The certificate will be valid longer than its CA!"
+ msgstr "Certifikát bude platný déle než Vaše CA!"
+ 
+ #: ../lib/GUI.pm:2663
+diff -up tinyca2-0.7.6-20070611/po/de.po.english tinyca2-0.7.6-20070611/po/de.po
+--- tinyca2-0.7.6-20070611/po/de.po.english	2007-06-11 14:39:31.000000000 +0300
++++ tinyca2-0.7.6-20070611/po/de.po	2011-03-18 10:15:00.000000000 +0200
+@@ -1254,7 +1254,7 @@ msgid "if the corresponding certificate 
+ msgstr "falls das Zertifikat noch gültig ist"
+ 
+ #: ../lib/GUI.pm:2661
+-msgid "The Certificate will be longer valid than your CA!"
++msgid "The certificate will be valid longer than its CA!"
+ msgstr "Das Zertifikat wird länger gültig sein als die CA!"
+ 
+ #: ../lib/GUI.pm:2663
+diff -up tinyca2-0.7.6-20070611/po/es.po.english tinyca2-0.7.6-20070611/po/es.po
+--- tinyca2-0.7.6-20070611/po/es.po.english	2007-06-11 14:39:32.000000000 +0300
++++ tinyca2-0.7.6-20070611/po/es.po	2011-03-18 10:15:00.000000000 +0200
+@@ -1269,7 +1269,7 @@ msgid "if the corresponding certificate 
+ msgstr "¡Si el Certificado correspondiente no ha caducado o ha sido revocado "
+ 
+ #: ../lib/GUI.pm:2661
+-msgid "The Certificate will be longer valid than your CA!"
++msgid "The certificate will be valid longer than its CA!"
+ msgstr "¡El Certificado tendrá mayor duración que la CA!"
+ 
+ #: ../lib/GUI.pm:2663
+diff -up tinyca2-0.7.6-20070611/po/fr.po.english tinyca2-0.7.6-20070611/po/fr.po
+--- tinyca2-0.7.6-20070611/po/fr.po.english	2007-06-11 14:39:32.000000000 +0300
++++ tinyca2-0.7.6-20070611/po/fr.po	2011-03-18 10:15:00.000000000 +0200
+@@ -1266,7 +1266,7 @@ msgid "if the corresponding certificate 
+ msgstr "Si le Certificat correspondant est tjours valide"
+ 
+ #: ../lib/GUI.pm:2661
+-msgid "The Certificate will be longer valid than your CA!"
++msgid "The certificate will be valid longer than its CA!"
+ msgstr ""
+ "La date de validité du Certificat dépasse la date de validité de la CA!"
+ 
+diff -up tinyca2-0.7.6-20070611/po/sv.po.english tinyca2-0.7.6-20070611/po/sv.po
+--- tinyca2-0.7.6-20070611/po/sv.po.english	2007-06-11 14:39:32.000000000 +0300
++++ tinyca2-0.7.6-20070611/po/sv.po	2011-03-18 10:15:00.000000000 +0200
+@@ -1253,7 +1253,7 @@ msgid "if the corresponding certificate 
+ msgstr "om det korresponderande certifikatet är giltigt fortfarande"
+ 
+ #: ../lib/GUI.pm:2661
+-msgid "The Certificate will be longer valid than your CA!"
++msgid "The certificate will be valid longer than its CA!"
+ msgstr "Certifikatet kommer vara giltigt längre än ditt CA!"
+ 
+ #: ../lib/GUI.pm:2663
diff --git a/tinyca2-exportformat.patch b/tinyca2-exportformat.patch
new file mode 100644
index 0000000..415d66c
--- /dev/null
+++ b/tinyca2-exportformat.patch
@@ -0,0 +1,79 @@
+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";
+       }
diff --git a/tinyca2-install-langs.patch b/tinyca2-install-langs.patch
new file mode 100644
index 0000000..cc30abd
--- /dev/null
+++ b/tinyca2-install-langs.patch
@@ -0,0 +1,19 @@
+diff -up tinyca2-0.7.6-20070611/install.sh.install-langs tinyca2-0.7.6-20070611/install.sh
+--- tinyca2-0.7.6-20070611/install.sh.install-langs	2005-03-31 21:52:57.000000000 +0300
++++ tinyca2-0.7.6-20070611/install.sh	2011-03-18 11:00:06.000000000 +0200
+@@ -1,9 +1,15 @@
+ #!/bin/bash
+ 
++rm -rf locale
++
+ mkdir -p locale/de/LC_MESSAGES
+ mkdir -p locale/es/LC_MESSAGES
+ mkdir -p locale/cs/LC_MESSAGES
++mkdir -p locale/fr/LC_MESSAGES
++mkdir -p locale/sv/LC_MESSAGES
+ 
+ msgfmt po/de.po -o locale/de/LC_MESSAGES/tinyca2.mo
+ msgfmt po/es.po -o locale/es/LC_MESSAGES/tinyca2.mo
+ msgfmt po/cs.po -o locale/cs/LC_MESSAGES/tinyca2.mo
++msgfmt po/fr.po -o locale/fr/LC_MESSAGES/tinyca2.mo
++msgfmt po/sv.po -o locale/sv/LC_MESSAGES/tinyca2.mo
diff --git a/tinyca2-sv.patch b/tinyca2-sv.patch
new file mode 100644
index 0000000..5f389c7
--- /dev/null
+++ b/tinyca2-sv.patch
@@ -0,0 +1,47 @@
+diff -up tinyca2-0.7.6-20070611/po/sv.po.swedish tinyca2-0.7.6-20070611/po/sv.po
+--- tinyca2-0.7.6-20070611/po/sv.po.swedish	2011-03-18 10:15:00.000000000 +0200
++++ tinyca2-0.7.6-20070611/po/sv.po	2011-03-18 10:20:41.000000000 +0200
+@@ -1,19 +1,22 @@
+ # Swedish translation of tinyca.
+ # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+ # This file is distributed under the same license as the tinyca package.
+-# Daniel Nylander <po at danielnylander.se>, 2006.
+ #
++# Daniel Nylander <po at danielnylander.se>, 2006.
++# Marcus Better <marcus at better.se>, 2009.
+ msgid ""
+ msgstr ""
+ "Project-Id-Version: tinyca\n"
+ "Report-Msgid-Bugs-To: \n"
+ "POT-Creation-Date: 2007-06-11 14:39+0300\n"
+-"PO-Revision-Date: 2006-07-10 16:23+0100\n"
+-"Last-Translator: Daniel Nylander <po at danielnylander.se>\n"
++"PO-Revision-Date: 2009-10-19 12:02+0200\n"
++"Last-Translator: Marcus Better <marcus at better.se>\n"
+ "Language-Team: Swedish <tp-sv at listor.tp-sv.se>\n"
+ "MIME-Version: 1.0\n"
+ "Content-Type: text/plain; charset=utf-8\n"
+ "Content-Transfer-Encoding: 8bit\n"
++"X-Generator: Lokalize 1.0\n"
++"Plural-Forms: nplurals=2; plural=(n != 1);\n"
+ 
+ #: ../lib/CA.pm:44
+ msgid "error: can't open basedir: "
+@@ -224,7 +227,7 @@ msgid ""
+ "Can't open Index file:\n"
+ "%s"
+ msgstr ""
+-"Kan inte öppna Index-fil:\n"
++"Kan inte öppna indexfil:\n"
+ "%s"
+ 
+ #: ../lib/CA.pm:665 ../lib/CERT.pm:61
+@@ -579,7 +582,7 @@ msgstr "Typ"
+ 
+ #: ../lib/GUI.pm:267
+ msgid "Keys"
+-msgstr "Tangenter"
++msgstr "Nycklar"
+ 
+ #: ../lib/GUI.pm:308
+ msgid "Requests"
diff --git a/tinyca2-use_io_select.patch b/tinyca2-use_io_select.patch
new file mode 100644
index 0000000..39ca29f
--- /dev/null
+++ b/tinyca2-use_io_select.patch
@@ -0,0 +1,144 @@
+diff -up tinyca2-0.7.6-20070611/lib/OpenSSL.pm.use_io_select tinyca2-0.7.6-20070611/lib/OpenSSL.pm
+--- tinyca2-0.7.6-20070611/lib/OpenSSL.pm.use_io_select	2006-07-14 01:36:13.000000000 +0300
++++ tinyca2-0.7.6-20070611/lib/OpenSSL.pm	2013-07-28 23:03:14.241449534 +0300
+@@ -22,6 +22,7 @@ package OpenSSL;
+ 
+ use POSIX;
+ use IPC::Open3;
++use IO::Select;
+ use Time::Local;
+ 
+ sub new {
+@@ -41,7 +42,7 @@ sub new {
+    close(TEST);
+ 
+    # set version (format: e.g. 0.9.7 or 0.9.7a)
+-   if($v =~ /\b(0\.9\.[678][a-z]?)\b/) {
++   if($v =~ /\b(0\.9\.[6-9][a-z]?)\b/ || $v =~ /\b(1\.0\.[01][a-z]?)\b/) {
+       $self->{'version'} = $1;
+    }
+ 
+@@ -817,7 +818,7 @@ sub convdata {
+    my $self = shift;
+    my $opts = { @_ };
+    
+-   my ($tmp, $ext, $ret, $file, $pid, $cmd);
++   my ($tmp, $ext, $ret, $file, $pid, $cmd, $cmdout, $cmderr);
+    $file = HELPERS::mktmp($self->{'tmp'}."/data");
+ 
+    $cmd = "$self->{'bin'} $opts->{'cmd'}";
+@@ -830,16 +831,7 @@ sub convdata {
+       $cmd .= " -outform $opts->{'outform'}";
+    }
+ 
+-   my($rdfh, $wtfh);
+-   $ext = "$cmd\n\n";
+-   $pid = open3($wtfh, $rdfh, $rdfh, $cmd);
+-   print $wtfh "$opts->{'data'}\n";
+-   while(<$rdfh>){
+-      $ext .= $_;
+-      # print STDERR "DEBUG: cmd ret: $_";
+-   };
+-   waitpid($pid, 0);
+-   $ret = $?>>8;
++   ($ret, $tmp, $ext) = _run_with_fixed_input($cmd, $opts->{'data'});
+ 
+    if($self->{'broken'}) {
+        if(($ret != 0 && $opts->{'cmd'} ne 'crl') ||
+@@ -859,14 +851,15 @@ sub convdata {
+       }
+    }
+ 
+-   open(IN, $file) || do {
+-      my $t = sprintf(_("Can't open file %s: %s"), $file, $!);
+-      GUI::HELPERS::print_warning($t);
+-      return;
+-   };
+-   $tmp .= $_ while(<IN>);
+-   close(IN);
+-
++   if (-s $file) { # If the file is empty, the payload is in $tmp (via STDOUT of the called process).
++      open(IN, $file) || do {
++	 my $t = sprintf(_("Can't open file %s: %s"), $file, $!);
++	 GUI::HELPERS::print_warning($t);
++         return;
++      };
++      $tmp .= $_ while(<IN>);
++      close(IN);
++   }
+    unlink($file);
+ 
+    return($ret, $tmp, $ext);
+@@ -1076,4 +1069,72 @@ sub _get_index {
+    }
+ }
+    
++
++=over
++
++=item _run_with_fixed_input($cmd, $input)
++
++This function runs C<$cmd> and writes the C<$input> to STDIN of the
++new process (all at once).
++
++While the command runs, all of its output to STDOUT and STDERR is
++collected.
++
++After the command terminates (closes both STDOUT and STDIN) the
++function returns the command's return value as well as everything it
++wrote to its STDOUT and STDERR in a list.
++
++=back
++
++=cut
++
++sub _run_with_fixed_input {
++   my $cmd = shift;
++   my $input = shift;
++
++   my ($wtfh, $rdfh, $erfh, $pid, $sel, $ret, $stdout, $stderr);
++   $erfh = Symbol::gensym; # Must not be false, otherwise it is lumped together with rdfh
++
++   # Run the command
++   $pid = open3($wtfh, $rdfh, $erfh, $cmd);
++   print $wtfh $input, "\n";
++
++   $stdout = '';
++   $stderr = '';
++   $sel = new IO::Select($rdfh, $erfh);
++   while (my @fhs = $sel->can_read()) {
++      foreach my $fh (@fhs) {
++         if ($fh == $rdfh) { # STDOUT
++            my $bytes_read = sysread($fh, my $buf='', 1024);
++            if ($bytes_read == -1) {
++               warn("Error reading from child's STDOUT: $!\n");
++               $sel->remove($fh);
++            } elsif ($bytes_read == 0) {
++               # print("Child's STDOUT closed.\n");
++               $sel->remove($fh);
++            } else {
++               $stdout .= $buf;
++            }
++         }
++         elsif ($fh == $erfh) { # STDERR
++            my $bytes_read = sysread($fh, my $buf='', 1024);
++            if ($bytes_read == -1) {
++               warn("Error reading from child's STDERR: $!\n");
++               $sel->remove($fh);
++            } elsif ($bytes_read == 0) {
++               # print("Child's STDERR closed.\n");
++               $sel->remove($fh);
++            } else {
++               $stderr .= $buf;
++            }
++         }
++      }
++   }
++
++   waitpid($pid, 0);
++   $ret = $?>>8;
++
++   return ($ret, $stdout, $stderr)
++}
++
+ 1


More information about the scm-commits mailing list