NTSTATUS ntStatus = STATUS_SUCCESS;
AFSProviderConnectionCB *pConnection = NULL, *pLastConnection = NULL;
- UNICODE_STRING uniRemoteName;
+ UNICODE_STRING uniRemoteName, uniServerName, uniShareName, uniRemainingPath;
AFSDeviceExt *pRDRDevExt = (AFSDeviceExt *)AFSRDRDeviceObject->DeviceExtension;
__Enter
"AFSAddConnection Retrieved authentication id %I64X\n",
ConnectCB->AuthenticationId.QuadPart));
+ uniServerName.Length = 0;
+ uniServerName.MaximumLength = 0;
+ uniServerName.Buffer = NULL;
+
+ uniShareName.Length = 0;
+ uniShareName.MaximumLength = 0;
+ uniShareName.Buffer = NULL;
+
AFSAcquireExcl( &pRDRDevExt->Specific.RDR.ProviderListLock,
TRUE);
uniRemoteName.Buffer = ConnectCB->RemoteName;
//
- // Strip off any trailing slashes
- //
+ // Strip off any trailing slashes
+ //
if( uniRemoteName.Length >= sizeof( WCHAR)
&& uniRemoteName.Buffer[ (uniRemoteName.Length/sizeof( WCHAR)) - 1] == L'\\')
- {
+ {
uniRemoteName.Length -= sizeof( WCHAR);
}
while( pConnection != NULL)
{
+ if( pConnection->LocalName != L'\0')
+ {
+
+ AFSDbgTrace(( AFS_SUBSYSTEM_NETWORK_PROVIDER,
+ AFS_TRACE_LEVEL_VERBOSE,
+ "AFSAddConnection Comparing passed in %C to %C authentication id %I64X - %I64X\n",
+ ConnectCB->LocalName,
+ pConnection->LocalName,
+ ConnectCB->AuthenticationId.QuadPart,
+ pConnection->AuthenticationId.QuadPart));
+ }
+ else
+ {
+
+ AFSDbgTrace(( AFS_SUBSYSTEM_NETWORK_PROVIDER,
+ AFS_TRACE_LEVEL_VERBOSE,
+ "AFSAddConnection Comparing passed in %C to (NULL) authentication id %I64X - %I64X\n",
+ ConnectCB->LocalName,
+ ConnectCB->AuthenticationId.QuadPart,
+ pConnection->AuthenticationId.QuadPart));
+ }
+
if( pConnection->LocalName == ConnectCB->LocalName &&
pConnection->AuthenticationId.QuadPart == ConnectCB->AuthenticationId.QuadPart &&
RtlCompareUnicodeString( &uniRemoteName,
uniRemoteName.Length -= (2 * sizeof( WCHAR));
}
- if( uniRemoteName.Length >= AFSServerName.Length)
- {
+ FsRtlDissectName( uniRemoteName,
+ &uniServerName,
+ &uniRemainingPath);
- USHORT usLength = uniRemoteName.Length;
-
- if (uniRemoteName.Buffer[AFSServerName.Length/sizeof( WCHAR)] != L'\\')
- {
-
- if( ConnectCB->LocalName != L'\0')
- {
-
- AFSDbgTrace(( AFS_SUBSYSTEM_NETWORK_PROVIDER,
- AFS_TRACE_LEVEL_VERBOSE,
- "AFSAddConnection BAD_NETNAME 1 remote name %wZ Local %C authentication id %I64X\n",
- &uniRemoteName,
- ConnectCB->LocalName,
- ConnectCB->AuthenticationId.QuadPart));
- }
- else
- {
-
- AFSDbgTrace(( AFS_SUBSYSTEM_NETWORK_PROVIDER,
- AFS_TRACE_LEVEL_VERBOSE,
- "AFSAddConnection BAD_NETNAME 1 remote name %wZ Local (NULL) authentication id %I64X\n",
- &uniRemoteName,
- ConnectCB->AuthenticationId.QuadPart));
- }
+ if( RtlCompareUnicodeString( &uniServerName,
+ &AFSServerName,
+ TRUE) != 0)
+ {
- *ResultStatus = WN_BAD_NETNAME;
+ if( ConnectCB->LocalName != L'\0')
+ {
- *ReturnOutputBufferLength = sizeof( ULONG);
+ AFSDbgTrace(( AFS_SUBSYSTEM_NETWORK_PROVIDER,
+ AFS_TRACE_LEVEL_VERBOSE,
+ "AFSAddConnection Bad Server Name remote name %wZ Local %C authentication id %I64X\n",
+ &uniRemoteName,
+ ConnectCB->LocalName,
+ ConnectCB->AuthenticationId.QuadPart));
+ }
+ else
+ {
- try_return( ntStatus = STATUS_SUCCESS);
- }
+ AFSDbgTrace(( AFS_SUBSYSTEM_NETWORK_PROVIDER,
+ AFS_TRACE_LEVEL_VERBOSE,
+ "AFSAddConnection Bad Server Name remote name %wZ Local (NULL) authentication id %I64X\n",
+ &uniRemoteName,
+ ConnectCB->AuthenticationId.QuadPart));
+ }
- uniRemoteName.Length = AFSServerName.Length;
+ *ResultStatus = WN_BAD_NETNAME;
- if( RtlCompareUnicodeString( &AFSServerName,
- &uniRemoteName,
- TRUE) != 0)
- {
+ *ReturnOutputBufferLength = sizeof( ULONG);
- if( ConnectCB->LocalName != L'\0')
- {
+ try_return( ntStatus = STATUS_SUCCESS);
+ }
- AFSDbgTrace(( AFS_SUBSYSTEM_NETWORK_PROVIDER,
- AFS_TRACE_LEVEL_VERBOSE,
- "AFSAddConnection BAD_NETNAME 2 remote name %wZ Local %C authentication id %I64X\n",
- &uniRemoteName,
- ConnectCB->LocalName,
- ConnectCB->AuthenticationId.QuadPart));
- }
- else
- {
+ if (uniRemainingPath.Length > 0)
+ {
- AFSDbgTrace(( AFS_SUBSYSTEM_NETWORK_PROVIDER,
- AFS_TRACE_LEVEL_VERBOSE,
- "AFSAddConnection BAD_NETNAME 2 remote name %wZ Local (NULL) authentication id %I64X\n",
- &uniRemoteName,
- ConnectCB->AuthenticationId.QuadPart));
- }
+ AFSProviderConnectionCB *pConnection;
- *ResultStatus = WN_BAD_NETNAME;
+ FsRtlDissectName( uniRemainingPath,
+ &uniShareName,
+ &uniRemainingPath);
- *ReturnOutputBufferLength = sizeof( ULONG);
+ pConnection = AFSLocateEnumRootEntry( &uniShareName);
- try_return( ntStatus = STATUS_SUCCESS);
- }
+ if ( pConnection == NULL) {
- uniRemoteName.Length = usLength;
- }
- else
- {
-
- if( ConnectCB->LocalName != L'\0')
- {
+ if( ConnectCB->LocalName != L'\0')
+ {
- AFSDbgTrace(( AFS_SUBSYSTEM_NETWORK_PROVIDER,
- AFS_TRACE_LEVEL_VERBOSE,
- "AFSAddConnection BAD_NETNAME 3 remote name %wZ Local %C authentication id %I64X\n",
- &uniRemoteName,
- ConnectCB->LocalName,
- ConnectCB->AuthenticationId.QuadPart));
- }
- else
- {
+ AFSDbgTrace(( AFS_SUBSYSTEM_NETWORK_PROVIDER,
+ AFS_TRACE_LEVEL_VERBOSE,
+ "AFSAddConnection Bad Share Name remote name %wZ Local %C authentication id %I64X\n",
+ &uniRemoteName,
+ ConnectCB->LocalName,
+ ConnectCB->AuthenticationId.QuadPart));
+ }
+ else
+ {
- AFSDbgTrace(( AFS_SUBSYSTEM_NETWORK_PROVIDER,
- AFS_TRACE_LEVEL_VERBOSE,
- "AFSAddConnection BAD_NETNAME 3 remote name %wZ Local (NULL) authentication id %I64X\n",
- &uniRemoteName,
- ConnectCB->AuthenticationId.QuadPart));
- }
+ AFSDbgTrace(( AFS_SUBSYSTEM_NETWORK_PROVIDER,
+ AFS_TRACE_LEVEL_VERBOSE,
+ "AFSAddConnection Bad Share Name remote name %wZ Local (NULL) authentication id %I64X\n",
+ &uniRemoteName,
+ ConnectCB->AuthenticationId.QuadPart));
+ }
- *ResultStatus = WN_BAD_NETNAME;
+ *ResultStatus = WN_BAD_NETNAME;
- *ReturnOutputBufferLength = sizeof( ULONG);
+ *ReturnOutputBufferLength = sizeof( ULONG);
- try_return( ntStatus = STATUS_SUCCESS);
- }
+ try_return( ntStatus = STATUS_SUCCESS);
+ }
+ }
uniRemoteName.Length = (USHORT)ConnectCB->RemoteNameLength;
uniRemoteName.MaximumLength = uniRemoteName.Length;
uniRemoteName.Buffer = ConnectCB->RemoteName;
//
- // Strip off any trailing slashes
- //
+ // Strip off any trailing slashes
+ //
if( uniRemoteName.Length >= sizeof( WCHAR)
&& uniRemoteName.Buffer[ (uniRemoteName.Length/sizeof( WCHAR)) - 1] == L'\\')
- {
+ {
uniRemoteName.Length -= sizeof( WCHAR);
}
TRUE) != 0)
{
- try_return( ntStatus = STATUS_INVALID_PARAMETER);
+ try_return( ntStatus = STATUS_BAD_NETWORK_NAME);
}
if ( uniRemainingPath.Length > 0 )
"AFSGetConnectionInfo Evaluation Failed share name %wZ\n",
uniShareName));
- try_return( ntStatus = STATUS_INVALID_PARAMETER);
+ try_return( ntStatus = STATUS_BAD_NETWORK_NAME);
}