summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorElan Yusuf Hakim <elan100cs@gmail.com>2016-06-01 16:53:38 +0200
committerNed McClain <ned@appliedtrust.com>2016-06-01 16:53:38 +0200
commitf9d5abcccb4fc5fd04412aac0fdc85ffb7b5b0d6 (patch)
tree21e5f66e2335e9e3370a5970af287d54ce90c0a1
parentMerge pull request #1 from BradburyLab/master (diff)
downloadldap-f9d5abcccb4fc5fd04412aac0fdc85ffb7b5b0d6.tar
ldap-f9d5abcccb4fc5fd04412aac0fdc85ffb7b5b0d6.tar.gz
ldap-f9d5abcccb4fc5fd04412aac0fdc85ffb7b5b0d6.tar.bz2
ldap-f9d5abcccb4fc5fd04412aac0fdc85ffb7b5b0d6.tar.lz
ldap-f9d5abcccb4fc5fd04412aac0fdc85ffb7b5b0d6.tar.xz
ldap-f9d5abcccb4fc5fd04412aac0fdc85ffb7b5b0d6.tar.zst
ldap-f9d5abcccb4fc5fd04412aac0fdc85ffb7b5b0d6.zip
Diffstat (limited to '')
-rw-r--r--control.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/control.go b/control.go
index 8376dd7..60fde91 100644
--- a/control.go
+++ b/control.go
@@ -5,6 +5,7 @@
package ldap
import (
+ "strings"
"fmt"
"github.com/nmcclain/asn1-ber"
)
@@ -39,7 +40,9 @@ func (c *ControlString) Encode() *ber.Packet {
if c.Criticality {
packet.AppendChild(ber.NewBoolean(ber.ClassUniversal, ber.TypePrimitive, ber.TagBoolean, c.Criticality, "Criticality"))
}
- packet.AppendChild(ber.NewString(ber.ClassUniversal, ber.TypePrimitive, ber.TagOctetString, c.ControlValue, "Control Value"))
+ if strings.TrimSpace(c.ControlValue) != "" {
+ packet.AppendChild(ber.NewString(ber.ClassUniversal, ber.TypePrimitive, ber.TagOctetString, c.ControlValue, "Control Value"))
+ }
return packet
}