On Sat, May 29, 2010 at 1:36 PM, Ludovic Rousseau
<[email protected]> wrote:
> 2010/5/29 Martin Vogt <[email protected]>:
>> On Sat, May 29, 2010 at 10:32 AM, Ludovic Rousseau
>> <[email protected]> wrote:
>>> 2010/5/29 Martin Vogt <[email protected]>:
>>>> Hello,
>>>>
>>>> If logging support is compiled in,  the daemon segfaults in the lookup of:
>>>>
>>>> CommandsText[header.command]
>>>>
>>>> The attached patch verifies if the received data actually is a valid
>>>> command.
>>>
>>> You need to use a patched libpcsclite to trigger this bug, right?
>>>
>> I have added a tcp/ivp4 transport, yes.
>> Thus it was telnet localhost 4545
>> <keyboard>+Return
>> =>segfault :-)
>>
>> Currently I'm thinking to add a dbus session object for pcscd/pcsclite
>> for linux hosts, but I'm unsure if this is usefull.
>
> I was also thinking about adding dbus support. My idea was to write a
> client application that talks to the daemon and is also a dbus server.
> I do not want to add dbus support in pcscd itself.
>
> One possible application I had in mind is to write a widget to display
> the communication status. If an APDU is in exchange then this state is
> visible. Many smart card reader do not signal when a communication
> with the card is on going.

Currently I'm experimenting a bit with dbus, I found a simple client/server
example for my experiments here:

http://www.herzi.eu/archives/159-Peer-to-Peer-DBus-over-TCP.html

But adding tcp/ipv4 is rather trivial.
Do you have an idea how this should be added to pcscd?

Currently I wrapped it in winscard_msg_srv.c and winscard_msg.c
with the socket passed back.
(Everything hardcoded, ugly hack, fixed IP Adress, port,...)

It keeps in the server part some structs:


typedef struct conn_s {
  conn_state_t state;
  conn_type_t type;
  int socket;

  int (*AcceptConnection)(struct conn_s* conn,uint32_t *pdwClientID);
} conn_t;


#define CONNECTIONS 2
typedef struct conn_event_s {
  int event_pos;
  conn_t conn[CONNECTIONS];
} conn_event_t;


and I moved the accept call from Initialize to the Process Event Queue.
There it does a multi select, which allows support for AF_LOCAL
and AF_INET simultanously.

Something like this:


  for(i=0;i<CONNECTIONS;i++) {
    conn_t* conn=&(conn_event.conn[i]);
    if (conn->state==STATE_OPEN) {
      FD_SET(conn->socket, &read_fd);
      if(conn->socket > sockNumber)
        sockNumber=conn->socket;
    }
  }
  // poll would be better here (because of the loop later)
  selret = select(sockNumber + 1, &read_fd, (fd_set *) NULL,
                  (fd_set *) NULL,

[..............]

  for(i=0;i<CONNECTIONS;i++) {
    conn_t* conn=&(conn_event.conn[i]);

    if (FD_ISSET(conn->socket, &read_fd))
      return conn->AcceptConnection(conn,pdwClientID);
  }


If you have some hints how it should be implemented I can give it a try.

regards,

Martin

_______________________________________________
Muscle mailing list
[email protected]
http://lists.drizzle.com/mailman/listinfo/muscle

Reply via email to