From b31d53b19a9a5044d4faf36e54ba44437f75bab6 Mon Sep 17 00:00:00 2001 From: ale <ale@incal.net> Date: Sat, 13 Jan 2018 09:34:16 +0000 Subject: [PATCH] Use defaults when public_key_attr/private_key_attr are unset --- backend/ldap.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/backend/ldap.go b/backend/ldap.go index 817cfdb8..f4f5e4d6 100644 --- a/backend/ldap.go +++ b/backend/ldap.go @@ -43,11 +43,16 @@ func (c *LDAPQueryConfig) Valid() error { } c.scope = s } + + // Since two different daemons use this code, with separate + // configs, and one of them does not need one of these + // attributes, it's more practical to set defaults rather than + // complain if values are unset. if c.PublicKeyAttr == "" { - return errors.New("empty public_key_attr") + c.PublicKeyAttr = "userPublicKey" } if c.PrivateKeyAttr == "" { - return errors.New("empty public_key_attr") + c.PrivateKeyAttr = "userEncryptedKey" } return nil } -- GitLab