Richard Levitte via RT wrote:
> 
> Please test the latest snapshot and check if the solution
> implemented there works for you.
> 
> [[EMAIL PROTECTED] - Tue Aug 27 14:12:50 2002]:
> 

Sorry for my late answer.

I have tested snapshot
  ftp://ftp.openssl.org/snapshot/openssl-SNAP-20021009.tar.gz

I founded changes like this
  my $fname = $_[0];
  my ($hash, $fprint) = `$openssl x509 -hash -fingerprint -noout -in "$fname"`;

This solution fails for example on file name like this
   bad".pem

[lojza@l3tmp]$ c_rehash .
Doing .
sh: -c: line 1: unexpected EOF while looking for matching `"'
sh: -c: line 2: syntax error: unexpected end of file
bad".pem => .0

I thing, that better strategy is use single quotas (') and escape
char ' in file name. (my pervious solution was wrong, sorry)

  replace every ' by '\''

  my $fname = $_[0];
  $fname =~ s/'/'\\''/g;
  my ($hash, $fprint) = `$openssl x509 -hash -fingerprint -noout -in '$fname'`;

  bad".pem  is now  'bad".pem'
  bad'.pem  is now  'bad'\''.pem'

Another solution should be not use quotas and escape all characters in
$fname by \

  my $fname = $_[0];
  $fname =~ s/(.)/\\$1/g;
  my ($hash, $fprint) = `$openssl x509 -hash -fingerprint -noout -in $fname`;

  bad".pem  is now  \b\a\d\"\.\p\e\m
  bad'.pem  is now  \b\a\d\'\.\p\e\m

Thanks JFCh for an advice.

Alois Vitasek

______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to