summaryrefslogtreecommitdiffstats
path: root/sc-ap
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2013-04-15 16:34:09 -0500
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2013-04-15 16:34:09 -0500
commit2a8d25d3bd5a4e33e44ca13c0b7903fa76e64711 (patch)
treea2d07a949da4a72087f476de18d9b6dca5845f82 /sc-ap
parent760c8abb53c8f4fd61eaafd9d4f7324e805dd220 (diff)
downloadwindows-ldap-integration-2a8d25d3bd5a4e33e44ca13c0b7903fa76e64711.tar.gz
windows-ldap-integration-2a8d25d3bd5a4e33e44ca13c0b7903fa76e64711.zip
Add registry permissions set utility
Fix crash on Windows XP
Diffstat (limited to 'sc-ap')
-rwxr-xr-xsc-ap/manageUser.cpp1
-rwxr-xr-xsc-ap/sspap3.cpp28
-rwxr-xr-xsc-ap/sspap3.sln14
3 files changed, 36 insertions, 7 deletions
diff --git a/sc-ap/manageUser.cpp b/sc-ap/manageUser.cpp
index 017f355..6f1c38f 100755
--- a/sc-ap/manageUser.cpp
+++ b/sc-ap/manageUser.cpp
@@ -20,6 +20,7 @@
*/
#include <algorithm>
+#include <iterator>
#include "ldapuser.h"
#include "netusergroup.h"
#include "utility.h"
diff --git a/sc-ap/sspap3.cpp b/sc-ap/sspap3.cpp
index ab16ef0..a44e398 100755
--- a/sc-ap/sspap3.cpp
+++ b/sc-ap/sspap3.cpp
@@ -166,6 +166,19 @@ extern "C" {
#endif // ENABLE_DEBUG
#endif // ENABLE_LSA_LOG
+ // Windows XP and Windows Vista/above use two different storage schemes for the user data
+ OSVERSIONINFO osvi;
+ BOOL bIsWindowsVistaorLater;
+
+ ZeroMemory(&osvi, sizeof(OSVERSIONINFO));
+ osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
+
+ GetVersionEx(&osvi);
+
+ bIsWindowsVistaorLater =
+ ( (osvi.dwMajorVersion > 6) ||
+ ( (osvi.dwMajorVersion == 6) && (osvi.dwMinorVersion >= 0) ));
+
KERB_INTERACTIVE_LOGON *ptr = ((KERB_INTERACTIVE_LOGON *)AuthenticationInformation);
#ifdef ENABLE_LSA_LOG
@@ -195,9 +208,18 @@ extern "C" {
LPWSTR password = (LPWSTR) calloc( ptr->Password.Length + 1, sizeof(wchar_t));
if (userName && domain) {
- memcpy( userName, (void*)((intptr_t)(ptr) + (intptr_t)(ptr->UserName.Buffer)), ptr->UserName.Length);
- memcpy( domain, (void*)((intptr_t)(ptr) + (intptr_t)(ptr->LogonDomainName.Buffer)), ptr->LogonDomainName.Length);
- memcpy( password, (void*)((intptr_t)(ptr) + (intptr_t)(ptr->Password.Buffer)), ptr->Password.Length);
+ if (bIsWindowsVistaorLater) {
+ // Windows Vista or later
+ memcpy( userName, (void*)((intptr_t)(ptr) + (intptr_t)(ptr->UserName.Buffer)), ptr->UserName.Length);
+ memcpy( domain, (void*)((intptr_t)(ptr) + (intptr_t)(ptr->LogonDomainName.Buffer)), ptr->LogonDomainName.Length);
+ memcpy( password, (void*)((intptr_t)(ptr) + (intptr_t)(ptr->Password.Buffer)), ptr->Password.Length);
+ }
+ else {
+ // Windows XP or earlier
+ wcsncpy( userName, (wchar_t *) ((char *) ptr + ((char *)ptr->UserName.Buffer - (char *) ClientAuthenticationBase)), ptr->UserName.Length / 2);
+ wcsncpy( domain, (wchar_t *) ((char *) ptr + ((char *)ptr->LogonDomainName.Buffer - (char *) ClientAuthenticationBase)), ptr->LogonDomainName.Length / 2);
+ //wcsncpy( password, (wchar_t *) ((char *) ptr + ((char *)ptr->Password.Buffer - (char *) ClientAuthenticationBase)), ptr->Password.Length / 2);
+ }
userName[ptr->UserName.Length] = L'\0';
domain[ptr->LogonDomainName.Length] = L'\0';
diff --git a/sc-ap/sspap3.sln b/sc-ap/sspap3.sln
index 51074dd..8d434c8 100755
--- a/sc-ap/sspap3.sln
+++ b/sc-ap/sspap3.sln
@@ -1,17 +1,23 @@
-Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio 2012
+Microsoft Visual Studio Solution File, Format Version 11.00
+# Visual Studio 2010
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sspap3", "sspap3.vcxproj", "{EA164A0F-6361-40D6-B356-B6E16EB9FA15}"
EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sspap3registrypermissions", "..\sspap3registrypermissions\sspap3registrypermissions.vcxproj", "{9BCBC2A2-62A2-4613-B61F-E7477CE0A487}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {EA164A0F-6361-40D6-B356-B6E16EB9FA15}.Debug|Win32.ActiveCfg = Debug|Win32
- {EA164A0F-6361-40D6-B356-B6E16EB9FA15}.Debug|Win32.Build.0 = Debug|Win32
+ {EA164A0F-6361-40D6-B356-B6E16EB9FA15}.Debug|Win32.ActiveCfg = Release|Win32
+ {EA164A0F-6361-40D6-B356-B6E16EB9FA15}.Debug|Win32.Build.0 = Release|Win32
{EA164A0F-6361-40D6-B356-B6E16EB9FA15}.Release|Win32.ActiveCfg = Release|Win32
{EA164A0F-6361-40D6-B356-B6E16EB9FA15}.Release|Win32.Build.0 = Release|Win32
+ {9BCBC2A2-62A2-4613-B61F-E7477CE0A487}.Debug|Win32.ActiveCfg = Release|Win32
+ {9BCBC2A2-62A2-4613-B61F-E7477CE0A487}.Debug|Win32.Build.0 = Release|Win32
+ {9BCBC2A2-62A2-4613-B61F-E7477CE0A487}.Release|Win32.ActiveCfg = Release|Win32
+ {9BCBC2A2-62A2-4613-B61F-E7477CE0A487}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE