[Freeswitch-svn] [commit] r9978 - freeswitch/trunk/src/mod/xml_int/mod_xml_ldap

Freeswitch SVN jskopis at freeswitch.org
Sat Oct 11 18:50:35 EDT 2008


Author: jskopis
Date: Sat Oct 11 18:50:34 2008
New Revision: 9978

Added:
   freeswitch/trunk/src/mod/xml_int/mod_xml_ldap/fsv2.schema
   freeswitch/trunk/src/mod/xml_int/mod_xml_ldap/reallyconfusingslapcat
Modified:
   freeswitch/trunk/src/mod/xml_int/mod_xml_ldap/mod_xml_ldap.c

Log:
some files

Added: freeswitch/trunk/src/mod/xml_int/mod_xml_ldap/fsv2.schema
==============================================================================
--- (empty file)
+++ freeswitch/trunk/src/mod/xml_int/mod_xml_ldap/fsv2.schema	Sat Oct 11 18:50:34 2008
@@ -0,0 +1,499 @@
+attributetype ( 1.3.6.1.4.1.65535.1.1.0 NAME 'fstag'
+    DESC '%attr_desc%'
+    EQUALITY caseIgnoreIA5Match
+    SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
+
+attributetype ( 1.3.6.1.4.1.65535.1.1.1 NAME 'action'
+    DESC '%attr_desc%'
+    EQUALITY caseIgnoreIA5Match
+    SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
+
+attributetype ( 1.3.6.1.4.1.65535.1.1.2 NAME 'application'
+    DESC '%attr_desc%'
+    EQUALITY caseIgnoreIA5Match
+    SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
+
+attributetype ( 1.3.6.1.4.1.65535.1.1.3 NAME 'bindings'
+    DESC '%attr_desc%'
+    EQUALITY caseIgnoreIA5Match
+    SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
+
+attributetype ( 1.3.6.1.4.1.65535.1.1.4 NAME 'break'
+    DESC '%attr_desc%'
+    EQUALITY caseIgnoreIA5Match
+    SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
+
+attributetype ( 1.3.6.1.4.1.65535.1.1.5 NAME 'breakonmatch'
+    DESC '%attr_desc%'
+    EQUALITY caseIgnoreIA5Match
+    SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
+
+attributetype ( 1.3.6.1.4.1.65535.1.1.6 NAME 'cidr'
+    DESC '%attr_desc%'
+    EQUALITY caseIgnoreIA5Match
+    SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
+
+attributetype ( 1.3.6.1.4.1.65535.1.1.7 NAME 'content'
+    DESC '%attr_desc%'
+    EQUALITY caseIgnoreIA5Match
+    SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
+
+attributetype ( 1.3.6.1.4.1.65535.1.1.8 NAME 'continue'
+    DESC '%attr_desc%'
+    EQUALITY caseIgnoreIA5Match
+    SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
+
+attributetype ( 1.3.6.1.4.1.65535.1.1.9 NAME 'data'
+    DESC '%attr_desc%'
+    EQUALITY caseIgnoreIA5Match
+    SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
+
+attributetype ( 1.3.6.1.4.1.65535.1.1.10 NAME 'default'
+    DESC '%attr_desc%'
+    EQUALITY caseIgnoreIA5Match
+    SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
+
+attributetype ( 1.3.6.1.4.1.65535.1.1.11 NAME 'digit-len'
+    DESC '%attr_desc%'
+    EQUALITY caseIgnoreIA5Match
+    SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
+
+attributetype ( 1.3.6.1.4.1.65535.1.1.12 NAME 'digits'
+    DESC '%attr_desc%'
+    EQUALITY caseIgnoreIA5Match
+    SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
+
+attributetype ( 1.3.6.1.4.1.65535.1.1.13 NAME 'domain'
+    DESC '%attr_desc%'
+    EQUALITY caseIgnoreIA5Match
+    SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
+
+attributetype ( 1.3.6.1.4.1.65535.1.1.14 NAME 'exit-sound'
+    DESC '%attr_desc%'
+    EQUALITY caseIgnoreIA5Match
+    SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
+
+attributetype ( 1.3.6.1.4.1.65535.1.1.15 NAME 'expression'
+    DESC '%attr_desc%'
+    EQUALITY caseIgnoreIA5Match
+    SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
+
+attributetype ( 1.3.6.1.4.1.65535.1.1.16 NAME 'field'
+    DESC '%attr_desc%'
+    EQUALITY caseIgnoreIA5Match
+    SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
+
+attributetype ( 1.3.6.1.4.1.65535.1.1.17 NAME 'function'
+    DESC '%attr_desc%'
+    EQUALITY caseIgnoreIA5Match
+    SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
+
+attributetype ( 1.3.6.1.4.1.65535.1.1.18 NAME 'greet-long'
+    DESC '%attr_desc%'
+    EQUALITY caseIgnoreIA5Match
+    SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
+
+attributetype ( 1.3.6.1.4.1.65535.1.1.19 NAME 'greet-short'
+    DESC '%attr_desc%'
+    EQUALITY caseIgnoreIA5Match
+    SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
+
+attributetype ( 1.3.6.1.4.1.65535.1.1.20 NAME 'id'
+    DESC '%attr_desc%'
+    EQUALITY caseIgnoreIA5Match
+    SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
+
+attributetype ( 1.3.6.1.4.1.65535.1.1.21 NAME 'inter-digit-timeout'
+    DESC '%attr_desc%'
+    EQUALITY caseIgnoreIA5Match
+    SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
+
+attributetype ( 1.3.6.1.4.1.65535.1.1.22 NAME 'invalid-sound'
+    DESC '%attr_desc%'
+    EQUALITY caseIgnoreIA5Match
+    SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
+
+attributetype ( 1.3.6.1.4.1.65535.1.1.23 NAME 'mailbox'
+    DESC '%attr_desc%'
+    EQUALITY caseIgnoreIA5Match
+    SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
+
+attributetype ( 1.3.6.1.4.1.65535.1.1.24 NAME 'max-failures'
+    DESC '%attr_desc%'
+    EQUALITY caseIgnoreIA5Match
+    SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
+
+attributetype ( 1.3.6.1.4.1.65535.1.1.25 NAME 'method'
+    DESC '%attr_desc%'
+    EQUALITY caseIgnoreIA5Match
+    SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
+
+attributetype ( 1.3.6.1.4.1.65535.1.1.26 NAME 'module'
+    DESC '%attr_desc%'
+    EQUALITY caseIgnoreIA5Match
+    SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
+
+attributetype ( 1.3.6.1.4.1.65535.1.1.27 NAME 'param'
+    DESC '%attr_desc%'
+    EQUALITY caseIgnoreIA5Match
+    SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
+
+attributetype ( 1.3.6.1.4.1.65535.1.1.28 NAME 'parse'
+    DESC '%attr_desc%'
+    EQUALITY caseIgnoreIA5Match
+    SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
+
+attributetype ( 1.3.6.1.4.1.65535.1.1.29 NAME 'path'
+    DESC '%attr_desc%'
+    EQUALITY caseIgnoreIA5Match
+    SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
+
+attributetype ( 1.3.6.1.4.1.65535.1.1.30 NAME 'pattern'
+    DESC '%attr_desc%'
+    EQUALITY caseIgnoreIA5Match
+    SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
+
+attributetype ( 1.3.6.1.4.1.65535.1.1.31 NAME 'regex'
+    DESC '%attr_desc%'
+    EQUALITY caseIgnoreIA5Match
+    SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
+
+attributetype ( 1.3.6.1.4.1.65535.1.1.32 NAME 'replace'
+    DESC '%attr_desc%'
+    EQUALITY caseIgnoreIA5Match
+    SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
+
+attributetype ( 1.3.6.1.4.1.65535.1.1.33 NAME 'service'
+    DESC '%attr_desc%'
+    EQUALITY caseIgnoreIA5Match
+    SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
+
+attributetype ( 1.3.6.1.4.1.65535.1.1.34 NAME 'sound-path'
+    DESC '%attr_desc%'
+    EQUALITY caseIgnoreIA5Match
+    SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
+
+attributetype ( 1.3.6.1.4.1.65535.1.1.35 NAME 'status'
+    DESC '%attr_desc%'
+    EQUALITY caseIgnoreIA5Match
+    SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
+
+attributetype ( 1.3.6.1.4.1.65535.1.1.36 NAME 'timeout'
+    DESC '%attr_desc%'
+    EQUALITY caseIgnoreIA5Match
+    SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
+
+attributetype ( 1.3.6.1.4.1.65535.1.1.37 NAME 'tts-engine'
+    DESC '%attr_desc%'
+    EQUALITY caseIgnoreIA5Match
+    SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
+
+attributetype ( 1.3.6.1.4.1.65535.1.1.38 NAME 'tts-voice'
+    DESC '%attr_desc%'
+    EQUALITY caseIgnoreIA5Match
+    SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
+
+attributetype ( 1.3.6.1.4.1.65535.1.1.39 NAME 'type'
+    DESC '%attr_desc%'
+    EQUALITY caseIgnoreIA5Match
+    SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
+
+attributetype ( 1.3.6.1.4.1.65535.1.1.40 NAME 'value'
+    DESC '%attr_desc%'
+    EQUALITY caseIgnoreIA5Match
+    SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
+
+objectclass ( 1.3.6.1.4.1.65535.1.2.0 NAME 'FSaction'
+    SUP top STRUCTURAL
+    DESC '%obj_desc%'
+    MAY ( fstag $ name $ application $ content $ data $ function $ method $ type ) )
+
+objectclass ( 1.3.6.1.4.1.65535.1.2.1 NAME 'FSadvertise'
+    SUP top STRUCTURAL
+    DESC '%obj_desc%'
+    MAY ( fstag $ name ) )
+
+objectclass ( 1.3.6.1.4.1.65535.1.2.2 NAME 'FSalias'
+    SUP top STRUCTURAL
+    DESC '%obj_desc%'
+    MAY ( fstag $ name ) )
+
+objectclass ( 1.3.6.1.4.1.65535.1.2.3 NAME 'FSaliases'
+    SUP top STRUCTURAL
+    DESC '%obj_desc%'
+    MAY ( fstag $ name ) )
+
+objectclass ( 1.3.6.1.4.1.65535.1.2.4 NAME 'FSanti-action'
+    SUP top STRUCTURAL
+    DESC '%obj_desc%'
+    MAY ( fstag $ name $ application $ data ) )
+
+objectclass ( 1.3.6.1.4.1.65535.1.2.5 NAME 'FSbinding'
+    SUP top STRUCTURAL
+    DESC '%obj_desc%'
+    MAY ( fstag $ name ) )
+
+objectclass ( 1.3.6.1.4.1.65535.1.2.6 NAME 'FSbindings'
+    SUP top STRUCTURAL
+    DESC '%obj_desc%'
+    MAY ( fstag $ name ) )
+
+objectclass ( 1.3.6.1.4.1.65535.1.2.7 NAME 'FScaller-controls'
+    SUP top STRUCTURAL
+    DESC '%obj_desc%'
+    MAY ( fstag $ name ) )
+
+objectclass ( 1.3.6.1.4.1.65535.1.2.8 NAME 'FScli-keybindings'
+    SUP top STRUCTURAL
+    DESC '%obj_desc%'
+    MAY ( fstag $ name ) )
+
+objectclass ( 1.3.6.1.4.1.65535.1.2.9 NAME 'FScondition'
+    SUP top STRUCTURAL
+    DESC '%obj_desc%'
+    MAY ( fstag $ name $ break $ expression $ field ) )
+
+objectclass ( 1.3.6.1.4.1.65535.1.2.10 NAME 'FSconfiguration'
+    SUP top STRUCTURAL
+    DESC '%obj_desc%'
+    MAY ( fstag $ name $ description ) )
+
+objectclass ( 1.3.6.1.4.1.65535.1.2.11 NAME 'FScontext'
+    SUP top STRUCTURAL
+    DESC '%obj_desc%'
+    MAY ( fstag $ name ) )
+
+objectclass ( 1.3.6.1.4.1.65535.1.2.12 NAME 'FScontrol'
+    SUP top STRUCTURAL
+    DESC '%obj_desc%'
+    MAY ( fstag $ name $ action $ digits ) )
+
+objectclass ( 1.3.6.1.4.1.65535.1.2.13 NAME 'FSdirectory'
+    SUP top STRUCTURAL
+    DESC '%obj_desc%'
+    MAY ( fstag $ name $ path ) )
+
+objectclass ( 1.3.6.1.4.1.65535.1.2.14 NAME 'FSdocument'
+    SUP top STRUCTURAL
+    DESC '%obj_desc%'
+    MAY ( fstag $ name $ type ) )
+
+objectclass ( 1.3.6.1.4.1.65535.1.2.15 NAME 'FSdomain'
+    SUP top STRUCTURAL
+    DESC '%obj_desc%'
+    MAY ( fstag $ name $ parse ) )
+
+objectclass ( 1.3.6.1.4.1.65535.1.2.16 NAME 'FSdomains'
+    SUP top STRUCTURAL
+    DESC '%obj_desc%'
+    MAY ( fstag $ name ) )
+
+objectclass ( 1.3.6.1.4.1.65535.1.2.17 NAME 'FSemail'
+    SUP top STRUCTURAL
+    DESC '%obj_desc%'
+    MAY ( fstag $ name ) )
+
+objectclass ( 1.3.6.1.4.1.65535.1.2.18 NAME 'FSentry'
+    SUP top STRUCTURAL
+    DESC '%obj_desc%'
+    MAY ( fstag $ name $ action $ digits $ param ) )
+
+objectclass ( 1.3.6.1.4.1.65535.1.2.19 NAME 'FSextension'
+    SUP top STRUCTURAL
+    DESC '%obj_desc%'
+    MAY ( fstag $ name $ continue ) )
+
+objectclass ( 1.3.6.1.4.1.65535.1.2.20 NAME 'FSglobalsettings'
+    SUP top STRUCTURAL
+    DESC '%obj_desc%'
+    MAY ( fstag $ name ) )
+
+objectclass ( 1.3.6.1.4.1.65535.1.2.21 NAME 'FSgroup'
+    SUP top STRUCTURAL
+    DESC '%obj_desc%'
+    MAY ( fstag $ name ) )
+
+objectclass ( 1.3.6.1.4.1.65535.1.2.22 NAME 'FSinput'
+    SUP top STRUCTURAL
+    DESC '%obj_desc%'
+    MAY ( fstag $ name $ breakonmatch $ pattern ) )
+
+objectclass ( 1.3.6.1.4.1.65535.1.2.23 NAME 'FSinterface'
+    SUP top STRUCTURAL
+    DESC '%obj_desc%'
+    MAY ( fstag $ name ) )
+
+objectclass ( 1.3.6.1.4.1.65535.1.2.24 NAME 'FSjavavm'
+    SUP top STRUCTURAL
+    DESC '%obj_desc%'
+    MAY ( fstag $ name $ path ) )
+
+objectclass ( 1.3.6.1.4.1.65535.1.2.25 NAME 'FSkey'
+    SUP top STRUCTURAL
+    DESC '%obj_desc%'
+    MAY ( fstag $ name $ value ) )
+
+objectclass ( 1.3.6.1.4.1.65535.1.2.26 NAME 'FSlanguage'
+    SUP top STRUCTURAL
+    DESC '%obj_desc%'
+    MAY ( fstag $ name $ sound-path $ tts-engine $ tts-voice ) )
+
+objectclass ( 1.3.6.1.4.1.65535.1.2.27 NAME 'FSlist'
+    SUP top STRUCTURAL
+    DESC '%obj_desc%'
+    MAY ( fstag $ name $ default ) )
+
+objectclass ( 1.3.6.1.4.1.65535.1.2.28 NAME 'FSload'
+    SUP top STRUCTURAL
+    DESC '%obj_desc%'
+    MAY ( fstag $ name $ module ) )
+
+objectclass ( 1.3.6.1.4.1.65535.1.2.29 NAME 'FSmacro'
+    SUP top STRUCTURAL
+    DESC '%obj_desc%'
+    MAY ( fstag $ name ) )
+
+objectclass ( 1.3.6.1.4.1.65535.1.2.30 NAME 'FSmacros'
+    SUP top STRUCTURAL
+    DESC '%obj_desc%'
+    MAY ( fstag $ name ) )
+
+objectclass ( 1.3.6.1.4.1.65535.1.2.31 NAME 'FSmap'
+    SUP top STRUCTURAL
+    DESC '%obj_desc%'
+    MAY ( fstag $ name $ value ) )
+
+objectclass ( 1.3.6.1.4.1.65535.1.2.32 NAME 'FSmappings'
+    SUP top STRUCTURAL
+    DESC '%obj_desc%'
+    MAY ( fstag $ name ) )
+
+objectclass ( 1.3.6.1.4.1.65535.1.2.33 NAME 'FSmatch'
+    SUP top STRUCTURAL
+    DESC '%obj_desc%'
+    MAY ( fstag $ name ) )
+
+objectclass ( 1.3.6.1.4.1.65535.1.2.34 NAME 'FSmenu'
+    SUP top STRUCTURAL
+    DESC '%obj_desc%'
+    MAY ( fstag $ name $ digit-len $ exit-sound $ greet-long $ greet-short $ inter-digit-timeout $ invalid-sound $ max-failures $ timeout ) )
+
+objectclass ( 1.3.6.1.4.1.65535.1.2.35 NAME 'FSmenus'
+    SUP top STRUCTURAL
+    DESC '%obj_desc%'
+    MAY ( fstag $ name ) )
+
+objectclass ( 1.3.6.1.4.1.65535.1.2.36 NAME 'FSmodules'
+    SUP top STRUCTURAL
+    DESC '%obj_desc%'
+    MAY ( fstag $ name ) )
+
+objectclass ( 1.3.6.1.4.1.65535.1.2.37 NAME 'FSnetwork-lists'
+    SUP top STRUCTURAL
+    DESC '%obj_desc%'
+    MAY ( fstag $ name ) )
+
+objectclass ( 1.3.6.1.4.1.65535.1.2.38 NAME 'FSnode'
+    SUP top STRUCTURAL
+    DESC '%obj_desc%'
+    MAY ( fstag $ name $ cidr $ type ) )
+
+objectclass ( 1.3.6.1.4.1.65535.1.2.39 NAME 'FSnomatch'
+    SUP top STRUCTURAL
+    DESC '%obj_desc%'
+    MAY ( fstag $ name ) )
+
+objectclass ( 1.3.6.1.4.1.65535.1.2.40 NAME 'FSoption'
+    SUP top STRUCTURAL
+    DESC '%obj_desc%'
+    MAY ( fstag $ name $ value ) )
+
+objectclass ( 1.3.6.1.4.1.65535.1.2.41 NAME 'FSoptions'
+    SUP top STRUCTURAL
+    DESC '%obj_desc%'
+    MAY ( fstag $ name ) )
+
+objectclass ( 1.3.6.1.4.1.65535.1.2.42 NAME 'FSparam'
+    SUP top STRUCTURAL
+    DESC '%obj_desc%'
+    MAY ( fstag $ name $ bindings $ value ) )
+
+objectclass ( 1.3.6.1.4.1.65535.1.2.43 NAME 'FSparams'
+    SUP top STRUCTURAL
+    DESC '%obj_desc%'
+    MAY ( fstag $ name ) )
+
+objectclass ( 1.3.6.1.4.1.65535.1.2.44 NAME 'FSprispans'
+    SUP top STRUCTURAL
+    DESC '%obj_desc%'
+    MAY ( fstag $ name ) )
+
+objectclass ( 1.3.6.1.4.1.65535.1.2.45 NAME 'FSprofile'
+    SUP top STRUCTURAL
+    DESC '%obj_desc%'
+    MAY ( fstag $ name $ description $ domain ) )
+
+objectclass ( 1.3.6.1.4.1.65535.1.2.46 NAME 'FSprofiles'
+    SUP top STRUCTURAL
+    DESC '%obj_desc%'
+    MAY ( fstag $ name ) )
+
+objectclass ( 1.3.6.1.4.1.65535.1.2.47 NAME 'FSroom'
+    SUP top STRUCTURAL
+    DESC '%obj_desc%'
+    MAY ( fstag $ name $ status ) )
+
+objectclass ( 1.3.6.1.4.1.65535.1.2.48 NAME 'FSroute'
+    SUP top STRUCTURAL
+    DESC '%obj_desc%'
+    MAY ( fstag $ name $ regex $ replace $ service ) )
+
+objectclass ( 1.3.6.1.4.1.65535.1.2.49 NAME 'FSroutes'
+    SUP top STRUCTURAL
+    DESC '%obj_desc%'
+    MAY ( fstag $ name ) )
+
+objectclass ( 1.3.6.1.4.1.65535.1.2.50 NAME 'FSsection'
+    SUP top STRUCTURAL
+    DESC '%obj_desc%'
+    MAY ( fstag $ name $ description ) )
+
+objectclass ( 1.3.6.1.4.1.65535.1.2.51 NAME 'FSsettings'
+    SUP top STRUCTURAL
+    DESC '%obj_desc%'
+    MAY ( fstag $ name ) )
+
+objectclass ( 1.3.6.1.4.1.65535.1.2.52 NAME 'FSspan'
+    SUP top STRUCTURAL
+    DESC '%obj_desc%'
+    MAY ( fstag $ name $ id ) )
+
+objectclass ( 1.3.6.1.4.1.65535.1.2.53 NAME 'FStemplate'
+    SUP top STRUCTURAL
+    DESC '%obj_desc%'
+    MAY ( fstag $ name $ content ) )
+
+objectclass ( 1.3.6.1.4.1.65535.1.2.54 NAME 'FStemplates'
+    SUP top STRUCTURAL
+    DESC '%obj_desc%'
+    MAY ( fstag $ name ) )
+
+objectclass ( 1.3.6.1.4.1.65535.1.2.55 NAME 'FSuser'
+    SUP top STRUCTURAL
+    DESC '%obj_desc%'
+    MAY ( fstag $ name $ id $ mailbox ) )
+
+objectclass ( 1.3.6.1.4.1.65535.1.2.56 NAME 'FSvariable'
+    SUP top STRUCTURAL
+    DESC '%obj_desc%'
+    MAY ( fstag $ name $ value ) )
+
+objectclass ( 1.3.6.1.4.1.65535.1.2.57 NAME 'FSvariables'
+    SUP top STRUCTURAL
+    DESC '%obj_desc%'
+    MAY ( fstag $ name ) )
+
+objectclass ( 1.3.6.1.4.1.65535.1.2.58 NAME 'FSx-profile'
+    SUP top STRUCTURAL
+    DESC '%obj_desc%'
+    MAY ( fstag $ name $ type ) )

Modified: freeswitch/trunk/src/mod/xml_int/mod_xml_ldap/mod_xml_ldap.c
==============================================================================
--- freeswitch/trunk/src/mod/xml_int/mod_xml_ldap/mod_xml_ldap.c	(original)
+++ freeswitch/trunk/src/mod/xml_int/mod_xml_ldap/mod_xml_ldap.c	Sat Oct 11 18:50:34 2008
@@ -1,50 +1,11 @@
-/*
- * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct at yahoo.com>
- *
- * Version: MPL 1.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- *
- * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct at yahoo.com>
- * Portions created by the Initial Developer are Copyright (C)
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *
- * Anthony Minessale II <anthmct at yahoo.com>
- * Bret McDanel <trixter AT 0xdecafbad.com>
- * Justin Cassidy <xachenant at hotmail.com>
- * John Skopis <john+fs at skopis.com>
- * 
- * mod_xml_ldap.c -- LDAP XML Gateway
- *
- */
 #include <switch.h>
 #include <stdlib.h>
 #include <string.h>
-#ifdef MSLDAP
-#include <windows.h>
-#include <winldap.h>
-#include <winber.h>
-#define LDAP_OPT_SUCCESS LDAP_SUCCESS
-#else
 #include <lber.h>
 #include <ldap.h>
-#include <sasl/sasl.h>
-#include "lutil_ldap.h"
-#endif
+
+#define PCACHE_TTL 300
+#define NCACHE_TTL 900
 
 typedef enum {
 	XML_LDAP_CONFIG = 0,
@@ -53,360 +14,69 @@
 	XML_LDAP_PHRASE
 } xml_ldap_query_type_t;
 
-SWITCH_MODULE_LOAD_FUNCTION(mod_xml_ldap_load);
-SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_xml_ldap_shutdown);
-SWITCH_MODULE_DEFINITION(mod_xml_ldap, mod_xml_ldap_load, mod_xml_ldap_shutdown, NULL);
 
 typedef struct xml_binding {
 	char *bindings;
-	char *host;
+	xml_ldap_query_type_t bt;
+	char *url;
 	char *basedn;
 	char *binddn;
 	char *bindpass;
 	char *filter;
-	char **attrs;
-	lutilSASLdefaults *defaults;
 } xml_binding_t;
 
-typedef struct ldap_c {
-	LDAP *ld;
-	LDAPMessage *msg;
-	LDAPMessage *entry;
-	BerElement *berkey;
-	BerElement *berval;
-	char *key;
-	char *val;
-	char **keyvals;
-	char **valvals;
-	char *sp;
-} ldap_ctx;
-
-static switch_status_t xml_ldap_directory_result(void *ldap_connection, xml_binding_t *binding, switch_xml_t *xml, int *off);
-static switch_status_t xml_ldap_dialplan_result(void *ldap_connection, xml_binding_t *binding, switch_xml_t *xml, int *off);
-
 
-#define XML_LDAP_SYNTAX "[debug_on|debug_off]"
-
-SWITCH_STANDARD_API(xml_ldap_function)
-{
-	if (session) {
-		return SWITCH_STATUS_FALSE;
-	}
-
-	if (switch_strlen_zero(cmd)) {
-		goto usage;
-	}
-
-	if (!strcasecmp(cmd, "debug_on")) {
-	} else if (!strcasecmp(cmd, "debug_off")) {
-	} else {
-		goto usage;
-	}
-
-	stream->write_function(stream, "OK\n");
-	return SWITCH_STATUS_SUCCESS;
+SWITCH_MODULE_LOAD_FUNCTION(mod_xml_ldap_load);
+SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_xml_ldap_shutdown);
+SWITCH_MODULE_DEFINITION(mod_xml_ldap, mod_xml_ldap_load, mod_xml_ldap_shutdown, NULL);
 
-  usage:
-	stream->write_function(stream, "USAGE: %s\n", XML_LDAP_SYNTAX);
-	return SWITCH_STATUS_SUCCESS;
-}
 
-static switch_status_t xml_ldap_result(void *ldap_connection, xml_binding_t *binding, switch_xml_t *xml, int *off, const xml_ldap_query_type_t query_type)
-{
-	switch (query_type) {
-	case XML_LDAP_DIRECTORY:
-		return xml_ldap_directory_result(ldap_connection, binding, xml, off);
+static switch_xml_t xml_ldap_search(const char *section, const char *tag_name, const char *key_name, const char *key_value, switch_event_t *params,
+                                    void *user_data);
 
-	case XML_LDAP_DIALPLAN:
-		return xml_ldap_dialplan_result(ldap_connection, binding, xml, off);
+static switch_status_t do_config(void);
+static switch_status_t trysearch( switch_xml_t *pxml, int *xoff, LDAP *ld, char *basedn, char *filter);
+void rec( switch_xml_t *, int*, LDAP *ld, char *);
 
-	default:
-		return SWITCH_STATUS_FALSE;
-	}
-}
+#define XML_LDAP_SYNTAX ""
 
-static switch_status_t xml_ldap_dialplan_result(void *ldap_connection, xml_binding_t *binding, switch_xml_t *xml, int *off)
+SWITCH_STANDARD_API(xml_ldap_function)
 {
 	return SWITCH_STATUS_FALSE;
 }
 
-static switch_status_t xml_ldap_directory_result(void *ldap_connection, xml_binding_t *binding, switch_xml_t *xml, int *off)
+SWITCH_MODULE_LOAD_FUNCTION(mod_xml_ldap_load)
 {
-	struct ldap_c *ldap = ldap_connection;
-	switch_xml_t asdf = *xml;
-	switch_xml_t param, variable, params = NULL, variables = NULL;
-	int i = 0;
-	int loff = *off;
-
-	for (ldap->entry = ldap_first_entry(ldap->ld, ldap->msg); ldap->entry != NULL; ldap->entry = ldap_next_entry(ldap->ld, ldap->entry)) {
-		ldap->key = ldap_first_attribute(ldap->ld, ldap->entry, &ldap->berkey);
-		do {
-			ldap->val = ldap_first_attribute(ldap->ld, ldap->entry, &ldap->berval);
-			do {
-				if (strstr(ldap->val, "value")) {
-					if (strstr(ldap->val, ldap->key) && strcmp(ldap->val, ldap->key)) {
-						if (!strcmp(ldap->key, "param")) {
-							params = switch_xml_add_child_d(asdf, "params", loff++);
-						} else if (!strcmp(ldap->key, "variable")) {
-							variables = switch_xml_add_child_d(asdf, "variables", loff++);
-						}
-
-						ldap->keyvals = ldap_get_values(ldap->ld, ldap->entry, ldap->key);
-						ldap->valvals = ldap_get_values(ldap->ld, ldap->entry, ldap->val);
-
-						if (ldap->keyvals && ldap->valvals) {
-							if (ldap_count_values(ldap->valvals) == ldap_count_values(ldap->keyvals)) {
-								for (i = 0; ldap->keyvals[i] != NULL && ldap->valvals[i] != NULL; i++) {
-									if (!strcmp(ldap->key, "param")) {
-										param = switch_xml_add_child_d(params, "param", loff++);
-										switch_xml_set_attr_d(param, "name", ldap->keyvals[i]);
-										switch_xml_set_attr_d(param, "value", ldap->valvals[i]);
-									} else if (!strcmp(ldap->key, "variable")) {
-										variable = switch_xml_add_child_d(variables, "variable", loff++);
-										switch_xml_set_attr_d(variable, "name", ldap->keyvals[i]);
-										switch_xml_set_attr_d(variable, "value", ldap->valvals[i]);
-									}
-								}
-
-								if (ldap->keyvals) {
-									ldap_value_free(ldap->keyvals);
-								}
-
-								if (ldap->valvals) {
-									ldap_value_free(ldap->valvals);
-								}
-							} else {
-								switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Seems the values %d and %d are not the same??\n",
-												  ldap_count_values(ldap->valvals), ldap_count_values(ldap->keyvals));
-							}
-						}
-					}
-				}
-				if (ldap->val) {
-					ldap_memfree(ldap->val);
-				}
-
-				ldap->val = ldap_next_attribute(ldap->ld, ldap->entry, ldap->berval);
-
-			} while (ldap->val != NULL);
+	switch_api_interface_t *xml_ldap_api_interface;
 
-			if (ldap->key) {
-				ldap_memfree(ldap->key);
-			}
+	/* connect my internal structure to the blank pointer passed to me */
+	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
 
-			if (ldap->berval) {
-				ber_free(ldap->berval, 0);
-			}
+	SWITCH_ADD_API(xml_ldap_api_interface, "xml_ldap", "XML LDAP", xml_ldap_function, XML_LDAP_SYNTAX);
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "XML LDAP module loading...\n");
 
-			ldap->key = ldap_next_attribute(ldap->ld, ldap->entry, ldap->berkey);
+	if (do_config() != SWITCH_STATUS_SUCCESS) {
+		return SWITCH_STATUS_FALSE;
+	}
 
-		} while (ldap->key != NULL);
 
-		if (ldap->berkey) {
-			ber_free(ldap->berkey, 0);
-		}
-	}
+	/* indicate that the module should continue to be loaded */
 	return SWITCH_STATUS_SUCCESS;
 }
 
-
-static switch_xml_t xml_ldap_search(const char *section, const char *tag_name, const char *key_name, const char *key_value, switch_event_t *params,
-									void *user_data)
+SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_xml_ldap_shutdown)
 {
-	xml_binding_t *binding = (xml_binding_t *) user_data;
-	switch_event_header_t *hi;
-
-	switch_xml_t xml = NULL, sub = NULL;
-
-	struct ldap_c ldap_connection;
-	struct ldap_c *ldap = &ldap_connection;
-
-	int auth_method = LDAP_AUTH_SIMPLE;
-	int desired_version = LDAP_VERSION3;
-	xml_ldap_query_type_t query_type;
-	char *dir_exten = NULL, *dir_domain = NULL;
-
-	char *search_filter = NULL, *search_base = NULL;
-	int off = 0, ret = 1;
-
-	//char *buf;
-	//buf = malloc(4096);
-
-
-	if (!binding) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No bindings...sorry bud returning now\n");
-		return NULL;
-	}
-
-	if (!strcmp(section, "configuration")) {
-		query_type = XML_LDAP_CONFIG;
-	} else if (!strcmp(section, "directory")) {
-		query_type = XML_LDAP_DIRECTORY;
-	} else if (!strcmp(section, "dialplan")) {
-		query_type = XML_LDAP_DIALPLAN;
-	} else if (!strcmp(section, "phrases")) {
-		query_type = XML_LDAP_PHRASE;
-	} else {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid section\n");
-		return NULL;
-	}
-
-	if (params) {
-		if ((hi = params->headers)) {
-			for (; hi; hi = hi->next) {
-				switch (query_type) {
-				case XML_LDAP_CONFIG:
-					break;
-
-				case XML_LDAP_DIRECTORY:
-					if (!strcmp(hi->name, "user")) {
-						dir_exten = strdup(hi->value);
-					} else if (!strcmp(hi->name, "domain")) {
-						dir_domain = strdup(hi->value);
-					}
-					break;
-
-				case XML_LDAP_DIALPLAN:
-				case XML_LDAP_PHRASE:
-					break;
-				}
-			}
-			switch (query_type) {
-			case XML_LDAP_CONFIG:
-				break;
-
-			case XML_LDAP_DIRECTORY:
-				if (dir_exten && dir_domain) {
-					if ((xml = switch_xml_new("directory"))) {
-						switch_xml_set_attr_d(xml, "type", "freeswitch/xml");
-
-						if ((sub = switch_xml_add_child_d(xml, "section", off++))) {
-							switch_xml_set_attr_d(sub, "name", "directory");
-						}
-
-						if ((sub = switch_xml_add_child_d(sub, "domain", off++))) {
-							switch_xml_set_attr_d(sub, "name", dir_domain);
-						}
-
-						if ((sub = switch_xml_add_child_d(sub, "user", off++))) {
-							switch_xml_set_attr_d(sub, "id", dir_exten);
-						}
-
-					}
-
-					search_filter = switch_mprintf(binding->filter, dir_exten);
-					search_base = switch_mprintf(binding->basedn, dir_domain);
-
-					free(dir_exten);
-					dir_exten = NULL;
-
-					free(dir_domain);
-					dir_domain = NULL;
-
-				} else {
-					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
-									  "Something bad happened during the query construction phase likely exten(%s) or domain(%s) is null\n", dir_exten,
-									  dir_domain);
-					goto cleanup;
-				}
-				break;
-
-			case XML_LDAP_DIALPLAN:
-				if ((xml = switch_xml_new("document"))) {
-					switch_xml_set_attr_d(xml, "type", "freeswitch/xml");
-
-					if ((sub = switch_xml_add_child_d(xml, "section", off++))) {
-						switch_xml_set_attr_d(sub, "name", "dialplan");
-					}
-
-					sub = switch_xml_add_child_d(xml, "context", off++);
-				}
-
-				break;
-
-			case XML_LDAP_PHRASE:
-				break;
-			}
-		} else {
-			goto cleanup;
-		}
-	}
-
-
-
-	if ((ldap->ld = (LDAP*)ldap_init(binding->host, LDAP_PORT)) == NULL) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unable to connect to ldap server.%s\n", binding->host);
-		goto cleanup;
-	}
-
-	if (ldap_set_option(ldap->ld, LDAP_OPT_PROTOCOL_VERSION, &desired_version) != LDAP_OPT_SUCCESS) {
-		goto cleanup;
-	}
-
-	ldap_set_option( ldap->ld, LDAP_OPT_X_SASL_SECPROPS, &ldap->sp );
-
-
-
-	if (binding->binddn) {
-		if (ldap_bind_s(ldap->ld, binding->binddn, binding->bindpass, auth_method) != LDAP_SUCCESS) {
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unable to bind to ldap server %s as %s\n", binding->host, binding->binddn);
-			goto cleanup;
-		}
-	} else {
-		if (ldap_sasl_interactive_bind_s( ldap->ld, NULL, binding->defaults->mech, NULL, NULL,(unsigned)LDAP_SASL_SIMPLE, lutil_sasl_interact , binding->defaults ) != LDAP_SUCCESS) {
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unable to sasl_bind to ldap server %s as %s\n", binding->host, binding->defaults->authcid);
-			goto cleanup;
-		}
-	}
-
-	if (ldap_search_s(ldap->ld, search_base, LDAP_SCOPE_SUBTREE, search_filter, NULL, 0, &ldap->msg) != LDAP_SUCCESS) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Query failed: -b \"%s\" \"%s\"\n", search_base, search_filter);
-		goto cleanup;
-	}
-
-	if (ldap_count_entries(ldap->ld, ldap->msg) <= 0) {
-		goto cleanup;
-	}
-
-	if (sub && xml_ldap_result(&ldap_connection, binding, &sub, &off, query_type) != SWITCH_STATUS_SUCCESS) {
-		goto cleanup;
-	}
-
-	ret = 0;
-
-  cleanup:
-	if (ldap->msg) {
-		ldap_msgfree(ldap->msg);
-	}
-
-	if (ldap->ld) {
-		ldap_unbind_s(ldap->ld);
-	}
-
-	switch_safe_free(search_filter);
-	switch_safe_free(search_base);
-
-	//switch_xml_toxml_buf(xml,buf,0,0,1);
-	//switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Providing:\n%s\n", buf);
-
-	if (ret) {
-		switch_xml_free(xml);
-		return NULL;
-	}
-
-	return xml;
+	return SWITCH_STATUS_SUCCESS;
 }
 
-
-static switch_status_t do_config(void)
-{
+static switch_status_t do_config(void) {
 	char *cf = "xml_ldap.conf";
 	switch_xml_t cfg, xml, bindings_tag, binding_tag, param;
 	xml_binding_t *binding = NULL;
 	int x = 0;
 
 	if (!(xml = switch_xml_open_cfg(cf, &cfg, NULL))) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Open of %s failed\n", cf);
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "open of %s failed\n", cf);
 		return SWITCH_STATUS_TERM;
 	}
 
@@ -423,11 +93,6 @@
 		}
 		memset(binding, 0, sizeof(*binding));
 
-		if (!(binding->defaults = malloc(sizeof(lutilSASLdefaults)))) {
-			goto done;
-		}
-		memset(binding->defaults, 0, sizeof(lutilSASLdefaults));
-
 		for (param = switch_xml_child(binding_tag, "param"); param; param = param->next) {
 
 			char *var = (char *) switch_xml_attr_soft(param, "name");
@@ -435,30 +100,35 @@
 
 			if (!strcasecmp(var, "filter")) {
 				binding->bindings = (char *) switch_xml_attr_soft(param, "bindings");
+
+				if (!strncmp(binding->bindings, "configuration",strlen(binding->bindings))) {
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "setting type XML_LDAP_CONFIG\n");
+					binding->bt = XML_LDAP_CONFIG;
+				} else if (!strncmp(binding->bindings, "directory",strlen(binding->bindings))) {
+					binding->bt = XML_LDAP_DIRECTORY;
+				} else if (!strncmp(binding->bindings, "dialplain",strlen(binding->bindings))) {
+					binding->bt = XML_LDAP_DIALPLAN;
+				} else if (!strncmp(binding->bindings, "phrases",strlen(binding->bindings))) {
+					binding->bt = XML_LDAP_PHRASE;
+				}
+
 				if (val) {
 					binding->filter = strdup(val);
+					printf("binding filter %s to %s\n", binding->filter, binding->bindings);
 				}
-			} else if (!strcasecmp(var, "basedn")) {
+			} else if (!strncasecmp(var, "basedn", strlen(val))) {
 				binding->basedn = strdup(val);
-			} else if (!strcasecmp(var, "binddn")) {
+			} else if (!strncasecmp(var, "binddn", strlen(val))) {
 				binding->binddn = strdup(val);
-			} else if (!strcasecmp(var, "bindpass")) {
+			} else if (!strncasecmp(var, "bindpass", strlen(val))) {
 				binding->bindpass = strdup(val);
-			} else if (!strcasecmp(var, "host")) {
-				binding->host = strdup(val);
-			} else if (!strcasecmp(var, "mech")) {
-				binding->defaults->mech = strdup(val);
-			} else if (!strcasecmp(var, "realm")) {
-				binding->defaults->realm = strdup(val);
-			} else if (!strcasecmp(var, "authcid")) {
-				binding->defaults->authcid = strdup(val);
-			} else if (!strcasecmp(var, "authzid")) {
-				binding->defaults->authzid = strdup(val);
+			} else if (!strncasecmp(var, "url", strlen(val))) {
+				binding->url = strdup(val);
 			}
 
 		}
 
-		if (!binding->basedn || !binding->filter) {
+		if (!binding->basedn || !binding->filter || !binding->url) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
 							  "You must define \"basedn\", and \"filter\" in mod_xml_ldap.conf.xml\n");
 			continue;
@@ -480,37 +150,208 @@
 	return SWITCH_STATUS_SUCCESS;
 }
 
+static switch_status_t trysearch ( switch_xml_t *pxml, int *xoff, LDAP *ld, char *basedn, char *filter) {
+	switch_status_t ret;
+	int off = *xoff;
+	char *key = NULL;
+	char *dn = NULL;
+	char **val = NULL;
+	BerElement *ber = NULL;
+	switch_xml_t xml = *pxml;
+	LDAPMessage *msg, *entry;
+
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "trying search in base %s with filter %s\n", basedn, filter);
+
+	ldap_search_s(ld, basedn,  LDAP_SCOPE_ONE, filter, NULL, 0, &msg);
+
+	if ( ldap_count_entries(ld, msg) > 0 ) {
+		ret = SWITCH_STATUS_SUCCESS;
+		for ( 
+			entry = ldap_first_entry(ld, msg); 
+			entry != NULL; 
+			entry = ldap_next_entry(ld, entry) ) {
+
+			val = ldap_get_values(ld,entry,"fstag" );
+			xml = switch_xml_add_child_d(xml, val[0], off);
+			ldap_value_free(val);
+
+			for (
+				key = ldap_first_attribute(ld, entry, &ber);
+				key != NULL;
+				key = ldap_next_attribute(ld, entry, ber) ) {
+
+				if ( !strncasecmp(key,"fstag",strlen(key)) || !strncasecmp(key,"objectclass",strlen(key)) ) {
+					ldap_memfree(key);
+					continue;
+				}
 
-SWITCH_MODULE_LOAD_FUNCTION(mod_xml_ldap_load)
-{
-	switch_api_interface_t *xml_ldap_api_interface;
+				val = ldap_get_values(ld,entry,key);
+				switch_xml_set_attr_d(xml, key, val[0]);
 
-	/* connect my internal structure to the blank pointer passed to me */
-	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
+				ldap_memfree(key);
+				ldap_value_free(val);
 
-	SWITCH_ADD_API(xml_ldap_api_interface, "xml_ldap", "XML LDAP", xml_ldap_function, XML_LDAP_SYNTAX);
-	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "XML LDAP module loading...\n");
+			}
+			ber_free(ber,0);
 
-	if (do_config() != SWITCH_STATUS_SUCCESS) {
-		return SWITCH_STATUS_FALSE;
+			dn = ldap_get_dn(ld,entry);
+		    rec(&xml,&off,ld,dn);
+
+			*xoff=1;
+		}
+
+		ldap_msgfree(entry);
+		ldap_msgfree(msg);
+	} else {
+		ret = SWITCH_STATUS_FALSE;
 	}
 
-	/* indicate that the module should continue to be loaded */
-	return SWITCH_STATUS_SUCCESS;
+	switch_safe_free(filter);
+	switch_safe_free(key);
+
+	return ret;
+	
 }
 
-SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_xml_ldap_shutdown)
-{
-	return SWITCH_STATUS_SUCCESS;
+
+
+
+void rec( switch_xml_t *pxml, int *xoff, LDAP *ld, char *dn) {
+	int off = *xoff;
+	char *key;
+	char **val;
+
+	switch_xml_t xml = *pxml, new;
+
+	LDAPMessage *msg, *entry;
+	BerElement *ber;
+
+	ldap_search_s(ld, dn, LDAP_SCOPE_ONE, NULL, NULL, 0, &msg);
+	switch_safe_free(dn);
+
+	if ( ldap_count_entries(ld, msg) > 0 ) {
+
+		for ( 
+			entry = ldap_first_entry(ld, msg);
+			entry != NULL;
+			entry = ldap_next_entry(ld, entry) ) {
+
+			val = ldap_get_values(ld,entry,"fstag" );
+			new  = switch_xml_add_child_d(xml, val[0], off);
+			ldap_value_free(val);
+
+			for (
+				key = ldap_first_attribute(ld, entry,&ber);
+				key != NULL;
+				key = ldap_next_attribute(ld,entry,ber) ) {
+
+				if ( !strncasecmp("fstag",key,5) || !strncasecmp("objectclass",key,10) ) {
+					ldap_memfree(key);
+					continue;
+				}
+
+                val = ldap_get_values(ld,entry,key);
+                switch_xml_set_attr_d(new, key, val[0]);
+				ldap_memfree(key);
+				ldap_value_free(val);
+			}
+			ber_free(ber,0);
+			rec( &new, xoff , ld, ldap_get_dn(ld,entry) );
+		}
+
+		ldap_msgfree(entry);
+
+	}
+	ldap_msgfree(msg);
+}
+
+
+static switch_xml_t xml_ldap_search(const char *section, const char *tag_name, const char *key_name, const char *key_value, switch_event_t *params,
+									void *user_data) {
+
+	xml_binding_t *binding = (xml_binding_t *) user_data;
+	switch_event_header_t *hi;
+
+	int desired_version = LDAP_VERSION3;
+	int auth_method = LDAP_AUTH_SIMPLE;
+
+	char *basedn = NULL, *filter = NULL;
+	char *dir_domain = NULL, *dir_exten = NULL;
+	
+	char *buf;        
+	buf = malloc(4096);
+
+	LDAP *ld;
+	switch_xml_t xml = NULL;
+
+	int xoff = 0;
+
+	if (params) {
+		if ((hi = params->headers)) {
+			for (; hi; hi = hi->next) {
+				switch (binding->bt) {
+				case XML_LDAP_CONFIG:
+					break;
+
+				case XML_LDAP_DIRECTORY:
+					if (!strncmp(hi->name, "user", strlen(hi->name))) {
+						dir_exten = strdup(hi->value);
+					} else if (!strncmp(hi->name, "domain", strlen(hi->name))) {
+						dir_domain = strdup(hi->value);
+					}
+					break;
+
+				case XML_LDAP_DIALPLAN:
+				case XML_LDAP_PHRASE:
+					break;
+				}
+			}
+		}
+	}
+	switch (binding->bt) {
+		case XML_LDAP_CONFIG:
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "humm %s", binding->filter);
+			filter = switch_mprintf(binding->filter,key_name,key_value);
+			basedn = switch_mprintf(binding->basedn,tag_name);
+			break;
+
+		case XML_LDAP_DIRECTORY:
+			if(!dir_exten) {
+				filter = switch_mprintf(binding->filter,"objectclass","*","(!(objectclass=fsuser))");
+				basedn = switch_mprintf(binding->basedn,dir_domain);
+			} else {
+				filter = switch_mprintf(binding->filter,key_name,key_value,"object_class=*");
+				basedn = switch_mprintf(binding->basedn,dir_domain);
+			}
+			break;
+
+		case XML_LDAP_DIALPLAN:
+			break;
+
+		case XML_LDAP_PHRASE:
+			break;
+	}
+
+
+	ldap_initialize(&ld,binding->url);
+	ldap_set_option(ld, LDAP_OPT_PROTOCOL_VERSION, &desired_version);
+	ldap_bind_s(ld, binding->binddn, binding->bindpass, auth_method);
+
+	xml = switch_xml_new("document");
+	switch_xml_set_attr_d(xml, "type", "freeswitch/xml");
+
+
+	
+	trysearch(&xml,&xoff,ld, basedn, filter);
+
+	ldap_unbind_s(ld);
+
+
+
+    switch_xml_toxml_buf(xml,buf,0,0,1);
+    printf("providing:\n%s\n", buf);
+	switch_safe_free(buf);
+	
+	return xml;
 }
 
-/* For Emacs:
- * Local Variables:
- * mode:c
- * indent-tabs-mode:t
- * tab-width:4
- * c-basic-offset:4
- * End:
- * For VIM:
- * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
- */

Added: freeswitch/trunk/src/mod/xml_int/mod_xml_ldap/reallyconfusingslapcat
==============================================================================
--- (empty file)
+++ freeswitch/trunk/src/mod/xml_int/mod_xml_ldap/reallyconfusingslapcat	Sat Oct 11 18:50:34 2008
@@ -0,0 +1,437 @@
+dn: dc=example
+objectClass: top
+objectClass: domain
+objectClass: dcObject
+dc: example
+structuralObjectClass: domain
+entryUUID: 1b7e98c8-150e-102d-87da-699749a84e6e
+creatorsName: cn=admin,dc=example
+createTimestamp: 20080912120016Z
+entryCSN: 20080912120016Z#000000#00#000000
+modifiersName: cn=admin,dc=example
+modifyTimestamp: 20080912120016Z
+
+dn: name=conference.conf,dc=example
+objectClass: configuration
+objectClass: top
+name: conference.conf
+fstag: configuration
+description: test
+structuralObjectClass: configuration
+entryUUID: 1b892054-150e-102d-87db-699749a84e6e
+creatorsName: cn=admin,dc=example
+createTimestamp: 20080912120016Z
+entryCSN: 20080912120016Z#000001#00#000000
+modifiersName: cn=admin,dc=example
+modifyTimestamp: 20080912120016Z
+
+dn: fstag=advertise,name=conference.conf,dc=example
+objectClass: advertise
+objectClass: top
+fstag: advertise
+structuralObjectClass: advertise
+entryUUID: 1b89edea-150e-102d-87dc-699749a84e6e
+creatorsName: cn=admin,dc=example
+createTimestamp: 20080912120016Z
+entryCSN: 20080912120016Z#000002#00#000000
+modifiersName: cn=admin,dc=example
+modifyTimestamp: 20080912120016Z
+
+dn: fstag=caller-controls,name=conference.conf,dc=example
+objectClass: caller-controls
+objectClass: top
+fstag: caller-controls
+structuralObjectClass: caller-controls
+entryUUID: 26b3b558-1517-102d-958b-7504163f8994
+creatorsName: cn=admin,dc=example
+createTimestamp: 20080912130500Z
+entryCSN: 20080912130500Z#000004#00#000000
+modifiersName: cn=admin,dc=example
+modifyTimestamp: 20080912130500Z
+
+dn: name=default,fstag=caller-controls,name=conference.conf,dc=example
+objectClass: group
+objectClass: top
+fstag: group
+name: default
+structuralObjectClass: group
+entryUUID: 26b9d410-1517-102d-958c-7504163f8994
+creatorsName: cn=admin,dc=example
+createTimestamp: 20080912130500Z
+entryCSN: 20080912130500Z#000005#00#000000
+modifiersName: cn=admin,dc=example
+modifyTimestamp: 20080912130500Z
+
+dn: action=mute,name=default,fstag=caller-controls,name=conference.conf,dc=exa
+ mple
+objectClass: control
+objectClass: top
+fstag: control
+action: mute
+digits: 0
+structuralObjectClass: control
+entryUUID: 26bce4de-1517-102d-958d-7504163f8994
+creatorsName: cn=admin,dc=example
+createTimestamp: 20080912130500Z
+entryCSN: 20080912130500Z#000006#00#000000
+modifiersName: cn=admin,dc=example
+modifyTimestamp: 20080912130500Z
+
+dn: action=deaf mute,name=default,fstag=caller-controls,name=conference.conf,d
+ c=example
+objectClass: control
+objectClass: top
+fstag: control
+action: deaf mute
+digits: *
+structuralObjectClass: control
+entryUUID: 3068b27e-1517-102d-9595-7504163f8994
+creatorsName: cn=admin,dc=example
+createTimestamp: 20080912130516Z
+entryCSN: 20080912130516Z#000007#00#000000
+modifiersName: cn=admin,dc=example
+modifyTimestamp: 20080912130516Z
+
+dn: name=test,fstag=advertise,name=conference.conf,dc=example
+objectClass: FSroom
+objectClass: top
+fstag: room
+name: test
+status: test2
+structuralObjectClass: FSroom
+entryUUID: 562f97e8-1521-102d-9596-7504163f8994
+creatorsName: cn=admin,dc=example
+createTimestamp: 20080912141755Z
+entryCSN: 20080912141755Z#000000#00#000000
+modifiersName: cn=admin,dc=example
+modifyTimestamp: 20080912141755Z
+
+dn: ou=configuration,dc=example
+objectClass: top
+objectClass: organizationalUnit
+ou: configuration
+structuralObjectClass: organizationalUnit
+entryUUID: d88d961c-1d83-102d-8d1a-cd7a5bd86334
+creatorsName: cn=admin,dc=example
+createTimestamp: 20080923062313Z
+entryCSN: 20080923062313Z#000001#00#000000
+modifiersName: cn=admin,dc=example
+modifyTimestamp: 20080923062313Z
+
+dn: name=post_load_modules.conf,ou=configuration,dc=example
+objectClass: top
+objectClass: FSconfiguration
+name: post_load_modules.conf
+fstag: configuration
+description: hi
+structuralObjectClass: FSconfiguration
+entryUUID: b10eb3f4-1d84-102d-9f9d-2b6c44ac6f10
+creatorsName: cn=admin,dc=example
+createTimestamp: 20080923062917Z
+entryCSN: 20080923062917Z#000002#00#000000
+modifiersName: cn=admin,dc=example
+modifyTimestamp: 20080923062917Z
+
+dn: fstag=modules,name=post_load_modules.conf,ou=configuration,dc=example
+objectClass: top
+objectClass: FSmodules
+fstag: modules
+structuralObjectClass: FSmodules
+entryUUID: b14ef2f2-1d84-102d-9f9e-2b6c44ac6f10
+creatorsName: cn=admin,dc=example
+createTimestamp: 20080923062917Z
+entryCSN: 20080923062917Z#000003#00#000000
+modifiersName: cn=admin,dc=example
+modifyTimestamp: 20080923062917Z
+
+dn: module=mod_conference,fstag=modules,name=post_load_modules.conf,ou=configu
+ ration,dc=example
+objectClass: top
+objectClass: FSload
+fstag: load
+module: mod_conference
+structuralObjectClass: FSload
+entryUUID: bd6f9582-1d84-102d-9fa4-2b6c44ac6f10
+creatorsName: cn=admin,dc=example
+createTimestamp: 20080923062937Z
+entryCSN: 20080923062937Z#000004#00#000000
+modifiersName: cn=admin,dc=example
+modifyTimestamp: 20080923062937Z
+
+dn: name=configuration,dc=example
+objectClass: top
+objectClass: FSsection
+fstag: section
+name: configuration
+structuralObjectClass: FSsection
+entryUUID: 7f74dd72-1d85-102d-9fa6-2b6c44ac6f10
+creatorsName: cn=admin,dc=example
+createTimestamp: 20080923063503Z
+entryCSN: 20080923063503Z#000001#00#000000
+modifiersName: cn=admin,dc=example
+modifyTimestamp: 20080923063503Z
+
+dn: name=post_load_modules.conf,name=configuration,dc=example
+objectClass: top
+objectClass: FSconfiguration
+name: post_load_modules.conf
+fstag: configuration
+description: hi
+structuralObjectClass: FSconfiguration
+entryUUID: 92fb7ca2-1d85-102d-9fa8-2b6c44ac6f10
+creatorsName: cn=admin,dc=example
+createTimestamp: 20080923063536Z
+entryCSN: 20080923063536Z#000001#00#000000
+modifiersName: cn=admin,dc=example
+modifyTimestamp: 20080923063536Z
+
+dn: fstag=modules,name=post_load_modules.conf,name=configuration,dc=example
+objectClass: top
+objectClass: FSmodules
+fstag: modules
+structuralObjectClass: FSmodules
+entryUUID: 92fce736-1d85-102d-9fa9-2b6c44ac6f10
+creatorsName: cn=admin,dc=example
+createTimestamp: 20080923063536Z
+entryCSN: 20080923063536Z#000002#00#000000
+modifiersName: cn=admin,dc=example
+modifyTimestamp: 20080923063536Z
+
+dn: module=mod_conference,fstag=modules,name=post_load_modules.conf,name=confi
+ guration,dc=example
+objectClass: top
+objectClass: FSload
+fstag: load
+module: mod_conference
+structuralObjectClass: FSload
+entryUUID: 93027886-1d85-102d-9faa-2b6c44ac6f10
+creatorsName: cn=admin,dc=example
+createTimestamp: 20080923063536Z
+entryCSN: 20080923063536Z#000003#00#000000
+modifiersName: cn=admin,dc=example
+modifyTimestamp: 20080923063536Z
+
+dn: name=directory,dc=example
+objectClass: top
+objectClass: FSsection
+fstag: section
+name: directory
+description: humm
+structuralObjectClass: FSsection
+entryUUID: b6a54832-1d8e-102d-9fb6-2b6c44ac6f10
+creatorsName: cn=admin,dc=example
+createTimestamp: 20080923074101Z
+entryCSN: 20080923074101Z#000001#00#000000
+modifiersName: cn=admin,dc=example
+modifyTimestamp: 20080923074101Z
+
+dn: name=172.16.75.129,name=directory,dc=example
+objectClass: top
+objectClass: FSdomain
+name: 172.16.75.129
+fstag: domain
+structuralObjectClass: FSdomain
+entryUUID: b6a66ef6-1d8e-102d-9fb7-2b6c44ac6f10
+creatorsName: cn=admin,dc=example
+createTimestamp: 20080923074101Z
+entryCSN: 20080923074101Z#000002#00#000000
+modifiersName: cn=admin,dc=example
+modifyTimestamp: 20080923074101Z
+
+dn: fstag=params,name=172.16.75.129,name=directory,dc=example
+objectClass: top
+objectClass: FSparams
+fstag: params
+structuralObjectClass: FSparams
+entryUUID: cf5ebb88-1d8e-102d-9fc5-2b6c44ac6f10
+creatorsName: cn=admin,dc=example
+createTimestamp: 20080923074142Z
+entryCSN: 20080923074142Z#000003#00#000000
+modifiersName: cn=admin,dc=example
+modifyTimestamp: 20080923074142Z
+
+dn: fstag=param,fstag=params,name=172.16.75.129,name=directory,dc=example
+objectClass: top
+objectClass: FSparam
+fstag: param
+name: dial-string
+value: {presence_id=${dialed_user}@${dialed_domain},transfer_fallback_extensio
+ n=${dialed_user}}${sofia_contact(${dialed_domain}/${dialed_user}@${dialed_dom
+ ain})}
+structuralObjectClass: FSparam
+entryUUID: cf5f7e38-1d8e-102d-9fc6-2b6c44ac6f10
+creatorsName: cn=admin,dc=example
+createTimestamp: 20080923074142Z
+entryCSN: 20080923074142Z#000004#00#000000
+modifiersName: cn=admin,dc=example
+modifyTimestamp: 20080923074142Z
+
+dn: fstag=variables,name=172.16.75.129,name=directory,dc=example
+objectClass: top
+objectClass: FSvariables
+fstag: variables
+structuralObjectClass: FSvariables
+entryUUID: cf721d90-1d8e-102d-9fc7-2b6c44ac6f10
+creatorsName: cn=admin,dc=example
+createTimestamp: 20080923074142Z
+entryCSN: 20080923074142Z#000005#00#000000
+modifiersName: cn=admin,dc=example
+modifyTimestamp: 20080923074142Z
+
+dn: fstag=variable,fstag=variables,name=172.16.75.129,name=directory,dc=exampl
+ e
+objectClass: top
+objectClass: FSvariable
+fstag: variable
+name: record_stereo
+value: true
+structuralObjectClass: FSvariable
+entryUUID: cf731b00-1d8e-102d-9fc8-2b6c44ac6f10
+creatorsName: cn=admin,dc=example
+createTimestamp: 20080923074142Z
+entryCSN: 20080923074142Z#000006#00#000000
+modifiersName: cn=admin,dc=example
+modifyTimestamp: 20080923074142Z
+
+dn: id=1000,name=172.16.75.129,name=directory,dc=example
+objectClass: top
+objectClass: FSuser
+fstag: user
+id: 1000
+mailbox: 1000
+structuralObjectClass: FSuser
+entryUUID: e6f0d078-1d8f-102d-9fd5-2b6c44ac6f10
+creatorsName: cn=admin,dc=example
+createTimestamp: 20080923074931Z
+entryCSN: 20080923074931Z#000006#00#000000
+modifiersName: cn=admin,dc=example
+modifyTimestamp: 20080923074931Z
+
+dn: fstag=variables,id=1000,name=172.16.75.129,name=directory,dc=example
+objectClass: top
+objectClass: FSvariables
+fstag: variables
+structuralObjectClass: FSvariables
+entryUUID: e7009954-1d8f-102d-9fd9-2b6c44ac6f10
+creatorsName: cn=admin,dc=example
+createTimestamp: 20080923074932Z
+entryCSN: 20080923074932Z#000003#00#000000
+modifiersName: cn=admin,dc=example
+modifyTimestamp: 20080923074932Z
+
+dn: name=dial-string,fstag=params,name=172.16.75.129,name=directory,dc=example
+objectClass: top
+objectClass: FSparam
+fstag: param
+name: dial-string
+value: {presence_id=${dialed_user}@${dialed_domain},transfer_fallback_extensio
+ n=${dialed_user}}${sofia_contact(${dialed_domain}/${dialed_user}@${dialed_dom
+ ain})}
+structuralObjectClass: FSparam
+entryUUID: f187bc90-1d8f-102d-9fdf-2b6c44ac6f10
+creatorsName: cn=admin,dc=example
+createTimestamp: 20080923074949Z
+entryCSN: 20080923074949Z#000004#00#000000
+modifiersName: cn=admin,dc=example
+modifyTimestamp: 20080923074949Z
+
+dn: name=record_stereo,fstag=variables,name=172.16.75.129,name=directory,dc=ex
+ ample
+objectClass: top
+objectClass: FSvariable
+fstag: variable
+name: record_stereo
+value: true
+structuralObjectClass: FSvariable
+entryUUID: fdc02d26-1d8f-102d-9fee-2b6c44ac6f10
+creatorsName: cn=admin,dc=example
+createTimestamp: 20080923075010Z
+entryCSN: 20080923075010Z#000006#00#000000
+modifiersName: cn=admin,dc=example
+modifyTimestamp: 20080923075010Z
+
+dn: fstag=params,id=1000,name=172.16.75.129,name=directory,dc=example
+objectClass: top
+objectClass: FSparams
+fstag: params
+structuralObjectClass: FSparams
+entryUUID: 09f26e6a-1d90-102d-9ffd-2b6c44ac6f10
+creatorsName: cn=admin,dc=example
+createTimestamp: 20080923075030Z
+entryCSN: 20080923075030Z#000008#00#000000
+modifiersName: cn=admin,dc=example
+modifyTimestamp: 20080923075030Z
+
+dn: name=password,fstag=params,id=1000,name=172.16.75.129,name=directory,dc=ex
+ ample
+objectClass: top
+objectClass: FSparam
+fstag: param
+name: password
+value: 1234
+structuralObjectClass: FSparam
+entryUUID: 09fa3906-1d90-102d-9ffe-2b6c44ac6f10
+creatorsName: cn=admin,dc=example
+createTimestamp: 20080923075030Z
+entryCSN: 20080923075030Z#000009#00#000000
+modifiersName: cn=admin,dc=example
+modifyTimestamp: 20080923075030Z
+
+dn: name=vm-password,fstag=params,id=1000,name=172.16.75.129,name=directory,dc
+ =example
+objectClass: top
+objectClass: FSparam
+fstag: param
+name: vm-password
+value: 1234
+structuralObjectClass: FSparam
+entryUUID: 09faa2ba-1d90-102d-9fff-2b6c44ac6f10
+creatorsName: cn=admin,dc=example
+createTimestamp: 20080923075030Z
+entryCSN: 20080923075030Z#00000a#00#000000
+modifiersName: cn=admin,dc=example
+modifyTimestamp: 20080923075030Z
+
+dn: name=accountcode,fstag=variables,id=1000,name=172.16.75.129,name=directory
+ ,dc=example
+objectClass: top
+objectClass: FSvariable
+fstag: variable
+name: accountcode
+value: 1000
+structuralObjectClass: FSvariable
+entryUUID: 12a9e15a-1d90-102d-800e-2b6c44ac6f10
+creatorsName: cn=admin,dc=example
+createTimestamp: 20080923075045Z
+entryCSN: 20080923075045Z#00000c#00#000000
+modifiersName: cn=admin,dc=example
+modifyTimestamp: 20080923075045Z
+
+dn: module=mod_xml_curl,fstag=modules,name=post_load_modules.conf,ou=configura
+ tion,dc=example
+objectClass: top
+objectClass: FSload
+fstag: load
+module: mod_xml_curl
+structuralObjectClass: FSload
+entryUUID: 0d2b13c0-1dae-102d-94cb-99a3f97cbb32
+creatorsName: cn=admin,dc=example
+createTimestamp: 20080923112520Z
+entryCSN: 20080923112520Z#000000#00#000000
+modifiersName: cn=admin,dc=example
+modifyTimestamp: 20080923112520Z
+
+dn: module=mod_xml_curl,fstag=modules,name=post_load_modules.conf,name=configu
+ ration,dc=example
+objectClass: top
+objectClass: FSload
+fstag: load
+module: mod_xml_curl
+structuralObjectClass: FSload
+entryUUID: 671f65d4-1dae-102d-94cc-99a3f97cbb32
+creatorsName: cn=admin,dc=example
+createTimestamp: 20080923112751Z
+entryCSN: 20080923112751Z#000000#00#000000
+modifiersName: cn=admin,dc=example
+modifyTimestamp: 20080923112751Z
+



More information about the Freeswitch-svn mailing list