diff options
author | Elan Yusuf Hakim <elan100cs@gmail.com> | 2016-06-01 16:53:38 +0200 |
---|---|---|
committer | Ned McClain <ned@appliedtrust.com> | 2016-06-01 16:53:38 +0200 |
commit | f9d5abcccb4fc5fd04412aac0fdc85ffb7b5b0d6 (patch) | |
tree | 21e5f66e2335e9e3370a5970af287d54ce90c0a1 | |
parent | Merge pull request #1 from BradburyLab/master (diff) | |
download | ldap-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.go | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -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 } |