Skip to content

Commit cb436b4

Browse files
authored
🐛 Only return Directory Server Entry object if explicitly requested (#10)
Ensure we return the Directory Server Entry (DSE) when the requested DN is the empty DN and the scope is for a base object (not a tree). The Directory Server Entry (DSE) is the root of the DB and contains server/service oriented information, not user data. This should only be returned when explicitly requested by requesting the empty DN and requesting just a base object (not a tree). Previously we could get the DSE based on a search for a DN that is a parent of the root data entry and we'd return that. Pull-request: #10
1 parent 4a27bfd commit cb436b4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

server.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ func (s *Server) handleSearch(w *gldap.ResponseWriter, r *gldap.Request) {
104104
return
105105
}
106106
base := s.db.DIT.Find(baseDN)
107-
if base == nil || (base.Entry.DN.IsEmpty() && req.Scope != gldap.BaseObject) {
107+
if base == nil || (baseDN.IsEmpty() && req.Scope != gldap.BaseObject) {
108108
slog.Error("basedn not found", "method", "search", "basedn", baseDN.String())
109109
resp.SetResultCode(gldap.ResultNoSuchObject)
110110
return

0 commit comments

Comments
 (0)