|
If your getting into LDAP coding you might want to look at a product like this http://iseries.msp.be/MSPLIB/ We user this and I think there are others out there. Using something like this makes doing LDAP from RPG a lot easier. Turns an LDAP lookup and update into something very easy to understand... // Create pointer to server pLDAP = LDAPCreate(LDAPServer:389); // Set server login user dn = 'cn=' + %trim(ldapusr) + ',' + %trim(LDAP_O); // Login to server ldapok = LDAPConnect(pLDAP:dn:%trim(ldappwd)); // Set LDAP Organization ldapok = LDAPsetBaseDN(pLDAP: %trim(LDAP_O)); // Set LDAP Attributes to retrieve Attributes = 'initials,fullname'; ldapok = LDAPsetAttributes(pLDAP: %trim(Attributes)); // Set LDAP User to query filter = '(cn=' + %trim(Netwid) + ')'; ldapok = LDAPsetFilter(pLDAP: filter); // Test for valid connection to LDAP server n = LDAPQuery(pLDAP); If n > 0; // Read defined attributes for defined user to buffer ldapok = LDAPFetch(pLDAP); // Read defined attributes for defined user from buffer LDAP_Initial = LDAPgetValue(pLDAP: 'initials'); LDAP_FullName = LDAPgetValue(pLDAP: 'fullname'); . . . // Update LDAP if needed If Initial <> Old_Initial or FullName <> Old_FullName; dn = 'cn=' + %trim(Netwid) + ',' + %trim(LDAP_OU) + ',' + %trim(LDAP_O); If Initial <> Old_Initial; ldapok = LDAPsetValue(pLDAP: 'initials': %trim(Initial)); EndIf; If FullName <> Old_FullName; ldapok = LDAPsetValue(pLDAP: 'fullname': %trim(FullName)); EndIf; ldapok = LDAPModify(pLDAP: dn); EndIf; EndIf; LDAPDisconnect(pLDAP); >>> WaldenL@xxxxxxxxxxxxxxx 11/1/2005 11:45:34 AM >>> AD is just an LDAP server (ok, it's more than that, but you can treat it like one) so scott's code at: http://archive.midrange.com/rpg400-l/200206/msg00503.html should point you in the right direction. -Walden ------------ Walden H Leverich III Tech Software (516) 627-3800 x11 WaldenL@xxxxxxxxxxxxxxx http://www.TechSoftInc.com Quiquid latine dictum sit altum viditur. (Whatever is said in Latin seems profound.)
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.