Monday, April 20, 2009

First difference between Railo CF & Adobe CF

I've been working with Railo for a short time now. Migrating from Adobe CF on Windows IIS to Redhat Apache and Railo. It's been great with some added bonuses.

This is the first case where something didn't work with the exact code from Adobe CF. It's using CFLDAP.


From an LDAP UIDNumber stored in the local DB I to an LDAP Query,

    <!--- Get the old data --->
    <cfldap action="QUERY"
           name="actualldap"
           attributes="dn,uidNumber,uid,givenname,street,city,state,postalcode,telephonenumber,email"
           start="uid=XXX,cn=users,dc=XXX,dc=XXX,dc=lan"
           filter="(&(uidnumber=#variables.ldapuidnumber#))"
           server="#variables.LDAPIP#"
           timeout="1"
           username="uid=XXX,cn=users,dc=XXX,dc=XXX,dc=lan"
           password="#variables.LDAPPW#">
   

When I did a cfdump and a cfabort right here, on the Adobe CF server it returned the DN equal to the 'username' passed in. In Railo CF it returns blank, which consequently makes the update LDAP error witht he blank DN. Once I discovered it was the same at the 'username' I was passing in I was able to easily overwrite the blank value with the known value and it was working again.

    <!--- OVERWRITE THE DN RETURNED BLANK!!! --->
    <cfset actualldap.dn = "uid=XXX,cn=users,dc=XXX,dc=XXX,dc=lan">
   
    <!--- Check any changed fields, write the attributes string 'variables.atbs' for the LDAP Modify --->
    ...
   
    <!--- update the changed LDAP fields --->
    <cfldap action="MODIFY"
        DN="#actualldap.dn#"
        attributes="#variables.atbs#"
        modifytype="REPLACE"
        server="#variables.LDAPIP#"
        username="uid=XXX,cn=users,dc=XXX,dc=XXX,dc=lan"
        password="#variables.LDAPPW#">


It was an easy enough fix, but it's strange that the results would be different. I'm not sure if there is a standard or which is not standard. I'm just really glad it was an easy fix.... After wasting 3 hours checking everything else.

That's a wrap.