- Timestamp:
- Apr 12, 2013 10:43:32 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/linux/lightdm-greeter/vbox-greeter.cpp
r45170 r45516 6 6 7 7 /* 8 * Copyright (C) 2012 Oracle Corporation8 * Copyright (C) 2012-2013 Oracle Corporation 9 9 * 10 10 * This file is part of VirtualBox Open Source Edition (OSE), as … … 143 143 /** The HGCM client ID. */ 144 144 uint32_t uClientId; 145 /** The credentials. */ 146 char *pszUsername; 145 /** The credential password. */ 147 146 char *pszPassword; 148 char *pszDomain;149 147 } VBOXGREETERCTX, *PVBOXGREETERCTX; 150 148 … … 360 358 else 361 359 { 362 rc = VbglR3CredentialsRetrieve(&pCtx->pszUsername, &pCtx->pszPassword, &pCtx->pszDomain); 360 /** @todo Domain handling needed? */ 361 char *pszUsername; /* User name only is kept local. */ 362 rc = VbglR3CredentialsRetrieve(&pszUsername, &pCtx->pszPassword, NULL /* pszDomain */); 363 363 if (RT_FAILURE(rc)) 364 364 { … … 368 368 { 369 369 #ifdef DEBUG 370 vboxGreeterLog("vboxGreeterCheckCreds: credentials retrieved: user=%s, password=%s , domain=%s\n",371 p Ctx->pszUsername, pCtx->pszPassword, pCtx->pszDomain);370 vboxGreeterLog("vboxGreeterCheckCreds: credentials retrieved: user=%s, password=%s\n", 371 pszUsername, pCtx->pszPassword); 372 372 #else 373 373 /* Don't log passwords in release mode! */ 374 vboxGreeterLog("vboxGreeterCheckCreds: credentials retrieved: user=%s, password=XXX , domain=%s\n",375 p Ctx->pszUsername, pCtx->pszDomain);376 #endif 377 lightdm_greeter_authenticate(pCtx->pGreeter, pCtx->pszUsername); /* Must be the real user name from host!*/378 /** @todo Add handling domains as well.*/379 /** @todo Move into context destroy! */ 380 #if 0 381 VbglR3CredentialsDestroy(pszUsername, pszPassword, pszDomain,374 vboxGreeterLog("vboxGreeterCheckCreds: credentials retrieved: user=%s, password=XXX\n", 375 pszUsername); 376 #endif 377 /* Trigger LightDM authentication with the user name just retrieved. */ 378 lightdm_greeter_authenticate(pCtx->pGreeter, pszUsername); /* Must be the real user name from host! */ 379 380 /* Securely wipe the user name again. */ 381 VbglR3CredentialsDestroy(pszUsername, NULL /* pszPassword */, NULL /* pszDomain */, 382 382 3 /* Three wipe passes */); 383 #endif384 383 } 385 384 } … … 442 441 break; 443 442 } 443 /** @todo Other fields? */ 444 444 445 445 default: … … 447 447 } 448 448 449 VbglR3CredentialsDestroy( pCtx->pszUsername, pCtx->pszPassword, pCtx->pszDomain,449 VbglR3CredentialsDestroy(NULL /* pszUsername */, pCtx->pszPassword, NULL /* pszDomain */, 450 450 3 /* Three wipe passes */); 451 pCtx->pszPassword = NULL; 451 452 } 452 453 … … 492 493 if (lightdm_greeter_get_is_authenticated(pGreeter)) 493 494 { 494 lightdm_greeter_start_session_sync(pGreeter, NULL, NULL); 495 495 /** @todo Add non-default session support. */ 496 496 gchar *pszSession = g_strdup(lightdm_greeter_get_default_session_hint(pGreeter)); 497 497 if (pszSession) 498 498 { 499 499 vboxGreeterLog("starting session: %s\n", pszSession); 500 if (!lightdm_greeter_start_session_sync(pGreeter, pszSession, NULL)) 500 GError *pError = NULL; 501 if (!lightdm_greeter_start_session_sync(pGreeter, pszSession, &pError)) 501 502 { 502 vboxGreeterError("unable to start session '%s'\n", pszSession); 503 vboxGreeterError("unable to start session '%s': %s\n", 504 pszSession, pError ? pError->message : "Unknown error"); 503 505 } 506 else 507 { 508 AssertPtr(pszSession); 509 vboxGreeterLog("session '%s' successfully started\n", pszSession); 510 } 511 if (pError) 512 g_error_free(pError); 504 513 g_free(pszSession); 505 514 } … … 716 725 { 717 726 /* Get optional message. */ 727 szVal[0] = '\0'; 718 728 int rc2 = vbox_read_prop(pCtx->uClientId, 719 729 "/VirtualBox/GuestAdd/PAM/CredsMsgWaitAbort", 720 730 true /* Read-only on guest */, 721 731 szVal, sizeof(szVal), NULL /* Timestamp. */); 722 if (RT_SUCCESS(rc2)) 723 { 732 if ( RT_FAILURE(rc2) 733 && rc2 != VERR_NOT_FOUND) 734 vboxGreeterError("cb_check_creds: getting wait abort message failed with rc=%Rrc\n", rc2); 724 735 # ifdef VBOX_WITH_FLTK 725 /** @todo */ 736 AssertPtr(pCtx->pLblInfo); 737 pCtx->pLblInfo->label(szVal); 738 # else 739 GtkLabel *pLblInfo = GTK_LABEL(gtk_builder_get_object(pCtx->pBuilder, VBOX_GREETER_UI_LBL_INFO)); 740 AssertPtr(pLblInfo); 741 gtk_label_set_text(pLblInfo, szVal); 742 # endif /* VBOX_WITH_FLTK */ 743 vboxGreeterLog("cb_check_creds: got notification from host to abort waiting\n"); 744 } 745 else 746 { 747 #endif /* VBOX_WITH_GUEST_PROPS */ 748 rc = vboxGreeterCheckCreds(pCtx); 749 if (RT_SUCCESS(rc)) 750 { 751 /* Credentials retrieved. */ 752 } 753 else if (rc == VERR_NOT_FOUND) 754 { 755 /* No credentials found, but try next round (if there's 756 * time left for) ... */ 757 } 758 #ifdef VBOX_WITH_GUEST_PROPS 759 } 760 #endif /* VBOX_WITH_GUEST_PROPS */ 761 762 if (rc == VERR_NOT_FOUND) /* No credential found this round. */ 763 { 764 /* Calculate timeout value left after process has been started. */ 765 uint64_t u64Elapsed = RTTimeMilliTS() - pCtx->uStartMS; 766 /* Is it time to bail out? */ 767 if (pCtx->uTimeoutMS < u64Elapsed) 768 { 769 #ifdef VBOX_WITH_GUEST_PROPS 770 szVal[0] = '\0'; 771 int rc2 = vbox_read_prop(pCtx->uClientId, 772 "/VirtualBox/GuestAdd/PAM/CredsMsgWaitTimeout", 773 true /* Read-only on guest */, 774 szVal, sizeof(szVal), NULL /* Timestamp. */); 775 if ( RT_FAILURE(rc2) 776 && rc2 != VERR_NOT_FOUND) 777 vboxGreeterError("cb_check_creds: getting wait timeout message failed with rc=%Rrc\n", rc2); 778 # ifdef VBOX_WITH_FLTK 779 AssertPtr(pCtx->pLblInfo); 780 pCtx->pLblInfo->label(szVal); 726 781 # else 727 782 GtkLabel *pLblInfo = GTK_LABEL(gtk_builder_get_object(pCtx->pBuilder, VBOX_GREETER_UI_LBL_INFO)); 728 783 AssertPtr(pLblInfo); 729 784 gtk_label_set_text(pLblInfo, szVal); 730 # endif /* VBOX_WITH_FLTK */731 }732 733 vboxGreeterLog("cb_check_creds: got notification from host to abort waiting\n");734 }735 else736 {737 #endif /* VBOX_WITH_GUEST_PROPS */738 rc = vboxGreeterCheckCreds(pCtx);739 if (RT_SUCCESS(rc))740 {741 /* Credentials retrieved. */742 }743 else if (rc == VERR_NOT_FOUND)744 {745 /* No credentials found, but try next round (if there's746 * time left for) ... */747 }748 #ifdef VBOX_WITH_GUEST_PROPS749 }750 #endif /* VBOX_WITH_GUEST_PROPS */751 752 if (rc == VERR_NOT_FOUND) /* No credential found this round. */753 {754 /* Calculate timeout value left after process has been started. */755 uint64_t u64Elapsed = RTTimeMilliTS() - pCtx->uStartMS;756 /* Is it time to bail out? */757 if (pCtx->uTimeoutMS < u64Elapsed)758 {759 #ifdef VBOX_WITH_GUEST_PROPS760 int rc2 = vbox_read_prop(pCtx->uClientId,761 "/VirtualBox/GuestAdd/PAM/CredsMsgWaitTimeout",762 true /* Read-only on guest */,763 szVal, sizeof(szVal), NULL /* Timestamp. */);764 if (RT_SUCCESS(rc2))765 {766 # ifdef VBOX_WITH_FLTK767 /** @todo */768 # else769 GtkLabel *pLblInfo = GTK_LABEL(gtk_builder_get_object(pCtx->pBuilder, VBOX_GREETER_UI_LBL_INFO));770 AssertPtr(pLblInfo);771 gtk_label_set_text(pLblInfo, szVal);772 785 # endif 773 }774 786 #endif /* VBOX_WITH_GUEST_PROPS */ 775 787 vboxGreeterLog("cb_check_creds: waiting thread has reached timeout (%dms), exiting ...\n",
Note:
See TracChangeset
for help on using the changeset viewer.