From ee4388c038f5d0912e2e2700443853308b6e621d Mon Sep 17 00:00:00 2001 From: dirkm Date: Wed, 3 Jul 2019 20:23:29 +0200 Subject: make serve function public (#4) * make serve function public * make Dn public * make attrs public --- server_modify.go | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'server_modify.go') diff --git a/server_modify.go b/server_modify.go index 0dca219..ca68e40 100644 --- a/server_modify.go +++ b/server_modify.go @@ -1,9 +1,10 @@ package ldap import ( - "github.com/nmcclain/asn1-ber" "log" "net" + + "github.com/nmcclain/asn1-ber" ) func HandleAddRequest(req *ber.Packet, boundDN string, fns map[string]Adder, conn net.Conn) (resultCode LDAPResultCode) { @@ -71,7 +72,7 @@ func HandleModifyRequest(req *ber.Packet, boundDN string, fns map[string]Modifie } var ok bool modReq := ModifyRequest{} - modReq.dn, ok = req.Children[0].Value.(string) + modReq.Dn, ok = req.Children[0].Value.(string) if !ok { return LDAPResultProtocolError } @@ -84,7 +85,7 @@ func HandleModifyRequest(req *ber.Packet, boundDN string, fns map[string]Modifie if len(attrs) != 2 { return LDAPResultProtocolError } - attr.attrType, ok = attrs[0].Value.(string) + attr.AttrType, ok = attrs[0].Value.(string) if !ok { return LDAPResultProtocolError } @@ -93,7 +94,7 @@ func HandleModifyRequest(req *ber.Packet, boundDN string, fns map[string]Modifie if !ok { return LDAPResultProtocolError } - attr.attrVals = append(attr.attrVals, v) + attr.AttrVals = append(attr.AttrVals, v) } op, ok := change.Children[0].Value.(uint64) if !ok { @@ -104,11 +105,11 @@ func HandleModifyRequest(req *ber.Packet, boundDN string, fns map[string]Modifie log.Printf("Unrecognized Modify attribute %d", op) return LDAPResultProtocolError case AddAttribute: - modReq.Add(attr.attrType, attr.attrVals) + modReq.Add(attr.AttrType, attr.AttrVals) case DeleteAttribute: - modReq.Delete(attr.attrType, attr.attrVals) + modReq.Delete(attr.AttrType, attr.AttrVals) case ReplaceAttribute: - modReq.Replace(attr.attrType, attr.attrVals) + modReq.Replace(attr.AttrType, attr.AttrVals) } } fnNames := []string{} -- cgit v1.2.3