aboutsummaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
Diffstat (limited to 'main.go')
-rw-r--r--main.go12
1 files changed, 8 insertions, 4 deletions
diff --git a/main.go b/main.go
index 7939733..a9b8031 100644
--- a/main.go
+++ b/main.go
@@ -1,8 +1,5 @@
package main
-// @FIXME: Proper handling of various upper/lower case combinations
-// @FIXME: Implement missing search filters (in applyFilter)
-// @FIXME: Add an initial prefix to the consul key value
import (
"crypto/rand"
@@ -381,7 +378,14 @@ func (server *Server) objectExists(dn string) (bool, error) {
return len(data) > 0, nil
}
-func (server *Server) checkSuffix(dn string, allow_extend bool) (string, error) {
+func (server *Server) checkDN(dn string, allow_extend bool) (string, error) {
+ // 1. Canonicalize: remove spaces between things
+ dn, err := canonicalDN(dn)
+ if err != nil {
+ return "", err
+ }
+
+ // 2. Check suffix (add it if allow_extend is set)
suffix := server.config.Suffix
if len(dn) < len(suffix) {
if dn != suffix[len(suffix)-len(dn):] || !allow_extend {