c42127d3cab5c78430e578a07038f54f8cdff459
bernd Login via Client-Zertifikat...

bernd authored 15 years ago

1) <?php
Bernd Wurst Added license tags for CC0,...

Bernd Wurst authored 12 years ago

2) /*
3) This file belongs to the Webinterface of schokokeks.org Hosting
4) 
Bernd Wurst Copyright year update

Bernd Wurst authored 6 years ago

5) Written 2008-2018 by schokokeks.org Hosting, namely
Bernd Wurst Added license tags for CC0,...

Bernd Wurst authored 12 years ago

6)   Bernd Wurst <bernd@schokokeks.org>
7)   Hanno Böck <hanno@schokokeks.org>
8) 
9) To the extent possible under law, the author(s) have dedicated all copyright and related and neighboring rights to this software to the public domain worldwide. This software is distributed without any warranty.
10) 
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

11) You should have received a copy of the CC0 Public Domain Dedication along with this software. If not, see
Bernd Wurst Added license tags for CC0,...

Bernd Wurst authored 12 years ago

12) http://creativecommons.org/publicdomain/zero/1.0/
13) 
14) Nevertheless, in case you use a significant part of this code, we ask (but not require, see the license) that you keep the authors' names in place and return your changes to the public. We would be especially happy if you tell us what you're going to do with this code.
15) */
16) 
bernd Login via Client-Zertifikat...

bernd authored 15 years ago

17) require_once('session/start.php');
18) require_once('x509.php');
19) 
bernd Ermögliche Client-Cert-Logi...

bernd authored 12 years ago

20) require_role(array(ROLE_SYSTEMUSER, ROLE_SUBUSER, ROLE_VMAIL_ACCOUNT));
bernd Login via Client-Zertifikat...

bernd authored 15 years ago

21) 
22) 
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

23) if ($_GET['action'] == 'new') {
24)     check_form_token('clientcert_add');
25)     if (! isset($_SESSION['clientcert_cert'])) {
26)         system_failure('Kein Zertifikat');
27)     }
Hanno remove whitespace in empty...

Hanno authored 6 years ago

28) 
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

29)     add_clientcert(
Hanno Update codingstyle accordin...

Hanno authored 5 years ago

30)         $_SESSION['clientcert_cert'],
31)         $_SESSION['clientcert_dn'],
32)         $_SESSION['clientcert_issuer'],
33)         $_SESSION['clientcert_serial'],
34)         $_SESSION['clientcert_valid_from'],
35)         $_SESSION['clientcert_valid_until']
Hanno remove whitespace in empty...

Hanno authored 6 years ago

36) 
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

37)   );
bernd Login via Client-Zertifikat...

bernd authored 15 years ago

38) 
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

39)     // Räume session auf
40)     unset($_SESSION['clientcert_cert']);
41)     unset($_SESSION['clientcert_dn']);
42)     unset($_SESSION['clientcert_issuer']);
43)     unset($_SESSION['clientcert_serial']);
44)     unset($_SESSION['clientcert_valid_from']);
45)     unset($_SESSION['clientcert_valid_until']);
46)     header('Location: cert');
47) } elseif ($_GET['action'] == 'delete') {
48)     $cert = get_cert_by_id($_GET['id']);
49)     if (! $cert) {
50)         system_failure('no ID');
51)     }
52)     $username = null;
53)     if ($_SESSION['role'] & ROLE_SYSTEMUSER) {
54)         $username = $_SESSION['userinfo']['username'];
55)         if (isset($_SESSION['subuser'])) {
56)             $username = $_SESSION['subuser'];
57)         }
58)     } elseif ($_SESSION['role'] & ROLE_VMAIL_ACCOUNT) {
59)         $username = $_SESSION['mailaccount'];
60)     }
61)     if (! ($cert['username'] == $username)) {
62)         system_failure('Das Zertifikat ist nicht für Ihren Zugang eingerichtet');
Bernd Wurst bugfix: missing brackets

Bernd Wurst authored 12 years ago

63)     }
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

64)     $sure = user_is_sure();
65)     if ($sure === null) {
Bernd Wurst Umstellung von filter_input...

Bernd Wurst authored 5 years ago

66)         are_you_sure("action=delete&id={$cert['id']}", filter_output_html("Möchten Sie das Zertifikat »{$cert['dn']}« (Seriennummer {$cert['serial']}, Gültig von {$cert['valid_from']} bis {$cert['valid_until']}) wirklich löschen?"));
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

67)     } elseif ($sure === true) {
68)         delete_clientcert($cert['id']);
69)         if (! $debugmode) {
70)             header("Location: cert");
71)         }
72)     } elseif ($sure === false) {
73)         if (! $debugmode) {
74)             header("Location: cert");
75)         }
76)     }
77) } else {
78)     system_failure('Kein Kommando');