Giter VIP home page Giter VIP logo

openldap's Introduction

OpenLDAP

this is Openldap binding in GO language. I don't work any more with golang, so, please fork this project.

Installation :

Installation is easy and very quick, as you can see :

# install openldap library and devel packages
sudo apt-get install libldap libldap2-dev  # debian/ubuntu.
sudo urpmi openldap-devel # fedora, RH, ...

# install go
go get github.com/mqu/openldap

# verify you've got it :
(cd $GOPATH ; go list ./...) | grep openldap

Usage

  • Look a this exemple.
  • a more complex example making LDAP search that mimics ldapsearch command, printing out result on console.

Doc:

  • run go doc openldap,
  • will come soon, complete documentation in this Wiki.
  • look at _examples/*.go to see how to use this library.

Todo :

  • thread-safe test,
  • complete LDAP:GetOption() and LDAP:SetOption() method : now, they work only for integer values,
  • avoid using deprecated function (see LDAP_DEPRECATED flag and "// DEPRECATED" comments in *.go sources),
  • write some tests,
  • verify memory leaks (Valgrind),
  • support LDIF format (in, out),
  • add support for external commands (ldapadd, ldapdelete)
  • create an LDAP CLI (command line interface), like lftp, with commands like shell,
  • a nice GUI with GTK,
  • proxy, server,
  • what else ?

Links :

Licence :

Copyright (C) 2012 - Marc Quinton.

Use of this source code is governed by the MIT Licence : http://opensource.org/licenses/mit-license.php

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

openldap's People

Contributors

caoimhechaos avatar marcquinton avatar mqu 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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

openldap's Issues

go get github.com/mqu/openldap in mac os error

go get github.com/mqu/openldap
show error Cannot compile in OS X 10.11

/Users/wenhuazhang/GoProjects/src/github.com/mqu/openldap/add-modify-delete.go:48:9: warning: 'ldap_add_ext_s' is deprecated: first deprecated in OS X 10.11 - use OpenDirectory Framework [-Wdeprecated-declarations]
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/ldap.h:1160:1: note: 'ldap_add_ext_s' has been explicitly marked deprecated here
/Users/wenhuazhang/GoProjects/src/github.com/mqu/openldap/add-modify-delete.go:54:9: warning: 'ldap_modify_ext_s' is deprecated: first deprecated in OS X 10.11 - use OpenDirectory Framework [-Wdeprecated-declarations]
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/ldap.h:1430:1: note: 'ldap_modify_ext_s' has been explicitly marked deprecated here
/Users/wenhuazhang/GoProjects/src/github.com/mqu/openldap/add-modify-delete.go:60:9: warning: 'ldap_rename_s' is deprecated: first deprecated in OS X 10.11 - use OpenDirectory Framework [-Wdeprecated-declarations]
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/ldap.h:1467:1: note: 'ldap_rename_s' has been explicitly marked deprecated here
/Users/wenhuazhang/GoProjects/src/github.com/mqu/openldap/add-modify-delete.go:65:9: warning: 'ldap_mods_free' is deprecated: first deprecated in OS X 10.11 - use OpenDirectory Framework [-Wdeprecated-declarations]
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/ldap.h:2014:1: note: 'ldap_mods_free' has been explicitly marked deprecated here
/Users/wenhuazhang/GoProjects/src/github.com/mqu/openldap/add-modify-delete.go:166:23: warning: 'ldap_delete_s' is deprecated: first deprecated in OS X 10.10 - use ldap_delete_ext_s [-Wdeprecated-declarations]
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/ldap.h:1363:1: note: 'ldap_delete_s' has been explicitly marked deprecated here

github.com/mqu/openldap

/Users/wenhuazhang/GoProjects/src/github.com/mqu/openldap/openldap.go:86:23: warning: 'ldap_bind_s' is deprecated: first deprecated in OS X 10.10 - use ldap_sasl_bind_s [-Wdeprecated-declarations]
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/ldap.h:1275:1: note: 'ldap_bind_s' has been explicitly marked deprecated here
/Users/wenhuazhang/GoProjects/src/github.com/mqu/openldap/openldap.go:101:23: warning: 'ldap_initialize' is deprecated: first deprecated in OS X 10.11 - use OpenDirectory Framework [-Wdeprecated-declarations]
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/ldap.h:1541:1: note: 'ldap_initialize' has been explicitly marked deprecated here
/Users/wenhuazhang/GoProjects/src/github.com/mqu/openldap/openldap.go:123:23: warning: 'ldap_search_s' is deprecated: first deprecated in OS X 10.10 - use ldap_search_ext_s [-Wdeprecated-declarations]
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/ldap.h:1925:1: note: 'ldap_search_s' has been explicitly marked deprecated here
/Users/wenhuazhang/GoProjects/src/github.com/mqu/openldap/openldap.go:139:23: warning: 'ldap_start_tls_s' is deprecated: first deprecated in OS X 10.11 - use OpenDirectory Framework [-Wdeprecated-declarations]
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/ldap.h:1569:1: note: 'ldap_start_tls_s' has been explicitly marked deprecated here
/Users/wenhuazhang/GoProjects/src/github.com/mqu/openldap/openldap.go:153:23: warning: 'ldap_unbind' is deprecated: first deprecated in OS X 10.10 - use ldap_unbind_ext [-Wdeprecated-declarations]
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/ldap.h:1967:1: note: 'ldap_unbind' has been explicitly marked deprecated here

github.com/mqu/openldap

/Users/wenhuazhang/GoProjects/src/github.com/mqu/openldap/options-errors.go:71:42: warning: 'ldap_err2string' is deprecated: first deprecated in OS X 10.11 - use OpenDirectory Framework [-Wdeprecated-declarations]
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/ldap.h:1384:1: note: 'ldap_err2string' has been explicitly marked deprecated here
/Users/wenhuazhang/GoProjects/src/github.com/mqu/openldap/options-errors.go:88:23: warning: 'ldap_get_option' is deprecated: first deprecated in OS X 10.11 - use OpenDirectory Framework [-Wdeprecated-declarations]
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/ldap.h:978:1: note: 'ldap_get_option' has been explicitly marked deprecated here
/Users/wenhuazhang/GoProjects/src/github.com/mqu/openldap/options-errors.go:105:23: warning: 'ldap_set_option' is deprecated: first deprecated in OS X 10.11 - use OpenDirectory Framework [-Wdeprecated-declarations]
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/ldap.h:984:1: note: 'ldap_set_option' has been explicitly marked deprecated here

github.com/mqu/openldap

/Users/wenhuazhang/GoProjects/src/github.com/mqu/openldap/results.go:111:23: warning: 'ldap_count_entries' is deprecated: first deprecated in OS X 10.11 - use OpenDirectory Framework [-Wdeprecated-declarations]
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/ldap.h:1633:1: note: 'ldap_count_entries' has been explicitly marked deprecated here
/Users/wenhuazhang/GoProjects/src/github.com/mqu/openldap/results.go:126:23: warning: 'ldap_count_messages' is deprecated: first deprecated in OS X 10.11 - use OpenDirectory Framework [-Wdeprecated-declarations]
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/ldap.h:1588:1: note: 'ldap_count_messages' has been explicitly marked deprecated here
/Users/wenhuazhang/GoProjects/src/github.com/mqu/openldap/results.go:140:23: warning: 'ldap_count_values_len' is deprecated: first deprecated in OS X 10.11 - use OpenDirectory Framework [-Wdeprecated-declarations]
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/ldap.h:1826:1: note: 'ldap_count_values_len' has been explicitly marked deprecated here
/Users/wenhuazhang/GoProjects/src/github.com/mqu/openldap/results.go:155:42: warning: 'ldap_first_attribute' is deprecated: first deprecated in OS X 10.11 - use OpenDirectory Framework [-Wdeprecated-declarations]
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/ldap.h:1804:1: note: 'ldap_first_attribute' has been explicitly marked deprecated here
/Users/wenhuazhang/GoProjects/src/github.com/mqu/openldap/results.go:169:42: warning: 'ldap_first_entry' is deprecated: first deprecated in OS X 10.11 - use OpenDirectory Framework [-Wdeprecated-declarations]
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/ldap.h:1623:1: note: 'ldap_first_entry' has been explicitly marked deprecated here
/Users/wenhuazhang/GoProjects/src/github.com/mqu/openldap/results.go:183:42: warning: 'ldap_first_message' is deprecated: first deprecated in OS X 10.11 - use OpenDirectory Framework [-Wdeprecated-declarations]
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/ldap.h:1578:1: note: 'ldap_first_message' has been explicitly marked deprecated here
/Users/wenhuazhang/GoProjects/src/github.com/mqu/openldap/results.go:197:42: warning: 'ldap_get_dn' is deprecated: first deprecated in OS X 10.11 - use OpenDirectory Framework [-Wdeprecated-declarations]
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/ldap.h:1662:1: note: 'ldap_get_dn' has been explicitly marked deprecated here
/Users/wenhuazhang/GoProjects/src/github.com/mqu/openldap/results.go:212:42: warning: 'ldap_get_values_len' is deprecated: first deprecated in OS X 10.11 - use OpenDirectory Framework [-Wdeprecated-declarations]
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/ldap.h:1820:1: note: 'ldap_get_values_len' has been explicitly marked deprecated here
/Users/wenhuazhang/GoProjects/src/github.com/mqu/openldap/results.go:226:23: warning: 'ldap_msgfree' is deprecated: first deprecated in OS X 10.11 - use OpenDirectory Framework [-Wdeprecated-declarations]
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/ldap.h:1869:1: note: 'ldap_msgfree' has been explicitly marked deprecated here
/Users/wenhuazhang/GoProjects/src/github.com/mqu/openldap/results.go:241:42: warning: 'ldap_next_attribute' is deprecated: first deprecated in OS X 10.11 - use OpenDirectory Framework [-Wdeprecated-declarations]
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/ldap.h:1810:1: note: 'ldap_next_attribute' has been explicitly marked deprecated here
/Users/wenhuazhang/GoProjects/src/github.com/mqu/openldap/results.go:255:42: warning: 'ldap_next_entry' is deprecated: first deprecated in OS X 10.11 - use OpenDirectory Framework [-Wdeprecated-declarations]
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/ldap.h:1628:1: note: 'ldap_next_entry' has been explicitly marked deprecated here
/Users/wenhuazhang/GoProjects/src/github.com/mqu/openldap/results.go:269:42: warning: 'ldap_next_message' is deprecated: first deprecated in OS X 10.11 - use OpenDirectory Framework [-Wdeprecated-declarations]
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/ldap.h:1583:1: note: 'ldap_next_message' has been explicitly marked deprecated here
/Users/wenhuazhang/GoProjects/src/github.com/mqu/openldap/results.go:287:23: warning: 'ldap_result' is deprecated: first deprecated in OS X 10.11 - use OpenDirectory Framework [-Wdeprecated-declarations]
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/ldap.h:1853:1: note: 'ldap_result' has been explicitly marked deprecated here
/Users/wenhuazhang/GoProjects/src/github.com/mqu/openldap/results.go:298:2: warning: 'ldap_value_free_len' is deprecated: first deprecated in OS X 10.11 - use OpenDirectory Framework [-Wdeprecated-declarations]
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/ldap.h:1830:1: note: 'ldap_value_free_len' has been explicitly marked deprecated here

Close() causes SIGABRT after failing Bind()

If a call to Bind() fails a later call to Close() on the Ldap object causes SIGABRT. I see that Bind() sets self.conn = nil if the ldap_bind_s() call is not successful; why does it do that?

Assertion failed: (ld != NULL), function ldap_unbind_ext, file unbind.c, line 49.
SIGABRT: abort
PC=0x7fff963fc866
signal arrived during cgo execution

runtime.cgocall(0x40016e0, 0x427dd48)
    /usr/local/go/src/pkg/runtime/cgocall.c:149 +0x11b fp=0x427dd30
github.com/mqu/openldap._Cfunc_ldap_unbind(0x0, 0x0)
    github.com/mqu/openldap/_obj/_cgo_defun.c:294 +0x31 fp=0x427dd48
github.com/mqu/openldap.(*Ldap).Close(0xc210000020, 0xf, 0x427df00)
    /Users/fcy/go/src/github.com/mqu/openldap/openldap.go:134 +0x35 fp=0x427dde8
main.main()
    /Users/fcy/go/src/github.com/fredcy/examples/ldap/main.go:41 +0x676 fp=0x427df48
runtime.main()
    /usr/local/go/src/pkg/runtime/proc.c:220 +0x11f fp=0x427dfa0
runtime.goexit()
    /usr/local/go/src/pkg/runtime/proc.c:1394 fp=0x427dfa8

goroutine 3 [syscall]:
runtime.goexit()
    /usr/local/go/src/pkg/runtime/proc.c:1394

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.