d9f74479a25fe7470a8419e03c1c06dde2bde7fc
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 Fix codingstyle

Hanno authored 5 years ago

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

bernd authored 15 years ago

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

Hanno authored 6 years ago

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

Bernd Wurst authored 12 years ago

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

Hanno authored 6 years ago

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

Bernd Wurst authored 5 years ago

65)         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

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