sspi - Small code tidy up

This commit is contained in:
Steve Holme 2012-04-22 18:59:07 +01:00
parent 2976de4808
commit 46cd5f1dad
1 changed files with 8 additions and 13 deletions

View File

@ -35,7 +35,6 @@
/* The last #include file should be: */ /* The last #include file should be: */
#include "memdebug.h" #include "memdebug.h"
/* We use our own typedef here since some headers might lack these */ /* We use our own typedef here since some headers might lack these */
typedef PSecurityFunctionTableA (APIENTRY *INITSECURITYINTERFACE_FN_A)(VOID); typedef PSecurityFunctionTableA (APIENTRY *INITSECURITYINTERFACE_FN_A)(VOID);
@ -45,7 +44,6 @@ HMODULE s_hSecDll = NULL;
/* Pointer to SSPI dispatch table */ /* Pointer to SSPI dispatch table */
PSecurityFunctionTableA s_pSecFn = NULL; PSecurityFunctionTableA s_pSecFn = NULL;
/* /*
* Curl_sspi_global_init() * Curl_sspi_global_init()
* *
@ -58,19 +56,17 @@ PSecurityFunctionTableA s_pSecFn = NULL;
* called through the Security Service Provider Interface dispatch table. * called through the Security Service Provider Interface dispatch table.
*/ */
CURLcode CURLcode Curl_sspi_global_init(void)
Curl_sspi_global_init(void)
{ {
OSVERSIONINFO osver; OSVERSIONINFO osver;
INITSECURITYINTERFACE_FN_A pInitSecurityInterface; INITSECURITYINTERFACE_FN_A pInitSecurityInterface;
/* If security interface is not yet initialized try to do this */ /* If security interface is not yet initialized try to do this */
if(s_hSecDll == NULL) { if(!s_hSecDll) {
/* Find out Windows version */ /* Find out Windows version */
memset(&osver, 0, sizeof(osver)); memset(&osver, 0, sizeof(osver));
osver.dwOSVersionInfoSize = sizeof(osver); osver.dwOSVersionInfoSize = sizeof(osver);
if(! GetVersionEx(&osver)) if(!GetVersionEx(&osver))
return CURLE_FAILED_INIT; return CURLE_FAILED_INIT;
/* Security Service Provider Interface (SSPI) functions are located in /* Security Service Provider Interface (SSPI) functions are located in
@ -83,21 +79,21 @@ Curl_sspi_global_init(void)
s_hSecDll = LoadLibrary("security.dll"); s_hSecDll = LoadLibrary("security.dll");
else else
s_hSecDll = LoadLibrary("secur32.dll"); s_hSecDll = LoadLibrary("secur32.dll");
if(! s_hSecDll) if(!s_hSecDll)
return CURLE_FAILED_INIT; return CURLE_FAILED_INIT;
/* Get address of the InitSecurityInterfaceA function from the SSPI dll */ /* Get address of the InitSecurityInterfaceA function from the SSPI dll */
pInitSecurityInterface = (INITSECURITYINTERFACE_FN_A) pInitSecurityInterface = (INITSECURITYINTERFACE_FN_A)
GetProcAddress(s_hSecDll, "InitSecurityInterfaceA"); GetProcAddress(s_hSecDll, "InitSecurityInterfaceA");
if(! pInitSecurityInterface) if(!pInitSecurityInterface)
return CURLE_FAILED_INIT; return CURLE_FAILED_INIT;
/* Get pointer to Security Service Provider Interface dispatch table */ /* Get pointer to Security Service Provider Interface dispatch table */
s_pSecFn = pInitSecurityInterface(); s_pSecFn = pInitSecurityInterface();
if(! s_pSecFn) if(!s_pSecFn)
return CURLE_FAILED_INIT; return CURLE_FAILED_INIT;
} }
return CURLE_OK; return CURLE_OK;
} }
@ -170,8 +166,7 @@ CURLcode Curl_sspi_version(int *major, int *minor, int *build, int *special)
* This deinitializes the Security Service Provider Interface from libcurl. * This deinitializes the Security Service Provider Interface from libcurl.
*/ */
void void Curl_sspi_global_cleanup(void)
Curl_sspi_global_cleanup(void)
{ {
if(s_hSecDll) { if(s_hSecDll) {
FreeLibrary(s_hSecDll); FreeLibrary(s_hSecDll);