Commit Graph

81 Commits

Author SHA1 Message Date
Christophe Fergeau 73db416ae7 libcacard: Don't link with all libraries QEMU links to
As described in https://bugzilla.redhat.com/show_bug.cgi?id=987441 ,
libcacard currently links to all the libraries QEMU is linking to,
including glusterfs libraries, libiscsi, ... libcacard does not need all of
these. This patch ensures it's only linked with the libraries it needs.

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Signed-off-by: Alon Levy <alevy@redhat.com>
2014-02-09 13:06:02 +02:00
Marc-André Lureau fa88afa51c vscclient: do not add a socket watch if there is not data to send
Fixes the following error:
** (process:780): CRITICAL **: do_socket_send: assertion
`socket_to_send->len != 0' failed

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2013-12-16 10:12:19 +01:00
Stefan Weil 5ad04fb6f1 libcacard: Fix compilation for older versions of glib (bug #1258168)
See https://bugs.launchpad.net/bugs/1258168

libcacard/vscclient.c: In function 'do_socket_read':
libcacard/vscclient.c:410: warning: implicit declaration of function 'g_warn_if_reached'
libcacard/vscclient.c:410: warning: nested extern declaration of 'g_warn_if_reached'
libcacard/vscclient.c: In function 'main':
libcacard/vscclient.c:763: warning: implicit declaration of function 'g_byte_array_unref'
libcacard/vscclient.c:763: warning: nested extern declaration of 'g_byte_array_unref'
...
libcacard/vscclient.o: In function `do_socket_read':
libcacard/vscclient.c:410: undefined reference to `g_warn_if_reached'
libcacard/vscclient.o: In function `main':
libcacard/vscclient.c:763: undefined reference to `g_byte_array_unref'

g_warn_if_reached was added in glib 2.16, and g_byte_array_unref is
supported since glib 2.22. QEMU requires glib 2.12, so both names must
not be used.

Instead of showing a warning for code which should not be reached,
vscclient better stop running, so g_warn_if_reached is not useful for
vscclient.

In libcacard/vsclient.c, g_byte_array_unref can be replaced by
g_byte_array_free. This is not generally true, so adding a compatibility
layer in include/glib-compat.h is no option here.

Reported-by: Laurent Desnogues <laurent.desnogues@gmail.com>
Reported-by: Don Slutz <dslutz@verizon.com>
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2013-12-09 12:19:05 +02:00
Stefan Weil efbc42e584 libcacard/vcard_emul_nss: Remove unused statement (value stored is never read)
Warning from ccc-analyzer:

libcacard/vcard_emul_nss.c:937:9: warning:
 Value stored to 'cert_count' is never read
        cert_count = options->vreader[i].cert_count;
        ^            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2013-12-02 21:07:25 +04:00
Stefan Weil 754e72e195 libcacard/cac: Remove unused statement (value stored is never read)
Warning from ccc-analyzer:

libcacard/cac.c:192:13: warning: Value stored to 'ret' is never read
            ret = VCARD_DONE;
            ^     ~~~~~~~~~~

Here 'ret' is assigned a value inside of a switch statement and also after
that switch statement.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2013-12-02 21:07:02 +04:00
Anthony Liguori 16121fa39e Merge remote-tracking branch 'stefanha/block' into staging
# By Stefan Hajnoczi (4) and others
# Via Stefan Hajnoczi
* stefanha/block:
  virtio-blk: do not relay a previous driver's WCE configuration to the current
  blockdev: do not default cache.no-flush to true
  block: don't lose data from last incomplete sector
  qcow2: Correct snapshots size for overlap check
  coroutine: fix /perf/nesting coroutine benchmark
  coroutine: add qemu_coroutine_yield benchmark
  qemu-timer: do not take the lock in timer_pending
  qemu-timer: make qemu_timer_mod_ns() and qemu_timer_del() thread-safe
  qemu-timer: drop outdated signal safety comments
  osdep: warn if open(O_DIRECT) on fails with EINVAL
  libcacard: link against qemu-error.o for error_report()

Message-id: 1379698931-946-1-git-send-email-stefanha@redhat.com
2013-09-23 11:53:05 -05:00
Michael Tokarev 69fded480e vscclient: remove unnecessary use of uninitialized variable
Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2013-09-20 20:09:24 +04:00
Stefan Hajnoczi 975a0015ee libcacard: link against qemu-error.o for error_report()
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-09-18 15:34:51 +02:00
Stefan Weil 4c293dc6e4 misc: Fix some typos in names and comments
Most typos were found using a modified version of codespell:

accross -> across
issueing -> issuing
TICNT_THRESHHOLD -> TICNT_THRESHOLD
bandwith -> bandwidth
VCARD_7816_PROPIETARY -> VCARD_7816_PROPRIETARY
occured -> occurred
gaurantee -> guarantee
sofware -> software

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2013-09-01 18:59:24 +04:00
Stefan Weil 48f0475f81 libcacard: Fix cppcheck warning and remove unneeded code
The local function vcard_emul_alloc_arrays always returned PR_TRUE.
Therefore cppcheck complained about code which handled the
non-existent PR_FALSE case.

Remove the function's return value and the dead code.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2013-06-21 22:52:50 +04:00
Alon Levy 581fe784c3 libcacard/vscclient: fix leakage of socket on error paths
Spotted by Coverity.

Signed-off-by: Alon Levy <alevy@redhat.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2013-06-12 16:04:43 +04:00
Alon Levy 57f97834ef libcacard/cac: change big switch functions to single return point
Signed-off-by: Alon Levy <alevy@redhat.com>
Reviewed-by: Marc-André Lureau <mlureau@redhat.com>
2013-04-24 11:48:06 +03:00
Alon Levy 0b6a16c1a4 libcacard: move atr setting from macro to function
Only because qemu's checkpatch complains about it.

Signed-off-by: Alon Levy <alevy@redhat.com>
Reviewed-by: Marc-André Lureau <mlureau@redhat.com>
2013-04-24 11:48:03 +03:00
Alon Levy 7a68589624 libcacard/vreader: add debugging messages for apdu
Using g_debug with log domain libcacard

Signed-off-by: Alon Levy <alevy@redhat.com>
Reviewed-by: Marc-André Lureau <mlureau@redhat.com>
2013-04-24 11:48:02 +03:00
Alon Levy a26dfd95d3 libcacard: change default ATR
Signed-off-by: Alon Levy <alevy@redhat.com>
Reviewed-by: Marc-André Lureau <mlureau@redhat.com>
2013-04-24 11:47:54 +03:00
Marc-André Lureau ad2181f2b6 libcacard: remove default libcoolkey loading
Use only the modules defined in the NSS database.

Signed-off-by: Marc-André Lureau <mlureau@redhat.com>
Reviewed-by: Alon Levy <alevy@redhat.com>
2013-04-24 11:47:47 +03:00
Marc-André Lureau 667e0b4b68 libcacard: remove sql: prefix
For some reason, with sql:/ prefix, the PKCS11 modules are not loaded.

This patch goes on top of Alon smartcard series.

Signed-off-by: Marc-André Lureau <mlureau@redhat.com>
Reviewed-by: Alon Levy <alevy@redhat.com>
2013-04-24 11:47:45 +03:00
Marc-André Lureau c9495ee9eb libcacard: teach vscclient to use GMainLoop for portability
This version handles non-blocking sending and receiving from the
socket.

Signed-off-by: Marc-André Lureau <mlureau@redhat.com>
Reviewed-by: Alon Levy <alevy@redhat.com>
2013-04-24 11:47:44 +03:00
Marc-André Lureau 930c8ad472 libcacard: vscclient to use QemuThread for portability
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Alon Levy <alevy@redhat.com>
2013-04-24 11:47:42 +03:00
Marc-André Lureau a50b831ae1 libcacard: split vscclient main() from socket reading
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Alon Levy <alevy@redhat.com>
2013-04-24 11:47:41 +03:00
Marc-André Lureau e2d9c5e769 libcacard: use system config directory for nss db on win32
It's a bit nicer to look for default database under
CSIDL_COMMON_APPDATA\pki\nss rather that /etc/pki/nss.

Signed-off-by: Marc-André Lureau <mlureau@redhat.com>
Reviewed-by: Alon Levy <alevy@redhat.com>
2013-04-24 11:47:36 +03:00
Marc-André Lureau e2fd2115ce libcacard: correct T0 historical bytes size
The VCARD_ATR_PREFIX macro adds a prefix of 6 characters only.

pcsc_scan was complaining before the patch:

+ Historical bytes: 56 43 41 52 44 5F 4E 53 53
 ERROR! ATR is truncated: 2 byte(s) is/are missing

Signed-off-by: Marc-André Lureau <mlureau@redhat.com>
Reviewed-by: Alon Levy <alevy@redhat.com>
2013-04-24 11:47:31 +03:00
Markus Armbruster be168af860 libcacard: Fix unchecked strdup() by converting to g_strdup()
Note that we already free with g_free().

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-01-30 11:14:46 +01:00
Paolo Bonzini ff667e2e9b build: fold trace-obj-y into libqemuutil.a
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2013-01-12 18:42:51 +01:00
Paolo Bonzini baacf04799 build: move libqemuutil.a components to util/
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2013-01-12 18:42:50 +01:00
Paolo Bonzini d9dc91ace8 libcacard: list oslib-obj-y file explicitly
We will grow the list of files in the next patches, but libcacard
should remain slim.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2013-01-12 18:42:50 +01:00
Paolo Bonzini 26ca8c06d2 libcacard: link vscclient to dynamic library
There is no reason for vscclient to duplicate the code.  rules.mak
takes care of invoking libtool to do the link.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2013-01-12 18:42:49 +01:00
Paolo Bonzini 992aeb8eb5 libcacard: rewrite Makefile in non-recursive style
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2013-01-12 18:42:49 +01:00
Paolo Bonzini 5018f1cc9f libcacard: add list of exported symbols
Do not export internal QEMU symbols.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2013-01-12 17:19:39 +01:00
Paolo Bonzini af0c8e9f3c libcacard: use per-target variable definitions
This lets the libcacard Makefile use more rules.mak magic.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2013-01-12 17:19:39 +01:00
Paolo Bonzini 591eca679e libcacard: prepare to use -y trick in the Makefile
Rename variables to follow the conventions of the rest of the build
systems.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2013-01-12 17:19:38 +01:00
Paolo Bonzini b6fc675b25 libcacard: require libtool to build it
Do not fail at build time, instead just disable the library if libtool
is not present.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2013-01-12 17:19:38 +01:00
Alon Levy e832341bde libcacard: fix missing symbol in libcacard.so
Before patch:
$ make libcacard.la
$ nm ./libcacard/.libs/libcacard.so.0.0.0 | grep " U " | \
    egrep -v "(g_)|(GLIBC)|(SECMOD)|(PK11)|(CERT)|(NSS)|(PORT)|(PR)"
                 U error_set

Signed-off-by: Alon Levy <alevy@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2013-01-12 17:19:38 +01:00
Paolo Bonzini 2165588274 build: support linking with libtool objects/libraries
This patch moves the complication of using libtool to the generic
rules.mak file.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2013-01-12 17:19:09 +01:00
Paolo Bonzini f141ccfa15 build: make libtool verbose when making with V=1
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2013-01-12 17:19:08 +01:00
Paolo Bonzini 1de7afc984 misc: move include files to include/qemu/
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-12-19 08:32:39 +01:00
Paolo Bonzini a636be69a8 libcacard: link in stubs
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-11-19 10:48:32 +01:00
Paolo Bonzini 31a3228958 libcacard: make unnesting rules available to Makefile.objs
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-11-19 10:48:31 +01:00
Aurelien Jarno 048d3612a5 Merge branch 'trivial-patches' of git://github.com/stefanha/qemu
* 'trivial-patches' of git://github.com/stefanha/qemu:
  versatilepb: Use symbolic indices for ARM PIC
  qdev: kill bogus comment
  qemu-barrier: Fix compiler version check for future gcc versions
  hw: Add missing 'static' attribute for QEMUMachine
  cleanup useless return sentence
  qemu-sockets: Fix compiler warning (regression for MinGW)
  vnc: Fix spelling (hellmen -> hellman) in comment
  slirp: Fix spelling in comment (enought -> enough, insure -> ensure)
  tcg/arm: Use tcg_out_mov_reg rather than inline equivalent code
  cpu: Add missing 'static' attribute to qemu_global_mutex
  configure: Support empty target list (--target-list=)
  hw: Fix return value check for bdrv_read, bdrv_write
2012-10-06 18:54:14 +02:00
Amos Kong 4d5b97da35 cleanup useless return sentence
This patch cleans up return sentences in the end of void functions.

Reported-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Amos Kong <akong@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
2012-10-05 15:10:21 +02:00
Jim Meyering 2e679780ae libcacard/vcard_emul_nss: use pstrcpy in place of strncpy
Replace strncpy+NUL-terminate use with use of pstrcpy.
This requires linking with cutils.o (or else vssclient doesn't link),
so add that in the Makefile.

Acked-by: Alon Levy <alevy@redhat.com>
Signed-off-by: Jim Meyering <meyering@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-10-05 07:58:38 -05:00
Blue Swirl 47ecbdf07e libcacard: build fixes
Link trace objects to fix these errors:
  LINK  vscclient
oslib-posix.o: In function `trace_qemu_vfree':
/src/qemu/obj-amd64/./trace.h:39: undefined reference to `trace1'
oslib-posix.o: In function `trace_qemu_memalign':
/src/qemu/obj-amd64/./trace.h:31: undefined reference to `trace3'
oslib-posix.o: In function `trace_qemu_vmalloc':
/src/qemu/obj-amd64/./trace.h:35: undefined reference to `trace2'

Add LDFLAGS to vscclient link command.

Clean up also in subdirectories of libcacard.

Use quiet-command for sed invocation.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Acked-by: Alon Levy <alevy@redhat.com>
2012-06-21 20:04:24 +00:00
Paolo Bonzini 00c705fb92 build: libcacard Makefile cleanups
Build vscclient from toplevel Makefile, limit usage of vpath.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-06-07 09:21:18 +02:00
Alon Levy 6f06f178f9 libcacard/vcard_emul_nss: add warning for old coolkey
Older coolkey versions (before the future fix of RHBZ 802435) have
a fake card reader created if no reader is detected during module
initialization. Warn libcacard users if the faulty coolkey is detected
by checking for the fake reader name "E-Gate 0 0".

Signed-off-by: Alon Levy <alevy@redhat.com>
2012-03-26 18:39:00 +02:00
Alon Levy 4e33988236 libcacard/vcard_emul_nss: handle no readers at startup
When starting with no readers, coolkey should show no slots (with
RHBZ 806038 fixed). Fix initialization to launch the event handling
thread for each module that isn't the internal module regardless of the
number of slots detected for it at initialization time, since slot
number may start as 0 and is dynamic.

RHBZ: 802435
Signed-off-by: Alon Levy <alevy@redhat.com>
2012-03-26 18:39:00 +02:00
Alon Levy 1b902f7def libcacard/vcard_emul_nss: don't stop thread when there are no slots
Signed-off-by: Alon Levy <alevy@redhat.com>
2012-03-26 18:39:00 +02:00
Anthony Liguori dac6b1b22c Merge remote-tracking branch 'stefanha/trivial-patches' into staging
* stefanha/trivial-patches:
  configure: Quote the configure args printed in config.log
  osdep: Remove local definition of macro offsetof
  libcacard: Spelling and grammar fixes in documentation
  Spelling fixes in comments (it's -> its)
  vnc: Add break statement
  libcacard: Use format specifier %u instead of %d for unsigned values
  Fix sign of sscanf format specifiers
  block/vmdk: Fix warning from splint (comparision of unsigned value)
  qmp: Fix spelling fourty -> forty
  qom: Fix spelling in documentation
  sh7750: Remove redundant 'struct' from MemoryRegionOps
2012-03-09 12:30:20 -06:00
Hans de Goede 0202181245 libcacard: Fix compilation with gcc-4.7
VCARD_ATR_PREFIX is used as part of an array initializer so it should
not have () around it, so far this happened to work, but gcc-4.7 does
not like it.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-03-09 07:02:50 -06:00
Stefan Weil 93148aa5c3 Spelling fixes in comments (it's -> its)
* it's -> its (fixed for all files)
* dont -> don't (only fixed in a line which was touched by the previous fix)
* distrub -> disturb (fixed in the same line)

Reviewed-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2012-03-08 15:22:11 +00:00
Stefan Weil ba79c88604 libcacard: Use format specifier %u instead of %d for unsigned values
splint reported warnings for those code statements.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2012-03-08 15:22:11 +00:00