aboutsummaryrefslogtreecommitdiff
path: root/radicale_web/web/infcloud/auth/plugins/ldap.inc
diff options
context:
space:
mode:
authorUnrud <unrud@openaliasbox.org>2017-06-04 17:16:11 +0200
committerUnrud <unrud@openaliasbox.org>2017-06-04 17:16:36 +0200
commit10eef51a0f086ad148928ba965c330599b4765cb (patch)
treed0283e55f1b4e66c49bf17461b5fee211b78768a /radicale_web/web/infcloud/auth/plugins/ldap.inc
parentUpdate license (diff)
downloadradicaleinfcloud-10eef51a0f086ad148928ba965c330599b4765cb.tar.gz
radicaleinfcloud-10eef51a0f086ad148928ba965c330599b4765cb.tar.bz2
radicaleinfcloud-10eef51a0f086ad148928ba965c330599b4765cb.zip
Update package for new web plugin interface
Diffstat (limited to 'radicale_web/web/infcloud/auth/plugins/ldap.inc')
-rw-r--r--radicale_web/web/infcloud/auth/plugins/ldap.inc37
1 files changed, 0 insertions, 37 deletions
diff --git a/radicale_web/web/infcloud/auth/plugins/ldap.inc b/radicale_web/web/infcloud/auth/plugins/ldap.inc
deleted file mode 100644
index f7012e5..0000000
--- a/radicale_web/web/infcloud/auth/plugins/ldap.inc
+++ /dev/null
@@ -1,37 +0,0 @@
-<?php
- require_once(dirname(__FILE__).'/ldap_conf.inc');
-
- function ldap_authenticate()
- {
- global $pluginconfig;
- if($_SERVER['PHP_AUTH_USER']!="" && $_SERVER['PHP_AUTH_PW']!="")
- {
- $ds=ldap_connect($pluginconfig['host']);
-
- // if binding is required for LDAP search
- if(isset($pluginconfig['bind_dn']) && isset($pluginconfig['bind_passwd']))
- {
- @ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3);
- if(!($r=@ldap_bind($ds, $pluginconfig['bind_dn'], $pluginconfig['bind_passwd'])))
- return -2; // auth unsuccessful (bind error)
- }
-
- // perform the search
- if(($r=ldap_search($ds, $pluginconfig['basedn'], '(&('.$pluginconfig['user_attr'].'='.$_SERVER['PHP_AUTH_USER'].')'.(isset($pluginconfig['filter']) && $pluginconfig['filter']!='' ? '('.$pluginconfig['filter'].')' : '' ).')'))!==false)
- {
- $result=@ldap_get_entries($ds, $r);
- if($result[0])
- {
- @ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3);
- if(@ldap_bind($ds, $result[0]['dn'], $_SERVER['PHP_AUTH_PW']))
- {
- @ldap_unbind($bi);
- return 1; // auth successful
- }
- }
- }
- return -1; // auth unsuccessful
- }
- return 0; // empty username or password
- }
-?> \ No newline at end of file
bgstack15