Bug 428299 - Gives output in unrelated programs
Gives output in unrelated programs
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: pcsc-lite (Show other bugs)
5.1
All Linux
urgent Severity urgent
: rc
: ---
Assigned To: Bob Relyea
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2008-01-10 11:45 EST by Enrico Scholz
Modified: 2008-05-21 10:33 EDT (History)
3 users (show)

See Also:
Fixed In Version: RHBA-2008-0363
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2008-05-21 10:33:08 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Enrico Scholz 2008-01-10 11:45:20 EST
Description of problem:

since update to RHEL5.1, e.g. krb related tools are noisy

$ kinit
winscard_clnt.c:320:SCardEstablishContextTH() Cannot open public shared file:
/var/run/pcscd.pub

$ kpasswd
winscard_clnt.c:320:SCardEstablishContextTH() Cannot open public shared file:
/var/run/pcscd.pub


This breaks programs which rely on the output of the krb5 admin tools (there
does not exist a public api for krb5-adm so this is the only reliable way).


Things worked fine with RHEL 5.0.


Version-Release number of selected component (if applicable):

pcsc-lite-1.3.1-7
krb5-workstation-1.6.1-17.el5


How reproducible:

100%
Comment 1 Ludovic Rousseau 2008-01-11 07:08:41 EST
The question now is: what's wrong with /var/run/pcscd.pub

What is the output of:
$ ls -l /var/run/pcscd.*

I guess the process pcscd is not started, right?

PS: I made a change in pcsc-lite upstream (revision 2728) so that the system error message is also logged
Comment 2 Enrico Scholz 2008-01-11 10:55:40 EST
# ls -l /var/run/pcscd.*
ls: /var/run/pcscd.*: No such file or directory


no; pcscd is not running. There are no plans to attach a cardreader; especially
because this happens in a virtual machine.
Comment 3 Ludovic Rousseau 2008-01-11 11:53:47 EST
Ok I see.

pcsc-lite upstream now (svn revision 2731) do not display anything if pcscd is not running.
The error code SCARD_E_NO_SERVICE will still be returned.
Comment 4 RHEL Product and Program Management 2008-01-11 16:36:11 EST
This request was evaluated by Red Hat Product Management for inclusion in a Red
Hat Enterprise Linux maintenance release.  Product Management has requested
further review of this request by Red Hat Engineering, for potential
inclusion in a Red Hat Enterprise Linux Update release for currently deployed
products.  This request is not yet committed for inclusion in an Update
release.
Comment 6 Bob Lord 2008-01-11 17:48:28 EST
devel_ack+
Comment 7 Ludovic Rousseau 2008-01-12 08:41:22 EST
Thanks to the comments from ssorce (in #5 but now removed).
The pcsclite library will not write anything to stderr unless PCSCLITE_DEBUG is explicitely set. Commited 
upstream in revision 2732.
Comment 8 Simo Sorce 2008-01-12 10:55:35 EST
Ludovic,
it would be much, much, better, if you provide an accessory function to provide
a debugging/logging function that applications can set.

typedef void (*pcsclite_debug_fn_t)(ctx, cons char *fmt, ...)
PRINTF_ATTRIBUTE(2, 3);
pcsclite_set_debug(pcsclite_debug_fn_t fn, void *ctx);


And then save it on your context (if you have one) or on a static variable (less
ideal as different libraries in the same app may end up trying to overwrite each
other debugging function, but this is a rare case probably).

The problem of writing on stderr, is that in daemons that is not necessarily
STDERR, daemons usually close stdin/stdout/stderr, and their FDs can be freely
used to open just any file, like databases, configuration files, data files etc...

While wrapping fprintf around a PCSCLITE_DEBUG env var will protect these apps,
it also means you can never use PCSCLITE_DEBUG at all except for CLI tools as
you risk introducing more problems than the ones you are trying to solve.

My 2c,
Simo.
Comment 9 Ludovic Rousseau 2008-01-12 14:52:26 EST
(In reply to comment #8)
> While wrapping fprintf around a PCSCLITE_DEBUG env var will protect these apps,
> it also means you can never use PCSCLITE_DEBUG at all except for CLI tools as
> you risk introducing more problems than the ones you are trying to solve.

Sending a message to stderr is targeting CLI tools only.

Setting a logging function by the application will diverge from the PC/SC API and would render the code 
non portable. This is not really an option.
It may be simpler to call syslog() instead of printf() in libpcsclite when needed.
Comment 13 errata-xmlrpc 2008-05-21 10:33:08 EDT
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on the solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2008-0363.html

Note You need to log in before you can comment on or make changes to this bug.