Re: [Spice-devel] [PATCH spice-server v3 0/5] Multiple improvements for Smartcard code

2019-10-09 Thread Victor Toso
On Wed, Oct 09, 2019 at 10:22:57AM +0100, Frediano Ziglio wrote: > Multiple fixes and automatic test of the device/channel. > Improve previous series. > Most fixes came from automatic test. > > Changes since v2: > - update some comments; > - split one fix into 2. Acked-by: Victor Toso Thanks, >

[Spice-devel] [PATCH spice-server v3 5/5] test-smardcard: Improve test coverage

2019-10-09 Thread Frediano Ziglio
Using coverage utility exercise more code paths: - message from channel with wrong type; - remove message from channel with already removed reader; - init message from channel (ignored); - data from devices, ADPU; - error from device; - messages split in different ways; - invalid reader_id values.

[Spice-devel] [PATCH spice-server v3 4/5] test-smartcard: Add test for Smartcard device

2019-10-09 Thread Frediano Ziglio
Create Smardcard device. Connect to it and test some messages are parsed and processed as expected. Signed-off-by: Frediano Ziglio Acked-by: Victor Toso --- server/tests/.gitignore | 1 + server/tests/Makefile.am | 4 + server/tests/meson.build | 4 + server/tests/test-sma

[Spice-devel] [PATCH spice-server v3 3/5] test-stream-device: Factor out VMC emulation

2019-10-09 Thread Frediano Ziglio
Allows to reuse code for emulating a character device. It will be used for Smardcard test. Signed-off-by: Frediano Ziglio Acked-by: Victor Toso --- server/tests/Makefile.am | 2 + server/tests/meson.build | 2 + server/tests/test-stream-device.c | 224 +

[Spice-devel] [PATCH spice-server v3 2/5] smartcard: Fix parsing multiple messages from the device

2019-10-09 Thread Frediano Ziglio
This patch handles the scenario when a single read to guest device brings multiple requests to be handled. When this happens, we will iterate till all requests are handled and no more requests can be read from guest device. If the remaining buffer contains a full request we don't need to read othe

[Spice-devel] [PATCH spice-server v3 1/5] smartcard: Fix copying remaining request

2019-10-09 Thread Frediano Ziglio
Use memmove instead of memcpy as the buffer can overlap if the second request if bigger than the first. "buf_pos" points to the point of the buffer after we read, if we want the first part of the next request is "buf_pos - remaining". Same consideration setting "buf_pos" for the next iteration. Si

[Spice-devel] [PATCH spice-server v3 0/5] Multiple improvements for Smartcard code

2019-10-09 Thread Frediano Ziglio
Multiple fixes and automatic test of the device/channel. Improve previous series. Most fixes came from automatic test. Changes since v2: - update some comments; - split one fix into 2. Frediano Ziglio (5): smartcard: Fix copying remaining request smartcard: Fix parsing multiple messages from

Re: [Spice-devel] [PATCH spice-server v2 7/7] test-smardcard: Improve test coverage

2019-10-09 Thread Victor Toso
Hi, On Tue, Oct 08, 2019 at 06:39:24PM +0100, Frediano Ziglio wrote: > Using coverage utility exercise more code paths: > - message from channel with wrong type; > - remove message from channel with already removed reader; > - init message from channel (ignored); > - data from devices, ADPU; > - e

Re: [Spice-devel] [PATCH spice-server v2 6/7] test-smartcard: Add test for Smartcard device

2019-10-09 Thread Victor Toso
On Tue, Oct 08, 2019 at 06:39:23PM +0100, Frediano Ziglio wrote: > Create Smardcard device. > Connect to it and test some messages are parsed and processed > as expected. > > Signed-off-by: Frediano Ziglio Acked-by: Victor Toso (and keeping ack of 5/7) > -- > Changes since v1: > - add more co

Re: [Spice-devel] [PATCH spice-server v2 4/7] smartcard: Fix parsing multiple messages from the device

2019-10-09 Thread Victor Toso
Hi, Code seems fine, I'd change a bit the commit log just to be straight forward with what this is fixing/improving. I'm suggesting to split what might be a bugfix but feel free to correct me if I'm mistaken ;) On Tue, Oct 08, 2019 at 06:39:21PM +0100, Frediano Ziglio wrote: > If the server is bu

Re: [Spice-devel] [PATCH spice-server v2 5/7] test-stream-device: Factor out VMC emulation

2019-10-09 Thread Frediano Ziglio
> > Allows to reuse code for emulating a character device. > It will be used for Smardcard test. > > Signed-off-by: Frediano Ziglio > Acked-by: Victor Toso > --- > server/tests/Makefile.am | 2 + > server/tests/meson.build | 2 + > server/tests/test-stream-device.c | 224

Re: [Spice-devel] [PATCH spice-server v2 3/7] smartcard: Do not crash if reader_id is invalid

2019-10-09 Thread Victor Toso
On Tue, Oct 08, 2019 at 06:39:20PM +0100, Frediano Ziglio wrote: > Avoid client to trigger crash. The value of smartcard_readers_get > is checked for NULL so returning it it's not an issue. > > Signed-off-by: Frediano Ziglio Nice catch. Acked-by: Victor Toso > --- > server/smartcard.c | 4 +++

Re: [Spice-devel] [PATCH spice-server v2 2/7] smartcard-channel-client: Use log instead of printf

2019-10-09 Thread Victor Toso
On Tue, Oct 08, 2019 at 06:39:19PM +0100, Frediano Ziglio wrote: > More coherent. Also it's not good for a library to output on > standard output. > > Signed-off-by: Frediano Ziglio Acked-by: Victor Toso Out of curiosity, have you hit unexpected messages? > --- > server/smartcard-channel-cli

Re: [Spice-devel] [PATCH spice-server v2 1/7] smartcard-channel-client: Remove properties code

2019-10-09 Thread Victor Toso
Hi, On Tue, Oct 08, 2019 at 06:39:18PM +0100, Frediano Ziglio wrote: > Not used > > Signed-off-by: Frediano Ziglio Yes, these are basically what default implementation does and if no plans to extend it are in place, removing should be fine Acked-by: Victor Toso > --- > server/smartcard-chan