84f379c09c768e103cbc7a61c20353dbba672be5
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 Lizenzinfos in eigenes Modu...

Bernd Wurst authored 10 years ago

5) Written 2008-2014 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 Serienn...

Bernd Wurst authored 8 years ago

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

bernd authored 15 years ago

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

Bernd Wurst authored 8 years ago

35)   unset($_SESSION['clientcert_serial']);
bernd Login via Client-Zertifikat...

bernd authored 15 years ago

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

bernd authored 12 years ago

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

Bernd Wurst authored 12 years ago

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

bernd authored 12 years ago

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

Bernd Wurst authored 12 years ago

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

bernd authored 12 years ago

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

Bernd Wurst authored 12 years ago

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

Bernd Wurst authored 12 years ago

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

bernd authored 12 years ago

50)     $username = $_SESSION['mailaccount'];
51)   }
52)   if (! ($cert['username'] == $username))
bernd Login via Client-Zertifikat...

bernd authored 15 years ago

53)     system_failure('Das Zertifikat ist nicht für Ihren Zugang eingerichtet');
54)   $sure = user_is_sure();
55)   if ($sure === NULL)
56)   {
Bernd Wurst Speichere und zeige Serienn...

Bernd Wurst authored 8 years ago

57)     are_you_sure("action=delete&id={$cert['id']}", "Möchten Sie das Zertifikat »{$cert['dn']}« (Seriennummer {$cert['serial']}) wirklich löschen?");