5effc2bd7685822df276c1372dab480cff321941
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)   
29)   add_clientcert($_SESSION['clientcert_cert'], $_SESSION['clientcert_dn'], $_SESSION['clientcert_issuer']);
30) 
31)   // Räume session auf
32)   unset($_SESSION['clientcert_cert']);
33)   unset($_SESSION['clientcert_dn']);
34)   unset($_SESSION['clientcert_issuer']);
35)   header('Location: cert');
36) }
37) elseif ($_GET['action'] == 'delete')
38) {
39)   $cert = get_cert_by_id($_GET['id']);
40)   if (! $cert)
41)     system_failure('no ID');
bernd Ermögliche Client-Cert-Logi...

bernd authored 12 years ago

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

Bernd Wurst authored 12 years ago

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

bernd authored 12 years ago

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

Bernd Wurst authored 12 years ago

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

bernd authored 12 years ago

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

Bernd Wurst authored 12 years ago

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

Bernd Wurst authored 12 years ago

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

bernd authored 12 years ago

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

bernd authored 15 years ago

52)     system_failure('Das Zertifikat ist nicht für Ihren Zugang eingerichtet');
53)   $sure = user_is_sure();
54)   if ($sure === NULL)
55)   {
bernd * alle internen Links sinnv...

bernd authored 15 years ago

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