Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

set PCSCLITE_CSOCK_NAME env var #963

Open
wants to merge 5 commits into
base: devel
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions common/xrdp_sockets.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#define CHANSRV_API_BASE_STR "xrdpapi_%d"
#define XRDP_X11RDP_BASE_STR "xrdp_display_%d"
#define XRDP_DISCONNECT_BASE_STR "xrdp_disconnect_display_%d"
#define XRDP_PCSC_BASE_STR "xrdp_pcsc_socket_%d"

/* fullpath of sockets */
#define XRDP_CHANSRV_STR XRDP_SOCKET_PATH "/" XRDP_CHANSRV_BASE_STR
Expand All @@ -36,5 +37,6 @@
#define CHANSRV_API_STR XRDP_SOCKET_PATH "/" CHANSRV_API_BASE_STR
#define XRDP_X11RDP_STR XRDP_SOCKET_PATH "/" XRDP_X11RDP_BASE_STR
#define XRDP_DISCONNECT_STR XRDP_SOCKET_PATH "/" XRDP_DISCONNECT_BASE_STR
#define XRDP_PCSC_STR XRDP_SOCKET_PATH "/" XRDP_PCSC_BASE_STR

#endif
4 changes: 2 additions & 2 deletions sesman/chansrv/devredir.c
Original file line number Diff line number Diff line change
Expand Up @@ -735,7 +735,7 @@ dev_redir_proc_device_iocompletion(struct stream *s)
xstream_rd_u32_le(s, CompletionId);
xstream_rd_u32_le(s, IoStatus);

log_debug("entered: IoStatus=0x%x CompletionId=%d", IoStatus, CompletionId);
//log_debug("entered: IoStatus=0x%x CompletionId=%d", IoStatus, CompletionId);

if ((irp = devredir_irp_find(CompletionId)) == NULL)
{
Expand Down Expand Up @@ -881,7 +881,7 @@ dev_redir_proc_device_iocompletion(struct stream *s)
free(fuse_data);
}

log_debug("exiting");
//log_debug("exiting");
}

void
Expand Down
107 changes: 57 additions & 50 deletions sesman/chansrv/smartcard.c
Original file line number Diff line number Diff line change
Expand Up @@ -169,55 +169,57 @@ static int scard_get_free_slot(void);
static void scard_release_resources(void);
static void scard_send_EstablishContext(IRP *irp, int scope);
static void scard_send_ReleaseContext(IRP *irp,
char *context, int context_bytes);
char *context, int context_bytes);
static void scard_send_IsContextValid(IRP* irp,
char *context, int context_bytes);
char *context, int context_bytes);
static void scard_send_ListReaders(IRP *irp,
char *context, int context_bytes,
char *groups, int cchReaders,
int wide);
char *context, int context_bytes,
char *groups, int cchReaders,
int wide, int mszReadersIsNULL);
static void scard_send_GetStatusChange(IRP *irp,
char *context, int context_bytes,
int wide,
tui32 timeout, tui32 num_readers,
READER_STATE *rsa);
char *context, int context_bytes,
int wide,
tui32 timeout, tui32 num_readers,
READER_STATE *rsa);
static void scard_send_Connect(IRP *irp,
char *context, int context_bytes,
int wide,
READER_STATE *rs);
char *context, int context_bytes,
int wide,
READER_STATE *rs);
static void scard_send_Reconnect(IRP *irp,
char *context, int context_bytes,
char *card, int card_bytes,
READER_STATE *rs);
char *context, int context_bytes,
char *card, int card_bytes,
READER_STATE *rs);
static void scard_send_BeginTransaction(IRP *irp,
char *context, int context_bytes,
char *card, int card_bytes);
char *context, int context_bytes,
char *card, int card_bytes);
static void scard_send_EndTransaction(IRP *irp,
char *context, int context_bytes,
char *card, int card_bytes,
tui32 dwDisposition);
char *context, int context_bytes,
char *card, int card_bytes,
tui32 dwDisposition);
static void scard_send_Status(IRP *irp, int wide,
char *context, int context_bytes,
char *card, int card_bytes,
int cchReaderLen, int cbAtrLen);
char *context, int context_bytes,
char *card, int card_bytes,
int cchReaderLen, int cbAtrLen,
int reader_name_is_null);
static void scard_send_Disconnect(IRP *irp,
char *context, int context_bytes,
char *card, int card_bytes,
int dwDisposition);
char *context, int context_bytes,
char *card, int card_bytes,
int dwDisposition);
static int scard_send_Transmit(IRP *irp,
char *context, int context_byte,
char *card, int card_bytes,
char *send_data, int send_bytes,
int recv_bytes,
struct xrdp_scard_io_request *send_ior,
struct xrdp_scard_io_request *recv_ior);
char *context, int context_byte,
char *card, int card_bytes,
char *send_data, int send_bytes,
int recv_bytes,
struct xrdp_scard_io_request *send_ior,
struct xrdp_scard_io_request *recv_ior,
int recv_ior_is_null, int recv_is_null);
static int scard_send_Control(IRP* irp, char *context, int context_bytes,
char *card, int card_bytes,
char *send_data, int send_bytes,
int recv_bytes, int control_code);
char *card, int card_bytes,
char *send_data, int send_bytes,
int recv_bytes, int control_code);
static int scard_send_Cancel(IRP *irp, char *context, int context_bytes);
static int scard_send_GetAttrib(IRP *irp, char *card, int card_bytes,
READER_STATE *rs);
READER_STATE *rs);

