Skip to content

Commit

Permalink
add a check to prevent panics (#5471)
Browse files Browse the repository at this point in the history
  • Loading branch information
Becca Petrin authored and jefferai committed Oct 8, 2018
1 parent a198fb3 commit a44cac3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
4 changes: 4 additions & 0 deletions helper/ldaputil/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,10 @@ func (c *Client) GetLdapGroups(cfg *ConfigEntry, conn Connection, userDN string,

// EscapeLDAPValue is exported because a plugin uses it outside this package.
func EscapeLDAPValue(input string) string {
if input == "" {
return ""
}

// RFC4514 forbids un-escaped:
// - leading space or hash
// - trailing space
Expand Down
1 change: 1 addition & 0 deletions helper/ldaputil/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ func TestLDAPEscape(t *testing.T) {
"test,hel+lo": "test\\,hel\\+lo",
"test\\hello": "test\\\\hello",
" test ": "\\ test \\ ",
"": "",
}

for test, answer := range testcases {
Expand Down

0 comments on commit a44cac3

Please sign in to comment.