× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Mike,

  Scott's code was exactly what I was looking for, the only thing I
don't understand is, how do I authenticate a user's password.  I don't
think we  want to make it so that all users can connect to the LDAP
server.  Or do we?  I was kind of thinking that one account would be
able to connect and do a query of a user profile and password?  How do I
get the password to authenticate it?

Kevin Touchette 

-----Original Message-----
From: Mike Cunningham [mailto:MCUNNING@xxxxxxx] 
Sent: Tuesday, November 01, 2005 10:17 AM
To: web400@xxxxxxxxxxxx; WaldenL@xxxxxxxxxxxxxxx
Subject: RE: [WEB400] Reading active directory from RPG

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.)

--
This is the Web Enabling the AS400 / iSeries (WEB400) mailing list To
post a message email: WEB400@xxxxxxxxxxxx To subscribe, unsubscribe, or
change list options,
visit: http://lists.midrange.com/mailman/listinfo/web400
or email: WEB400-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives at
http://archive.midrange.com/web400.




As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

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.