Rich Salz | e0a6519 | 2016-04-19 22:10:43 -0400 | [diff] [blame] | 1 | #! /usr/bin/env perl |
| 2 | # Copyright 2004-2016 The OpenSSL Project Authors. All Rights Reserved. |
| 3 | # |
Richard Levitte | 402dd55 | 2018-12-06 14:08:43 +0100 | [diff] [blame] | 4 | # Licensed under the Apache License 2.0 (the "License"). You may not use |
Rich Salz | e0a6519 | 2016-04-19 22:10:43 -0400 | [diff] [blame] | 5 | # this file except in compliance with the License. You can obtain a copy |
| 6 | # in the file LICENSE in the source distribution or at |
| 7 | # https://www.openssl.org/source/license.html |
| 8 | |
Richard Levitte | 2faa930 | 2004-05-13 21:38:26 +0000 | [diff] [blame] | 9 | |
| 10 | use strict; |
| 11 | use warnings; |
| 12 | |
| 13 | my @directory_vars = ( "dir", "certs", "crl_dir", "new_certs_dir" ); |
| 14 | my @file_vars = ( "database", "certificate", "serial", "crlnumber", |
| 15 | "crl", "private_key", "RANDFILE" ); |
| 16 | while(<STDIN>) { |
Richard Levitte | 9ba96fb | 2016-02-11 21:47:30 +0100 | [diff] [blame] | 17 | s|\R$||; |
Richard Levitte | 2faa930 | 2004-05-13 21:38:26 +0000 | [diff] [blame] | 18 | foreach my $d (@directory_vars) { |
| 19 | if (/^(\s*\#?\s*${d}\s*=\s*)\.\/([^\s\#]*)([\s\#].*)$/) { |
| 20 | $_ = "$1sys\\\$disk:\[.$2$3"; |
| 21 | } elsif (/^(\s*\#?\s*${d}\s*=\s*)(\w[^\s\#]*)([\s\#].*)$/) { |
| 22 | $_ = "$1sys\\\$disk:\[.$2$3"; |
| 23 | } |
| 24 | s/^(\s*\#?\s*${d}\s*=\s*\$\w+)\/([^\s\#]*)([\s\#].*)$/$1.$2\]$3/; |
| 25 | while(/^(\s*\#?\s*${d}\s*=\s*(\$\w+\.|sys\\\$disk:\[\.)[\w\.]+)\/([^\]]*)\](.*)$/) { |
| 26 | $_ = "$1.$3]$4"; |
| 27 | } |
| 28 | } |
| 29 | foreach my $f (@file_vars) { |
| 30 | s/^(\s*\#?\s*${f}\s*=\s*)\.\/(.*)$/$1sys\\\$disk:\[\/$2/; |
| 31 | while(/^(\s*\#?\s*${f}\s*=\s*(\$\w+|sys\\\$disk:\[)[^\/]*)\/(\w+\/[^\s\#]*)([\s\#].*)$/) { |
| 32 | $_ = "$1.$3$4"; |
| 33 | } |
| 34 | if (/^(\s*\#?\s*${f}\s*=\s*(\$\w+|sys\\\$disk:\[)[^\/]*)\/(\w+)([\s\#].*)$/) { |
| 35 | $_ = "$1]$3.$4"; |
| 36 | } elsif (/^(\s*\#?\s*${f}\s*=\s*(\$\w+|sys\\\$disk:\[)[^\/]*)\/([^\s\#]*)([\s\#].*)$/) { |
| 37 | $_ = "$1]$3$4"; |
| 38 | } |
| 39 | } |
| 40 | print $_,"\n"; |
| 41 | } |