1 |
diff -Nur -x '*.orig' -x '*.rej' phpki/phpki-0.82/include/openssl_functions.php mezzanine_patched_phpki/phpki-0.82/include/openssl_functions.php |
2 |
--- phpki/phpki-0.82/include/openssl_functions.php 2008-12-08 03:44:27.000000000 +0100 |
3 |
+++ mezzanine_patched_phpki/phpki-0.82/include/openssl_functions.php 2008-12-08 03:44:07.000000000 +0100 |
4 |
@@ -324,15 +324,43 @@ |
5 |
if (time() > strtotime("$mm/$dd/$yy")) |
6 |
$db['status'] = "Expired"; |
7 |
|
8 |
- $db['serial'] = $a[3]; |
9 |
- $db['country'] = $b[1]; |
10 |
- $db['province'] = $b[2]; |
11 |
- $db['locality'] = $b[3]; |
12 |
- $db['organization'] = $b[4]; |
13 |
- $db['issuer'] = $b[5]; |
14 |
- $db['unit'] = $b[6]; |
15 |
- $db['common_name'] = $b[7]; |
16 |
- $db['email'] = $b[8]; |
17 |
+ |
18 |
+ // Compatibility with migrated certs from openvpn-bridge |
19 |
+ if(count($b) == 7){ |
20 |
+ $db['serial'] = $a[3]; |
21 |
+ $db['country'] = $b[1]; |
22 |
+ $db['province'] = $b[2]; |
23 |
+ $db['locality'] = ''; |
24 |
+ $db['organization'] = $b[3]; |
25 |
+ $db['issuer'] = ''; |
26 |
+ $db['unit'] = $b[4]; |
27 |
+ $db['common_name'] = $b[5]; |
28 |
+ $db['email'] = $b[6]; |
29 |
+ } |
30 |
+ // Compatibility with renewed certs from openvpn-bridge |
31 |
+ elseif(count($b) == 8){ |
32 |
+ $db['serial'] = $a[3]; |
33 |
+ $db['country'] = $b[1]; |
34 |
+ $db['province'] = $b[2]; |
35 |
+ $db['locality'] = $b[3]; |
36 |
+ $db['organization'] = $b[4]; |
37 |
+ $db['issuer'] = ''; |
38 |
+ $db['unit'] = $b[5]; |
39 |
+ $db['common_name'] = $b[6]; |
40 |
+ $db['email'] = $b[7]; |
41 |
+ } |
42 |
+ // Else, it's a certificate created with phpki |
43 |
+ else{ |
44 |
+ $db['serial'] = $a[3]; |
45 |
+ $db['country'] = $b[1]; |
46 |
+ $db['province'] = $b[2]; |
47 |
+ $db['locality'] = $b[3]; |
48 |
+ $db['organization'] = $b[4]; |
49 |
+ $db['issuer'] = $b[5]; |
50 |
+ $db['unit'] = $b[6]; |
51 |
+ $db['common_name'] = $b[7]; |
52 |
+ $db['email'] = $b[8]; |
53 |
+ } |
54 |
|
55 |
return $db; |
56 |
} |