Giter Site home page Giter Site logo

ldap's Introduction

GoDoc Build Status

Basic LDAP v3 functionality for the GO programming language.

Install

For the latest version use:

go get gopkg.in/ldap.v2

Import the latest version with:

import "gopkg.in/ldap.v2"

Required Libraries:

  • gopkg.in/asn1-ber.v1

Features:

  • Connecting to LDAP server (non-TLS, TLS, STARTTLS)
  • Binding to LDAP server
  • Searching for entries
  • Filter Compile / Decompile
  • Paging Search Results
  • Modify Requests / Responses
  • Add Requests / Responses
  • Delete Requests / Responses

Examples:

  • search
  • modify

Contributing:

Bug reports and pull requests are welcome!

Before submitting a pull request, please make sure tests and verification scripts pass:

make all

To set up a pre-push hook to run the tests and verify scripts before pushing:

ln -s ../../.githooks/pre-push .git/hooks/pre-push

The Go gopher was designed by Renee French. (http://reneefrench.blogspot.com/) The design is licensed under the Creative Commons 3.0 Attributions license. Read this article for more details: http://blog.golang.org/gopher

ldap's People

Contributors

adunham-stripe avatar bestiancode avatar blakewedwards avatar bluecmd avatar bollenberger avatar deoxxa avatar donhcd avatar hochhaus avatar ianwoolf avatar jlhawn avatar johnweldon avatar judwhite avatar liggitt avatar marcsauter avatar mikkolehtisalo avatar mmitton avatar mzimmerman avatar nohupped avatar pnelson avatar qjcg avatar samuel avatar sgotti avatar stevekuznetsov avatar tiziano88 avatar trestletech avatar vanackere avatar vbatoufflet avatar vetinari avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ldap's Issues

Invalid filter packets created for basic search

When I attempt a simple search as follows:

req := ldap.NewSearchRequest(
    "",
    ldap.ScopeBaseObject,
    ldap.DerefFindingBaseObj,
    0,                          // SizeLimit
    0,                          // TimeLimit
    false,                      // TypesOnly
    "(objectClass=*)",          // Filter
    []string{"rootDomainNamingContext"},
    nil,
)
res,err := conn.Search(req)

The server rejects the request. This is because the Go library is apparently generating invalid filter request packets, as detailed in this post on StackExchange: http://stackoverflow.com/q/27022146/13860

"Message Result chan not found" on the 128th request

I have a strange error - I have a few hundred queries to run, each only differing in the basedn used. Every time I run the app, the 128th query fails with the same message:

Sending message 128
Receiving message 4294967168
Message Result chan not found (possible Abandon), MessageID: 4294967168

Every message before this succeeds, and I can confirm by seeing

MessageID: 127, ok: true
...
Sending message 127
Receiving message 127
...

I'm happy to send more information if needed, but does this give you any idea why the 128th query fails?

SCRAM-SHA-1(-PLUS) + SCRAM-SHA-256(-PLUS) + SCRAM-SHA-512(-PLUS) + SCRAM-SHA3-512(-PLUS) supports

Dear @mmitton,

In first, I wish you a Happy New Year!

Can you add supports of :

  • SCRAM-SHA-1
  • SCRAM-SHA-1-PLUS
  • SCRAM-SHA-256
  • SCRAM-SHA-256-PLUS
  • SCRAM-SHA-512
  • SCRAM-SHA-512-PLUS
  • SCRAM-SHA3-512
  • SCRAM-SHA3-512-PLUS

"When using the SASL SCRAM mechanism, the SCRAM-SHA-256-PLUS variant SHOULD be preferred over the SCRAM-SHA-256 variant, and SHA-256 variants [RFC7677] SHOULD be preferred over SHA-1 variants [RFC5802]".

https://xmpp.org/extensions/inbox/hash-recommendations.html

-PLUS variants:

LDAP:

  • RFC5803: Lightweight Directory Access Protocol (LDAP) Schema for Storing Salted: Challenge Response Authentication Mechanism (SCRAM) Secrets: https://tools.ietf.org/html/rfc5803

HTTP:

2FA:

IANA:

Linked to:

go get fails for go1.2rc2

github.com/mmitton/asn1-ber

../../../Workspaces/go/src/github.com/mmitton/asn1-ber/ber.go:170: undefined: os.Error
../../../Workspaces/go/src/github.com/mmitton/asn1-ber/ber.go:183: undefined: os.Error
../../../Workspaces/go/src/github.com/mmitton/asn1-ber/ber.go:386: undefined: reflect.NewValue

conn.go's bug

conn.go at line 304 ,have many go routines is a bug.

it happens to a close channel to write

Search returns each result twice?

I seem to be getting each search result twice when querying Active Directory. Haven't dug into debugging yet. Any ideas?

I have some code like this:

  fmt.Printf("TestSearch: %s -> num of entries = %d\n", search_request.Filter, len(sr.Entries))
  for idx, entry := range sr.Entries {
    fmt.Printf("    %4d - entry: %+v\n", idx, entry)
  }

The output looks like this:

TestSearch: (objectClass=user) -> num of entries = 579
       0 - entry: &{DN:CN=Kanye West Attributes:[0xc2081b2420 0xc2081b2450]}
       1 - entry: &{DN:CN=Kanye West Attributes:[0xc2081b24b0 0xc2081b24e0]}
       2 - entry: &{DN:CN=Alicia Keys Attributes:[0xc2081b3140 0xc2081b3170]}
       3 - entry: &{DN:CN=Alicia Keys Attributes:[0xc2081b31d0 0xc2081b3200]}
...

panic: runtime error: send on closed channel

I'm building a web-application that uses an LDAP server for authentication.

All the server needs to do is login using the LDAP server, no authorizations are made beyond that.

When I use the library to login once, it works fine, however, on a second try, it will panic.

A very minimal example that reproduces this problem is:

package main

import (
    "fmt"
    "github.com/mmitton/ldap"
    "log"
)

const (
    ADDR   = "WWWW"
    DOMAIN = "XXXX"
    USER   = "YYYY"
    PASS   = "ZZZZ"
)

func main() {
    fmt.Println("Try 1...")
    doLDAP()

    fmt.Println("\nTry 2...")
    doLDAP()
}

func doLDAP() {
    conn, err := ldap.Dial("tcp", ADDR)
    if err != nil {
        log.Fatal(err)
    }
    defer conn.Close()

    fmt.Println("Connected successfully")

    err = conn.Bind(DOMAIN+"\\"+USER, PASS)
    if err != nil {
        log.Fatal(err)
    }

    fmt.Println("Logged in successfully")
}

Note that the constants are modified to working values for the LDAP server I am using.

The output is:

Try 1...
Connected successfully
Logged in successfully

Try 2...
closeAllChannels
panic: runtime error: send on closed channel

goroutine 25 [running]:
runtime.panic(0x5cd8e0, 0x71b19e)
    /tmp/go/src/pkg/runtime/panic.c:279 +0xf5
github.com/mmitton/ldap.func·003()
    /home/zeal/go/src/github.com/mmitton/ldap/conn.go:299 +0x4c
created by github.com/mmitton/ldap.(*Conn).sendProcessMessage
    /home/zeal/go/src/github.com/mmitton/ldap/conn.go:299 +0xa0

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.