aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/gopkg.in/ldap.v3/compare.go
diff options
context:
space:
mode:
author6543 <6543@obermui.de>2020-10-15 21:27:33 +0200
committerGitHub <noreply@github.com>2020-10-15 15:27:33 -0400
commite374bb7e2dede03eeacaec376c8fbb3c05d07a25 (patch)
treed946047c3c62ee57be2ed13f0e0bebf5f19bc021 /vendor/gopkg.in/ldap.v3/compare.go
parentbcf45bb162e50554a09b9735cf966f8679595b09 (diff)
downloadgitea-e374bb7e2dede03eeacaec376c8fbb3c05d07a25.tar.gz
gitea-e374bb7e2dede03eeacaec376c8fbb3c05d07a25.zip
[Vendor] Update go-ldap to v3.2.4 (#13163)
* [Vendor] update go-ldap to v3.0.3 * update go-ldap to v3.2.4 Co-authored-by: techknowlogick <techknowlogick@gitea.io>
Diffstat (limited to 'vendor/gopkg.in/ldap.v3/compare.go')
-rw-r--r--vendor/gopkg.in/ldap.v3/compare.go83
1 files changed, 0 insertions, 83 deletions
diff --git a/vendor/gopkg.in/ldap.v3/compare.go b/vendor/gopkg.in/ldap.v3/compare.go
deleted file mode 100644
index 5b5013cbed..0000000000
--- a/vendor/gopkg.in/ldap.v3/compare.go
+++ /dev/null
@@ -1,83 +0,0 @@
-// File contains Compare functionality
-//
-// https://tools.ietf.org/html/rfc4511
-//
-// CompareRequest ::= [APPLICATION 14] SEQUENCE {
-// entry LDAPDN,
-// ava AttributeValueAssertion }
-//
-// AttributeValueAssertion ::= SEQUENCE {
-// attributeDesc AttributeDescription,
-// assertionValue AssertionValue }
-//
-// AttributeDescription ::= LDAPString
-// -- Constrained to <attributedescription>
-// -- [RFC4512]
-//
-// AttributeValue ::= OCTET STRING
-//
-
-package ldap
-
-import (
- "errors"
- "fmt"
-
- "gopkg.in/asn1-ber.v1"
-)
-
-// Compare checks to see if the attribute of the dn matches value. Returns true if it does otherwise
-// false with any error that occurs if any.
-func (l *Conn) Compare(dn, attribute, value string) (bool, error) {
- packet := ber.Encode(ber.ClassUniversal, ber.TypeConstructed, ber.TagSequence, nil, "LDAP Request")
- packet.AppendChild(ber.NewInteger(ber.ClassUniversal, ber.TypePrimitive, ber.TagInteger, l.nextMessageID(), "MessageID"))
-
- request := ber.Encode(ber.ClassApplication, ber.TypeConstructed, ApplicationCompareRequest, nil, "Compare Request")
- request.AppendChild(ber.NewString(ber.ClassUniversal, ber.TypePrimitive, ber.TagOctetString, dn, "DN"))
-
- ava := ber.Encode(ber.ClassUniversal, ber.TypeConstructed, ber.TagSequence, nil, "AttributeValueAssertion")
- ava.AppendChild(ber.NewString(ber.ClassUniversal, ber.TypePrimitive, ber.TagOctetString, attribute, "AttributeDesc"))
- ava.AppendChild(ber.Encode(ber.ClassUniversal, ber.TypePrimitive, ber.TagOctetString, value, "AssertionValue"))
- request.AppendChild(ava)
- packet.AppendChild(request)
-
- l.Debug.PrintPacket(packet)
-
- msgCtx, err := l.sendMessage(packet)
- if err != nil {
- return false, err
- }
- defer l.finishMessage(msgCtx)
-
- l.Debug.Printf("%d: waiting for response", msgCtx.id)
- packetResponse, ok := <-msgCtx.responses
- if !ok {
- return false, NewError(ErrorNetwork, errors.New("ldap: response channel closed"))
- }
- packet, err = packetResponse.ReadPacket()
- l.Debug.Printf("%d: got response %p", msgCtx.id, packet)
- if err != nil {
- return false, err
- }
-
- if l.Debug {
- if err := addLDAPDescriptions(packet); err != nil {
- return false, err
- }
- ber.PrintPacket(packet)
- }
-
- if packet.Children[1].Tag == ApplicationCompareResponse {
- err := GetLDAPError(packet)
-
- switch {
- case IsErrorWithCode(err, LDAPResultCompareTrue):
- return true, nil
- case IsErrorWithCode(err, LDAPResultCompareFalse):
- return false, nil
- default:
- return false, err
- }
- }
- return false, fmt.Errorf("unexpected Response: %d", packet.Children[1].Tag)
-}