Browse code

Entferne Javascript-Konstrukt für den automatischen Certlogin, das kann man auch voll transparent über PHP machen.

Bernd Wurst authored on 13/02/2018 12:31:52
Showing 1 changed files
1 1
deleted file mode 100644
... ...
@@ -1,79 +0,0 @@
1
-<?php
2
-/*
3
-This file belongs to the Webinterface of schokokeks.org Hosting
4
-
5
-Written 2008-2018 by schokokeks.org Hosting, namely
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
-
17
-// Setze das Arbeitsverzeichnis auf das Stammverzeichnis, damit die Voraussetzungen gleich sind wie bei allen anderen Requests
18
-chdir('..');
19
-
20
-require_once('config.php');
21
-global $prefix;
22
-$prefix = '../';
23
-
24
-// Das Parent-Verzeichnis in den Include-Pfad, da wir uns jetzt in einem anderen Verzeichnis befinden.
25
-ini_set('include_path', ini_get('include_path').':../');
26
-
27
-require_once('session/start.php');
28
-require_once('inc/base.php');
29
-require_once('inc/debug.php');
30
-require_once('inc/error.php');
31
-require_once('inc/theme.php');
32
-
33
-
34
-function prepare_cert($cert)
35
-{
36
-	return str_replace(array('-----BEGIN CERTIFICATE-----', '-----END CERTIFICATE-----', ' ', "\n"), array(), $cert);
37
-}
38
-
39
-
40
-function get_logins_by_cert($cert) 
41
-{
42
-	$cert = prepare_cert($cert);
43
-	$result = db_query("SELECT type,username,startpage FROM system.clientcert WHERE cert=?", array($cert));
44
-	if ($result->rowCount() < 1)
45
-		return NULL;
46
-	else {
47
-		$ret = array();
48
-		while ($row = $result->fetch()) {
49
-			$ret[] = $row;
50
-		}
51
-		return $ret;
52
-	}
53
-}
54
-
55
-DEBUG('$_SERVER:');
56
-DEBUG($_SERVER);
57
-
58
-header('Content-type: text/plain');
59
-
60
-if (isset($_SERVER['REDIRECT_SSL_CLIENT_CERT']) && 
61
-    isset($_SERVER['REDIRECT_SSL_CLIENT_S_DN']) && $_SERVER['REDIRECT_SSL_CLIENT_S_DN'] != '' && 
62
-    isset($_SERVER['REDIRECT_SSL_CLIENT_I_DN']) && $_SERVER['REDIRECT_SSL_CLIENT_I_DN'] != '') {
63
-  $ret = get_logins_by_cert($_SERVER['REDIRECT_SSL_CLIENT_CERT']);
64
-  if ($ret === NULL) {
65
-    echo 'error';
66
-    die();
67
-  }
68
-  if (count($ret) == 1) {
69
-    $uid = $ret[0]['username'];
70
-    $role = find_role($uid, '', True);
71
-    setup_session($role, $uid);
72
-    setcookie('CLIENTCERT_AUTOLOGIN', '1', time()+3600*24*365, '/');
73
-    echo 'ok';
74
-    die();
75
-  }
76
-}
77
-echo 'error';
78
-die();
79
-?>
Browse code

Copyright year update

Bernd Wurst authored on 13/01/2018 06:07:05
Showing 1 changed files
... ...
@@ -2,7 +2,7 @@
2 2
 /*
3 3
 This file belongs to the Webinterface of schokokeks.org Hosting
4 4
 
5
-Written 2008-2014 by schokokeks.org Hosting, namely
5
+Written 2008-2018 by schokokeks.org Hosting, namely
6 6
   Bernd Wurst <bernd@schokokeks.org>
7 7
   Hanno Böck <hanno@schokokeks.org>
8 8
 
Browse code

Lizenzinfos in eigenes Modul ausgelagert und Copyright auf 2014 angepasst

Bernd Wurst authored on 08/02/2014 05:45:07
Showing 1 changed files
... ...
@@ -2,7 +2,7 @@
2 2
 /*
3 3
 This file belongs to the Webinterface of schokokeks.org Hosting
4 4
 
5
-Written 2008-2013 by schokokeks.org Hosting, namely
5
+Written 2008-2014 by schokokeks.org Hosting, namely
6 6
   Bernd Wurst <bernd@schokokeks.org>
7 7
   Hanno Böck <hanno@schokokeks.org>
8 8
 
Browse code

Weitere Prepared-Statements

Bernd Wurst authored on 04/02/2014 14:37:35
Showing 1 changed files
... ...
@@ -39,9 +39,8 @@ function prepare_cert($cert)
39 39
 
40 40
 function get_logins_by_cert($cert) 
41 41
 {
42
-	$cert = db_escape_string(prepare_cert($cert));
43
-	$query = "SELECT type,username,startpage FROM system.clientcert WHERE cert='{$cert}'";
44
-	$result = db_query($query);
42
+	$cert = prepare_cert($cert);
43
+	$result = db_query("SELECT type,username,startpage FROM system.clientcert WHERE cert=?", array($cert));
45 44
 	if ($result->rowCount() < 1)
46 45
 		return NULL;
47 46
 	else {
Browse code

Umstellung auf PDO-Datenbankverbindung

Bernd Wurst authored on 01/02/2014 18:38:23
Showing 1 changed files
... ...
@@ -39,14 +39,14 @@ function prepare_cert($cert)
39 39
 
40 40
 function get_logins_by_cert($cert) 
41 41
 {
42
-	$cert = mysql_real_escape_string(prepare_cert($cert));
42
+	$cert = db_escape_string(prepare_cert($cert));
43 43
 	$query = "SELECT type,username,startpage FROM system.clientcert WHERE cert='{$cert}'";
44 44
 	$result = db_query($query);
45
-	if (mysql_num_rows($result) < 1)
45
+	if ($result->rowCount() < 1)
46 46
 		return NULL;
47 47
 	else {
48 48
 		$ret = array();
49
-		while ($row = mysql_fetch_assoc($result)) {
49
+		while ($row = $result->fetch()) {
50 50
 			$ret[] = $row;
51 51
 		}
52 52
 		return $ret;
Browse code

Cookie-based autologin when previous login was via client cert validation issues

Bernd Wurst authored on 26/01/2013 14:49:03
Showing 1 changed files
... ...
@@ -70,6 +70,7 @@ if (isset($_SERVER['REDIRECT_SSL_CLIENT_CERT']) &&
70 70
     $uid = $ret[0]['username'];
71 71
     $role = find_role($uid, '', True);
72 72
     setup_session($role, $uid);
73
+    setcookie('CLIENTCERT_AUTOLOGIN', '1', time()+3600*24*365, '/');
73 74
     echo 'ok';
74 75
     die();
75 76
   }
Browse code

jQuery-based Certlogin, so entfällt ein Mausklick

Bernd Wurst authored on 23/01/2013 10:36:54
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,79 @@
1
+<?php
2
+/*
3
+This file belongs to the Webinterface of schokokeks.org Hosting
4
+
5
+Written 2008-2013 by schokokeks.org Hosting, namely
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
+
17
+// Setze das Arbeitsverzeichnis auf das Stammverzeichnis, damit die Voraussetzungen gleich sind wie bei allen anderen Requests
18
+chdir('..');
19
+
20
+require_once('config.php');
21
+global $prefix;
22
+$prefix = '../';
23
+
24
+// Das Parent-Verzeichnis in den Include-Pfad, da wir uns jetzt in einem anderen Verzeichnis befinden.
25
+ini_set('include_path', ini_get('include_path').':../');
26
+
27
+require_once('session/start.php');
28
+require_once('inc/base.php');
29
+require_once('inc/debug.php');
30
+require_once('inc/error.php');
31
+require_once('inc/theme.php');
32
+
33
+
34
+function prepare_cert($cert)
35
+{
36
+	return str_replace(array('-----BEGIN CERTIFICATE-----', '-----END CERTIFICATE-----', ' ', "\n"), array(), $cert);
37
+}
38
+
39
+
40
+function get_logins_by_cert($cert) 
41
+{
42
+	$cert = mysql_real_escape_string(prepare_cert($cert));
43
+	$query = "SELECT type,username,startpage FROM system.clientcert WHERE cert='{$cert}'";
44
+	$result = db_query($query);
45
+	if (mysql_num_rows($result) < 1)
46
+		return NULL;
47
+	else {
48
+		$ret = array();
49
+		while ($row = mysql_fetch_assoc($result)) {
50
+			$ret[] = $row;
51
+		}
52
+		return $ret;
53
+	}
54
+}
55
+
56
+DEBUG('$_SERVER:');
57
+DEBUG($_SERVER);
58
+
59
+header('Content-type: text/plain');
60
+
61
+if (isset($_SERVER['REDIRECT_SSL_CLIENT_CERT']) && 
62
+    isset($_SERVER['REDIRECT_SSL_CLIENT_S_DN']) && $_SERVER['REDIRECT_SSL_CLIENT_S_DN'] != '' && 
63
+    isset($_SERVER['REDIRECT_SSL_CLIENT_I_DN']) && $_SERVER['REDIRECT_SSL_CLIENT_I_DN'] != '') {
64
+  $ret = get_logins_by_cert($_SERVER['REDIRECT_SSL_CLIENT_CERT']);
65
+  if ($ret === NULL) {
66
+    echo 'error';
67
+    die();
68
+  }
69
+  if (count($ret) == 1) {
70
+    $uid = $ret[0]['username'];
71
+    $role = find_role($uid, '', True);
72
+    setup_session($role, $uid);
73
+    echo 'ok';
74
+    die();
75
+  }
76
+}
77
+echo 'error';
78
+die();
79
+?>