Continued changes for client port to Linux.
This commit is contained in:
parent
68ccb5b8d8
commit
c8bb4008e6
@ -21,26 +21,26 @@
|
|||||||
}
|
}
|
||||||
"Entry"
|
"Entry"
|
||||||
{
|
{
|
||||||
"MsmKey" = "8:_1231718055D14020BF756DCF44D2BF22"
|
|
||||||
"OwnerKey" = "8:_UNDEFINED"
|
|
||||||
"MsmSig" = "8:_UNDEFINED"
|
|
||||||
}
|
|
||||||
"Entry"
|
|
||||||
{
|
|
||||||
"MsmKey" = "8:_1ED6B3F7C91A4BBE875FC4621FC3CD97"
|
"MsmKey" = "8:_1ED6B3F7C91A4BBE875FC4621FC3CD97"
|
||||||
"OwnerKey" = "8:_UNDEFINED"
|
"OwnerKey" = "8:_UNDEFINED"
|
||||||
"MsmSig" = "8:_UNDEFINED"
|
"MsmSig" = "8:_UNDEFINED"
|
||||||
}
|
}
|
||||||
"Entry"
|
"Entry"
|
||||||
{
|
{
|
||||||
"MsmKey" = "8:_2EEDD0C5BE8546CBA62A0852850DB473"
|
"MsmKey" = "8:_313DE095D13281AF91A64E3F3D472413"
|
||||||
"OwnerKey" = "8:_UNDEFINED"
|
"OwnerKey" = "8:_F0358243F2B34E40852F2185663C5B71"
|
||||||
"MsmSig" = "8:_UNDEFINED"
|
"MsmSig" = "8:_UNDEFINED"
|
||||||
}
|
}
|
||||||
"Entry"
|
"Entry"
|
||||||
{
|
{
|
||||||
"MsmKey" = "8:_313DE095D13281AF91A64E3F3D472413"
|
"MsmKey" = "8:_35590D5026504A138951C430142FECBA"
|
||||||
"OwnerKey" = "8:_2EEDD0C5BE8546CBA62A0852850DB473"
|
"OwnerKey" = "8:_8292EFFD84EF46C6BD2F1F3E20808684"
|
||||||
|
"MsmSig" = "8:_UNDEFINED"
|
||||||
|
}
|
||||||
|
"Entry"
|
||||||
|
{
|
||||||
|
"MsmKey" = "8:_3986DA1502244FFBB04A66472E74633B"
|
||||||
|
"OwnerKey" = "8:_UNDEFINED"
|
||||||
"MsmSig" = "8:_UNDEFINED"
|
"MsmSig" = "8:_UNDEFINED"
|
||||||
}
|
}
|
||||||
"Entry"
|
"Entry"
|
||||||
@ -64,18 +64,18 @@
|
|||||||
"Entry"
|
"Entry"
|
||||||
{
|
{
|
||||||
"MsmKey" = "8:_92336612AC7D083F97ED302BB7674A2D"
|
"MsmKey" = "8:_92336612AC7D083F97ED302BB7674A2D"
|
||||||
"OwnerKey" = "8:_EE2A593B866F43FD8D97250E1457988A"
|
"OwnerKey" = "8:_3986DA1502244FFBB04A66472E74633B"
|
||||||
"MsmSig" = "8:_UNDEFINED"
|
"MsmSig" = "8:_UNDEFINED"
|
||||||
}
|
}
|
||||||
"Entry"
|
"Entry"
|
||||||
{
|
{
|
||||||
"MsmKey" = "8:_AFBDE40E9A784962B750ECA4C15ADD85"
|
"MsmKey" = "8:_EDA39B5CAD864AF0821AAFC9783DFF12"
|
||||||
"OwnerKey" = "8:_8292EFFD84EF46C6BD2F1F3E20808684"
|
"OwnerKey" = "8:_UNDEFINED"
|
||||||
"MsmSig" = "8:_UNDEFINED"
|
"MsmSig" = "8:_UNDEFINED"
|
||||||
}
|
}
|
||||||
"Entry"
|
"Entry"
|
||||||
{
|
{
|
||||||
"MsmKey" = "8:_EE2A593B866F43FD8D97250E1457988A"
|
"MsmKey" = "8:_F0358243F2B34E40852F2185663C5B71"
|
||||||
"OwnerKey" = "8:_UNDEFINED"
|
"OwnerKey" = "8:_UNDEFINED"
|
||||||
"MsmSig" = "8:_UNDEFINED"
|
"MsmSig" = "8:_UNDEFINED"
|
||||||
}
|
}
|
||||||
@ -148,26 +148,6 @@
|
|||||||
"IsDependency" = "11:FALSE"
|
"IsDependency" = "11:FALSE"
|
||||||
"IsolateTo" = "8:"
|
"IsolateTo" = "8:"
|
||||||
}
|
}
|
||||||
"{A582A373-4685-4296-BEFE-614B80A702C3}:_1231718055D14020BF756DCF44D2BF22"
|
|
||||||
{
|
|
||||||
"SourcePath" = "8:..\\mechanisms\\krb5\\Krb5Authenticate.conf"
|
|
||||||
"TargetName" = "8:Krb5Authenticate.conf"
|
|
||||||
"Tag" = "8:"
|
|
||||||
"Folder" = "8:_DEA051CA331E4FEA83D99711FB584664"
|
|
||||||
"Condition" = "8:"
|
|
||||||
"Transitive" = "11:FALSE"
|
|
||||||
"Vital" = "11:TRUE"
|
|
||||||
"ReadOnly" = "11:FALSE"
|
|
||||||
"Hidden" = "11:FALSE"
|
|
||||||
"System" = "11:FALSE"
|
|
||||||
"Permanent" = "11:FALSE"
|
|
||||||
"SharedLegacy" = "11:FALSE"
|
|
||||||
"PackageAs" = "3:1"
|
|
||||||
"Register" = "3:1"
|
|
||||||
"Exclude" = "11:FALSE"
|
|
||||||
"IsDependency" = "11:FALSE"
|
|
||||||
"IsolateTo" = "8:"
|
|
||||||
}
|
|
||||||
"{A582A373-4685-4296-BEFE-614B80A702C3}:_1ED6B3F7C91A4BBE875FC4621FC3CD97"
|
"{A582A373-4685-4296-BEFE-614B80A702C3}:_1ED6B3F7C91A4BBE875FC4621FC3CD97"
|
||||||
{
|
{
|
||||||
"SourcePath" = "8:..\\..\\include\\casa_c_authtoken.h"
|
"SourcePath" = "8:..\\..\\include\\casa_c_authtoken.h"
|
||||||
@ -264,10 +244,30 @@
|
|||||||
"SharedLegacy" = "11:FALSE"
|
"SharedLegacy" = "11:FALSE"
|
||||||
"PackageAs" = "3:1"
|
"PackageAs" = "3:1"
|
||||||
"Register" = "3:1"
|
"Register" = "3:1"
|
||||||
"Exclude" = "11:FALSE"
|
"Exclude" = "11:TRUE"
|
||||||
"IsDependency" = "11:TRUE"
|
"IsDependency" = "11:TRUE"
|
||||||
"IsolateTo" = "8:"
|
"IsolateTo" = "8:"
|
||||||
}
|
}
|
||||||
|
"{A582A373-4685-4296-BEFE-614B80A702C3}:_EDA39B5CAD864AF0821AAFC9783DFF12"
|
||||||
|
{
|
||||||
|
"SourcePath" = "8:..\\mechanisms\\krb5\\windows\\Krb5Authenticate.conf"
|
||||||
|
"TargetName" = "8:Krb5Authenticate.conf"
|
||||||
|
"Tag" = "8:"
|
||||||
|
"Folder" = "8:_DEA051CA331E4FEA83D99711FB584664"
|
||||||
|
"Condition" = "8:"
|
||||||
|
"Transitive" = "11:FALSE"
|
||||||
|
"Vital" = "11:TRUE"
|
||||||
|
"ReadOnly" = "11:FALSE"
|
||||||
|
"Hidden" = "11:FALSE"
|
||||||
|
"System" = "11:FALSE"
|
||||||
|
"Permanent" = "11:FALSE"
|
||||||
|
"SharedLegacy" = "11:FALSE"
|
||||||
|
"PackageAs" = "3:1"
|
||||||
|
"Register" = "3:1"
|
||||||
|
"Exclude" = "11:FALSE"
|
||||||
|
"IsDependency" = "11:FALSE"
|
||||||
|
"IsolateTo" = "8:"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
"FileType"
|
"FileType"
|
||||||
{
|
{
|
||||||
@ -404,7 +404,7 @@
|
|||||||
}
|
}
|
||||||
"MergeModule"
|
"MergeModule"
|
||||||
{
|
{
|
||||||
"{35A69C6E-5BA4-440D-803D-762B59A45393}:_AFBDE40E9A784962B750ECA4C15ADD85"
|
"{35A69C6E-5BA4-440D-803D-762B59A45393}:_35590D5026504A138951C430142FECBA"
|
||||||
{
|
{
|
||||||
"UseDynamicProperties" = "11:FALSE"
|
"UseDynamicProperties" = "11:FALSE"
|
||||||
"IsDependency" = "11:TRUE"
|
"IsDependency" = "11:TRUE"
|
||||||
@ -430,9 +430,9 @@
|
|||||||
}
|
}
|
||||||
"ProjectOutput"
|
"ProjectOutput"
|
||||||
{
|
{
|
||||||
"{8062640A-2EEE-46E9-AB67-688E9A886E9F}:_2EEDD0C5BE8546CBA62A0852850DB473"
|
"{8062640A-2EEE-46E9-AB67-688E9A886E9F}:_3986DA1502244FFBB04A66472E74633B"
|
||||||
{
|
{
|
||||||
"SourcePath" = "8:..\\mechanisms\\krb5\\windows\\Release\\krb5mech.dll"
|
"SourcePath" = "8:..\\mechanisms\\pwd\\windows\\Release\\pwmech.dll"
|
||||||
"TargetName" = "8:"
|
"TargetName" = "8:"
|
||||||
"Tag" = "8:"
|
"Tag" = "8:"
|
||||||
"Folder" = "8:_F5F5F604B81645F8B6463F7A7D6A53AD"
|
"Folder" = "8:_F5F5F604B81645F8B6463F7A7D6A53AD"
|
||||||
@ -486,9 +486,9 @@
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
"{8062640A-2EEE-46E9-AB67-688E9A886E9F}:_EE2A593B866F43FD8D97250E1457988A"
|
"{8062640A-2EEE-46E9-AB67-688E9A886E9F}:_F0358243F2B34E40852F2185663C5B71"
|
||||||
{
|
{
|
||||||
"SourcePath" = "8:..\\mechanisms\\pwd\\windows\\Release\\pwmech.dll"
|
"SourcePath" = "8:..\\mechanisms\\krb5\\windows\\Release\\krb5mech.dll"
|
||||||
"TargetName" = "8:"
|
"TargetName" = "8:"
|
||||||
"Tag" = "8:"
|
"Tag" = "8:"
|
||||||
"Folder" = "8:_F5F5F604B81645F8B6463F7A7D6A53AD"
|
"Folder" = "8:_F5F5F604B81645F8B6463F7A7D6A53AD"
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
#######################################################
|
#######################################################
|
||||||
# #
|
# #
|
||||||
# CASA Authentication Token System configuration file #
|
# CASA Authentication Token System configuration file #
|
||||||
# for module: #
|
# for module: #
|
||||||
# #
|
# #
|
||||||
# Krb5Authenticate #
|
# Krb5Authenticate #
|
||||||
# #
|
# #
|
||||||
#######################################################
|
#######################################################
|
||||||
|
|
||||||
LibraryName \Program Files\novell\casa\lib\krb5mech.dll
|
LibraryName \Program Files\novell\casa\lib\krb5mech.dll
|
||||||
|
|
||||||
|
|
@ -20,7 +20,7 @@
|
|||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
AdditionalOptions="-DSECURITY_WIN32"
|
AdditionalOptions="-DSECURITY_WIN32"
|
||||||
Optimization="0"
|
Optimization="0"
|
||||||
AdditionalIncludeDirectories="windows;.;"..\..";"C:\Program Files\novell\CASA\include";"..\..\..\include""
|
AdditionalIncludeDirectories=""C:\Dev\casa\CASA-auth-token\non-java\client\mechanisms\krb5\windows";"C:\Dev\casa\CASA-auth-token\non-java\client\mechanisms\krb5";"C:\Dev\casa\CASA-auth-token\non-java\client";"C:\Program Files\novell\CASA\include";"C:\Dev\casa\CASA-auth-token\non-java\include""
|
||||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS"
|
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS"
|
||||||
MinimalRebuild="TRUE"
|
MinimalRebuild="TRUE"
|
||||||
BasicRuntimeChecks="3"
|
BasicRuntimeChecks="3"
|
||||||
@ -80,7 +80,7 @@ copy $(OutDir)\krb5mech.dll \"Program Files"\novell\casa\lib\krb5mech.
|
|||||||
<Tool
|
<Tool
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
AdditionalOptions="-DSECURITY_WIN32"
|
AdditionalOptions="-DSECURITY_WIN32"
|
||||||
AdditionalIncludeDirectories="windows;.;"..\..";"C:\Program Files\novell\CASA\include";"..\..\..\include""
|
AdditionalIncludeDirectories=""C:\Dev\casa\CASA-auth-token\non-java\client\mechanisms\krb5\windows";"C:\Dev\casa\CASA-auth-token\non-java\client\mechanisms\krb5";"C:\Dev\casa\CASA-auth-token\non-java\client";"C:\Program Files\novell\CASA\include";"C:\Dev\casa\CASA-auth-token\non-java\include""
|
||||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
|
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
|
||||||
RuntimeLibrary="4"
|
RuntimeLibrary="4"
|
||||||
UsePrecompiledHeader="0"
|
UsePrecompiledHeader="0"
|
||||||
@ -139,25 +139,25 @@ copy $(OutDir)\krb5mech.dll \"Program Files"\novell\casa\lib\krb5mech.
|
|||||||
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
|
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
|
||||||
<File
|
<File
|
||||||
RelativePath=".\windows\dllsup.c">
|
RelativePath=".\dllsup.c">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\windows\get.c">
|
RelativePath=".\get.c">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\interface.c">
|
RelativePath="..\interface.c">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\Krb5Authenticate.conf">
|
RelativePath=".\Krb5Authenticate.conf">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\win32\krb5mech.def">
|
RelativePath=".\krb5mech.def">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\windows\platform.c">
|
RelativePath=".\platform.c">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\util.c">
|
RelativePath="..\util.c">
|
||||||
</File>
|
</File>
|
||||||
</Filter>
|
</Filter>
|
||||||
<Filter
|
<Filter
|
||||||
@ -165,10 +165,10 @@ copy $(OutDir)\krb5mech.dll \"Program Files"\novell\casa\lib\krb5mech.
|
|||||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
|
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
|
||||||
<File
|
<File
|
||||||
RelativePath=".\internal.h">
|
RelativePath="..\internal.h">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\windows\platform.h">
|
RelativePath=".\platform.h">
|
||||||
</File>
|
</File>
|
||||||
</Filter>
|
</Filter>
|
||||||
<Filter
|
<Filter
|
@ -22,49 +22,23 @@
|
|||||||
*
|
*
|
||||||
***********************************************************************/
|
***********************************************************************/
|
||||||
|
|
||||||
#include <windows.h>
|
#include "platform.h"
|
||||||
#include "casa_c_authtoken.h"
|
|
||||||
|
|
||||||
// Globals
|
// Externals
|
||||||
char usageString[] = "usage: test -a serverAddress -p serverPort [-s serviceName] [-h]\n";
|
extern
|
||||||
|
char *pServerAddress;
|
||||||
|
|
||||||
char *pServerAddress = NULL;
|
extern
|
||||||
int serverPort = 0;
|
int serverPort;
|
||||||
BOOLEAN execHttpTest = FALSE;
|
|
||||||
|
|
||||||
char serviceName[] = "testService";
|
extern
|
||||||
char *pServiceName = serviceName;
|
BOOLEAN execHttpTest;
|
||||||
|
|
||||||
|
extern
|
||||||
|
char serviceName[];
|
||||||
|
|
||||||
/***********************************************************************
|
extern
|
||||||
*
|
char *pServiceName;
|
||||||
* dtoul()
|
|
||||||
*
|
|
||||||
***********************************************************************/
|
|
||||||
int
|
|
||||||
dtoul(
|
|
||||||
IN char *cp,
|
|
||||||
IN int len)
|
|
||||||
{
|
|
||||||
int n = 0;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
for (i = 0; i < len; i++, cp++)
|
|
||||||
{
|
|
||||||
// Verify that we are dealing with a valid digit
|
|
||||||
if (*cp >= '0' && *cp <= '9')
|
|
||||||
{
|
|
||||||
n = 10 * n + (*cp - '0');
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
printf("-dtoul- Found invalid digit\n");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return n;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
@ -166,108 +140,95 @@ void NonHttpTest(void)
|
|||||||
struct sockaddr_in remoteAddr = {0};
|
struct sockaddr_in remoteAddr = {0};
|
||||||
struct linger linger_opt = {1, 15};
|
struct linger linger_opt = {1, 15};
|
||||||
struct hostent *pLookupResult;
|
struct hostent *pLookupResult;
|
||||||
int winsockStartupResult;
|
|
||||||
WSADATA winsockData;
|
|
||||||
|
|
||||||
printf("-NonHttpTest- ObtainAuthToken succedded, tokenlen = %d\n", authTokenLen);
|
printf("-NonHttpTest- ObtainAuthToken succedded, tokenlen = %d\n", authTokenLen);
|
||||||
|
|
||||||
// Send the token to the server
|
// Send the token to the server
|
||||||
//
|
//
|
||||||
// First initialize winsock
|
// Open socket
|
||||||
if ((winsockStartupResult = WSAStartup(MAKEWORD(2,2), &winsockData)) == 0)
|
sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
|
||||||
|
if (sock != INVALID_SOCKET)
|
||||||
{
|
{
|
||||||
// Open socket
|
// Setup the local address structure
|
||||||
sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
|
localAddr.sin_family = AF_INET;
|
||||||
if (sock != INVALID_SOCKET)
|
localAddr.sin_addr.s_addr = htonl(INADDR_ANY);
|
||||||
|
|
||||||
|
// Bind socket
|
||||||
|
if (!bind(sock, (const struct sockaddr*) &localAddr, sizeof(struct sockaddr_in)))
|
||||||
{
|
{
|
||||||
// Setup the local address structure
|
// Resolve the server address
|
||||||
localAddr.sin_family = AF_INET;
|
pLookupResult = gethostbyname(pServerAddress);
|
||||||
localAddr.sin_addr.s_addr = htonl(INADDR_ANY);
|
if (pLookupResult)
|
||||||
|
|
||||||
// Bind socket
|
|
||||||
if (!bind(sock, (const struct sockaddr*) &localAddr, sizeof(struct sockaddr_in)))
|
|
||||||
{
|
{
|
||||||
// Resolve the server address
|
// Validate the address type returned
|
||||||
pLookupResult = gethostbyname(pServerAddress);
|
if (pLookupResult->h_addrtype == AF_INET)
|
||||||
if (pLookupResult)
|
|
||||||
{
|
{
|
||||||
// Validate the address type returned
|
int numAddressesFound = 0;
|
||||||
if (pLookupResult->h_addrtype == AF_INET)
|
|
||||||
|
// Determine how many addresses where returned
|
||||||
|
while (pLookupResult->h_addr_list[numAddressesFound] != NULL)
|
||||||
{
|
{
|
||||||
int numAddressesFound = 0;
|
//printf("ServerAddress = %08X\n", *((int*) pLookupResult->h_addr_list[numAddressesFound]));
|
||||||
|
numAddressesFound ++;
|
||||||
|
}
|
||||||
|
//printf("Found %d addresses\n", numAddressesFound);
|
||||||
|
|
||||||
// Determine how many addresses where returned
|
// Setup the remote address structure with the lookup results
|
||||||
while (pLookupResult->h_addr_list[numAddressesFound] != NULL)
|
remoteAddr.sin_family = AF_INET;
|
||||||
{
|
remoteAddr.sin_port = serverPort;
|
||||||
//printf("ServerAddress = %08X\n", *((int*) pLookupResult->h_addr_list[numAddressesFound]));
|
remoteAddr.sin_addr.s_addr = *((int*) pLookupResult->h_addr_list[0]); // Short-cut
|
||||||
numAddressesFound ++;
|
//printf("ServerAddress = %08X\n", remoteAddr.sin_addr.s_addr);
|
||||||
}
|
|
||||||
//printf("Found %d addresses\n", numAddressesFound);
|
|
||||||
|
|
||||||
// Setup the remote address structure with the lookup results
|
// Perform connect operation
|
||||||
remoteAddr.sin_family = AF_INET;
|
if (connect(sock,
|
||||||
remoteAddr.sin_port = serverPort;
|
(struct sockaddr*) &remoteAddr,
|
||||||
remoteAddr.sin_addr.s_addr = *((int*) pLookupResult->h_addr_list[0]); // Short-cut
|
sizeof(struct sockaddr_in)) == SOCKET_ERROR)
|
||||||
//printf("ServerAddress = %08X\n", remoteAddr.sin_addr.s_addr);
|
{
|
||||||
|
printf("-NonHttpTest- Connection creation failed, error = %d\n", WSAGetLastError());
|
||||||
// Perform connect operation
|
|
||||||
if (connect(sock,
|
|
||||||
(struct sockaddr*) &remoteAddr,
|
|
||||||
sizeof(struct sockaddr_in)) == SOCKET_ERROR)
|
|
||||||
{
|
|
||||||
printf("-NonHttpTest- Connection creation failed, error = %d\n", WSAGetLastError());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Now the connection is setup, send the credentials to the server as one line.
|
|
||||||
// using our cheesy protocol followed by a hello string.
|
|
||||||
//
|
|
||||||
// Send the token to the server (including NULL terminator)
|
|
||||||
send(sock, authToken, (int) strlen(authToken) + 1, 0);
|
|
||||||
|
|
||||||
// Send new line
|
|
||||||
send(sock, "\n", 1, 0);
|
|
||||||
|
|
||||||
// Send "hello"
|
|
||||||
//send(sock, helloString, strlen(helloString) + 1, MSG_NOSIGNAL);
|
|
||||||
|
|
||||||
// Send new line
|
|
||||||
//send(sock, "\n", 1, 0);
|
|
||||||
|
|
||||||
// Shutdown the connection
|
|
||||||
shutdown(sock, 0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
printf("-NonHttpTest- Unsupported address type returned %08X\n", pLookupResult->h_addrtype);
|
// Now the connection is setup, send the credentials to the server as one line.
|
||||||
|
// using our cheesy protocol followed by a hello string.
|
||||||
|
//
|
||||||
|
// Send the token to the server (including NULL terminator)
|
||||||
|
send(sock, authToken, (int) strlen(authToken) + 1, 0);
|
||||||
|
|
||||||
|
// Send new line
|
||||||
|
send(sock, "\n", 1, 0);
|
||||||
|
|
||||||
|
// Send "hello"
|
||||||
|
//send(sock, helloString, strlen(helloString) + 1, MSG_NOSIGNAL);
|
||||||
|
|
||||||
|
// Send new line
|
||||||
|
//send(sock, "\n", 1, 0);
|
||||||
|
|
||||||
|
// Shutdown the connection
|
||||||
|
shutdown(sock, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
printf("-NonHttpTest- Lookup for %s failed\n", pServerAddress);
|
printf("-NonHttpTest- Unsupported address type returned %08X\n", pLookupResult->h_addrtype);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
printf("-NonHttpTest- Unable to bind socket, error = %d", errno);
|
printf("-NonHttpTest- Lookup for %s failed\n", pServerAddress);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Close the socket
|
|
||||||
setsockopt(sock, SOL_SOCKET, SO_LINGER, (const char*) &linger_opt, sizeof(linger_opt));
|
|
||||||
closesocket(sock);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
printf("-NonHttpTest- Unable to open socket, error = %d\n", errno);
|
printf("-NonHttpTest- Unable to bind socket, error = %d", errno);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Close winsock
|
// Close the socket
|
||||||
WSACleanup();
|
setsockopt(sock, SOL_SOCKET, SO_LINGER, (const char*) &linger_opt, sizeof(linger_opt));
|
||||||
|
closesocket(sock);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
printf("-NonHttpTest- WSAStartup failed, error = %d\n", winsockStartupResult);
|
printf("-NonHttpTest- Unable to open socket, error = %d\n", errno);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -297,235 +258,125 @@ void HttpTest(void)
|
|||||||
struct sockaddr_in remoteAddr = {0};
|
struct sockaddr_in remoteAddr = {0};
|
||||||
struct linger linger_opt = {1, 15};
|
struct linger linger_opt = {1, 15};
|
||||||
struct hostent *pLookupResult;
|
struct hostent *pLookupResult;
|
||||||
int winsockStartupResult;
|
|
||||||
WSADATA winsockData;
|
|
||||||
|
|
||||||
//printf("ObtainAuthToken succedded, token = %s\n", authToken);
|
//printf("ObtainAuthToken succedded, token = %s\n", authToken);
|
||||||
printf("-HttpTest- ObtainAuthToken succedded, tokenlen = %d\n", authTokenLen);
|
printf("-HttpTest- ObtainAuthToken succedded, tokenlen = %d\n", authTokenLen);
|
||||||
|
|
||||||
// Send the token to the server
|
// Send the token to the server
|
||||||
//
|
// Open socket
|
||||||
// First initialize winsock
|
sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
|
||||||
if ((winsockStartupResult = WSAStartup(MAKEWORD(2,2), &winsockData)) == 0)
|
if (sock != INVALID_SOCKET)
|
||||||
{
|
{
|
||||||
// Open socket
|
// Setup the local address structure
|
||||||
sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
|
localAddr.sin_family = AF_INET;
|
||||||
if (sock != INVALID_SOCKET)
|
localAddr.sin_addr.s_addr = htonl(INADDR_ANY);
|
||||||
|
|
||||||
|
// Bind socket
|
||||||
|
if (!bind(sock, (const struct sockaddr*) &localAddr, sizeof(struct sockaddr_in)))
|
||||||
{
|
{
|
||||||
// Setup the local address structure
|
// Resolve the server address
|
||||||
localAddr.sin_family = AF_INET;
|
pLookupResult = gethostbyname(pServerAddress);
|
||||||
localAddr.sin_addr.s_addr = htonl(INADDR_ANY);
|
if (pLookupResult)
|
||||||
|
|
||||||
// Bind socket
|
|
||||||
if (!bind(sock, (const struct sockaddr*) &localAddr, sizeof(struct sockaddr_in)))
|
|
||||||
{
|
{
|
||||||
// Resolve the server address
|
// Validate the address type returned
|
||||||
pLookupResult = gethostbyname(pServerAddress);
|
if (pLookupResult->h_addrtype == AF_INET)
|
||||||
if (pLookupResult)
|
|
||||||
{
|
{
|
||||||
// Validate the address type returned
|
int numAddressesFound = 0;
|
||||||
if (pLookupResult->h_addrtype == AF_INET)
|
|
||||||
|
// Determine how many addresses where returned
|
||||||
|
while (pLookupResult->h_addr_list[numAddressesFound] != NULL)
|
||||||
{
|
{
|
||||||
int numAddressesFound = 0;
|
//printf("ServerAddress = %08X\n", *((int*) pLookupResult->h_addr_list[numAddressesFound]));
|
||||||
|
numAddressesFound ++;
|
||||||
// Determine how many addresses where returned
|
}
|
||||||
while (pLookupResult->h_addr_list[numAddressesFound] != NULL)
|
//printf("Found %d addresses\n", numAddressesFound);
|
||||||
{
|
|
||||||
//printf("ServerAddress = %08X\n", *((int*) pLookupResult->h_addr_list[numAddressesFound]));
|
|
||||||
numAddressesFound ++;
|
|
||||||
}
|
|
||||||
//printf("Found %d addresses\n", numAddressesFound);
|
|
||||||
|
|
||||||
|
|
||||||
// Setup the remote address structure with the lookup results
|
// Setup the remote address structure with the lookup results
|
||||||
remoteAddr.sin_family = AF_INET;
|
remoteAddr.sin_family = AF_INET;
|
||||||
remoteAddr.sin_port = serverPort;
|
remoteAddr.sin_port = serverPort;
|
||||||
remoteAddr.sin_addr.s_addr = *((int*) pLookupResult->h_addr_list[0]); // Short-cut
|
remoteAddr.sin_addr.s_addr = *((int*) pLookupResult->h_addr_list[0]); // Short-cut
|
||||||
//printf("ServerAddress = %08X\n", remoteAddr.sin_addr.s_addr);
|
//printf("ServerAddress = %08X\n", remoteAddr.sin_addr.s_addr);
|
||||||
|
|
||||||
// Perform connect operation
|
// Perform connect operation
|
||||||
if (connect(sock,
|
if (connect(sock,
|
||||||
(struct sockaddr*) &remoteAddr,
|
(struct sockaddr*) &remoteAddr,
|
||||||
sizeof(struct sockaddr_in)) == SOCKET_ERROR)
|
sizeof(struct sockaddr_in)) == SOCKET_ERROR)
|
||||||
{
|
{
|
||||||
printf("-HttpTest- Connection creation failed, error = %d\n", WSAGetLastError());
|
printf("-HttpTest- Connection creation failed, error = %d\n", WSAGetLastError());
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
char *pBasicCredentials;
|
|
||||||
char *pEncodedBasicCredentials;
|
|
||||||
int encodedLength;
|
|
||||||
char CasaPrincipal[] = "CasaPrincipal:";
|
|
||||||
char HTTPReqPart1[] = "GET /example-info HTTP/1.1\r\\nUser-Agent: CasaTestClient\r\nHost: jcstation.dnsdhcp.provo.novell.com:4096\r\nConnection: Keep-Alive\r\nAuthorization: Basic ";
|
|
||||||
|
|
||||||
// Now the connection is setup, send 1st part of HTTP request to the server.
|
|
||||||
send(sock, HTTPReqPart1, (int) strlen(HTTPReqPart1), 0);
|
|
||||||
|
|
||||||
// Now setup the HTTP Basic Credentials
|
|
||||||
pBasicCredentials = (char*) malloc(strlen(CasaPrincipal) + strlen(authToken) + 1);
|
|
||||||
if (pBasicCredentials)
|
|
||||||
{
|
|
||||||
char *pEncodedCredentials;
|
|
||||||
|
|
||||||
memcpy(pBasicCredentials, CasaPrincipal, sizeof(CasaPrincipal));
|
|
||||||
strcat(pBasicCredentials, authToken);
|
|
||||||
|
|
||||||
// Now Base64 encode the credentials
|
|
||||||
if (EncodeData(pBasicCredentials, strlen(pBasicCredentials), &pEncodedBasicCredentials, &encodedLength) == 0)
|
|
||||||
{
|
|
||||||
// Send the encoded credentials
|
|
||||||
send(sock, pEncodedBasicCredentials, encodedLength - 1, 0);
|
|
||||||
|
|
||||||
// Send the rest of the header
|
|
||||||
send(sock, "\r\n\r\n", 4, 0);
|
|
||||||
|
|
||||||
// Free the buffer holding the encoded credentials
|
|
||||||
free(pEncodedBasicCredentials);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
printf("-HttpTest- Error encoding credentials\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Free the buffer containing the basic credentials
|
|
||||||
free(pBasicCredentials);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
printf("-HttpTest- Buffer allocation failure\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Shutdown the connection
|
|
||||||
shutdown(sock, 0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
printf("-HttpTest- Unsupported address type returned %08X\n", pLookupResult->h_addrtype);
|
char *pBasicCredentials;
|
||||||
|
char *pEncodedBasicCredentials;
|
||||||
|
int encodedLength;
|
||||||
|
char CasaPrincipal[] = "CasaPrincipal:";
|
||||||
|
char HTTPReqPart1[] = "GET /example-info HTTP/1.1\r\\nUser-Agent: CasaTestClient\r\nHost: jcstation.dnsdhcp.provo.novell.com:4096\r\nConnection: Keep-Alive\r\nAuthorization: Basic ";
|
||||||
|
|
||||||
|
// Now the connection is setup, send 1st part of HTTP request to the server.
|
||||||
|
send(sock, HTTPReqPart1, (int) strlen(HTTPReqPart1), 0);
|
||||||
|
|
||||||
|
// Now setup the HTTP Basic Credentials
|
||||||
|
pBasicCredentials = (char*) malloc(strlen(CasaPrincipal) + strlen(authToken) + 1);
|
||||||
|
if (pBasicCredentials)
|
||||||
|
{
|
||||||
|
memcpy(pBasicCredentials, CasaPrincipal, sizeof(CasaPrincipal));
|
||||||
|
strcat(pBasicCredentials, authToken);
|
||||||
|
|
||||||
|
// Now Base64 encode the credentials
|
||||||
|
if (EncodeData((const void*) pBasicCredentials,
|
||||||
|
(const int32_t) strlen(pBasicCredentials),
|
||||||
|
&pEncodedBasicCredentials,
|
||||||
|
(int32_t *) &encodedLength) == 0)
|
||||||
|
{
|
||||||
|
// Send the encoded credentials
|
||||||
|
send(sock, pEncodedBasicCredentials, encodedLength - 1, 0);
|
||||||
|
|
||||||
|
// Send the rest of the header
|
||||||
|
send(sock, "\r\n\r\n", 4, 0);
|
||||||
|
|
||||||
|
// Free the buffer holding the encoded credentials
|
||||||
|
free(pEncodedBasicCredentials);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
printf("-HttpTest- Error encoding credentials\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Free the buffer containing the basic credentials
|
||||||
|
free(pBasicCredentials);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
printf("-HttpTest- Buffer allocation failure\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Shutdown the connection
|
||||||
|
shutdown(sock, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
printf("-HttpTest- Lookup for %s failed\n", pServerAddress);
|
printf("-HttpTest- Unsupported address type returned %08X\n", pLookupResult->h_addrtype);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
printf("-HttpTest- Unable to bind socket, error = %d", errno);
|
printf("-HttpTest- Lookup for %s failed\n", pServerAddress);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Close the socket
|
|
||||||
setsockopt(sock, SOL_SOCKET, SO_LINGER, (const char*) &linger_opt, sizeof(linger_opt));
|
|
||||||
closesocket(sock);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
printf("-HttpTest- Unable to open socket, error = %d\n", errno);
|
printf("-HttpTest- Unable to bind socket, error = %d", errno);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Close winsock
|
// Close the socket
|
||||||
WSACleanup();
|
setsockopt(sock, SOL_SOCKET, SO_LINGER, (const char*) &linger_opt, sizeof(linger_opt));
|
||||||
|
closesocket(sock);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
printf("-HttpTest- WSAStartup failed, error = %d\n", winsockStartupResult);
|
printf("-HttpTest- Unable to open socket, error = %d\n", errno);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
|
||||||
*
|
|
||||||
* main()
|
|
||||||
*
|
|
||||||
***********************************************************************/
|
|
||||||
int main(int argc, char* argv[])
|
|
||||||
{
|
|
||||||
// Process input parameters
|
|
||||||
int i = 1;
|
|
||||||
while(argv[i] != NULL)
|
|
||||||
{
|
|
||||||
if (stricmp(argv[i], "-a") == 0)
|
|
||||||
{
|
|
||||||
// Server Address option, the next argument should
|
|
||||||
// contain the address.
|
|
||||||
i++;
|
|
||||||
if (argv[i] != NULL)
|
|
||||||
{
|
|
||||||
pServerAddress = argv[i];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
printf(usageString);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (stricmp(argv[i], "-p") == 0)
|
|
||||||
{
|
|
||||||
// Server port option, the next argument should
|
|
||||||
// contain the port.
|
|
||||||
i++;
|
|
||||||
if (argv[i] != NULL)
|
|
||||||
{
|
|
||||||
serverPort = htons(dtoul(argv[i], strlen(argv[i])));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
printf(usageString);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (stricmp(argv[i], "-s") == 0)
|
|
||||||
{
|
|
||||||
// Service name option, the next argument should
|
|
||||||
// contain the name of the service to be targeted.
|
|
||||||
i++;
|
|
||||||
if (argv[i] != NULL)
|
|
||||||
{
|
|
||||||
pServiceName = argv[i];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
printf(usageString);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (stricmp(argv[i], "-h") == 0)
|
|
||||||
{
|
|
||||||
// Perform http test option
|
|
||||||
execHttpTest = TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Advance to the next argument
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Verify that the server address and port were specified
|
|
||||||
if (pServerAddress && serverPort != 0)
|
|
||||||
{
|
|
||||||
// Repeat the test when indicated
|
|
||||||
printf("Press 'Enter' to run test or 'n + Enter' to stop.\n");
|
|
||||||
while(getchar() != 'n')
|
|
||||||
{
|
|
||||||
// Execute the appropriate test
|
|
||||||
if (execHttpTest)
|
|
||||||
{
|
|
||||||
HttpTest();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
NonHttpTest();
|
|
||||||
}
|
|
||||||
printf("Press 'Enter' to run test or 'n + Enter' to stop.\n");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
printf(usageString);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
187
CASA-auth-token/non-java/client/test/windows/main.cpp
Normal file
187
CASA-auth-token/non-java/client/test/windows/main.cpp
Normal file
@ -0,0 +1,187 @@
|
|||||||
|
/***********************************************************************
|
||||||
|
*
|
||||||
|
* 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>
|
||||||
|
*
|
||||||
|
***********************************************************************/
|
||||||
|
|
||||||
|
#include "platform.h"
|
||||||
|
|
||||||
|
// Extern functions
|
||||||
|
extern
|
||||||
|
void NonHttpTest(void);
|
||||||
|
|
||||||
|
extern
|
||||||
|
void HttpTest(void);
|
||||||
|
|
||||||
|
|
||||||
|
// Globals
|
||||||
|
char usageString[] = "usage: test -a serverAddress -p serverPort [-s serviceName] [-h]\n";
|
||||||
|
|
||||||
|
char *pServerAddress = NULL;
|
||||||
|
int serverPort = 0;
|
||||||
|
BOOLEAN execHttpTest = FALSE;
|
||||||
|
|
||||||
|
char serviceName[] = "testService";
|
||||||
|
char *pServiceName = serviceName;
|
||||||
|
|
||||||
|
|
||||||
|
/***********************************************************************
|
||||||
|
*
|
||||||
|
* dtoul()
|
||||||
|
*
|
||||||
|
***********************************************************************/
|
||||||
|
int
|
||||||
|
dtoul(
|
||||||
|
IN char *cp,
|
||||||
|
IN int len)
|
||||||
|
{
|
||||||
|
int n = 0;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; i < len; i++, cp++)
|
||||||
|
{
|
||||||
|
// Verify that we are dealing with a valid digit
|
||||||
|
if (*cp >= '0' && *cp <= '9')
|
||||||
|
{
|
||||||
|
n = 10 * n + (*cp - '0');
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
printf("-dtoul- Found invalid digit\n");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return n;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/***********************************************************************
|
||||||
|
*
|
||||||
|
* main()
|
||||||
|
*
|
||||||
|
***********************************************************************/
|
||||||
|
int main(int argc, char* argv[])
|
||||||
|
{
|
||||||
|
// Process input parameters
|
||||||
|
int i = 1;
|
||||||
|
while(argv[i] != NULL)
|
||||||
|
{
|
||||||
|
if (stricmp(argv[i], "-a") == 0)
|
||||||
|
{
|
||||||
|
// Server Address option, the next argument should
|
||||||
|
// contain the address.
|
||||||
|
i++;
|
||||||
|
if (argv[i] != NULL)
|
||||||
|
{
|
||||||
|
pServerAddress = argv[i];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
printf(usageString);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (stricmp(argv[i], "-p") == 0)
|
||||||
|
{
|
||||||
|
// Server port option, the next argument should
|
||||||
|
// contain the port.
|
||||||
|
i++;
|
||||||
|
if (argv[i] != NULL)
|
||||||
|
{
|
||||||
|
serverPort = htons(dtoul(argv[i], (int) strlen(argv[i])));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
printf(usageString);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (stricmp(argv[i], "-s") == 0)
|
||||||
|
{
|
||||||
|
// Service name option, the next argument should
|
||||||
|
// contain the name of the service to be targeted.
|
||||||
|
i++;
|
||||||
|
if (argv[i] != NULL)
|
||||||
|
{
|
||||||
|
pServiceName = argv[i];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
printf(usageString);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (stricmp(argv[i], "-h") == 0)
|
||||||
|
{
|
||||||
|
// Perform http test option
|
||||||
|
execHttpTest = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Advance to the next argument
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Verify that the server address and port were specified
|
||||||
|
if (pServerAddress && serverPort != 0)
|
||||||
|
{
|
||||||
|
int winsockStartupResult;
|
||||||
|
WSADATA winsockData;
|
||||||
|
|
||||||
|
// First initialize winsock
|
||||||
|
if ((winsockStartupResult = WSAStartup(MAKEWORD(2,2), &winsockData)) == 0)
|
||||||
|
{
|
||||||
|
// Repeat the test when indicated
|
||||||
|
printf("Press 'Enter' to run test or 'n + Enter' to stop.\n");
|
||||||
|
while(getchar() != 'n')
|
||||||
|
{
|
||||||
|
// Execute the appropriate test
|
||||||
|
if (execHttpTest)
|
||||||
|
{
|
||||||
|
HttpTest();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
NonHttpTest();
|
||||||
|
}
|
||||||
|
printf("Press 'Enter' to run test or 'n + Enter' to stop.\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Close winsock
|
||||||
|
WSACleanup();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
printf("-main- WSAStartup failed, error = %d\n", winsockStartupResult);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
printf(usageString);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
27
CASA-auth-token/non-java/client/test/windows/platform.h
Normal file
27
CASA-auth-token/non-java/client/test/windows/platform.h
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
/***********************************************************************
|
||||||
|
*
|
||||||
|
* 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>
|
||||||
|
*
|
||||||
|
***********************************************************************/
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <windows.h>
|
||||||
|
#include "casa_c_authtoken.h"
|
@ -19,7 +19,7 @@
|
|||||||
<Tool
|
<Tool
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
Optimization="0"
|
Optimization="0"
|
||||||
AdditionalIncludeDirectories=""..\..\include";"C:\Program Files\novell\CASA\include""
|
AdditionalIncludeDirectories=""C:\Dev\casa\CASA-auth-token\non-java\client\test\windows";"C:\Dev\casa\CASA-auth-token\non-java\include";"C:\Program Files\novell\CASA\include""
|
||||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
|
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
|
||||||
MinimalRebuild="TRUE"
|
MinimalRebuild="TRUE"
|
||||||
BasicRuntimeChecks="3"
|
BasicRuntimeChecks="3"
|
||||||
@ -70,7 +70,7 @@
|
|||||||
CharacterSet="2">
|
CharacterSet="2">
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
AdditionalIncludeDirectories=""..\..\include";"C:\Program Files\novell\CASA\include""
|
AdditionalIncludeDirectories=""C:\Dev\casa\CASA-auth-token\non-java\client\test\windows";"C:\Dev\casa\CASA-auth-token\non-java\include";"C:\Program Files\novell\CASA\include""
|
||||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
|
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
|
||||||
RuntimeLibrary="4"
|
RuntimeLibrary="4"
|
||||||
UsePrecompiledHeader="0"
|
UsePrecompiledHeader="0"
|
||||||
@ -120,22 +120,25 @@
|
|||||||
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
|
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
|
||||||
<File
|
<File
|
||||||
RelativePath=".\CASA_Auth.cpp">
|
RelativePath="..\CASA_Auth.cpp">
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\main.cpp">
|
||||||
</File>
|
</File>
|
||||||
</Filter>
|
</Filter>
|
||||||
<Filter
|
<Filter
|
||||||
Name="Header Files"
|
Name="Header Files"
|
||||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
|
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
|
||||||
|
<File
|
||||||
|
RelativePath=".\platform.h">
|
||||||
|
</File>
|
||||||
</Filter>
|
</Filter>
|
||||||
<Filter
|
<Filter
|
||||||
Name="Resource Files"
|
Name="Resource Files"
|
||||||
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
|
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
|
||||||
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}">
|
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}">
|
||||||
</Filter>
|
</Filter>
|
||||||
<File
|
|
||||||
RelativePath=".\ReadMe.txt">
|
|
||||||
</File>
|
|
||||||
</Files>
|
</Files>
|
||||||
<Globals>
|
<Globals>
|
||||||
</Globals>
|
</Globals>
|
Loading…
Reference in New Issue
Block a user