IF NOT INSTRING('\',parms.pAuthUser) AND NOT INSTRING('@',parms.pAuthUser)
parms.pAuthUser = CLIP(Config:Logon:Domain) & '\' & parms.pAuthUser
END
Now that's very old and may not be needed as such anymore, but it works, so I'm not touching it!
Where are you finding that code, Sean?
That is fine and solid - assuming that the Active Directory forest only has one domain (Config:Logon:Domain). Which is the case with my client.
That's similar to line 592 in NetLDAP.SetAuthUser.
The code that has changed - removing self.LoginDomain but leaving the extraneous backslash, is in NetLDAP.SetUser (not Set
AuthUser).
The LdapDemo app checks group membership for pUser, not pAuthUser. NetLDAP.UserInGroup uses self.user, not selfAuthUser.
My new situation may seem strange, but may become more common.
The AD domain uses a .LOCAL suffix. The client needs to switch user logins to an actual owned domain for some kind of AD-integrated cloud-based single-sign-on service for compatibility with third-party cloud-based apps.
I have figured out how to make this domain mismatch work in my situation. (Multiple possibilities, listed below.)
But I don't want to code it that way if it might be better to fix NetLDAP.clw. (In case this client is not the only one for whom the mixed-domain-name situation will ever show up).
Illustration:
In the first pic, I've set up my domain to support two UPNs in addition to the domain default (which is beach.test).
The second pic shows running an attributes query in the LdapDemo app for Suzi@janefleming.com who is actually a user in the beach.test domain.
Third pic shows the UserInGroup call from the LdapDemo app. On the first pass through, it correctly has the beach.test AD domain name.
But in order to fetch the distinguished name it resets self.domain by fetching the (bogus/arbitrary) domain suffix from the user being checked.
In the second part of the recursion, it uses that incorrect dc=janefleming,dc=com in the call to Active Directory and throws an error. (Third pic).
I have multiple ways to fix it that work for me.
1. Override NetLDAP.SetDomain so it returns based on Config:Logon:Domain.
2. Make my own call to search attributes for the distinguished name BEFORE doing the InGroup. That avoids the recursion which avoids the wrong domain name being set in NetLdap.SetDomain.
This second choice also has some slight speed improvements in one of my apps that checks 5 different group memberships as part of the login. I can code so I only need to look up the distinguished name once and use that for all 5 domain-membership lookups.
Again, don't know whether anyone wants to modify NetLDAP for this. I'm fine coding my own workarounds now that I understand the issue.
But the extraneous backslash in NetLDAP.SetUser is definitely a bug that isn't valid for anybody's situation, as far as I can tell.
Cheers,
Jane