regression: Fix client issues with no smartcard
57609d4aa7 introduced an issue where
the numCapabilities field in the DR_CORE_CAPABILITY_REQ PDU
was incorrect unless --enable-smartcard was specified.
This commit also improves the logic around handling clients who
advertise a smartcard even if we do not support it.
This commit is contained in:
@@ -484,14 +484,18 @@ devredir_send_server_core_cap_req(void)
|
||||
{
|
||||
struct stream *s;
|
||||
int bytes;
|
||||
int caps_count = 4;
|
||||
|
||||
#ifdef XRDP_SMARTCARD
|
||||
++caps_count;
|
||||
#endif
|
||||
xstream_new(s, 1024);
|
||||
|
||||
/* setup header */
|
||||
xstream_wr_u16_le(s, RDPDR_CTYP_CORE);
|
||||
xstream_wr_u16_le(s, PAKID_CORE_SERVER_CAPABILITY);
|
||||
|
||||
xstream_wr_u16_le(s, 5); /* num of caps we are sending */
|
||||
xstream_wr_u16_le(s, caps_count); /* num of caps we are sending */
|
||||
xstream_wr_u16_le(s, 0x0000); /* padding */
|
||||
|
||||
/* setup general capability */
|
||||
@@ -976,9 +980,10 @@ devredir_proc_client_devlist_announce_req(struct stream *s)
|
||||
"device_type=SMARTCARD device_id=0x%x dosname=%s",
|
||||
g_device_id, preferred_dos_name);
|
||||
|
||||
response_status = STATUS_SUCCESS;
|
||||
|
||||
scard_device_announce(g_device_id);
|
||||
if (scard_device_announce(g_device_id) == 0)
|
||||
{
|
||||
response_status = STATUS_SUCCESS;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
+19
-13
@@ -273,30 +273,36 @@ static void scard_handle_GetAttrib_Return(struct stream *s, IRP *irp,
|
||||
|
||||
/**
|
||||
*****************************************************************************/
|
||||
void
|
||||
int
|
||||
scard_device_announce(tui32 device_id)
|
||||
{
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "entered: device_id=%d", device_id);
|
||||
int rv;
|
||||
|
||||
if (g_smartcards_inited)
|
||||
{
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "already init");
|
||||
return;
|
||||
}
|
||||
|
||||
g_memset(&smartcards, 0, sizeof(smartcards));
|
||||
g_smartcards_inited = 1;
|
||||
g_device_id = device_id;
|
||||
g_scard_index = scard_add_new_device(device_id);
|
||||
|
||||
if (g_scard_index < 0)
|
||||
{
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "scard_add_new_device failed with DeviceId=%d", g_device_id);
|
||||
rv = (device_id == g_device_id) ? 0 : 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "added smartcard with DeviceId=%d to list", g_device_id);
|
||||
g_memset(&smartcards, 0, sizeof(smartcards));
|
||||
g_smartcards_inited = 1;
|
||||
g_scard_index = scard_add_new_device(device_id);
|
||||
|
||||
if (g_scard_index < 0)
|
||||
{
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "scard_add_new_device failed with DeviceId=%d", g_device_id);
|
||||
rv = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "added smartcard with DeviceId=%d to list", g_device_id);
|
||||
g_device_id = device_id;
|
||||
rv = 0;
|
||||
}
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -28,10 +28,10 @@
|
||||
|
||||
#include "arch.h"
|
||||
|
||||
void scard_device_announce(tui32 device_id);
|
||||
int scard_get_wait_objs(tbus *objs, int *count, int *timeout);
|
||||
int scard_check_wait_objs(void);
|
||||
int scard_init(void);
|
||||
int scard_deinit(void);
|
||||
int scard_device_announce(tui32 device_id);
|
||||
int scard_get_wait_objs(tbus *objs, int *count, int *timeout);
|
||||
int scard_check_wait_objs(void);
|
||||
int scard_init(void);
|
||||
int scard_deinit(void);
|
||||
|
||||
#endif /* end #ifndef SMARTCARD_H */
|
||||
|
||||
@@ -33,9 +33,10 @@
|
||||
#include "smartcard.h"
|
||||
|
||||
/*****************************************************************************/
|
||||
void
|
||||
int
|
||||
scard_device_announce(tui32 device_id)
|
||||
{
|
||||
return 1; // Not supported
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
@@ -56,7 +57,7 @@ scard_check_wait_objs(void)
|
||||
int
|
||||
scard_init(void)
|
||||
{
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
Reference in New Issue
Block a user