Xenobiologist Posted April 24, 2007 Share Posted April 24, 2007 (edited) Hi,I'm using this LDAP-Browser : http://www-unix.mcs.anl.gov/~gawor/ldap/The connection with this settings works fine: LDAP Settings PICHow can I connect to the LDAP with Autoit?Global Const $LDAPBaseDN = 'racfid=xxx,profiletype=user,ou=racf,ousys,o=XXX' Global Const $LDAPPort = "636" Global Const $LDAPServer = "XXXX" Global Const $LDAPAddress = $LDAPServer & ":" & $LDAPPort & "/" & $LDAPBaseDN Global Const $LookFor = "racfpasswordchangedate" ; Initialize COM error handler add in the beginning of the script $oMyError = ObjEvent("AutoIt.Error","MyErrFunc") $ObjMember = ObjGet("LDAP://" & $LDAPServer & ":" & $LDAPPort & "/uid=" & $LookFor & "," & $LDAPBaseDN) If @error Then MsgBox(4096, "LDAP Connection", $LDAPServer & " connection error") Exit EndIf MsgBox(4096, "", $ObjMember.Name) ExitHow to send my current password to authorize? Any help is appreciated!So long,MegaP.S.: This is no AD! Edited January 12, 2009 by Xenobiologist Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times Link to comment Share on other sites More sharing options...
Gun-Food Posted April 24, 2007 Share Posted April 24, 2007 (edited) maybe stupid answer. Simple Global Const $LDAPAddress = $user & ":" & $passwd & "@" & $LDAPServer & ":" & $LDAPPort & "/" & $LDAPBaseDN doesn't work? Edited April 24, 2007 by Gun-Food Link to comment Share on other sites More sharing options...
Xenobiologist Posted April 25, 2007 Author Share Posted April 25, 2007 Hi, okay no luck until yet. Next try with an openLDAP. This works: ldapsearch -x uid=xf01145 -h glpls01 -b ou=user,ou=RZ,ou=0000,ou=cust,o=GAX sambaKickoffTime expandcollapse popup# extended LDIF # # LDAPv3 # base <ou=user,ou=RZ,ou=0000,ou=cust,o=GAX> with scope sub # filter: uid=xf01145 # requesting: sambaKickoffTime # # xf01145, user, RZ, 0000, cust, GAX dn: uid=xf01145,ou=user,ou=RZ,ou=0000,ou=cust,o=GAX sambaKickoffTime: 1180714325 # search result search: 2 result: 0 SuccessoÝ÷ Øz0¶h¶¬p.¶jëh×6Global Const $userDN = "xf01145,ou=user,ou=RZ,ou=0000,ou=cust,o=GAX" Global Const $user = 'xf01145' Global Const $password = 'XXX' Global Const $LDAPBaseDN = 'ou=user,ou=RZ,ou=0000,ou=cust,o=GAX' Global Const $LDAPPort = "389" Global Const $LDAPServer = "glpls01.XXX.de" Global Const $LDAPAddress = $user & ':' & $password & '@' & $LDAPServer & ':' & $LDAPPort & '/' & $LDAPBaseDN Global Const $LookFor = 'sambaKickoffTime' $oMyError = ObjEvent('AutoIt.Error', 'MyErrFunc') $ObjLDAP = ObjGet ("LDAP://" & $LDAPAddress) For $ObjMembers In $ObjLDAP ConsoleWrite($ObjMembers & @CR) Next Func MyErrFunc() $HexNumber = Hex($oMyError.number, 8) MsgBox(0, 'AutoItCOM Test', 'We intercepted a COM Error !' & @CRLF & @CRLF & _ 'err.description is: ' & @TAB & $oMyError.description & @CRLF & _ 'err.windescription:' & @TAB & $oMyError.windescription & @CRLF & _ 'err.number is: ' & @TAB & $HexNumber & @CRLF & _ 'err.lastdllerror is: ' & @TAB & $oMyError.lastdllerror & @CRLF & _ 'err.scriptline is: ' & @TAB & $oMyError.scriptline & @CRLF & _ 'err.source is: ' & @TAB & $oMyError.source & @CRLF & _ 'err.helpfile is: ' & @TAB & $oMyError.helpfile & @CRLF & _ 'err.helpcontext is: ' & @TAB & $oMyError.helpcontext _ ) SetError(1) ; to check for after this function returns EndFunc ;==>MyErrFunc I guess nobody can help ... :"> So long, Mega Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times Link to comment Share on other sites More sharing options...
Xenobiologist Posted January 11, 2009 Author Share Posted January 11, 2009 Hi, back to a very old topic. Anybody who can translate this so that it works with pure Autoit? #include <Constants.au3> #include <Array.au3> #include <Date.au3> Global Const $LDAPServer = "glpls01.gaxeg.de" Global Const $LDAPBaseDN = 'ou=user,ou=RZ,ou=0000,ou=cust,o=GAX' Global Const $uid = 'user' Global Const $LookFor = 'sambaKickoffTime' Global $sreBuffer = 0, $stdBuffer = 0 $command = 'ldapsearch.exe -h glpls01.gaxeg.de -b "ou=user,ou=RZ,ou=0000,ou=cust,o=GAX" uid=' & $uid & ' sambaKickoffTime' $Pid = Run(@ComSpec & ' /c ' & $command, '', @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD) While Not @error $stdBuffer &= StdoutRead($Pid) WEnd ConsoleWrite($stdBuffer & @CRLF) With the attached exe it works. Any help is appreciated! Mega Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times Link to comment Share on other sites More sharing options...
Xenobiologist Posted January 12, 2009 Author Share Posted January 12, 2009 Hi, okay one last try? Nodody who has been able to send a query to a LDAP (no AD!) within pure Autoit? Mega Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times Link to comment Share on other sites More sharing options...
martin Posted January 12, 2009 Share Posted January 12, 2009 Hi,okay one last try? Nodody who has been able to send a query to a LDAP (no AD!) within pure Autoit?MegaI haven't tried and I haven't got a solution, but could you perhaps run the exe which works while running wireshark or similar to see what is actually sent? Then all you have to do is reproduce that in AutoIt. Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
ResNullius Posted January 12, 2009 Share Posted January 12, 2009 Hi,okay one last try? Nodody who has been able to send a query to a LDAP (no AD!) within pure Autoit?MegaThis looks similar to some of what you have tried, maybe something there you've missed?http://nersp.nerdc.ufl.edu/~asr/ldap-for-s...vbscript-a.html Link to comment Share on other sites More sharing options...
ProgAndy Posted January 12, 2009 Share Posted January 12, 2009 Hey,does this work?http://www.tek-tips.com/viewthread.cfm?qid=969032&page=1 (the reply from: 19 Dec 04 2:54 ) *GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes Link to comment Share on other sites More sharing options...
Xenobiologist Posted January 12, 2009 Author Share Posted January 12, 2009 Thank you!!! I'll try to translate the example provided in VB and I'll try to use wireshark to get the data sent to the server. I'll report ... Mega P.S.: If somebody is good in translating vb ... :-) besides I do not need username and password to get what I want from the LDAP. Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times Link to comment Share on other sites More sharing options...
Xenobiologist Posted May 6, 2009 Author Share Posted May 6, 2009 Hi, just read about someone else trying to connect to LDAP with pure Autoit. No chance for me. Anybody tried that meanwhile? Mega Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times Link to comment Share on other sites More sharing options...
Marc Posted June 22, 2009 Share Posted June 22, 2009 (edited) Well, I had to connect to a LDAP-Server, too... (X500). So I fiddled around with it, and at least got a connection to the LDAP directory. Simply connecting (without userid/password) and reading a specfic data set is easy: $oDS = ObjGet("LDAP://xserv.xxx.de/ou=our_company,c=de") $oUsr = $oDS.GetObject("Person", "cn=Meyer Peter") MSGBOX (0,"", $oUsr.mail) two source codes (1 in vbs, 1 in autoti) stood here until the forum revamp nuked both of them... gotta find them on my hardidsk... As mentioned above. both versions of the script return the same amount of records. The differences are: 1. the vbs file detects the found as an array 2. the array is converted to a string and displayed correctly 3. AutoIt does not consider the variable an array, but a string and returns "" as result. I am quite sure there is one small stupid thing I don't see... any hints? Best regards, Marc Edit: fixed first source code, added comment about the two deleted source codes Edited July 24, 2009 by Marc Any of my own codes posted on the forum are free for use by others without any restriction of any kind. (WTFPL) Link to comment Share on other sites More sharing options...
venugopalpoli Posted September 3, 2012 Share Posted September 3, 2012 Hi, back to a very old topic. Anybody who can translate this so that it works with pure Autoit? #include <Constants.au3> #include <Array.au3> #include <Date.au3> Global Const $LDAPServer = "glpls01.gaxeg.de" Global Const $LDAPBaseDN = 'ou=user,ou=RZ,ou=0000,ou=cust,o=GAX' Global Const $uid = 'user' Global Const $LookFor = 'sambaKickoffTime' Global $sreBuffer = 0, $stdBuffer = 0 $command = 'ldapsearch.exe -h glpls01.gaxeg.de -b "ou=user,ou=RZ,ou=0000,ou=cust,o=GAX" uid=' & $uid & ' sambaKickoffTime' $Pid = Run(@ComSpec & ' /c ' & $command, '', @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD) While Not @error $stdBuffer &= StdoutRead($Pid) WEnd ConsoleWrite($stdBuffer & @CRLF) With the attached exe it works. Any help is appreciated! Mega Please, can you give more details on $command = 'ldapsearch.exe -h glpls01.gaxeg.de -b "ou=user,ou=RZ,ou=0000,ou=cust,o=GAX" uid=' & $uid & ' sambaKickoffTime'? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now