Skip to content

Commit 2de1dca

Browse files
authored
Merge pull request #1346 from Blazam-App/deps
Improve LDAP null safety and update project version
2 parents ca618bf + f393462 commit 2de1dca

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

BLAZAM/BLAZAM.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<ImplicitUsings>enable</ImplicitUsings>
77
<ServerGarbageCollection>false</ServerGarbageCollection>
88
<AssemblyVersion>1.5.2</AssemblyVersion>
9-
<Version>2026.02.26.0132</Version>
9+
<Version>2026.02.26.0141</Version>
1010
<IncludeSourceRevisionInInformationalVersion>false</IncludeSourceRevisionInInformationalVersion>
1111
<RootNamespace>BLAZAM</RootNamespace>
1212
<GenerateDocumentationFile>True</GenerateDocumentationFile>

BLAZAMActiveDirectory/Adapters/LdapDirectoryEntry.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -401,13 +401,12 @@ private void GetNamingContext()
401401
// First, find the schema naming context
402402
var rootDseRequest = new SearchRequest("", "(objectClass=*)",SearchScope.Base, "schemaNamingContext");
403403
var rootDseResponse = SendRequestAndGetResponse<SearchResponse>(rootDseRequest);
404-
if (rootDseResponse?.Entries.Count == 0)
404+
if (rootDseResponse==null || rootDseResponse.Entries.Count == 0)
405405
{
406406
throw new AppException("Could not read RootDSE to find schema naming context.");
407407
}
408-
string schemaNamingContext = rootDseResponse.Entries[0].Attributes["schemaNamingContext"][0].ToString();
409408

410-
_namingContextCache = schemaNamingContext;
409+
_namingContextCache = rootDseResponse.Entries[0].Attributes["schemaNamingContext"][0].ToString()??String.Empty;
411410
}
412411
}
413412
}
@@ -742,7 +741,7 @@ public void CommitChanges()
742741
}
743742
else
744743
{
745-
throw new DirectoryException($"Failed to create entry. LDAP Error: {response.ResultCode} - {response.ErrorMessage}");
744+
throw new DirectoryException($"Failed to create entry. LDAP Error: {response?.ResultCode} - {response?.ErrorMessage}");
746745
}
747746
}
748747
}

0 commit comments

Comments
 (0)