View | Details | Raw Unified | Return to bug 186025
Collapse All | Expand All

(-)b/security/tinyca/Makefile (-1 / +1 lines)
Lines 3-9 Link Here
3
3
4
PORTNAME=	tinyca
4
PORTNAME=	tinyca
5
PORTVERSION=	0.7.5
5
PORTVERSION=	0.7.5
6
PORTREVISION=	5
6
PORTREVISION=	6
7
CATEGORIES=	security net
7
CATEGORIES=	security net
8
MASTER_SITES=	http://tinyca.sm-zone.net/ \
8
MASTER_SITES=	http://tinyca.sm-zone.net/ \
9
		http://tinyca.sm-zone.net/old/
9
		http://tinyca.sm-zone.net/old/
(-)b/security/tinyca/files/patch-lib::GUI.pm (+92 lines)
Added Link Here
1
--- lib/GUI.pm.orig
2
+++ lib/GUI.pm
3
@@ -978,7 +978,7 @@
4
    $piter = $store->append($root);
5
    $store->set($piter, 0 => $t);
6
 
7
-   for my $l qw(CN EMAIL O OU C ST L) {
8
+   for my $l (qw(CN EMAIL O OU C ST L)) {
9
       if(defined($parsed->{$l})) {
10
          if($l eq "OU") {
11
             foreach my $ou (@{$parsed->{'OU'}}) {
12
@@ -1003,7 +1003,7 @@
13
       $piter = $store->append($root);
14
       $store->set($piter, 0 => $t);
15
    
16
-      for my $l qw(CN EMAIL O OU C ST L) {
17
+      for my $l (qw(CN EMAIL O OU C ST L)) {
18
          if(defined($parsed->{'ISSUERDN'}->{$l})) {
19
             if($l eq "OU") {
20
                foreach my $ou (@{$parsed->{'ISSUERDN'}->{'OU'}}) {
21
@@ -1029,7 +1029,7 @@
22
       $piter = $store->append($root);
23
       $store->set($piter, 0 => $t);
24
    
25
-      for my $l qw(STATUS NOTBEFORE NOTAFTER) {
26
+      for my $l (qw(STATUS NOTBEFORE NOTAFTER)) {
27
          if(defined($parsed->{$l})) {
28
             $citer = $store->append($piter);
29
             $store->set($citer, 
30
@@ -1045,7 +1045,7 @@
31
    $store->set($piter, 0 => $t);
32
 
33
 
34
-   for my $l qw(STATUS SERIAL KEYSIZE PK_ALGORITHM SIG_ALGORITHM TYPE) {
35
+   for my $l (qw(STATUS SERIAL KEYSIZE PK_ALGORITHM SIG_ALGORITHM TYPE)) {
36
       if(defined($parsed->{$l})) {
37
          $citer = $store->append($piter);
38
          $store->set($citer, 
39
@@ -1060,7 +1060,7 @@
40
       $piter = $store->append($root);
41
       $store->set($piter, 0 => $t);
42
    
43
-      for my $l qw(FINGERPRINTMD5 FINGERPRINTSHA1) {
44
+      for my $l (qw(FINGERPRINTMD5 FINGERPRINTSHA1)) {
45
          if(defined($parsed->{$l})) {
46
             $citer = $store->append($piter);
47
             $store->set($citer, 
48
@@ -1249,7 +1249,7 @@
49
    # table for request data
50
    my $cc=0;
51
    my $ous = 1;
52
-   if(defined($opts->{'OU'})) {
53
+   if(defined($opts->{'OU'}) and defined @{$opts->{'OU'}}) {
54
       $ous = @{$opts->{'OU'}} - 1;
55
    }
56
    $reqtable = Gtk2::Table->new(1, 13 + $ous, 0);
57
@@ -1297,7 +1297,7 @@
58
          _("Organization Name (eg. company):"),
59
          \$opts->{'O'}, $reqtable, 10, 1);
60
 
61
-   if(defined($opts->{'OU'})) {
62
+   if(defined($opts->{'OU'}) and defined @{$opts->{'OU'}}) {
63
       foreach my $ou (@{$opts->{'OU'}}) {
64
          $entry = GUI::HELPERS::entry_to_table(
65
                _("Organizational Unit Name (eg. section):"),
66
@@ -2521,7 +2521,7 @@
67
    my ($aboutdialog, $href, $label);
68
 
69
    $aboutdialog = Gtk2::AboutDialog->new();
70
-   $aboutdialog->set_name("TinyCA2");
71
+   $aboutdialog->set_program_name("TinyCA2");
72
    $aboutdialog->set_version($main->{'version'});
73
    $aboutdialog->set_copyright("2002-2006 Stephan Martin");
74
    $aboutdialog->set_license("GNU Public License (GPL)");
75
@@ -2534,6 +2534,8 @@
76
          _("French: Thibault Le Meur <Thibault.Lemeur\@supelec.fr>"));
77
 
78
    $aboutdialog->show_all();
79
+   $aboutdialog->run;
80
+   $aboutdialog->destroy;
81
 
82
    return;
83
 }
84
@@ -2634,7 +2636,7 @@
85
 
86
    my ($box, $button_ok, $button_cancel, $t);
87
 
88
-   $t = _("The Certificate will be longer valid than your CA!");
89
+   $t = _("The certificate will be valid longer than its CA!");
90
    $t .= "\n";
91
    $t .= _("This may cause problems with some software!!");
92
 
(-)b/security/tinyca/files/patch-lib::OpenSSL.pm (+143 lines)
Added Link Here
1
--- lib/OpenSSL.pm.orig
2
+++ lib/OpenSSL.pm
3
@@ -22,6 +22,7 @@
4
 
5
 use POSIX;
6
 use IPC::Open3;
7
+use IO::Select;
8
 use Time::Local;
9
 
10
 sub new {
11
@@ -41,7 +42,7 @@
12
    close(TEST);
13
 
14
    # set version (format: e.g. 0.9.7 or 0.9.7a)
15
-   if($v =~ /\b(0\.9\.[678][a-z]?)\b/) {
16
+   if($v =~ /\b(0\.9\.[6-9][a-z]?)\b/ || $v =~ /\b(1\.0\.[01][a-z]?)\b/) {
17
       $self->{'version'} = $1;
18
    }
19
 
20
@@ -817,7 +818,7 @@
21
    my $self = shift;
22
    my $opts = { @_ };
23
    
24
-   my ($tmp, $ext, $ret, $file, $pid, $cmd);
25
+   my ($tmp, $ext, $ret, $file, $pid, $cmd, $cmdout, $cmderr);
26
    $file = HELPERS::mktmp($self->{'tmp'}."/data");
27
 
28
    $cmd = "$self->{'bin'} $opts->{'cmd'}";
29
@@ -830,16 +831,7 @@
30
       $cmd .= " -outform $opts->{'outform'}";
31
    }
32
 
33
-   my($rdfh, $wtfh);
34
-   $ext = "$cmd\n\n";
35
-   $pid = open3($wtfh, $rdfh, $rdfh, $cmd);
36
-   print $wtfh "$opts->{'data'}\n";
37
-   while(<$rdfh>){
38
-      $ext .= $_;
39
-      # print STDERR "DEBUG: cmd ret: $_";
40
-   };
41
-   waitpid($pid, 0);
42
-   $ret = $?>>8;
43
+   ($ret, $tmp, $ext) = _run_with_fixed_input($cmd, $opts->{'data'});
44
 
45
    if($self->{'broken'}) {
46
        if(($ret != 0 && $opts->{'cmd'} ne 'crl') ||
47
@@ -859,14 +851,15 @@
48
       }
49
    }
50
 
51
-   open(IN, $file) || do {
52
-      my $t = sprintf(_("Can't open file %s: %s"), $file, $!);
53
-      GUI::HELPERS::print_warning($t);
54
-      return;
55
-   };
56
-   $tmp .= $_ while(<IN>);
57
-   close(IN);
58
-
59
+   if (-s $file) { # If the file is empty, the payload is in $tmp (via STDOUT of the called process).
60
+      open(IN, $file) || do {
61
+         my $t = sprintf(_("Can't open file %s: %s"), $file, $!);
62
+         GUI::HELPERS::print_warning($t);
63
+         return;
64
+      };
65
+      $tmp .= $_ while(<IN>);
66
+      close(IN);
67
+   }
68
    unlink($file);
69
 
70
    return($ret, $tmp, $ext);
71
@@ -1076,4 +1069,72 @@
72
    }
73
 }
74
    
75
+
76
+=over
77
+
78
+=item _run_with_fixed_input($cmd, $input)
79
+
80
+This function runs C<$cmd> and writes the C<$input> to STDIN of the
81
+new process (all at once).
82
+
83
+While the command runs, all of its output to STDOUT and STDERR is
84
+collected.
85
+
86
+After the command terminates (closes both STDOUT and STDIN) the
87
+function returns the command's return value as well as everything it
88
+wrote to its STDOUT and STDERR in a list.
89
+
90
+=back
91
+
92
+=cut
93
+
94
+sub _run_with_fixed_input {
95
+   my $cmd = shift;
96
+   my $input = shift;
97
+
98
+   my ($wtfh, $rdfh, $erfh, $pid, $sel, $ret, $stdout, $stderr);
99
+   $erfh = Symbol::gensym; # Must not be false, otherwise it is lumped together with rdfh
100
+
101
+   # Run the command
102
+   $pid = open3($wtfh, $rdfh, $erfh, $cmd);
103
+   print $wtfh $input, "\n";
104
+
105
+   $stdout = '';
106
+   $stderr = '';
107
+   $sel = new IO::Select($rdfh, $erfh);
108
+   while (my @fhs = $sel->can_read()) {
109
+      foreach my $fh (@fhs) {
110
+         if ($fh == $rdfh) { # STDOUT
111
+            my $bytes_read = sysread($fh, my $buf='', 1024);
112
+            if ($bytes_read == -1) {
113
+               warn("Error reading from child's STDOUT: $!\n");
114
+               $sel->remove($fh);
115
+             } elsif ($bytes_read == 0) {
116
+               # print("Child's STDOUT closed.\n");
117
+               $sel->remove($fh);
118
+             } else {
119
+               $stdout .= $buf;
120
+             }
121
+         }
122
+         elsif ($fh == $erfh) { # STDERR
123
+            my $bytes_read = sysread($fh, my $buf='', 1024);
124
+            if ($bytes_read == -1) {
125
+               warn("Error reading from child's STDERR: $!\n");
126
+               $sel->remove($fh);
127
+            } elsif ($bytes_read == 0) {
128
+               # print("Child's STDERR closed.\n");
129
+               $sel->remove($fh);
130
+            } else {
131
+              $stderr .= $buf;
132
+            }
133
+         }
134
+      }
135
+   }
136
+
137
+   waitpid($pid, 0);
138
+   $ret = $?>>8;
139
+
140
+   return ($ret, $stdout, $stderr)
141
+   }
142
+
143
 1

Return to bug 186025