cf54502a10b16c985ea28db17885d377226b6145
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) 
11) You should have received a copy of the CC0 Public Domain Dedication along with this software. If not, see 
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) 
23) if ($_GET['action'] == 'new')
24) {
25)   check_form_token('clientcert_add');
26)   if (! isset($_SESSION['clientcert_cert']))
27)     system_failure('Kein Zertifikat');
28)   
Bernd Wurst Speichere und zeige Start-...

Bernd Wurst authored 8 years ago

29)   add_clientcert($_SESSION['clientcert_cert'], $_SESSION['clientcert_dn'], $_SESSION['clientcert_issuer'], 
30)                  $_SESSION['clientcert_serial'], $_SESSION['clientcert_valid_from'], $_SESSION['clientcert_valid_until']);
bernd Login via Client-Zertifikat...

bernd authored 15 years ago

31) 
32)   // Räume session auf
33)   unset($_SESSION['clientcert_cert']);
34)   unset($_SESSION['clientcert_dn']);
35)   unset($_SESSION['clientcert_issuer']);
Bernd Wurst Speichere und zeige Serienn...

Bernd Wurst authored 8 years ago

36)   unset($_SESSION['clientcert_serial']);
Bernd Wurst Speichere und zeige Start-...

Bernd Wurst authored 8 years ago

37)   unset($_SESSION['clientcert_valid_from']);
38)   unset($_SESSION['clientcert_valid_until']);
bernd Login via Client-Zertifikat...

bernd authored 15 years ago

39)   header('Location: cert');
40) }
41) elseif ($_GET['action'] == 'delete')
42) {
43)   $cert = get_cert_by_id($_GET['id']);
44)   if (! $cert)
45)     system_failure('no ID');
bernd Ermögliche Client-Cert-Logi...

bernd authored 12 years ago

46)   $username = NULL;
Bernd Wurst bugfix: (once again) most u...

Bernd Wurst authored 12 years ago

47)   if ($_SESSION['role'] & ROLE_SYSTEMUSER) {
bernd Ermögliche Client-Cert-Logi...

bernd authored 12 years ago

48)     $username = $_SESSION['userinfo']['username'];
Bernd Wurst bugfix: missing brackets

Bernd Wurst authored 12 years ago

49)     if (isset($_SESSION['subuser'])) {
bernd Ermögliche Client-Cert-Logi...

bernd authored 12 years ago

50)       $username = $_SESSION['subuser'];
Bernd Wurst bugfix: missing brackets

Bernd Wurst authored 12 years ago

51)     }
Bernd Wurst bugfix: (once again) most u...

Bernd Wurst authored 12 years ago

52)   } elseif ($_SESSION['role'] & ROLE_VMAIL_ACCOUNT) {
bernd Ermögliche Client-Cert-Logi...

bernd authored 12 years ago

53)     $username = $_SESSION['mailaccount'];
54)   }
55)   if (! ($cert['username'] == $username))
bernd Login via Client-Zertifikat...

bernd authored 15 years ago

56)     system_failure('Das Zertifikat ist nicht für Ihren Zugang eingerichtet');
57)   $sure = user_is_sure();
58)   if ($sure === NULL)
59)   {
Bernd Wurst Speichere und zeige Start-...

Bernd Wurst authored 8 years ago

60)     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?");