// NULL or empty cell returns information on local cell
if (rc = get_cellconfig(Dmycell, &ak_cellconfig, local_cell))
{
- KFW_AFS_error(rc, "get_cellconfig()");
+ // KFW_AFS_error(rc, "get_cellconfig()");
return(rc);
}
else
errText = "Unknown error!";
- sprintf(message, "%s\n(%s failed)", errText, FailedFunctionName);
+ sprintf(message, "%s (0x%x)\n(%s failed)", errText, rc, FailedFunctionName);
if ( IsDebuggerPresent() ) {
OutputDebugString(message);
code = pkrb5_c_random_make_octets(ctx, &pwdata);
if (code) {
int i;
- for ( i=0 ; i<PROBE_PASSWORD_LEN ; i )
+ for ( i=0 ; i<PROBE_PASSWORD_LEN ; i++ )
password[i] = 'x';
}
password[PROBE_PASSWORD_LEN] = '\0';
}
} else {
int i;
- for ( i=0 ; i<PROBE_PASSWORD_LEN ; i )
+
+ for ( i=0 ; i<PROBE_PASSWORD_LEN ; i++ )
password[i] = 'x';
- code = ObtainNewCredentials(rootcell, PROBE_USERNAME, password);
- serverReachable = 1;
+ code = ObtainNewCredentials(rootcell, PROBE_USERNAME, password, TRUE);
+ switch ( code ) {
+ case INTK_BADPW:
+ case KERB_ERR_PRINCIPAL_UNKNOWN:
+ case KERB_ERR_SERVICE_EXP:
+ case RD_AP_TIME:
+ serverReachable = TRUE;
+ break;
+ default:
+ serverReachable = FALSE;
+ }
}
#endif
if ( !serverReachable ) {
if (code == ERROR_INSUFFICIENT_BUFFER) {
pIpAddrTable = malloc(dwSize);
code = GetIpAddrTable(pIpAddrTable, &dwSize, 0);
- for ( index=0; index < pIpAddrTable->dwNumEntries; index++ ) {
- if (pIpAddrTable->table[index].dwAddr != 0)
- validAddrs++;
+ if ( code == NO_ERROR ) {
+ for ( index=0; index < pIpAddrTable->dwNumEntries; index++ ) {
+ if (pIpAddrTable->table[index].dwAddr != 0)
+ validAddrs++;
+ }
}
free(pIpAddrTable);
}
IpAddrChangeMonitor(void * hWnd)
{
#ifdef USE_OVERLAPPED
- HANDLE Handle = INVALID_HANDLE_VALUE;
+ HANDLE Handle = INVALID_HANDLE_VALUE; /* Do Not Close This Handle */
OVERLAPPED Ovlap;
#endif /* USE_OVERLAPPED */
DWORD Result;
DWORD prevNumOfAddrs = GetNumOfIpAddrs();
DWORD NumOfAddrs;
+ char message[256];
if ( !hWnd )
return;
Result = NotifyAddrChange(&Handle,&Ovlap);
if (Result != ERROR_IO_PENDING)
{
- printf("NotifyAddrChange() failed with error %d \n", Result);
+ if ( IsDebuggerPresent() ) {
+ sprintf(message, "NotifyAddrChange() failed with error %d \n", Result);
+ OutputDebugString(message);
+ }
break;
}
- if ((Result = WaitForSingleObject(Handle,INFINITE)) == WAIT_FAILED)
+ if ((Result = WaitForSingleObject(Handle,INFINITE)) != WAIT_OBJECT_0)
{
- printf("WaitForSingleObject() failed with error %d\n",
- GetLastError());
+ if ( IsDebuggerPresent() ) {
+ sprintf(message, "WaitForSingleObject() failed with error %d\n",
+ GetLastError());
+ OutputDebugString(message);
+ }
continue;
}
if (GetOverlappedResult(Handle, &Ovlap,
&DataTransfered, TRUE) == 0)
{
- printf("GetOverlapped result failed %d \n",
- GetLastError());
+ if ( IsDebuggerPresent() ) {
+ sprintf(message, "GetOverlapped result failed %d \n",
+ GetLastError());
+ OutputDebugString(message);
+ }
break;
}
-
#else
Result = NotifyAddrChange(NULL,NULL);
+ if (Result != NO_ERROR)
+ {
+ if ( IsDebuggerPresent() ) {
+ sprintf(message, "NotifyAddrChange() failed with error %d \n", Result);
+ OutputDebugString(message);
+ }
+ break;
+ }
#endif
NumOfAddrs = GetNumOfIpAddrs();
if ( IsDebuggerPresent() ) {
- char message[256];
sprintf(message,"IPAddrChangeMonitor() NumOfAddrs: now %d was %d\n",
NumOfAddrs, prevNumOfAddrs);
OutputDebugString(message);
}
prevNumOfAddrs = NumOfAddrs;
}
-
-#ifdef USE_OVERLAPPED
- if (Handle != INVALID_HANDLE_VALUE)
- CloseHandle(Handle);
-#endif
}