Changeset 44044 in vbox for trunk/src/VBox/Additions
- Timestamp:
- Dec 5, 2012 6:35:32 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/common/VBoxService/VBoxServiceVMInfo.cpp
r43927 r44044 393 393 { 394 394 VBoxServiceVerbose(4, "ConsoleKit: retrieved %RU16 session(s)\n", cSessions); 395 AssertPtr(*ppszSessions);396 395 397 396 char **ppszCurSession = ppszSessions; 398 for (ppszCurSession; *ppszCurSession; ppszCurSession++) 397 for (ppszCurSession; 398 ppszCurSession && *ppszCurSession; ppszCurSession++) 399 399 { 400 400 VBoxServiceVerbose(4, "ConsoleKit: processing session '%s' ...\n", *ppszCurSession); 401 402 /* Only respect active sessions .*/ 403 bool fActive = false; 404 DBusMessage *pMsgSessionActive = dbus_message_new_method_call("org.freedesktop.ConsoleKit", 405 *ppszCurSession, 406 "org.freedesktop.ConsoleKit.Session", 407 "IsActive"); 408 if ( pMsgSessionActive 409 && dbus_message_get_type(pMsgSessionActive) == DBUS_MESSAGE_TYPE_METHOD_CALL) 410 { 411 DBusMessage *pReplySessionActive = dbus_connection_send_with_reply_and_block(pConnection, 412 pMsgSessionActive, 30 * 1000 /* 30s timeout */, 413 &dbErr); 414 if ( pReplySessionActive 415 && !dbus_error_is_set(&dbErr)) 416 { 417 DBusMessageIter itMsg; 418 if ( dbus_message_iter_init(pReplySessionActive, &itMsg) 419 && dbus_message_iter_get_arg_type(&itMsg) == DBUS_TYPE_BOOLEAN) 420 { 421 /* Get uid from message. */ 422 int val; 423 dbus_message_iter_get_basic(&itMsg, &val); 424 fActive = val >= 1; 425 } 426 427 if (pReplySessionActive) 428 dbus_message_unref(pReplySessionActive); 429 } 430 431 if (pMsgSessionActive) 432 dbus_message_unref(pMsgSessionActive); 433 } 434 435 VBoxServiceVerbose(4, "ConsoleKit: session '%s' is %s\n", 436 *ppszCurSession, fActive ? "active" : "not active"); 401 437 402 438 /* *ppszCurSession now contains the object path … … 406 442 "org.freedesktop.ConsoleKit.Session", 407 443 "GetUnixUser"); 408 if ( pMsgUnixUser 444 if ( fActive 445 && pMsgUnixUser 409 446 && dbus_message_get_type(pMsgUnixUser) == DBUS_MESSAGE_TYPE_METHOD_CALL) 410 447 { … … 427 464 struct passwd *ppwEntry = getpwuid(uid); 428 465 if ( ppwEntry 466 && ppwEntry->pw_uid >= 1000 /* Only respect users, not daemons etc. */ 429 467 && ppwEntry->pw_name) 430 468 {
Note:
See TracChangeset
for help on using the changeset viewer.