904b651c7dc557f880c8c8056ddb2f441b0b6eee
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 5 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 5 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 5 years ago

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

Hanno authored 5 years ago

29)     add_clientcert(
Hanno remove whitespace in empty...

Hanno authored 5 years ago

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

Hanno authored 5 years ago

31)       $_SESSION['clientcert_cert'],
Hanno remove whitespace in empty...

Hanno authored 5 years ago

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

Hanno authored 5 years ago

33)       $_SESSION['clientcert_dn'],
Hanno remove whitespace in empty...

Hanno authored 5 years ago

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

Hanno authored 5 years ago

35)       $_SESSION['clientcert_issuer'],
36)                  $_SESSION['clientcert_serial'],
Hanno remove whitespace in empty...

Hanno authored 5 years ago

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

Hanno authored 5 years ago

38)       $_SESSION['clientcert_valid_from'],
Hanno remove whitespace in empty...

Hanno authored 5 years ago

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

Hanno authored 5 years ago

40)       $_SESSION['clientcert_valid_until']
Hanno remove whitespace in empty...

Hanno authored 5 years ago

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

Hanno authored 5 years ago

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

bernd authored 15 years ago

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

Hanno authored 5 years ago

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

Bernd Wurst authored 11 years ago

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

Hanno authored 5 years ago

69)     $sure = user_is_sure();
70)     if ($sure === null) {
71)         are_you_sure("action=delete&id={$cert['id']}", "Möchten Sie das Zertifikat »{$cert['dn']}« (Seriennummer {$cert['serial']}, Gültig von {$cert['valid_from']} bis {$cert['valid_until']}) wirklich löschen?");
72)     } elseif ($sure === true) {
73)         delete_clientcert($cert['id']);
74)         if (! $debugmode) {
75)             header("Location: cert");
76)         }
77)     } elseif ($sure === false) {
78)         if (! $debugmode) {
79)             header("Location: cert");
80)         }
81)     }
82) } else {
83)     system_failure('Kein Kommando');