Skip to content

Commit

Permalink
2.9.160
Browse files Browse the repository at this point in the history
  • Loading branch information
Bureau Audit committed Dec 1, 2020
1 parent 698cd53 commit de12fb1
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 59 deletions.
46 changes: 8 additions & 38 deletions Filters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
extern HANDLE g_hHeap;
extern BOOL g_bSupportsAnsi;

#define NEVER_VALUE 9223372036854775808
#define NEVER_VALUE_1 9223372036854775807 // cf. https://docs.microsoft.com/en-us/windows/win32/adschema/a-accountexpires
#define NEVER_VALUE_2 9223372036854775808
#define STR_UNABLE_CONVERT_SID L"Unable to convert SID"
#define STR_NEVER L"Never"

Expand Down Expand Up @@ -289,8 +290,10 @@ pFilterFiletime (

llValue = *(PLONGLONG)pvData;

if (llValue == 0)
if (llValue <= 0)
*szResult = NULL;
else if ((llValue == NEVER_VALUE_1) || (llValue == NEVER_VALUE_2))
*szResult = pHeapAllocAndCopyString(STR_NEVER);
else
{
LONGLONG llDay;
Expand All @@ -312,10 +315,10 @@ pFilterFiletime (
lSecond = (LONG)(llValue / 60);
llValue = llValue - ((LONGLONG)lSecond * 60);

*szResult = (LPWSTR)_HeapAlloc(15 * sizeof(WCHAR));
*szResult = (LPWSTR)_HeapAlloc((25 + 1) * sizeof(WCHAR));
if (*szResult != NULL)
{
swprintf_s(*szResult, 15, L"%llu:%02u:%02u:%02u", llDay, lHour, lMinute, lSecond);
swprintf_s(*szResult, 25, L"%llu:%02u:%02u:%02u", llDay, lHour, lMinute, lSecond);
}
}

Expand All @@ -333,41 +336,8 @@ pFilterNegFiletime (

LONGLONG llValue;

*szResult = NULL;

llValue = -(*(PLONGLONG)pvData);

if (llValue == 0)
*szResult = NULL;
else if (llValue == NEVER_VALUE)
*szResult = pHeapAllocAndCopyString(STR_NEVER);
else
{
LONGLONG llDay;
LONG lHour;
LONG lMinute;
LONG lSecond;

llValue = llValue / 10000000;

llDay = llValue / 86400;
llValue = llValue - (llDay * 86400);

lHour = (LONG)(llValue / 3600);
llValue = llValue - ((LONGLONG)lHour * 3600);

lMinute = (LONG)(llValue / 60);
llValue = llValue - ((LONGLONG)lMinute * 60);

lSecond = (LONG)(llValue / 60);
llValue = llValue - ((LONGLONG)lSecond * 60);

*szResult = (LPWSTR)_HeapAlloc(15 * sizeof(WCHAR));
if (*szResult != NULL)
{
swprintf_s(*szResult, 15, L"%llu:%02u:%02u:%02u", llDay, lHour, lMinute, lSecond);
}
}
pFilterFiletime(&llValue, pvParam, szResult);

return TRUE;
}
Expand Down
40 changes: 26 additions & 14 deletions LDAP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -887,24 +887,36 @@ LdapProcessRequest (
{
ppval = ldap_get_values_len(pLdapHandle, pEntry, pAttribute);

if (ppval)
if (ppval != NULL)
{
LPWSTR szSid;
DWORD dwTotalSize = 0;
ULONG ulValues;

bResult = ConvertSidToStringSid(ppval[0]->bv_val, &szSid);
if (bResult == TRUE)
{
_CallWriteAndGetMax(BufferWrite(pBuffer, szSid), pRequest->pdwStringMaxLength[j]);
LocalFree(szSid);
}
else
ulValues = ldap_count_values_len(ppval);

for (ULONG k = 0; k < ulValues; k++)
{
Log(
__FILE__, __FUNCTION__, __LINE__, LOG_LEVEL_ERROR,
"[!] %sUnable to convert SID.%s",
COLOR_RED, COLOR_RESET
);
LPWSTR szSid;

if (k != 0)
dwTotalSize += BufferWriteSemicolon(pBuffer);

bResult = ConvertSidToStringSid(ppval[k]->bv_val, &szSid);
if (bResult == TRUE)
{
dwTotalSize += BufferWrite(pBuffer, szSid);
LocalFree(szSid);
}
else
{
Log(
__FILE__, __FUNCTION__, __LINE__, LOG_LEVEL_ERROR,
"[!] %sUnable to convert SID.%s",
COLOR_RED, COLOR_RESET
);
}
}
pRequest->pdwStringMaxLength[j] = __max(pRequest->pdwStringMaxLength[j], dwTotalSize);
}
}
break;
Expand Down
Binary file modified ORADAD.rc
Binary file not shown.
14 changes: 7 additions & 7 deletions oradad-schema.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1371,7 +1371,7 @@
<attribute name="msDS-HABSeniorityIndex" level="9" type="INT" />
<attribute name="msDS-HasDomainNCs" level="2" type="STRS" />
<attribute name="msDS-hasFullReplicaNCs" level="1" type="STRS" />
<attribute name="msDS-HasInstantiatedNCs" level="2" type="STR" />
<attribute name="msDS-HasInstantiatedNCs" level="2" type="STRS" />
<attribute name="msDS-hasMasterNCs" level="2" type="STRS" />
<attribute name="msDS-HostServiceAccount" level="2" type="STRS" />
<attribute name="msDS-HostServiceAccountBL" level="1" type="STRS" />
Expand Down Expand Up @@ -2200,12 +2200,12 @@
<attribute name="msExchEventHistoryRetentionPeriod" level="9" type="INT" />
<attribute name="msExchEvictedMembersLink" level="9" type="STRS" />
<attribute name="msExchEvictedMemebersBL" level="9" type="STRS" />
<attribute name="msExchEwsApplicationAccessPolicy" level="9" type="INT" />
<attribute name="msExchEwsEnabled" level="9" type="INT" />
<attribute name="msExchEwsExceptions" level="9" type="STRS" />
<attribute name="msExchEwsApplicationAccessPolicy" level="3" type="INT" />
<attribute name="msExchEwsEnabled" level="3" type="INT" />
<attribute name="msExchEwsExceptions" level="3" type="STRS" />
<attribute name="msExchEWSThrottlingPolicyState" level="9" type="STR" />
<attribute name="msExchEWSThrottlingPolicyStateEx" level="9" type="STR" />
<attribute name="msExchEwsWellKnownApplicationPolicies" level="9" type="STRS" />
<attribute name="msExchEwsWellKnownApplicationPolicies" level="3" type="STRS" />
<attribute name="msExchExchangeHelpAppOnline" level="9" type="BOOL" />
<attribute name="msExchExchangeRPCServiceArrayBL" level="9" type="STRS" />
<attribute name="msExchExchangeRPCServiceArrayLink" level="9" type="STR" />
Expand Down Expand Up @@ -3066,7 +3066,7 @@
<attribute name="msExchPrivacyStatementURLEnabled" level="9" type="BOOL" />
<attribute name="pRMD" level="9" type="STR" />
<attribute name="msExchProcessedSids" level="9" type="SID" />
<attribute name="msExchProductID" level="9" type="STR" />
<attribute name="msExchProductID" level="3" type="STR" />
<attribute name="promoExpiration" level="9" type="DATE" />
<attribute name="msExchPromptPublishingPoint" level="9" type="STR" />
<attribute name="protocolSettings" level="3" type="STRS" />
Expand Down Expand Up @@ -11750,4 +11750,4 @@
<attribute name="pager" />
</class>
</classes>
</schema>
</schema>

0 comments on commit de12fb1

Please sign in to comment.