Commit Graph
18 Commits
Author SHA1 Message Date
timmy 0446af3e70 Add a connection level context 2026-08-25 14:48:54 -07:00
timmy f8adba666d Ensure potential panic is handled in close functions 2026-08-25 14:48:54 -07:00
timmy 75ae796156 Allow sending an error message with the ldap response
Cleanup interfaces and allow the errorMessage ldap field to be used

Use the correct ldap server-side error code
LDAPResultNotSupported(92) is for a client side error
LDAPResultUnavailable(52) is for when a subsystem is not available
LDAPResultOther(80) is for generic server errors

Provide better errors

Fix binding dn to connection

Fix tests

Make handleSearchRequest conform to rfc4511
2026-08-25 14:48:53 -07:00
timmy e0d54e0800 Add a server context instead of a public quit channel 2026-08-25 14:21:16 -07:00
timmy ee905451dc Simplify encodeProtocolErrorResponse usage 2026-08-24 18:04:45 -07:00
timmy d56912c7af Simplify early returns 2026-08-24 18:04:45 -07:00
timmy 93ce6da943 Stricter error handling 2026-08-24 18:04:45 -07:00
timmy 928eb6c5e6 Fix stats mutex being copied 2026-08-24 18:04:45 -07:00
timmy a03b89f9be Rename package to ldaps 2026-08-24 16:30:01 -07:00
timmy a4b5f16b98 Minimal set of changes to remove client and use upstream ldap package
Switches to github.com/go-ldap/ldap/v3 for ldap management as it generally
 has better practices and security
2026-08-24 16:29:16 -07:00
Chris F Ravenscroft 34c5f9b3cb Harden LDAP control decoding against malformed BER input (#6)
* Harden LDAP control decoding against malformed BER input

Change DecodeControl to return (Control, error) and validate control structure and value types instead of relying on unchecked access.
Handle decode failures on both server and client paths, returning protocol errors for bad request controls and surfacing response decode errors.

* fix: top-level recover() and fix missing TLSConfig check

* chore: verify fix
2026-07-18 13:29:43 -07:00
Alessandro Cabbia 1f14f5c1b4 Address panic when client starts a StartTLS connection but server is not configured to accept (#4)
* fix: don't start TLS connection if TLSConfig is nil

addresses and closes https://github.com/glauth/glauth/issues/389

* deps: update asn1-ber
2024-04-19 10:15:21 -07:00
Chris F Ravenscroft 53c26f3f5e feat: support paging (#3) 2024-03-23 17:03:53 -07:00
b9bf4d1baf Start tls by @shipperizer (#1)
* switch nmcclain/asn1-ber to go-asn1-ber/and1-ber.
This newer package has ben updated with tests, and looks to actually be supported.
It is also is a forked version of nmcclain/asn1-ber, so supports the same API.

* no need to print errors if client disconnects early and unexpectedly

* added in Close method on server to avoid a race condition

* test ssl certs are untrusted, ldapsearch needs to be told to allow untrusted certs

* Extra time.Wait causes the test to fail

* removed singaling with a custom quit chanel

* feat: support StartTLS in server

* lint: fmt and imports

* feat: rename library to be used by glauth

* chore: renamed packages

---------

Co-authored-by: Daniel Barney <daniel@thoughtplot.io>
Co-authored-by: Mark Rushakoff <mark@influxdata.com>
Co-authored-by: shipperizer <alexcabb@gmail.com>
2023-12-10 14:58:23 -08:00
wxiaoguang 7f8d1e44ee strings in LDAP are case-insensitive (#8)
Thank you @wxiaoguang !

* strings in LDAP are case-insensitive

* optmize routeFunc (faster, case-insensitive)

* small optimiztion to routeFunc

* request the directory server to return operational attributes by adding + (the plus sign) in your ldapsearch command.

* request the directory server to return operational attributes by adding + (the plus sign) in your ldapsearch command.

* request the directory server to return operational attributes by adding + (the plus sign) in your ldapsearch command.

* remove operational attributes
2021-07-20 10:27:43 -06:00
dirkm ee4388c038 make serve function public (#4)
* make serve function public

* make Dn public

* make attrs public
2019-07-03 12:23:29 -06:00
ned c43d537d5b Implemented other LDAP server operations (add/delete/modify/extended/etc.) and tests. 2014-11-23 12:03:05 -07:00
ned f4e67fa4cd LDAP server support 2014-11-12 14:52:16 -07:00