[reSIProcate] nonce delta incorrect when authenticating request
Justin Matthews
jmatthewsr at yahoo.com
Mon Jul 24 14:41:29 CDT 2006
I believe the code, for windows only, in Timer.cxx::getSystemTime is causing
helper.cxx::advancedAuthenticateRequest to fail due to the nonce time delta
calculation. For this scenario nonce is expected to most likely be the unix
epoch timestamp, getSystemTime can be normalized to return the unix-style
time on windows as follows.
UInt64
Timer::getSystemTime()
{
assert( sizeof(UInt64) == 64/8 );
UInt64 time=0;
#if defined(WIN32)
FILETIME ft;
GetSystemTimeAsFileTime(&ft);
ULARGE_INTEGER li;
li.LowPart = ft.dwLowDateTime;
li.HighPart = ft.dwHighDateTime;
/** Micro-second difference between windows and unix epoch time:
* 01.01.1970 - 01.01.1601 = 11644473600000000
*/
time = (li.QuadPart/10) - 11644473600000000ULL;
#else
struct timeval now;
gettimeofday( &now , NULL );
//assert( now );
time = now.tv_sec;
time = time*1000000;
time += now.tv_usec;
#endif
return time;
}
More information about the resiprocate-devel
mailing list