aboutsummaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2020-01-26 21:03:18 +0100
committerAlex Auvolat <alex@adnab.me>2020-01-26 21:03:18 +0100
commit8e4537d2ef7cad3428d1ca668568d928f2a472d3 (patch)
tree3618552d5ac9658bebc9f6d34cf8d0114dfc423c /main.go
parent0bd2aeef061618d933477c71b69d209d6599bda2 (diff)
downloadbottin-8e4537d2ef7cad3428d1ca668568d928f2a472d3.tar.gz
bottin-8e4537d2ef7cad3428d1ca668568d928f2a472d3.zip
Fixes
Diffstat (limited to 'main.go')
-rw-r--r--main.go15
1 files changed, 12 insertions, 3 deletions
diff --git a/main.go b/main.go
index 26d46b3..d55601b 100644
--- a/main.go
+++ b/main.go
@@ -1,6 +1,7 @@
package main
-// @FIXME: Panics if invalid keys are in consul (consulToDN in util.go)
+// @FIXME: Auto populate entryuuid creatorsname createtimestamp modifiersname modifytimestamp (uuid: github.com/google/uuid, timestamps: 20060102150405Z)
+// @FIXME: Use memberof and not memberOf
// @FIXME: Implement missing search filters (in applyFilter)
// @FIXME: Add an initial prefix to the consul key value
@@ -112,6 +113,8 @@ func readConfig() Config {
}
func main() {
+ flag.Parse()
+
ldap.Logger = log.New(os.Stdout, "[ldapserver] ", log.LstdFlags)
config := readConfig()
@@ -739,7 +742,10 @@ func (server *Server) handleDeleteInternal(state *State, r *message.DelRequest)
return ldap.LDAPResultNoSuchObject, fmt.Errorf("Not found: %s", dn)
}
for _, item := range items {
- itemDN, _ := consulToDN(item.Key)
+ itemDN, _, err := consulToDN(item.Key)
+ if err != nil {
+ continue
+ }
if itemDN != dn {
return ldap.LDAPResultNotAllowedOnNonLeaf, fmt.Errorf(
"Cannot delete %d as it has children", dn)
@@ -833,7 +839,10 @@ func (server *Server) handleModifyInternal(state *State, r *message.ModifyReques
prevEntry := Entry{}
for _, item := range items {
- itemDN, attr := consulToDN(item.Key)
+ itemDN, attr, err := consulToDN(item.Key)
+ if err != nil {
+ continue
+ }
if itemDN != dn {
panic("itemDN != dn in handleModifyInternal")
}