aboutsummaryrefslogtreecommitdiff
path: root/goldap/dn.go
diff options
context:
space:
mode:
authorQuentin Dufour <quentin@deuxfleurs.fr>2021-09-16 13:41:01 +0200
committerQuentin Dufour <quentin@deuxfleurs.fr>2021-09-16 13:41:01 +0200
commit477d7014edc787ba9a977acd19fcbfc55531768b (patch)
treeac8b65be8634fa9526cd727da60893244d11e88a /goldap/dn.go
parenta53641e773730ba171df2602c8d199968d6e6447 (diff)
downloadbottin-477d7014edc787ba9a977acd19fcbfc55531768b.tar.gz
bottin-477d7014edc787ba9a977acd19fcbfc55531768b.zip
Vendor goldap
Diffstat (limited to 'goldap/dn.go')
-rw-r--r--goldap/dn.go60
1 files changed, 60 insertions, 0 deletions
diff --git a/goldap/dn.go b/goldap/dn.go
new file mode 100644
index 0000000..c622fd8
--- /dev/null
+++ b/goldap/dn.go
@@ -0,0 +1,60 @@
+package message
+
+import "fmt"
+
+//
+// LDAPDN ::= LDAPString -- Constrained to <distinguishedName>
+// -- [RFC4514]
+
+func readLDAPDN(bytes *Bytes) (ret LDAPDN, err error) {
+ var str LDAPString
+ str, err = readLDAPString(bytes)
+ if err != nil {
+ err = LdapError{fmt.Sprintf("readLDAPDN:\n%s", err.Error())}
+ return
+ }
+ ret = LDAPDN(str)
+ return
+}
+
+func readTaggedLDAPDN(bytes *Bytes, class int, tag int) (ret LDAPDN, err error) {
+ var ldapstring LDAPString
+ ldapstring, err = readTaggedLDAPString(bytes, class, tag)
+ if err != nil {
+ err = LdapError{fmt.Sprintf("readTaggedLDAPDN:\n%s", err.Error())}
+ return
+ }
+ // @TODO: check RFC4514
+ ret = LDAPDN(ldapstring)
+ return
+}
+
+func (l LDAPDN) Pointer() *LDAPDN { return &l }
+
+func readRelativeLDAPDN(bytes *Bytes) (ret RelativeLDAPDN, err error) {
+ var ldapstring LDAPString
+ ldapstring, err = readLDAPString(bytes)
+ if err != nil {
+ err = LdapError{fmt.Sprintf("readRelativeLDAPDN:\n%s", err.Error())}
+ return
+ }
+ // @TODO: check RFC4514
+ ret = RelativeLDAPDN(ldapstring)
+ return
+}
+
+func (l LDAPDN) write(bytes *Bytes) int {
+ return LDAPString(l).write(bytes)
+}
+
+func (l LDAPDN) writeTagged(bytes *Bytes, class int, tag int) int {
+ return LDAPString(l).writeTagged(bytes, class, tag)
+}
+
+func (l LDAPDN) size() int {
+ return LDAPString(l).size()
+}
+
+func (l LDAPDN) sizeTagged(tag int) int {
+ return LDAPString(l).sizeTagged(tag)
+}