trinity-devel@lists.pearsoncomputing.net

Message: previous - next
Month: February 2014

Re: [trinity-devel] Bug 1902 - pam.d and preprocessor checks surrounding consolekit may be part of issue

From: "David C. Rankin" <drankinatty@...>
Date: Thu, 27 Feb 2014 00:17:10 -0600
On 02/26/2014 11:38 AM, Slávek Banko wrote:
> As I noted in the bug report: This is not a problem. Presence code for 
> ConsoleKit has no effect unless ConsoleKit present on system. With the 
> ConsoleKit communicates via D-Bus. If ConsoleKit not present, not with 
> whom to communicate => code has no effect == same as it was not used.

Slavek,

dm.h:40:   #define WITH_CONSOLE_KIT

** there is NO conditional surround this define, it is defined always.

dm.h:488: #ifdef WITH_CONSOLE_KIT
dm.h:489: int StartClient( const char *ck_session_cookie );
dm.h:490: #else
dm.h:491: int StartClient( void );
dm.h:492: #endif

client.c:1205: #ifdef WITH_CONSOLE_KIT
client.c:1206: int
client.c:1207: StartClient( const char *ck_session_cookie )
client.c:1208: #else
client.c:1209: int
client.c:1210: StartClient()
client.c:1211: #endif

client.c:1311: env = setEnv ( env, "XDG_SESSION_COOKIE", ck_session_cookie );

session.c:642: #ifdef WITH_CONSOLE_KIT
session.c:643: 	ck_session_cookie = open_ck_session (getpwnam(curuser), d);
session.c:644: 	if (!(clientPid = StartClient(ck_session_cookie))) {
session.c:645: #else
session.c:646: 	if (!(clientPid = StartClient())) {
session.c:647: #endif


Even without consolekit installed on the system, this still causes StartClient
to be declared as:

  int StartClient( const char *ck_session_cookie );

instead of

  int StartClient( void );

and client.c causes StartClient to be initialized with the character pointer
ck_session_cookie (hopefully NULL) and part of the XDG_SESSION_COOKIE
environment to be set (if not NULL).

It may not matter, but it does not seem like good practice to leave code like
that hanging around in the absence of concolekit. I have put fprintf statements
inside all WITH_CONSOLE_KIT preprocessor conditionals and will report back with
which ones are being executed..

-- 
David C. Rankin, J.D.,P.E.