summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sesman/chansrv/devredir.c4
-rw-r--r--sesman/chansrv/smartcard.c56
-rw-r--r--sesman/chansrv/smartcard_pcsc.c90
-rw-r--r--sesman/chansrv/smartcard_pcsc.h5
4 files changed, 116 insertions, 39 deletions
diff --git a/sesman/chansrv/devredir.c b/sesman/chansrv/devredir.c
index 22debb11..05fd3302 100644
--- a/sesman/chansrv/devredir.c
+++ b/sesman/chansrv/devredir.c
@@ -68,7 +68,7 @@
#define log_info(_params...) \
{ \
- if (LOG_INFO <= LOG_LEVEL) \
+ if (LOG_INFO <= LOG_LEVEL) \
{ \
g_write("[%10.10u]: DEV_REDIR %s: %d : ", \
g_time3(), __func__, __LINE__); \
@@ -78,7 +78,7 @@
#define log_debug(_params...) \
{ \
- if (LOG_DEBUG <= LOG_LEVEL) \
+ if (LOG_DEBUG <= LOG_LEVEL) \
{ \
g_write("[%10.10u]: DEV_REDIR %s: %d : ", \
g_time3(), __func__, __LINE__); \
diff --git a/sesman/chansrv/smartcard.c b/sesman/chansrv/smartcard.c
index d422716c..8e3761e6 100644
--- a/sesman/chansrv/smartcard.c
+++ b/sesman/chansrv/smartcard.c
@@ -309,8 +309,8 @@ scard_handle_ListReaders_Return(struct stream *s, IRP *irp,
/* get OutputBufferLen */
xstream_rd_u32_le(s, len);
- scard_function_get_readers_state_return((struct trans *) (irp->user_data),
- s, len);
+ scard_function_list_readers_return((struct trans *) (irp->user_data),
+ s, len);
/* LK_TODO */
//log_debug("dumping %d bytes", len);
@@ -389,22 +389,22 @@ scard_send_ListReaders(IRP *irp, int wide)
xstream_copyin(s, sc->Context, sc->Context_len);
xstream_wr_u32_le(s, 36); /* length of mszGroups */
- xstream_wr_u16_le(s, 0x0053);
- xstream_wr_u16_le(s, 0x0043);
- xstream_wr_u16_le(s, 0x0061);
- xstream_wr_u16_le(s, 0x0072);
- xstream_wr_u16_le(s, 0x0064);
- xstream_wr_u16_le(s, 0x0024);
- xstream_wr_u16_le(s, 0x0041);
- xstream_wr_u16_le(s, 0x006c);
- xstream_wr_u16_le(s, 0x006c);
- xstream_wr_u16_le(s, 0x0052);
- xstream_wr_u16_le(s, 0x0065);
- xstream_wr_u16_le(s, 0x0061);
- xstream_wr_u16_le(s, 0x0064);
- xstream_wr_u16_le(s, 0x0065);
- xstream_wr_u16_le(s, 0x0072);
- xstream_wr_u16_le(s, 0x0073);
+ xstream_wr_u16_le(s, 0x0053); /* S */
+ xstream_wr_u16_le(s, 0x0043); /* C */
+ xstream_wr_u16_le(s, 0x0061); /* a */
+ xstream_wr_u16_le(s, 0x0072); /* r */
+ xstream_wr_u16_le(s, 0x0064); /* d */
+ xstream_wr_u16_le(s, 0x0024); /* $ */
+ xstream_wr_u16_le(s, 0x0041); /* A */
+ xstream_wr_u16_le(s, 0x006c); /* l */
+ xstream_wr_u16_le(s, 0x006c); /* l */
+ xstream_wr_u16_le(s, 0x0052); /* R */
+ xstream_wr_u16_le(s, 0x0065); /* e */
+ xstream_wr_u16_le(s, 0x0061); /* a */
+ xstream_wr_u16_le(s, 0x0064); /* d */
+ xstream_wr_u16_le(s, 0x0065); /* e */
+ xstream_wr_u16_le(s, 0x0072); /* r */
+ xstream_wr_u16_le(s, 0x0073); /* s */
xstream_wr_u32_le(s, 0x00);
@@ -419,16 +419,16 @@ scard_send_ListReaders(IRP *irp, int wide)
xstream_free(s);
/*
- scard_device_control: dumping 120 bytes of data
- 0000 00 08 00 00 58 00 00 00 2c 00 09 00 00 00 00 00 ....X...,.......
- 0010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
- 0020 01 10 08 00 cc cc cc cc 48 00 00 00 00 00 00 00 ........H.......
- 0030 04 00 00 00 00 00 02 00 24 00 00 00 04 00 02 00 ........$.......
- 0040 00 00 00 00 ff ff ff ff 04 00 00 00 84 db 03 01 ................
- 0050 24 00 00 00 53 00 43 00 61 00 72 00 64 00 24 00 $...S.C.a.r.d.$.
- 0060 41 00 6c 00 6c 00 52 00 65 00 61 00 64 00 65 00 A.l.l.R.e.a.d.e.
- 0070 72 00 73 00 00 00 00 00 r.s.....
- scard_device_control: output_len=2048 input_len=88 ioctl_code=0x9002c
+ scard_device_control: dumping 120 bytes of data
+ 0000 00 08 00 00 58 00 00 00 2c 00 09 00 00 00 00 00 ....X...,.......
+ 0010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
+ 0020 01 10 08 00 cc cc cc cc 48 00 00 00 00 00 00 00 ........H.......
+ 0030 04 00 00 00 00 00 02 00 24 00 00 00 04 00 02 00 ........$.......
+ 0040 00 00 00 00 ff ff ff ff 04 00 00 00 84 db 03 01 ................
+ 0050 24 00 00 00 53 00 43 00 61 00 72 00 64 00 24 00 $...S.C.a.r.d.$.
+ 0060 41 00 6c 00 6c 00 52 00 65 00 61 00 64 00 65 00 A.l.l.R.e.a.d.e.
+ 0070 72 00 73 00 00 00 00 00 r.s.....
+ scard_device_control: output_len=2048 input_len=88 ioctl_code=0x9002c
*/
/*
diff --git a/sesman/chansrv/smartcard_pcsc.c b/sesman/chansrv/smartcard_pcsc.c
index 3eec4793..72249f32 100644
--- a/sesman/chansrv/smartcard_pcsc.c
+++ b/sesman/chansrv/smartcard_pcsc.c
@@ -195,15 +195,15 @@ scard_function_establish_context_return(struct trans *con, int context)
/*****************************************************************************/
/* returns error */
int APP_CC
-scard_proess_release_context(struct stream *in_s)
+scard_process_release_context(struct stream *in_s)
{
struct release_struct in_rs;
struct release_struct out_rs;
struct stream *out_s;
- LLOGLN(0, ("scard_proess_release_context:"));
+ LLOGLN(0, ("scard_process_release_context:"));
in_uint8a(in_s, &in_rs, sizeof(in_rs));
- LLOGLN(0, ("scard_proess_release_context: hContext %d", in_rs.hContext));
+ LLOGLN(0, ("scard_process_release_context: hContext %d", in_rs.hContext));
out_rs.hContext = in_rs.hContext;
out_rs.rv = SCARD_S_SUCCESS;
out_s = trans_get_out_s(g_con, 8192);
@@ -248,13 +248,32 @@ scard_process_get_readers_state(struct stream *in_s)
/*****************************************************************************/
/* returns error */
int APP_CC
-scard_function_get_readers_state_return(struct trans *con,
- struct stream *in_s,
- int len)
+scard_function_list_readers_return(struct trans *con,
+ struct stream *in_s,
+ int len)
{
struct stream *out_s;
g_hexdump(in_s->p, len);
+
+ g_strcpy(g_reader_states[0].readerName, "ACS AET65 00 00");
+ g_reader_states[0].readerState = 0x14;
+ g_reader_states[0].cardProtocol = 3;
+
+ g_reader_states[0].cardAtrLength = 10;
+ g_reader_states[0].cardAtr[0] = 0x3B;
+ g_reader_states[0].cardAtr[1] = 0x95;
+ g_reader_states[0].cardAtr[2] = 0x95;
+ g_reader_states[0].cardAtr[3] = 0x40;
+ g_reader_states[0].cardAtr[4] = 0xFF;
+ g_reader_states[0].cardAtr[5] = 0xD0;
+ g_reader_states[0].cardAtr[6] = 0x00;
+ g_reader_states[0].cardAtr[7] = 0x54;
+ g_reader_states[0].cardAtr[8] = 0x01;
+ g_reader_states[0].cardAtr[9] = 0x32;
+
+ //g_reader_states[0].eventCounter++;
+
out_s = trans_get_out_s(con, 8192);
out_uint8a(out_s, g_reader_states, sizeof(g_reader_states));
s_mark_end(out_s);
@@ -352,8 +371,65 @@ scard_process_msg(struct trans *con, struct stream *in_s, int command)
break;
case 0x02: /* SCARD_RELEASE_CONTEXT */
LLOGLN(0, ("scard_process_msg: SCARD_RELEASE_CONTEXT"));
- rv = scard_proess_release_context(in_s);
+ rv = scard_process_release_context(in_s);
+ break;
+
+ case 0x03: /* SCARD_LIST_READERS */
+ LLOGLN(0, ("scard_process_msg: SCARD_LIST_READERS"));
+ break;
+
+ case 0x04: /* SCARD_CONNECT */
+ LLOGLN(0, ("scard_process_msg: SCARD_CONNECT"));
+ break;
+
+ case 0x05: /* SCARD_RECONNECT */
+ LLOGLN(0, ("scard_process_msg: SCARD_RECONNECT"));
+ break;
+
+ case 0x06: /* SCARD_DISCONNECT */
+ LLOGLN(0, ("scard_process_msg: SCARD_DISCONNECT"));
+ break;
+
+ case 0x07: /* SCARD_BEGIN_TRANSACTION */
+ LLOGLN(0, ("scard_process_msg: SCARD_BEGIN_TRANSACTION"));
+ break;
+
+ case 0x08: /* SCARD_END_TRANSACTION */
+ LLOGLN(0, ("scard_process_msg: SCARD_END_TRANSACTION"));
+ break;
+
+ case 0x09: /* SCARD_TRANSMIT */
+ LLOGLN(0, ("scard_process_msg: SCARD_TRANSMIT"));
break;
+
+ case 0x0A: /* SCARD_CONTROL */
+ LLOGLN(0, ("scard_process_msg: SCARD_CONTROL"));
+ break;
+
+ case 0x0B: /* SCARD_STATUS */
+ LLOGLN(0, ("scard_process_msg: SCARD_STATUS"));
+ break;
+
+ case 0x0C: /* SCARD_GET_STATUS_CHANGE */
+ LLOGLN(0, ("scard_process_msg: SCARD_GET_STATUS_CHANGE"));
+ break;
+
+ case 0x0D: /* SCARD_CANCEL */
+ LLOGLN(0, ("scard_process_msg: SCARD_CANCEL"));
+ break;
+
+ case 0x0E: /* SCARD_CANCEL_TRANSACTION */
+ LLOGLN(0, ("scard_process_msg: SCARD_CANCEL_TRANSACTION"));
+ break;
+
+ case 0x0F: /* SCARD_GET_ATTRIB */
+ LLOGLN(0, ("scard_process_msg: SCARD_GET_ATTRIB"));
+ break;
+
+ case 0x10: /* SCARD_SET_ATTRIB */
+ LLOGLN(0, ("scard_process_msg: SCARD_SET_ATTRIB"));
+ break;
+
case 0x11: /* CMD_VERSION */
LLOGLN(0, ("scard_process_msg: CMD_VERSION"));
rv = scard_process_version(con, in_s);
diff --git a/sesman/chansrv/smartcard_pcsc.h b/sesman/chansrv/smartcard_pcsc.h
index 282128f9..bac8638c 100644
--- a/sesman/chansrv/smartcard_pcsc.h
+++ b/sesman/chansrv/smartcard_pcsc.h
@@ -36,7 +36,8 @@ scard_pcsc_deinit(void);
int APP_CC
scard_function_establish_context_return(struct trans *con, int context);
int APP_CC
-scard_function_get_readers_state_return(struct trans *con, struct stream *in_s,
- int len);
+scard_function_list_readers_return(struct trans *con,
+ struct stream *in_s,
+ int len);
#endif /* end #ifndef _SMARTCARD_PCSC_H */