This commit is contained in:
		| @@ -39,7 +39,7 @@ CasaStatus SSCS_CALL | ||||
| AuthTokenIf_GetAuthToken( | ||||
|    IN       const void  *pIfInstance, | ||||
|    IN       const char  *pContext, | ||||
|    IN       char        *pMechInfo, | ||||
|    IN       const char  *pMechInfo, | ||||
|    IN       const char  *pHostName, | ||||
|    IN       void        *pCredStoreScope, | ||||
|    INOUT    char        *pTokenBuf, | ||||
| @@ -122,32 +122,53 @@ AuthTokenIf_GetAuthToken( | ||||
|    // Process any mechanism information that may have been provided | ||||
|    if (pMechInfo) | ||||
|    { | ||||
|       // Mechanism information has been provided. Mechanism information | ||||
|       // consists of semicolon delimited settings. The settings are formated | ||||
|       // using the format settingName=settingvalue. No white space is allowed | ||||
|       // as part of the mechanism information. | ||||
|       char *pNextSettingToken; | ||||
|       char *pSettingValueToken = strtok_r(pMechInfo, ";", &pNextSettingToken); | ||||
|       while (pSettingValueToken != NULL) | ||||
|       { | ||||
|          char *pNextToken; | ||||
|          char *pSettingName = strtok_r(pSettingValueToken, "=", &pNextToken); | ||||
|          char *pSettingValue = strtok_r(NULL, "=", &pNextToken); | ||||
|          if (pSettingValue) | ||||
|          { | ||||
|             // Process the setting | ||||
|             if (strcmpi(pSettingName, "SVC_PRINCIPAL") == 0) | ||||
|             { | ||||
|                pKrbServiceName = pSettingValue; | ||||
|             } | ||||
|          } | ||||
|          else | ||||
|          { | ||||
|             DbgTrace(0, "-AuthTokenIf_GetAuthToken- Bad setting\n", 0); | ||||
|          } | ||||
|       // Allocate a buffer to hold the mech info so that we can manipulate it | ||||
|       char *pMechInfoInt = malloc(strlen(pMechInfo) + 1); | ||||
|       if (pMechInfoInt) | ||||
|       { | ||||
|          char *pNextSettingToken; | ||||
|          char *pSettingValueToken; | ||||
|  | ||||
|          pSettingValueToken = strtok_r(NULL, ";", &pNextSettingToken); | ||||
|       } | ||||
|          // Copy the mechanism info to our work buffer | ||||
|          strcpy(pMechInfoInt, pMechInfo); | ||||
|  | ||||
|          // Mechanism information has been provided. Mechanism information | ||||
|          // consists of semicolon delimited settings. The settings are formated | ||||
|          // using the format settingName=settingvalue. No white space is allowed | ||||
|          // as part of the mechanism information. | ||||
|          pSettingValueToken = strtok_r(pMechInfoInt, ";", &pNextSettingToken); | ||||
|          while (pSettingValueToken != NULL) | ||||
|          { | ||||
|             char *pNextToken; | ||||
|             char *pSettingName = strtok_r(pSettingValueToken, "=", &pNextToken); | ||||
|             char *pSettingValue = strtok_r(NULL, "=", &pNextToken); | ||||
|             if (pSettingValue) | ||||
|             { | ||||
|                // Process the setting | ||||
|                if (stricmp(pSettingName, "SVC_PRINCIPAL") == 0) | ||||
|                { | ||||
|                   pKrbServiceName = pSettingValue; | ||||
|                } | ||||
|             } | ||||
|             else | ||||
|             { | ||||
|                DbgTrace(0, "-AuthTokenIf_GetAuthToken- Bad setting\n", 0); | ||||
|             } | ||||
|  | ||||
|             pSettingValueToken = strtok_r(NULL, ";", &pNextSettingToken); | ||||
|          } | ||||
|  | ||||
|          // Free the buffer that we allocated | ||||
|          free(pMechInfoInt); | ||||
|       } | ||||
|       else | ||||
|       { | ||||
|          DbgTrace(0, "-AuthTokenIf_GetAuthToken- Buffer allocation failure\n", 0); | ||||
|          retStatus = CasaStatusBuild(CASA_SEVERITY_ERROR, | ||||
|                                      CASA_FACILITY_PWTOKEN, | ||||
|                                      CASA_STATUS_INVALID_PARAMETER); | ||||
|          goto exit; | ||||
|       } | ||||
|    } | ||||
|  | ||||
|    // Check if we need to construct the service name | ||||
|   | ||||
| @@ -102,88 +102,6 @@ | ||||
| 				CommandLine="mkdir \"Program Files"\novell\
mkdir \"Program Files"\novell\casa
mkdir \"Program Files"\novell\casa\lib\
mkdir \"Program Files"\novell\casa\etc\
mkdir \"Program Files"\novell\casa\etc\auth\
mkdir \"Program Files"\novell\casa\etc\auth\mechanisms\
copy Krb5Authenticate.conf \"Program Files"\novell\casa\etc\auth\mechanisms\Krb5Authenticate.conf
copy $(OutDir)\krb5mech.dll \"Program Files"\novell\casa\lib\krb5mech.dll
" | ||||
| 			/> | ||||
| 		</Configuration> | ||||
| 		<Configuration | ||||
| 			Name="Release|Win32" | ||||
| 			OutputDirectory="..\windows\$(ConfigurationName)" | ||||
| 			IntermediateDirectory="..\windows\$(ConfigurationName)" | ||||
| 			ConfigurationType="2" | ||||
| 			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops" | ||||
| 			CharacterSet="2" | ||||
| 			> | ||||
| 			<Tool | ||||
| 				Name="VCPreBuildEventTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCCustomBuildTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCXMLDataGeneratorTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCWebServiceProxyGeneratorTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCMIDLTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCCLCompilerTool" | ||||
| 				AdditionalOptions="-DSECURITY_WIN32 -D"_CRT_SECURE_NO_DEPRECATE"" | ||||
| 				AdditionalIncludeDirectories=".\;..\;..\..\..;..\..\..\..\include;"..\..\..\..\..\..\..\Expat-2.0.0\source\lib";..\..\..\..\..\..\CASA\include" | ||||
| 				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS" | ||||
| 				RuntimeLibrary="0" | ||||
| 				UsePrecompiledHeader="0" | ||||
| 				WarningLevel="3" | ||||
| 				Detect64BitPortabilityProblems="true" | ||||
| 				DebugInformationFormat="3" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCManagedResourceCompilerTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCResourceCompilerTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCPreLinkEventTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCLinkerTool" | ||||
| 				AdditionalOptions="/EXPORT:GetAuthTokenInterface" | ||||
| 				AdditionalDependencies="secur32.lib" | ||||
| 				OutputFile="$(OutDir)/krb5mech.dll" | ||||
| 				LinkIncremental="1" | ||||
| 				IgnoreDefaultLibraryNames="libc" | ||||
| 				GenerateDebugInformation="true" | ||||
| 				SubSystem="0" | ||||
| 				OptimizeReferences="2" | ||||
| 				EnableCOMDATFolding="2" | ||||
| 				TargetMachine="1" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCALinkTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCManifestTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCXDCMakeTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCBscMakeTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCFxCopTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCAppVerifierTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCWebDeploymentTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCPostBuildEventTool" | ||||
| 				CommandLine="" | ||||
| 			/> | ||||
| 		</Configuration> | ||||
| 		<Configuration | ||||
| 			Name="Debug|x64" | ||||
| 			OutputDirectory="$(PlatformName)\$(ConfigurationName)" | ||||
| @@ -266,7 +184,89 @@ | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCPostBuildEventTool" | ||||
| 				CommandLine="mkdir \"Program Files"\novell\
mkdir \"Program Files"\novell\casa
mkdir \"Program Files"\novell\casa\lib\
mkdir \"Program Files"\novell\casa\etc\
mkdir \"Program Files"\novell\casa\etc\auth\
mkdir \"Program Files"\novell\casa\etc\auth\mechanisms\
copy Krb5Authenticate.conf \"Program Files"\novell\casa\etc\auth\mechanisms\Krb5Authenticate.conf
copy $(OutDir)\krb5mech.dll \"Program Files"\novell\casa\lib\krb5mech.dll
" | ||||
| 				CommandLine="" | ||||
| 			/> | ||||
| 		</Configuration> | ||||
| 		<Configuration | ||||
| 			Name="Release|Win32" | ||||
| 			OutputDirectory="..\windows\$(ConfigurationName)" | ||||
| 			IntermediateDirectory="..\windows\$(ConfigurationName)" | ||||
| 			ConfigurationType="2" | ||||
| 			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops" | ||||
| 			CharacterSet="2" | ||||
| 			> | ||||
| 			<Tool | ||||
| 				Name="VCPreBuildEventTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCCustomBuildTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCXMLDataGeneratorTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCWebServiceProxyGeneratorTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCMIDLTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCCLCompilerTool" | ||||
| 				AdditionalOptions="-DSECURITY_WIN32 -D"_CRT_SECURE_NO_DEPRECATE"" | ||||
| 				AdditionalIncludeDirectories=".\;..\;..\..\..;..\..\..\..\include;"..\..\..\..\..\..\..\Expat-2.0.0\source\lib";..\..\..\..\..\..\CASA\include" | ||||
| 				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS" | ||||
| 				RuntimeLibrary="0" | ||||
| 				UsePrecompiledHeader="0" | ||||
| 				WarningLevel="3" | ||||
| 				Detect64BitPortabilityProblems="true" | ||||
| 				DebugInformationFormat="3" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCManagedResourceCompilerTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCResourceCompilerTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCPreLinkEventTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCLinkerTool" | ||||
| 				AdditionalOptions="/EXPORT:GetAuthTokenInterface" | ||||
| 				AdditionalDependencies="secur32.lib" | ||||
| 				OutputFile="$(OutDir)/krb5mech.dll" | ||||
| 				LinkIncremental="1" | ||||
| 				IgnoreDefaultLibraryNames="libc" | ||||
| 				GenerateDebugInformation="true" | ||||
| 				SubSystem="0" | ||||
| 				OptimizeReferences="2" | ||||
| 				EnableCOMDATFolding="2" | ||||
| 				TargetMachine="1" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCALinkTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCManifestTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCXDCMakeTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCBscMakeTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCFxCopTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCAppVerifierTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCWebDeploymentTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCPostBuildEventTool" | ||||
| 				CommandLine="" | ||||
| 			/> | ||||
| 		</Configuration> | ||||
| 		<Configuration | ||||
|   | ||||
| @@ -1,97 +1,97 @@ | ||||
| /*********************************************************************** | ||||
|  *  | ||||
|  *  Copyright (C) 2006 Novell, Inc. All Rights Reserved. | ||||
|  * | ||||
|  *  This library is free software; you can redistribute it and/or | ||||
|  *  modify it under the terms of the GNU Lesser General Public | ||||
|  *  License as published by the Free Software Foundation; version 2.1 | ||||
|  *  of the License. | ||||
|  * | ||||
|  *  This library is distributed in the hope that it will be useful, | ||||
|  *  but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
|  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU | ||||
|  *  Library Lesser General Public License for more details. | ||||
|  * | ||||
|  *  You should have received a copy of the GNU Lesser General Public | ||||
|  *  License along with this library; if not, Novell, Inc. | ||||
|  *  | ||||
|  *  To contact Novell about this file by physical or electronic mail,  | ||||
|  *  you may find current contact information at www.novell.com. | ||||
|  *  | ||||
|  *  Author: Juan Carlos Luciani <jluciani@novell.com> | ||||
|  * | ||||
|  ***********************************************************************/ | ||||
|  | ||||
| #ifndef _PLATFORM_H_ | ||||
| #define _PLATFORM_H_ | ||||
|  | ||||
| //===[ Include files ]===================================================== | ||||
|  | ||||
| #include <windows.h> | ||||
| #include <stdio.h> | ||||
| #include <winerror.h> | ||||
| #include <security.h> | ||||
| #include <sspi.h> | ||||
|  | ||||
| //===[ Type definitions ]================================================== | ||||
|  | ||||
| #ifndef CONTAINING_RECORD | ||||
| #define CONTAINING_RECORD(address, type, field) ((type *)(     \ | ||||
|              (char*)(address) -                                \ | ||||
|              (char*)(&((type *)0)->field))) | ||||
| #endif | ||||
|  | ||||
| // | ||||
| // DbgTrace macro define | ||||
| // | ||||
| //#define DbgTrace(LEVEL, X, Y) {                          \ | ||||
| //char printBuff[256];                                     \ | ||||
| //   if (LEVEL == 0 || DebugLevel >= LEVEL)                \ | ||||
| //   {                                                     \ | ||||
| //      _snprintf(printBuff, sizeof(printBuff), X, Y);     \ | ||||
| //      printf("Krb5Mech %s", printBuff);                  \ | ||||
| //   }                                                     \ | ||||
| //} | ||||
| #define DbgTrace(LEVEL, X, Y) {                                  \ | ||||
| char formatBuff[128];                                            \ | ||||
| char printBuff[256];                                             \ | ||||
| /*********************************************************************** | ||||
|  *  | ||||
|  *  Copyright (C) 2006 Novell, Inc. All Rights Reserved. | ||||
|  * | ||||
|  *  This library is free software; you can redistribute it and/or | ||||
|  *  modify it under the terms of the GNU Lesser General Public | ||||
|  *  License as published by the Free Software Foundation; version 2.1 | ||||
|  *  of the License. | ||||
|  * | ||||
|  *  This library is distributed in the hope that it will be useful, | ||||
|  *  but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
|  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU | ||||
|  *  Library Lesser General Public License for more details. | ||||
|  * | ||||
|  *  You should have received a copy of the GNU Lesser General Public | ||||
|  *  License along with this library; if not, Novell, Inc. | ||||
|  *  | ||||
|  *  To contact Novell about this file by physical or electronic mail,  | ||||
|  *  you may find current contact information at www.novell.com. | ||||
|  *  | ||||
|  *  Author: Juan Carlos Luciani <jluciani@novell.com> | ||||
|  * | ||||
|  ***********************************************************************/ | ||||
|  | ||||
| #ifndef _PLATFORM_H_ | ||||
| #define _PLATFORM_H_ | ||||
|  | ||||
| //===[ Include files ]===================================================== | ||||
|  | ||||
| #include <windows.h> | ||||
| #include <stdio.h> | ||||
| #include <winerror.h> | ||||
| #include <security.h> | ||||
| #include <sspi.h> | ||||
|  | ||||
| //===[ Type definitions ]================================================== | ||||
|  | ||||
| #ifndef CONTAINING_RECORD | ||||
| #define CONTAINING_RECORD(address, type, field) ((type *)(     \ | ||||
|              (char*)(address) -                                \ | ||||
|              (char*)(&((type *)0)->field))) | ||||
| #endif | ||||
|  | ||||
| // | ||||
| // DbgTrace macro define | ||||
| // | ||||
| //#define DbgTrace(LEVEL, X, Y) {                          \ | ||||
| //char printBuff[256];                                     \ | ||||
| //   if (LEVEL == 0 || DebugLevel >= LEVEL)                \ | ||||
| //   {                                                     \ | ||||
| //      _snprintf(printBuff, sizeof(printBuff), X, Y);     \ | ||||
| //      printf("Krb5Mech %s", printBuff);                  \ | ||||
| //   }                                                     \ | ||||
| //} | ||||
| #define DbgTrace(LEVEL, X, Y) {                                  \ | ||||
| char formatBuff[128];                                            \ | ||||
| char printBuff[256];                                             \ | ||||
| FILE  *pDebugFile;                                               \ | ||||
|    if (LEVEL == 0 || KrbMechDebugLevel >= LEVEL)                 \ | ||||
|    {                                                             \ | ||||
|       strcpy(formatBuff, "Krb5Mech ");                           \ | ||||
|       strncat(formatBuff, X, sizeof(formatBuff) - 9);            \ | ||||
|       _snprintf(printBuff, sizeof(printBuff), formatBuff, Y);    \ | ||||
|       if (pKrbMechDebugLogFilePath)                              \ | ||||
|       {                                                          \ | ||||
|    if (LEVEL == 0 || KrbMechDebugLevel >= LEVEL)                 \ | ||||
|    {                                                             \ | ||||
|       strcpy(formatBuff, "Krb5Mech ");                           \ | ||||
|       strncat(formatBuff, X, sizeof(formatBuff) - 9);            \ | ||||
|       _snprintf(printBuff, sizeof(printBuff), formatBuff, Y);    \ | ||||
|       if (pKrbMechDebugLogFilePath)                              \ | ||||
|       {                                                          \ | ||||
|          pDebugFile = fopen(pKrbMechDebugLogFilePath, "a+");     \ | ||||
|          if (pDebugFile)                                         \ | ||||
|          {                                                       \ | ||||
|             fwrite(printBuff, strlen(printBuff), 1, pDebugFile); \ | ||||
|             fclose(pDebugFile);                                  \ | ||||
|          }                                                       \ | ||||
|       }                                                          \ | ||||
|       else                                                       \ | ||||
|          OutputDebugString(printBuff);                           \ | ||||
|    }                                                             \ | ||||
| } | ||||
|  | ||||
| #define INT32_MAX (2147483647) | ||||
| #define UINT32_MAX (4294967295U) | ||||
| #define bool BOOLEAN | ||||
| #define true TRUE | ||||
| #define false FALSE | ||||
| #define strtok_r strtok_s | ||||
|  | ||||
| //===[ Inlines functions   ]=============================================== | ||||
|  | ||||
| //===[ Function prototypes ]=============================================== | ||||
|  | ||||
| //===[ Global externals ]================================================== | ||||
|  | ||||
| //===[ External prototypes ]=============================================== | ||||
|  | ||||
|  | ||||
| //========================================================================= | ||||
|  | ||||
| #endif // _PLATFORM_H_ | ||||
|  | ||||
|          if (pDebugFile)                                         \ | ||||
|          {                                                       \ | ||||
|             fwrite(printBuff, strlen(printBuff), 1, pDebugFile); \ | ||||
|             fclose(pDebugFile);                                  \ | ||||
|          }                                                       \ | ||||
|       }                                                          \ | ||||
|       else                                                       \ | ||||
|          OutputDebugString(printBuff);                           \ | ||||
|    }                                                             \ | ||||
| } | ||||
|  | ||||
| #define INT32_MAX (2147483647) | ||||
| #define UINT32_MAX (4294967295U) | ||||
| #define bool BOOLEAN | ||||
| #define true TRUE | ||||
| #define false FALSE | ||||
| #define strtok_r strtok_s | ||||
|  | ||||
| //===[ Inlines functions   ]=============================================== | ||||
|  | ||||
| //===[ Function prototypes ]=============================================== | ||||
|  | ||||
| //===[ Global externals ]================================================== | ||||
|  | ||||
| //===[ External prototypes ]=============================================== | ||||
|  | ||||
|  | ||||
| //========================================================================= | ||||
|  | ||||
| #endif // _PLATFORM_H_ | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user