Skip to content

Commit

Permalink
Smartcard MAX_READERS get from pcsclite package
Browse files Browse the repository at this point in the history
  • Loading branch information
zorgluf authored and Cloud User committed Jul 21, 2021
1 parent 49503d2 commit f6f80f2
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 8 deletions.
8 changes: 8 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,14 @@ else
fi
fi

save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -I/usr/include/PCSC"
# checking for pcsclite headers
AC_CHECK_HEADER([PCSC/pcsclite.h], [],
[AC_MSG_ERROR([please install libpcsclite-dev or pcsc-lite-dev])])

CFLAGS="$save_CFLAGS"

AC_PATH_XTRA
if test "x$no_x" == "xyes"; then
AC_MSG_ERROR([please install libx11-dev or libX11-devel])
Expand Down
1 change: 1 addition & 0 deletions sesman/chansrv/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ AM_CPPFLAGS = \
-DXRDP_SHARE_PATH=\"${datadir}/xrdp\" \
-DXRDP_PID_PATH=\"${localstatedir}/run\" \
-DXRDP_SOCKET_PATH=\"${socketdir}\" \
-I/usr/include/PCSC \
-I$(top_srcdir)/common

CHANSRV_EXTRA_LIBS =
Expand Down
14 changes: 6 additions & 8 deletions sesman/chansrv/smartcard_pcsc.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,11 @@
#include "list.h"
#include "defines.h"
#include "xrdp_sockets.h"
#include "PCSC/pcsclite.h"

#if PCSC_STANDIN


#define MAX_ATR_SIZE 33
#define MAX_READERS 32

extern int g_display_num; /* in chansrv.c */

static int g_autoinc = 0; /* general purpose autoinc */
Expand Down Expand Up @@ -93,9 +91,9 @@ struct pcsc_uds_client
int state;
int pad1;

PCSC_READER_STATE readerStates[MAX_READERS];
tui32 current_states[MAX_READERS];
tui32 event_states[MAX_READERS];
PCSC_READER_STATE readerStates[PCSCLITE_MAX_READERS_CONTEXTS];
tui32 current_states[PCSCLITE_MAX_READERS_CONTEXTS];
tui32 event_states[PCSCLITE_MAX_READERS_CONTEXTS];
int numReaders;
int waiting;
int something_changed;
Expand Down Expand Up @@ -748,7 +746,7 @@ scard_readers_to_list(struct pcsc_uds_client *uds_client,
}
reader_index++;
hold_reader = uds_client->readerStates[reader_index];
if (reader_index > (MAX_READERS - 1))
if (reader_index > (PCSCLITE_MAX_READERS_CONTEXTS - 1))
{
return 0;
}
Expand All @@ -763,7 +761,7 @@ scard_readers_to_list(struct pcsc_uds_client *uds_client,
}
uds_client->numReaders = reader_index;
/* clear the rest */
while (reader_index < MAX_READERS)
while (reader_index < PCSCLITE_MAX_READERS_CONTEXTS)
{
g_memset(uds_client->readerStates + reader_index, 0, sizeof(PCSC_READER_STATE));
uds_client->current_states[reader_index] = 0;
Expand Down

0 comments on commit f6f80f2

Please sign in to comment.