mirror of
https://git.openafs.org/openafs.git
synced 2025-01-21 08:20:16 +00:00
jaltman-afsd-loopback-w2k-and-noipc-patches-20031121
* Change handling of CM_ERROR_NOIPC to return an Access Denied error instead of a Bad Network Name error. The reason is that Bad Network Name results in a subsequent query by many apps to find a good network name which cannot be accomplished. Access Denied is more appropriate and results in an immediate error return. * Disable the Loopback Adapter hack for operating systems prior to Windows XP because the Loopback adapter on previous versions does not perform loopback operations on Broadcast messages which are necessary for the proper registration of the NETBIOS name for the AFS Service. * Many minor corrections to uninitialized variables; spelling errors; formatting errors; etc.
This commit is contained in:
parent
955d376ddd
commit
1972aa4414
@ -167,7 +167,7 @@ BOOL InitInstance(
|
|||||||
main_rect.right = GetDeviceCaps(hDC, HORZRES);
|
main_rect.right = GetDeviceCaps(hDC, HORZRES);
|
||||||
main_rect.top = GetDeviceCaps(hDC, LOGPIXELSY) / 4; /* 1/4 inch */
|
main_rect.top = GetDeviceCaps(hDC, LOGPIXELSY) / 4; /* 1/4 inch */
|
||||||
ReleaseDC(hWnd, hDC);
|
ReleaseDC(hWnd, hDC);
|
||||||
main_rect.bottom = rect.top + nLineHeight;
|
main_rect.bottom = main_rect.top + nLineHeight;
|
||||||
|
|
||||||
osi_InitPanic(afsd_notifier);
|
osi_InitPanic(afsd_notifier);
|
||||||
|
|
||||||
|
@ -2113,6 +2113,7 @@ register struct cmd_syndesc *as; {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1862,7 +1862,7 @@ void smb_MapNTError(long code, unsigned long *NTStatusp)
|
|||||||
NTStatus = 0xC00000CCL; /* Bad network name */
|
NTStatus = 0xC00000CCL; /* Bad network name */
|
||||||
}
|
}
|
||||||
else if (code == CM_ERROR_NOIPC) {
|
else if (code == CM_ERROR_NOIPC) {
|
||||||
NTStatus = 0xC00000CCL; /* Bad network name */
|
NTStatus = 0xC0000022L; /* Access Denied */
|
||||||
}
|
}
|
||||||
else if (code == CM_ERROR_CLOCKSKEW) {
|
else if (code == CM_ERROR_CLOCKSKEW) {
|
||||||
NTStatus = 0xC0000133L; /* Time difference at DC */
|
NTStatus = 0xC0000133L; /* Time difference at DC */
|
||||||
@ -1986,8 +1986,8 @@ void smb_MapCoreError(long code, smb_vc_t *vcp, unsigned short *scodep,
|
|||||||
error = 6;
|
error = 6;
|
||||||
}
|
}
|
||||||
else if (code == CM_ERROR_NOIPC) {
|
else if (code == CM_ERROR_NOIPC) {
|
||||||
class = 1;
|
class = 2;
|
||||||
error = 66;
|
error = 4; /* bad access */
|
||||||
}
|
}
|
||||||
else if (code == CM_ERROR_CLOCKSKEW) {
|
else if (code == CM_ERROR_CLOCKSKEW) {
|
||||||
class = 1; /* invalid function */
|
class = 1; /* invalid function */
|
||||||
@ -5881,17 +5881,17 @@ void InitNCBslot(int idx)
|
|||||||
void smb_Listener(void *parmp)
|
void smb_Listener(void *parmp)
|
||||||
{
|
{
|
||||||
NCB *ncbp;
|
NCB *ncbp;
|
||||||
long code;
|
long code;
|
||||||
long len;
|
long len;
|
||||||
long i, j;
|
long i, j;
|
||||||
smb_vc_t *vcp;
|
smb_vc_t *vcp;
|
||||||
int flags;
|
int flags = 0;
|
||||||
char rname[NCBNAMSZ+1];
|
char rname[NCBNAMSZ+1];
|
||||||
char cname[MAX_COMPUTERNAME_LENGTH+1];
|
char cname[MAX_COMPUTERNAME_LENGTH+1];
|
||||||
int cnamelen = MAX_COMPUTERNAME_LENGTH+1;
|
int cnamelen = MAX_COMPUTERNAME_LENGTH+1;
|
||||||
#ifdef DJGPP
|
#ifdef DJGPP
|
||||||
dos_ptr dos_ncb;
|
dos_ptr dos_ncb;
|
||||||
time_t now;
|
time_t now;
|
||||||
#endif /* DJGPP */
|
#endif /* DJGPP */
|
||||||
int lana = (int) parmp;
|
int lana = (int) parmp;
|
||||||
|
|
||||||
@ -6059,6 +6059,7 @@ void smb_NetbiosInit()
|
|||||||
int delname_tried=0;
|
int delname_tried=0;
|
||||||
int len;
|
int len;
|
||||||
int lana_found = 0;
|
int lana_found = 0;
|
||||||
|
OSVERSIONINFO Version;
|
||||||
|
|
||||||
/*******************************************************************/
|
/*******************************************************************/
|
||||||
/* ms loopback adapter scan */
|
/* ms loopback adapter scan */
|
||||||
@ -6076,6 +6077,11 @@ void smb_NetbiosInit()
|
|||||||
unsigned char kWLA_MAC[6] = { 0x02, 0x00, 0x4c, 0x4f, 0x4f, 0x50 };
|
unsigned char kWLA_MAC[6] = { 0x02, 0x00, 0x4c, 0x4f, 0x4f, 0x50 };
|
||||||
/*******************************************************************/
|
/*******************************************************************/
|
||||||
|
|
||||||
|
/* Get the version of Windows */
|
||||||
|
memset(&Version, 0x00, sizeof(Version));
|
||||||
|
Version.dwOSVersionInfoSize = sizeof(Version);
|
||||||
|
GetVersionEx(&Version);
|
||||||
|
|
||||||
/* setup the NCB system */
|
/* setup the NCB system */
|
||||||
ncbp = GetNCB();
|
ncbp = GetNCB();
|
||||||
#ifdef DJGPP
|
#ifdef DJGPP
|
||||||
@ -6108,39 +6114,54 @@ void smb_NetbiosInit()
|
|||||||
ncbp->ncb_callname[2] = 100;
|
ncbp->ncb_callname[2] = 100;
|
||||||
ncbp->ncb_lana_num = lana_list.lana[i];
|
ncbp->ncb_lana_num = lana_list.lana[i];
|
||||||
code = Netbios(ncbp);
|
code = Netbios(ncbp);
|
||||||
if (code == 0) code = ncbp->ncb_retcode;
|
if (code == 0)
|
||||||
|
code = ncbp->ncb_retcode;
|
||||||
if (code != 0) {
|
if (code != 0) {
|
||||||
sprintf(s, "Netbios NCBRESET lana %d error code %d", lana_list.lana[i], code);
|
sprintf(s, "Netbios NCBRESET lana %d error code %d", lana_list.lana[i], code);
|
||||||
afsi_log(s);
|
afsi_log(s);
|
||||||
lana_list.lana[i] = 255; /* invalid lana */
|
lana_list.lana[i] = 255; /* invalid lana */
|
||||||
} else {
|
} else {
|
||||||
sprintf(s, "Netbios NCBRESET lana %d succeeded", lana_list.lana[i]);
|
sprintf(s, "Netbios NCBRESET lana %d succeeded", lana_list.lana[i]);
|
||||||
afsi_log(s);
|
afsi_log(s);
|
||||||
/* check to see if this is the "Microsoft Loopback Adapter" */
|
memset( ncbp, 0, sizeof (*ncbp) );
|
||||||
memset( ncbp, 0, sizeof (*ncbp) );
|
ncbp->ncb_command = NCBASTAT;
|
||||||
ncbp->ncb_command = NCBASTAT;
|
ncbp->ncb_lana_num = lana_list.lana[i];
|
||||||
ncbp->ncb_lana_num = lana_list.lana[i];
|
strcpy( ncbp->ncb_callname, "* " );
|
||||||
strcpy( ncbp->ncb_callname, "* " );
|
ncbp->ncb_buffer = (char *) &Adapter;
|
||||||
ncbp->ncb_buffer = (char *) &Adapter;
|
ncbp->ncb_length = sizeof(Adapter);
|
||||||
ncbp->ncb_length = sizeof(Adapter);
|
code = Netbios( ncbp );
|
||||||
code = Netbios( ncbp );
|
|
||||||
|
|
||||||
if ( code == 0 ) {
|
if ( code == 0 ) {
|
||||||
wla_found = TRUE;
|
wla_found = TRUE;
|
||||||
for (j=0; wla_found && (j<6); j++)
|
for (j=0; wla_found && (j<6); j++)
|
||||||
wla_found = ( Adapter.status.adapter_address[j] == kWLA_MAC[j] );
|
wla_found = ( Adapter.status.adapter_address[j] == kWLA_MAC[j] );
|
||||||
|
|
||||||
if ( wla_found ) {
|
if ( wla_found ) {
|
||||||
sprintf(s, "Windows Loopback Adapter detected lana %d", lana_list.lana[i]);
|
/*
|
||||||
afsi_log(s);
|
* check to see if this is the Microsoft Loopback Adapter"
|
||||||
|
* if we are running on Windows XP or higher
|
||||||
|
*/
|
||||||
|
if ( Version.dwPlatformId == VER_PLATFORM_WIN32_NT &&
|
||||||
|
( Version.dwMajorVersion > 5 ||
|
||||||
|
Version.dwMajorVersion == 5 &&
|
||||||
|
Version.dwMinorVersion >= 1 )
|
||||||
|
)
|
||||||
|
{
|
||||||
|
sprintf(s, "Windows Loopback Adapter detected lana %d", lana_list.lana[i]);
|
||||||
|
afsi_log(s);
|
||||||
|
|
||||||
/* select this lana; no need to continue */
|
/* select this lana; no need to continue */
|
||||||
lana_list.length = 1;
|
lana_list.length = 1;
|
||||||
lana_list.lana[0] = lana_list.lana[i];
|
lana_list.lana[0] = lana_list.lana[i];
|
||||||
break;
|
break;
|
||||||
}
|
} else {
|
||||||
}
|
sprintf(s, "Windows Loopback Adapter disabled lana %d", lana_list.lana[i]);
|
||||||
}
|
afsi_log(s);
|
||||||
|
lana_list.lana[i] = 255; /* invalid lana */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
/* for DJGPP, there is no NCBENUM and NCBRESET is a real reset. so
|
/* for DJGPP, there is no NCBENUM and NCBRESET is a real reset. so
|
||||||
@ -6270,16 +6291,16 @@ void smb_Init(osi_log_t *logp, char *snamep, int useV3, int LANadapt,
|
|||||||
|
|
||||||
{
|
{
|
||||||
thread_t phandle;
|
thread_t phandle;
|
||||||
int lpid;
|
int lpid;
|
||||||
int i;
|
int i;
|
||||||
long code;
|
long code;
|
||||||
int len;
|
int len;
|
||||||
NCB *ncbp;
|
NCB *ncbp;
|
||||||
struct tm myTime;
|
struct tm myTime;
|
||||||
char s[100];
|
char s[100];
|
||||||
#ifdef DJGPP
|
#ifdef DJGPP
|
||||||
int npar, seg, sel;
|
int npar, seg, sel;
|
||||||
dos_ptr rawBuf;
|
dos_ptr rawBuf;
|
||||||
#endif /* DJGPP */
|
#endif /* DJGPP */
|
||||||
|
|
||||||
#ifndef DJGPP
|
#ifndef DJGPP
|
||||||
|
Loading…
Reference in New Issue
Block a user