/******************************************************************************
** local callbacks into this module **
Expand Down Expand Up @@ -448,7 +450,8 @@ scard_send_is_valid_context(void *user_data, char *context, int context_bytes)
*****************************************************************************/
int
scard_send_list_readers(void *user_data, char *context, int context_bytes,
char *groups, int cchReaders, int wide)
char *groups, int cchReaders, int wide,
int mszReadersIsNULL)
{
IRP *irp;

Expand All @@ -466,7 +469,7 @@ scard_send_list_readers(void *user_data, char *context, int context_bytes,

/* send IRP to client */
scard_send_ListReaders(irp, context, context_bytes, groups,
cchReaders, wide);
cchReaders, wide, mszReadersIsNULL);

return 0;
}
Expand Down Expand Up @@ -648,7 +651,7 @@ scard_send_end_transaction(void *user_data, char *context, int context_bytes,
int
scard_send_status(void *user_data, int wide, char *context, int context_bytes,
char *card, int card_bytes,
int cchReaderLen, int cbAtrLen)
int cchReaderLen, int cbAtrLen, int reader_name_is_null)
{
IRP *irp;

Expand All @@ -667,7 +670,7 @@ scard_send_status(void *user_data, int wide, char *context, int context_bytes,

/* send IRP to client */
scard_send_Status(irp, wide, context, context_bytes, card, card_bytes,
cchReaderLen, cbAtrLen);
cchReaderLen, cbAtrLen, reader_name_is_null);

return 0;
}
Expand Down Expand Up @@ -713,7 +716,8 @@ scard_send_transmit(void *user_data, char *context, int context_bytes,
char *card, int card_bytes,
char *send_data, int send_bytes, int recv_bytes,
struct xrdp_scard_io_request *send_ior,
struct xrdp_scard_io_request *recv_ior)
struct xrdp_scard_io_request *recv_ior,
int recv_ior_is_null, int recv_is_null)
{
IRP *irp;

Expand All @@ -733,7 +737,8 @@ scard_send_transmit(void *user_data, char *context, int context_bytes,
/* send IRP to client */
scard_send_Transmit(irp, context, context_bytes, card, card_bytes,
send_data, send_bytes,
recv_bytes, send_ior, recv_ior);
recv_bytes, send_ior, recv_ior,
recv_ior_is_null, recv_is_null);

return 0;
}
Expand Down Expand Up @@ -1117,7 +1122,8 @@ scard_send_IsContextValid(IRP *irp, char *context, int context_bytes)
*****************************************************************************/
static void
scard_send_ListReaders(IRP *irp, char *context, int context_bytes,
char *groups, int cchReaders, int wide)
char *groups, int cchReaders, int wide,
int mszReadersIsNULL)
{
/* see [MS-RDPESC] 2.2.2.4 */

Expand Down Expand Up @@ -1167,7 +1173,7 @@ scard_send_ListReaders(IRP *irp, char *context, int context_bytes,
out_uint32_le(s, 0x00020000);
out_uint32_le(s, bytes_groups);
out_uint32_le(s, val);
out_uint32_le(s, 0x00000000);
out_uint32_le(s, mszReadersIsNULL);
out_uint32_le(s, cchReaders);

/* insert context */
Expand Down Expand Up @@ -1683,7 +1689,7 @@ scard_send_EndTransaction(IRP *irp, char *context, int context_bytes,
static void
scard_send_Status(IRP *irp, int wide, char *context, int context_bytes,
char *card, int card_bytes,
int cchReaderLen, int cbAtrLen)
int cchReaderLen, int cbAtrLen, int reader_name_is_null)
{
/* see [MS-RDPESC] 2.2.2.18 */

Expand Down Expand Up @@ -1726,7 +1732,7 @@ scard_send_Status(IRP *irp, int wide, char *context, int context_bytes,
out_uint32_le(s, 0x00020000);
out_uint32_le(s, card_bytes);
out_uint32_le(s, 0x00020004);
out_uint32_le(s, 0x00000001);
out_uint32_le(s, reader_name_is_null);
out_uint32_le(s, cchReaderLen); /* readerLen, see [MS-RDPESC] 4.11 */
out_uint32_le(s, cbAtrLen); /* atrLen, see [MS-RDPESC] 4.11 */

Expand Down Expand Up @@ -1837,7 +1843,8 @@ scard_send_Transmit(IRP *irp, char *context, int context_bytes,
char *card, int card_bytes, char *send_data,
int send_bytes, int recv_bytes,
struct xrdp_scard_io_request *send_ior,
struct xrdp_scard_io_request *recv_ior)
struct xrdp_scard_io_request *recv_ior,
int recv_ior_is_null, int recv_is_null)
{
/* see [MS-RDPESC] 2.2.2.19 */

Expand Down Expand Up @@ -1954,10 +1961,10 @@ scard_send_Transmit(IRP *irp, char *context, int context_bytes,
val = send_bytes > 0 ? 0x00020008 : 0;
out_uint32_le(s, val); /* map3 */

val = recv_ior->cbPciLength > 0 ? 0x0002000c : 0;
val = recv_ior_is_null ? 0 : 0x00020008;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

where is this constant come from?

out_uint32_le(s, val); /* map 4 */

out_uint32_le(s, 0); // map5
out_uint32_le(s, recv_is_null); // map5
out_uint32_le(s, recv_bytes);

/* map0 */
Expand All @@ -1981,7 +1988,7 @@ scard_send_Transmit(IRP *irp, char *context, int context_bytes,
align_s(s, 4);
}

if (recv_ior->cbPciLength > 0)
if (recv_ior_is_null == 0)
{
/* map4 */
out_uint32_le(s, recv_ior->dwProtocol);
Expand Down
65 changes: 34 additions & 31 deletions sesman/chansrv/smartcard.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,61 +112,64 @@ int scard_init(void);
int scard_deinit(void);
int scard_send_establish_context(void *user_data, int scope);
int scard_send_release_context(void *user_data,
char *context, int context_bytes);
char *context, int context_bytes);
int scard_send_is_valid_context(void *user_data,
char *context, int context_bytes);
char *context, int context_bytes);
int scard_send_list_readers(void *user_data,
char *context, int context_bytes,
char *groups, int cchReaders, int wide);
char *context, int context_bytes,
char *groups, int cchReaders, int wide,
int mszReadersIsNULL);

int scard_send_get_status_change(void *user_data,
char *context, int context_bytes,
int wide, tui32 timeout,
tui32 num_readers, READER_STATE* rsa);
char *context, int context_bytes,
int wide, tui32 timeout,
tui32 num_readers, READER_STATE* rsa);

int scard_send_connect(void *user_data,
char *context, int context_bytes, int wide,
READER_STATE* rs);
char *context, int context_bytes, int wide,
READER_STATE* rs);

int scard_send_reconnect(void *user_data,
char *context, int context_bytes,
char *card, int card_bytes,
READER_STATE* rs);
char *context, int context_bytes,
char *card, int card_bytes,
READER_STATE* rs);

