semaphore icon indicating copy to clipboard operation
semaphore copied to clipboard

Incorrect parsing of LDAP bind user DN

Open msnelling opened this issue 7 years ago • 4 comments

The Semaphore setup process incorrectly parses the LDAP bind user DN if it contains spaces. E.g cn=some user,ou=some org,dc=domain,dc=com.

Each space is treated as a carriage-return and incorrectly prompts for the next configuration item.

msnelling avatar Aug 10 '17 14:08 msnelling

I'm still experiencing this. Was there a resolution?

jamesalbert avatar Jun 15 '22 23:06 jamesalbert

seems to be expected behavior for fmt.Sscanln

jamesalbert avatar Jun 16 '22 01:06 jamesalbert

Hi @jamesalbert I'm not familiar with LDAP in depth, what does that mean? Should I reopen the issue?

fiftin avatar Jun 23 '22 15:06 fiftin

IT sysadmin here: LDAP, or in my case Microsoft Active Directory, which also uses LDAP, in fact supports spaces in the names of organisation units (OUs). This effects almost any type of bject in LDAP, except domainnames itself. So given a distinguished name (DN) of "CN=foobar,OU=foo bar,DC=foo,DC=bar" is actually different from "CN=foo bar,OU=foobar,DC=foo,DC=bar" In fact, in Microsoft Ative Directory there is a builtin OU named "Domain Administrators", which you SHOULD NOT edit in any way. When i try to set "ldap_searchdn" : "OU=Domain Administrators,DC=foo,DC=bar" the function breaks the line, this is a bug from the LDAP point of view.

JgdKdoFhr avatar Mar 22 '23 10:03 JgdKdoFhr

This behaviour still applies. Following the suggestion from @jamesalbert , I found this post: https://stackoverflow.com/a/43843848 So, when the function finds my ldap path that contains a space in it , the sscanln stops reading the input at the space.

This results in an incorrect input for the remainder of the code referenced by @jamesalbert in his previous reply.

Also , as pointed out by @JgdKdoFhr , Active Directory uses spaces in built on OUs so, no workarounds there.

Reading through the code I realised that if I use a config file , the part os the code that breaks because of the sscanln behaviour around spaces is skipped .

So, around that line of inquiry, I got it working by creating the config file and creating a bind volume in my docker compose file.

I think that the bufferio.scanner path could solve this issue .

I will fork the repo and try the bufferio.scanner path .

lafayetteduarte avatar Jul 01 '23 23:07 lafayetteduarte