steffen: server/kolab/kolab/admin/service index.php,1.7,1.8

cvs at intevation.de cvs at intevation.de
Fri Apr 16 12:17:31 CEST 2004


Author: steffen

Update of /kolabrepository/server/kolab/kolab/admin/service
In directory doto:/tmp/cvs-serv22487/admin/service

Modified Files:
	index.php 
Log Message:
Started restructuring the webinterface. New classes:

KolabLdap: Class for accessing the ldap server, API not fully evolved yet
KolabAuth: Class for authenticating a user using the LDAP class
KolabForm: HTML form handling class. This is supposed to replace the many 
	long input forms in the webinterface. Currently it is only used in
	user/ and some error-handling is missing



Index: index.php
===================================================================
RCS file: /kolabrepository/server/kolab/kolab/admin/service/index.php,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- index.php	14 Jun 2003 13:51:39 -0000	1.7
+++ index.php	16 Apr 2004 10:17:28 -0000	1.8
@@ -5,13 +5,13 @@
  This program is Free Software under the GNU General Public License (>=v2).
  Read the file COPYING that comes with this packages for details.
 */
+require_once('../include/authenticate.php');
 
-	// checks if this file is openend by another file
-		include_once("head.php");
-		This("service/");
-		Head();
+// checks if this file is openend by another file
+include_once("head.php");
+This("service/");
+Head();
 ?>
-
 <div class="maintitle">Enable or Disable individual Services</div>
 <div class="contentsimple">
 <p>Using legacy services poses a security thread due to leakage of cleartext passwords, lack of authenticity and privacy.</p>
@@ -30,11 +30,11 @@
 debug("debug is on");
 $errors = array();
 
-// read environment/server variables and connect to LDAP server
-if (!($uid = $_SERVER['PHP_AUTH_USER']) ||
-    !($bind_dn = uid2dn($uid)) ||
-    !($group = uid2group($uid)))
-   array_push($errors, "Internal Error: could not get Authentication Information");
+// user authentication 
+$uid = $auth->uid();
+$bind_dn = $auth->dn();
+$group = $auth->group();
+$link = $ldap->connection;
 
 if (!$errors && $group != "admin")
    array_push($errors, "Error: You don't have the required Permissions");
@@ -43,16 +43,6 @@
 
 $myself = $_SERVER['PHP_SELF'];
 
-if (!empty($_SESSION['ldap_server'])) $ldap_server = $_SESSION['ldap_server'];
-   else $ldap_server = '127.0.0.1';
-
-if (!empty($_SESSION['ldap_port'])) $ldap_port = $_SESSION['ldap_port'];
-   else $ldap_port = 389;
-
-if (!$errors && (!($link = ldap_connect($ldap_server,$ldap_port)) ||
-    !ldap_bind($link, $bind_dn, $_SERVER["PHP_AUTH_PW"])))
-   array_push($errors, "Communication Error: could not query ldap://$ldap_server:$ldap_port ".ldap_error($link));
-
 $allowed = array('TRUE','FALSE'); // implement LDAP Boolean Syntax
 $attrs = array();
 if (!empty($HTTP_GET_VARS['pop3'])) {
@@ -179,27 +169,13 @@
 if (isset($HTTP_GET_VARS['change'])) $change = trim(urldecode($HTTP_GET_VARS['change']));
 if (isset($HTTP_GET_VARS['hostname'])) $hostname = trim(urldecode($HTTP_GET_VARS['hostname']));
 if (isset($HTTP_GET_VARS['mydomain'])) $mydomain = trim(urldecode($HTTP_GET_VARS['mydomain']));
-if (!($uid = $_SERVER["PHP_AUTH_USER"]) || 
-    !($password=$_SERVER['PHP_AUTH_PW']) ||
-    !($bind_dn = uid2dn($uid)) ||
-    !($group = uid2group($uid))) 
-   array_push($errors, "Internal Error: could not read credentials");
 
 if ($group != "admin") array_push($errors, "Error: invalid permissions");
 
-if (isset($_SESSION['ldap_server'])) $ldap_server=$_SESSION['ldap_server'];
-   else $ldap_server = "127.0.0.1";
-if (isset($_SESSION['ldap_port'])) $ldap_port=$_SESSION['ldap_port'];
-   else $ldap_port = 389;
 if (isset($_SESSION['base_dn'])) $base_dn = $_SESSION['base_dn'];
    else $base_dn = 'k=kolab' ;
 
 $myself=$_SERVER['PHP_SELF'];
-
-if (!($link=ldap_connect($ldap_server,$ldap_port)) ||
-    !ldap_bind($link, $bind_dn, $password) ) {
-   array_push($errors, "LDAP Error: could not connect to ldap://$ldap_server:$ldap_port ".ldap_error($link));
-}
 
 if (!$errors) {
 





More information about the commits mailing list