fix channel/smartcard: error handling
authorBernhard Miklautz <bernhard.miklautz@thincast.com>
Mon, 4 Dec 2017 11:17:57 +0000 (12:17 +0100)
committerBernhard Miklautz <bernhard.miklautz@thincast.com>
Wed, 13 Dec 2017 16:04:06 +0000 (17:04 +0100)
According to MS-RDPESC the smart card channel must set the IoStatus to
an NTSTATUS in case a encoding or decoding error happens. The smart card
channel did this correctly but the output stream was modified
incorrectly causing the smart card remote manager to stop in error
cases.

channels/smartcard/client/smartcard_operations.c

index a34cc0b..b6d5a7d 100644 (file)
@@ -2022,13 +2022,12 @@ LONG smartcard_irp_device_control_call(SMARTCARD_DEVICE* smartcard, SMARTCARD_OP
                          SCardGetErrorString(result), result);
        }
 
-       irp->IoStatus = 0;
+       irp->IoStatus = STATUS_SUCCESS;
 
        if ((result & 0xC0000000) == 0xC0000000)
        {
                /* NTSTATUS error */
                irp->IoStatus = (UINT32)result;
-               Stream_SetPosition(irp->output, RDPDR_DEVICE_IO_RESPONSE_LENGTH);
                WLog_WARN(TAG, "IRP failure: %s (0x%08"PRIX32"), ntstatus: 0x%08"PRIX32"",
                          smartcard_get_ioctl_string(ioControlCode, TRUE), ioControlCode, result);
        }