int scard_send_begin_transaction(void *user_data,
char *context, int context_bytes,
char *card, int card_bytes);
char *context, int context_bytes,
char *card, int card_bytes);
int scard_send_end_transaction(void *user_data,
char *context, int context_bytes,
char *card, int card_bytes,
tui32 dwDisposition);
char *context, int context_bytes,
char *card, int card_bytes,
tui32 dwDisposition);
int scard_send_status(void *user_data, int wide,
char *context, int context_bytes,
char *card, int card_bytes,
int cchReaderLen, int cbAtrLen);
char *context, int context_bytes,
char *card, int card_bytes,
int cchReaderLen, int cbAtrLen,
int reader_name_is_null);
int scard_send_disconnect(void *user_data,
char *context, int context_bytes,
char *card, int card_bytes,
int dwDisposition);

int scard_send_transmit(void *user_data,
char *context, int context_bytes,
char *card, int card_bytes,
char *send_data, int send_bytes, int recv_bytes,
struct xrdp_scard_io_request *send_ior,
struct xrdp_scard_io_request *recv_ior);
char *context, int context_bytes,
char *card, int card_bytes,
char *send_data, int send_bytes, int recv_bytes,
struct xrdp_scard_io_request *send_ior,
struct xrdp_scard_io_request *recv_ior,
int recv_ior_is_null, int recv_is_null);

int scard_send_control(void *user_data,
char *context, int context_bytes,
char *card, int card_bytes,
char *send_data, int send_bytes,
int recv_bytes, int control_code);
char *context, int context_bytes,
char *card, int card_bytes,
char *send_data, int send_bytes,
int recv_bytes, int control_code);

int scard_send_cancel(void *user_data,
char *context, int context_bytes);
char *context, int context_bytes);

int scard_send_get_attrib(void *user_data, char *card, int card_bytes,
READER_STATE* rs);
READER_STATE* rs);

/*
* Notes:
Expand Down
Loading