pam_vbox.cpp revision 9dd1b6641213871df02600e50584e9052a9ffd78
2N/A * available from http://www.virtualbox.org. This file is free software;
2N/A#define PAM_SM_AUTH
2N/A#define PAM_SM_ACCOUNT
2N/A#define PAM_SM_PASSWORD
2N/A#define PAM_SM_SESSION
#ifdef RT_OS_SOLARIS
#ifdef RT_OS_LINUX
#include <pwd.h>
#include <syslog.h>
#include <stdlib.h>
#ifdef VBOX_WITH_GUEST_PROPS
using namespace guestProp;
#ifdef DEBUG
static int g_verbosity = 0;
typedef struct PAMVBOXTHREAD
int rc;
#ifdef RT_OS_LINUX
closelog();
char *buf;
if (g_verbosity)
char *buf;
if (!iStyle)
#ifdef RT_OS_SOLARIS
#ifdef RT_OS_SOLARIS
&& conv)
#ifdef RT_OS_SOLARIS
return rc;
#ifdef DEBUG
RTAssertSetMayPanic(false);
switch(rc)
case VERR_ACCESS_DENIED:
pam_vbox_error(hPAM, "pam_vbox_init: access is denied to guest driver! Please make sure you run with sufficient rights. Aborting\n");
case VERR_FILE_NOT_FOUND:
pam_vbox_error(hPAM, "pam_vbox_init: guest driver not found! Guest Additions installed? Aborting\n");
#ifdef RT_OS_SOLARIS
return rc;
VbglR3Term();
pam_vbox_error(hPAM, "pam_vbox_check_creds: could not query for credentials! rc=%Rrc. Aborting\n", rc);
#ifdef DEBUG
char *pszUsername;
char *pszPassword;
char *pszDomain;
pam_vbox_error(hPAM, "pam_vbox_check_creds: could not retrieve credentials! rc=%Rrc. Aborting\n", rc);
#ifdef DEBUG
pam_vbox_log(hPAM, "pam_vbox_check_creds: credentials retrieved: user=%s, password=%s, domain=%s\n",
pam_vbox_log(hPAM, "pam_vbox_check_creds: credentials retrieved: user=%s, password=XXX, domain=%s\n",
#ifdef DEBUG
return rc;
#ifdef VBOX_WITH_GUEST_PROPS
int rc;
char *pszValTemp;
if (pvTmpBuf)
&cbBuf);
switch (rc)
case VERR_BUFFER_OVERFLOW:
if (pszFlags)
if ( fReadOnly
pszKey);
pszKey);
return rc;
int rc;
if (pvTmpBuf)
return rc;
#ifdef VBOX_WITH_GUEST_PROPS
pam_vbox_error(pUserData->hPAM, "pam_vbox_wait_thread: Unable to connect to guest property service, rc=%Rrc\n", rc);
#ifdef VBOX_WITH_GUEST_PROPS
if (uClientID)
switch (rc)
case VINF_SUCCESS:
case VERR_INTERRUPTED:
pam_vbox_error(pUserData->hPAM, "pam_vbox_wait_thread: The abort notification request timed out or was interrupted\n");
case VERR_TIMEOUT:
case VERR_TOO_MUCH_DATA:
pam_vbox_error(pUserData->hPAM, "pam_vbox_wait_thread: Temporarily unable to get abort notification\n");
pam_vbox_error(pUserData->hPAM, "pam_vbox_wait_thread: The abort notification request failed with rc=%Rrc\n", rc);
#ifndef VBOX_WITH_GUEST_PROPS
pam_vbox_log(pUserData->hPAM, "pam_vbox_wait_thread: Waiting thread has reached timeout (%dms), exiting ...\n",
#ifdef VBOX_WITH_GUEST_PROPS
return rc;
(void *)&threadData, 0,
return rc;
for (i = 0; i < argc; i++)
bool fFallback = true;
#ifdef VBOX_WITH_GUEST_PROPS
if (!uTimeoutMS)
pam_vbox_error(hPAM, "pam_sm_authenticate: invalid waiting timeout value specified, defaulting to infinite timeout\n");
pam_vbox_error(hPAM, "pam_sm_authenticate: error setting waiting information message, rc=%Rrc\n", rc2);
pam_vbox_error(hPAM, "pam_sm_authenticate: no credentials given, even when waited for it, rc=%Rrc\n", rc);
fFallback = false;
if (fFallback)
return PAM_SUCCESS;
return PAM_SUCCESS;
return PAM_SUCCESS;
return PAM_SUCCESS;
return PAM_SUCCESS;
return PAM_SUCCESS;
#ifdef DEBUG
DECLEXPORT(void) RTAssertMsg1Weak(const char *pszExpr, unsigned uLine, const char *pszFile, const char *pszFunction)