VirtualBox

Changeset 38468 in vbox for trunk/src/VBox/Additions/common


Ignore:
Timestamp:
Aug 16, 2011 9:45:38 AM (13 years ago)
Author:
vboxsync
Message:

PAM: First implementation of waiting for credentials.

Location:
trunk/src/VBox/Additions/common/pam
Files:
1 edited
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/common/pam/Makefile.kmk

    r29058 r38468  
    55
    66#
    7 # Copyright (C) 2010 Oracle Corporation
     7# Copyright (C) 2011 Oracle Corporation
    88#
    99# This file is part of VirtualBox Open Source Edition (OSE), as
     
    2424pam_vbox_TEMPLATE = VBOXGUESTR3DLL
    2525pam_vbox_DEFS     = LOG_TO_BACKDOOR VBOX_WITH_HGCM
    26 pam_vbox_SOURCES  = pam_vbox.c
     26pam_vbox_DEFS    += \
     27        $(if $(VBOX_WITH_GUEST_PROPS),VBOX_WITH_GUEST_PROPS,)
     28pam_vbox_SOURCES  = pam_vbox.cpp
    2729pam_vbox_LIBS = \
    2830        pam \
  • trunk/src/VBox/Additions/common/pam/pam_vbox.cpp

    r38459 r38468  
    2424#define PAM_SM_SESSION
    2525
    26 #ifdef _DEBUG
     26#ifdef DEBUG
    2727# define PAM_DEBUG
    2828#endif
     
    4040#include <syslog.h>
    4141
     42#include <iprt/assert.h>
    4243#include <iprt/env.h>
     44#include <iprt/initterm.h>
     45#include <iprt/mem.h>
    4346#include <iprt/stream.h>
    44 #include <iprt/initterm.h>
    4547#include <iprt/string.h>
    46 #include <iprt/assert.h>
     48
     49#include <VBox/VBoxGuestLib.h>
     50
    4751#include <VBox/log.h>
    48 
    49 #include <VBox/VBoxGuestLib.h>
     52#ifdef VBOX_WITH_GUEST_PROPS
     53# include <VBox/HostServices/GuestPropertySvc.h>
     54  using namespace guestProp;
     55#endif
    5056
    5157#define VBOX_MODULE_NAME "pam_vbox"
    5258
    5359/** For debugging. */
    54 #ifdef _DEBUG
     60#ifdef DEBUG
    5561static pam_handle_t *g_pam_handle;
    5662static int g_verbosity = 99;
     
    6874#ifdef RT_OS_LINUX
    6975    openlog("pam_vbox", LOG_PID, LOG_AUTHPRIV);
    70     syslog(LOG_ERR, pszBuf);
     76    syslog(LOG_ERR, "%s", pszBuf);
    7177    closelog();
    7278#elif defined(RT_OS_SOLARIS)
     
    8288 * @param   ...         Format arguments.
    8389 */
    84 static void pam_vbox_error(pam_handle_t *h, const char *pszFormat, ...)
     90static void pam_vbox_error(pam_handle_t *hPAM, const char *pszFormat, ...)
    8591{
    8692    va_list va;
     
    103109 * @param   ...         Format arguments.
    104110 */
    105 static void pam_vbox_log(pam_handle_t *h, const char *pszFormat, ...)
     111static void pam_vbox_log(pam_handle_t *hPAM, const char *pszFormat, ...)
    106112{
    107113    if (g_verbosity)
     
    124130
    125131
    126 static int pam_vbox_do_check(pam_handle_t *h)
    127 {
    128     int rc;
    129     int pamrc;
    130 
    131 #ifdef _DEBUG
    132     g_pam_handle = h; /* hack for getting assertion text */
     132static int vbox_set_msg(pam_handle_t *hPAM, int iStyle, const char *pszText)
     133{
     134    AssertPtrReturn(hPAM, VERR_INVALID_POINTER);
     135    AssertPtrReturn(pszText, VERR_INVALID_POINTER);
     136
     137    if (!iStyle)
     138        iStyle = PAM_TEXT_INFO;
     139
     140    int rc = VINF_SUCCESS;
     141
     142    struct pam_message msg;
     143    msg.msg_style = iStyle;
     144    msg.msg = pszText;
     145
     146    const struct pam_conv *conv;
     147    int pamrc = pam_get_item(hPAM, PAM_CONV, (const void **)&conv);
     148    if (pamrc == PAM_SUCCESS)
     149    {
     150        struct pam_response *resp;
     151        const struct pam_message *msg_p = &msg;
     152        pamrc = conv->conv(1 /* One message only */, &msg_p, &resp, conv->appdata_ptr);
     153        if (pamrc == PAM_SUCCESS)
     154        {
     155            pam_vbox_log(hPAM, "Showing message (type %d): %s", msg, pszText);
     156            free(resp);
     157        }
     158    }
     159    else
     160        rc = VERR_NOT_FOUND;
     161    return rc;
     162}
     163
     164
     165static int pam_vbox_init(pam_handle_t *hPAM)
     166{
     167#ifdef DEBUG
     168    g_pam_handle = hPAM; /* hack for getting assertion text */
    133169#endif
    134170
     
    138174    RTAssertSetMayPanic(false);
    139175
    140     rc = RTR3Init();
     176    int rc = RTR3Init();
    141177    if (RT_FAILURE(rc))
    142178    {
    143         pam_vbox_error(h, "pam_vbox_do_check: could not init runtime! rc=%Rrc. Aborting.\n", rc);
     179        pam_vbox_error(hPAM, "pam_vbox_init: could not init runtime! rc=%Rrc. Aborting\n", rc);
    144180        return PAM_SUCCESS; /* Jump out as early as we can to not mess around. */
    145181    }
    146182
    147     pam_vbox_log(h, "pam_vbox_do_check: runtime initialized.\n");
     183    pam_vbox_log(hPAM, "pam_vbox_init: runtime initialized\n");
    148184    if (RT_SUCCESS(rc))
    149185    {
     
    154190            {
    155191                case VERR_ACCESS_DENIED:
    156                     pam_vbox_error(h, "pam_vbox_do_check: access is denied to guest driver! Please make sure you run with sufficient rights. Aborting.\n");
     192                    pam_vbox_error(hPAM, "pam_vbox_init: access is denied to guest driver! Please make sure you run with sufficient rights. Aborting\n");
    157193                    break;
    158194
    159195                case VERR_FILE_NOT_FOUND:
    160                     pam_vbox_error(h, "pam_vbox_do_check: guest driver not found! Guest Additions installed? Aborting.\n");
     196                    pam_vbox_error(hPAM, "pam_vbox_init: guest driver not found! Guest Additions installed? Aborting\n");
    161197                    break;
    162198
    163199                default:
    164                     pam_vbox_error(h, "pam_vbox_do_check: could not init VbglR3 library! rc=%Rrc. Aborting.\n", rc);
     200                    pam_vbox_error(hPAM, "pam_vbox_init: could not init VbglR3 library! rc=%Rrc. Aborting\n", rc);
    165201                    break;
    166202            }
    167             return PAM_SUCCESS; /* Jump out as early as we can to not mess around. */
    168         }
    169         pam_vbox_log(h, "pam_vbox_do_check: guest lib initialized.\n");
    170     }
    171 
    172     pamrc = PAM_OPEN_ERR; /* The PAM return code; intentionally not used as an exit value below. */
     203        }
     204        pam_vbox_log(hPAM, "pam_vbox_init: guest lib initialized\n");
     205    }
     206
    173207    if (RT_SUCCESS(rc))
    174208    {
     
    177211        char *prompt = NULL;
    178212#ifdef RT_OS_SOLARIS
    179         pam_get_item(h, PAM_RHOST, (void**) &rhost);
    180         pam_get_item(h, PAM_TTY, (void**) &tty);
    181         pam_get_item(h, PAM_USER_PROMPT, (void**) &prompt);
     213        pam_get_item(hPAM, PAM_RHOST, (void**) &rhost);
     214        pam_get_item(hPAM, PAM_TTY, (void**) &tty);
     215        pam_get_item(hPAM, PAM_USER_PROMPT, (void**) &prompt);
    182216#else
    183         pam_get_item(h, PAM_RHOST, (const void**) &rhost);
    184         pam_get_item(h, PAM_TTY, (const void**) &tty);
    185         pam_get_item(h, PAM_USER_PROMPT, (const void**) &prompt);
    186 #endif
    187         pam_vbox_log(h, "pam_vbox_do_check: rhost=%s, tty=%s, prompt=%s\n",
     217        pam_get_item(hPAM, PAM_RHOST, (const void**) &rhost);
     218        pam_get_item(hPAM, PAM_TTY, (const void**) &tty);
     219        pam_get_item(hPAM, PAM_USER_PROMPT, (const void**) &prompt);
     220#endif
     221        pam_vbox_log(hPAM, "pam_vbox_init: rhost=%s, tty=%s, prompt=%s\n",
    188222                     rhost ? rhost : "<none>", tty ? tty : "<none>", prompt ? prompt : "<none>");
    189 
    190         rc = VbglR3CredentialsQueryAvailability();
     223    }
     224
     225    return rc;
     226}
     227
     228
     229static void pam_vbox_shutdown(pam_handle_t *hPAM)
     230{
     231    VbglR3Term();
     232}
     233
     234
     235static int pam_vbox_check_creds(pam_handle_t *hPAM)
     236{
     237    int rc = VbglR3CredentialsQueryAvailability();
     238    if (RT_FAILURE(rc))
     239    {
     240        if (rc == VERR_NOT_FOUND)
     241            pam_vbox_log(hPAM, "pam_vbox_check_creds: no credentials available\n");
     242        else
     243            pam_vbox_error(hPAM, "pam_vbox_check_creds: could not query for credentials! rc=%Rrc. Aborting\n", rc);
     244    }
     245    else
     246    {
     247        char *pszUsername;
     248        char *pszPassword;
     249        char *pszDomain;
     250
     251        rc = VbglR3CredentialsRetrieve(&pszUsername, &pszPassword, &pszDomain);
    191252        if (RT_FAILURE(rc))
    192253        {
    193             if (rc == VERR_NOT_FOUND)
    194                 pam_vbox_log(h, "pam_vbox_do_check: no credentials available.\n");
    195             else
    196                 pam_vbox_error(h, "pam_vbox_do_check: could not query for credentials! rc=%Rrc. Aborting.\n", rc);
    197             pamrc = PAM_SUCCESS;
     254            pam_vbox_error(hPAM, "pam_vbox_check_creds: could not retrieve credentials! rc=%Rrc. Aborting\n", rc);
    198255        }
    199256        else
    200257        {
    201             char *pszUsername;
    202             char *pszPassword;
    203             char *pszDomain;
    204 
    205             rc = VbglR3CredentialsRetrieve(&pszUsername, &pszPassword, &pszDomain);
    206             if (RT_FAILURE(rc))
     258#ifdef DEBUG
     259            pam_vbox_log(hPAM, "pam_vbox_check_creds: credentials retrieved: user=%s, password=%s, domain=%s\n",
     260                         pszUsername, pszPassword, pszDomain);
     261#else
     262            /* Don't log passwords in release mode! */
     263            pam_vbox_log(hPAM, "pam_vbox_check_creds: credentials retrieved: user=%s, password=XXX, domain=%s\n",
     264                         pszUsername, pszDomain);
     265#endif
     266            /* Fill credentials into PAM. */
     267            int pamrc = pam_set_item(hPAM, PAM_USER, pszUsername);
     268            if (pamrc != PAM_SUCCESS)
    207269            {
    208                 pam_vbox_error(h, "pam_vbox_do_check: could not retrieve credentials! rc=%Rrc. Aborting.\n", rc);
     270                pam_vbox_error(hPAM, "pam_vbox_check_creds: could not set user name! pamrc=%d, msg=%s. Aborting\n",
     271                               pamrc, pam_strerror(hPAM, pamrc));
    209272            }
    210273            else
    211274            {
    212 #ifdef _DEBUG
    213                 pam_vbox_log(h, "pam_vbox_do_check: credentials retrieved: user=%s, password=%s, domain=%s\n",
    214                              pszUsername, pszPassword, pszDomain);
    215 #else
    216                 pam_vbox_log(h, "pam_vbox_do_check: credentials retrieved: user=%s, password=XXX, domain=%s\n",
    217                              pszUsername, pszDomain);
    218 #endif
    219                 /* Fill credentials into PAM. */
    220                 pamrc = pam_set_item(h, PAM_USER, pszUsername);
     275                pamrc = pam_set_item(hPAM, PAM_AUTHTOK, pszPassword);
    221276                if (pamrc != PAM_SUCCESS)
     277                    pam_vbox_error(hPAM, "pam_vbox_check_creds: could not set password! pamrc=%d, msg=%s. Aborting\n",
     278                                   pamrc, pam_strerror(hPAM, pamrc));
     279            }
     280            /** @todo Add handling domains as well. */
     281
     282            VbglR3CredentialsDestroy(pszUsername, pszPassword, pszDomain,
     283                                     3 /* Three wipe passes */);
     284           pam_vbox_log(hPAM, "pam_vbox_check_creds: returned with pamrc=%d, msg=%s\n",
     285                        pamrc, pam_strerror(hPAM, pamrc));
     286        }
     287    }
     288
     289    pam_vbox_log(hPAM, "pam_vbox_check_creds: returned with rc=%Rrc\n", rc);
     290    return rc;
     291}
     292
     293#ifdef VBOX_WITH_GUEST_PROPS
     294static int pam_vbox_wait_for_creds(pam_handle_t *hPAM, uint32_t uClientID, uint32_t uTimeoutMS)
     295{
     296    int rc;
     297
     298    /* The buffer for storing the data and its initial size.  We leave a bit
     299     * of space here in case the maximum values are raised. */
     300    void *pvBuf = NULL;
     301    uint32_t cbBuf = MAX_NAME_LEN + MAX_VALUE_LEN + MAX_FLAGS_LEN + _1K;
     302
     303    pam_vbox_log(hPAM, "Waiting for credentials (%dms) ...\n", uTimeoutMS);
     304
     305    int i;
     306    for (i = 0; i < 10; i++)
     307    {
     308        void *pvTmpBuf = RTMemRealloc(pvBuf, cbBuf);
     309        if (pvTmpBuf)
     310        {
     311            char *pszName = NULL;
     312            char *pszValue = NULL;
     313            uint64_t u64TimestampOut = 0;
     314            char *pszFlags = NULL;
     315
     316            pvBuf = pvTmpBuf;
     317            rc = VbglR3GuestPropWait(uClientID, "/VirtualBox/GuestAdd/PAM/CredsChanged", pvBuf, cbBuf,
     318                                     0 /* Last timestamp; just wait for next event */, uTimeoutMS,
     319                                     &pszName, &pszValue, &u64TimestampOut,
     320                                     &pszFlags, &cbBuf);
     321        }
     322        else
     323            rc = VERR_NO_MEMORY;
     324
     325        switch (rc)
     326        {
     327            case VINF_SUCCESS:
     328                pam_vbox_error(hPAM, "Got notification for supplied credentials\n");
     329                break;
     330
     331            case VERR_BUFFER_OVERFLOW:
     332            {
     333                /* Buffer too small, try it with a bigger one next time. */
     334                cbBuf += _1K;
     335                continue; /* Try next round. */
     336            }
     337
     338            case VERR_INTERRUPTED:
     339                pam_vbox_error(hPAM, "The credentials notification request timed out or was interrupted\n");
     340                break;
     341
     342            case VERR_TIMEOUT:
     343                pam_vbox_error(hPAM, "Credentials did not arrive within time (%dms)\n", uTimeoutMS);
     344                break;
     345
     346            case VERR_TOO_MUCH_DATA:
     347                pam_vbox_error(hPAM, "Temporarily unable to get credentials notification\n");
     348                break;
     349
     350            default:
     351                pam_vbox_error(hPAM, "The credentials notification request failed with rc=%Rrc\n", rc);
     352                break;
     353        }
     354
     355        /* Everything except VERR_BUFFER_OVERLOW makes us bail out ... */
     356        break;
     357    }
     358
     359    pam_vbox_log(hPAM, "Waiting for credentials returned with rc=%Rrc\n", rc);
     360    return rc;
     361}
     362
     363static int pam_vbox_read_prop(pam_handle_t *hPAM, uint32_t clientid, const char *pszKey,
     364                              char *pszValue, size_t cbValue)
     365{
     366    AssertReturn(clientid, VERR_INVALID_PARAMETER);
     367    AssertPtrReturn(pszKey, VERR_INVALID_POINTER);
     368    AssertPtrReturn(pszValue, VERR_INVALID_POINTER);
     369
     370    int rc = VbglR3GuestPropReadValue(clientid, pszKey,
     371                                      pszValue, cbValue, NULL /* Actual size, not required. */);
     372    pam_vbox_log(hPAM, "pam_vbox_read_prop: read key \"%s\" with rc=%Rrc\n",
     373                 pszKey, rc);
     374    if (RT_SUCCESS(rc))
     375        pam_vbox_log(hPAM, "pam_vbox_read_prop: key \"%s\"=\"%s\"\n",
     376                     pszKey, pszValue);
     377    return rc;
     378}
     379#endif
     380
     381
     382/**
     383 * Performs authentication within the PAM framework.
     384 *
     385 * @todo
     386 */
     387DECLEXPORT(int) pam_sm_authenticate(pam_handle_t *hPAM, int iFlags,
     388                                    int argc, const char **argv)
     389{
     390    /* Parse arguments. */
     391    int i;
     392    for (i = 0; i < argc; i++)
     393    {
     394        if (!RTStrICmp(argv[i], "debug"))
     395            g_verbosity = 1;
     396        else
     397            pam_vbox_error(hPAM, "pam_sm_authenticate: unknown command line argument \"%s\"\n", argv[i]);
     398    }
     399    pam_vbox_log(hPAM, "pam_vbox_authenticate called\n");
     400
     401    int rc = pam_vbox_init(hPAM);
     402    if (RT_FAILURE(rc))
     403        return PAM_SUCCESS; /* Jump out as early as we can to not mess around. */
     404
     405    bool fFallback = true;
     406
     407#ifdef VBOX_WITH_GUEST_PROPS
     408    uint32_t uClientId;
     409    rc = VbglR3GuestPropConnect(&uClientId);
     410    if (RT_SUCCESS(rc))
     411    {
     412        char szVal[256];
     413        rc = pam_vbox_read_prop(hPAM,uClientId, "/VirtualBox/GuestAdd/PAM/CredsWait",
     414                                szVal, sizeof(szVal));
     415        if (RT_SUCCESS(rc))
     416        {
     417            /* All calls which are checked against rc2 are not critical, e.g. it does
     418             * not matter if they succeed or not. */
     419            uint32_t uTimeoutMS = RT_INDEFINITE_WAIT; /* Wait infinite by default. */
     420            int rc2 = pam_vbox_read_prop(hPAM, uClientId, "/VirtualBox/GuestAdd/PAM/CredsWaitTimeout",
     421                                         szVal, sizeof(szVal));
     422            if (RT_SUCCESS(rc2))
     423            {
     424                uTimeoutMS = RTStrToUInt32(szVal);
     425                if (!uTimeoutMS)
    222426                {
    223                     pam_vbox_error(h, "pam_vbox_do_check: could not set user name! pamrc=%d. Aborting.\n", pamrc);
     427                    pam_vbox_error(hPAM, "pam_sm_authenticate: invalid waiting timeout value specified, defaulting to infinite timeout\n");
     428                    uTimeoutMS = RT_INDEFINITE_WAIT;
    224429                }
    225430                else
     431                    uTimeoutMS = uTimeoutMS * 1000; /* Make ms out of s. */
     432            }
     433
     434            rc2 = pam_vbox_read_prop(hPAM, uClientId, "/VirtualBox/GuestAdd/PAM/CredsMsgWaiting",
     435                                     szVal, sizeof(szVal));
     436            const char *pszWaitMsg = NULL;
     437            if (RT_SUCCESS(rc2))
     438                pszWaitMsg = szVal;
     439
     440            rc2 = vbox_set_msg(hPAM, 0 /* Info message */,
     441                               pszWaitMsg ? pszWaitMsg : "Waiting for credentials ...");
     442            if (RT_FAILURE(rc2)) /* Not critical. */
     443                pam_vbox_error(hPAM, "pam_sm_authenticate: error setting waiting information message, rc=%Rrc\n", rc2);
     444
     445            if (RT_SUCCESS(rc))
     446            {
     447                /* Before we actuall wait for credentials just make sure we didn't already get credentials
     448                 * set so that we can skip waiting for them ... */
     449                rc = pam_vbox_check_creds(hPAM);
     450                if (rc == VERR_NOT_FOUND)
    226451                {
    227                     pamrc = pam_set_item(h, PAM_AUTHTOK, pszPassword);
    228                     if (pamrc != PAM_SUCCESS)
    229                         pam_vbox_error(h, "pam_vbox_do_check: could not set password! pamrc=%d. Aborting.\n", pamrc);
     452                    rc = pam_vbox_wait_for_creds(hPAM, uClientId, uTimeoutMS);
     453                    if (RT_SUCCESS(rc))
     454                    {
     455                        /* Waiting for credentials succeeded, try getting those ... */
     456                        rc = pam_vbox_check_creds(hPAM);
     457                        if (RT_FAILURE(rc))
     458                            pam_vbox_error(hPAM, "pam_sm_authenticate: no credentials given, even when waited for it, rc=%Rrc\n", rc);
     459                    }
     460                    else if (rc == VERR_TIMEOUT)
     461                    {
     462                        pam_vbox_log(hPAM, "pam_sm_authenticate: no credentials given within time\n", rc);
     463
     464                        rc2 = pam_vbox_read_prop(hPAM, uClientId, "/VirtualBox/GuestAdd/PAM/CredsMsgWaitTimeout",
     465                                                 szVal, sizeof(szVal));
     466                        if (RT_SUCCESS(rc2))
     467                            rc2 = vbox_set_msg(hPAM, 0 /* Info message */, szVal);
     468                    }
    230469                }
    231                 /** @todo Add handling domains as well. */
    232 
    233                 VbglR3CredentialsDestroy(pszUsername, pszPassword, pszDomain,
    234                                          3 /* Three wipe passes */);
     470
     471                /* If we got here we don't need the fallback, so just deactivate it. */
     472                fFallback = false;
    235473            }
    236474        }
    237         VbglR3Term();
    238     } /* VbglR3 init okay */
    239 
    240 #if 0 /** @todo implement RTR3Term, or create some hack to force anything containing RTR3Init to stay loaded. */
    241     RTR3Term();
    242 #endif
    243 
    244     pam_vbox_log(h, "pam_vbox_do_check: returned with pamrc=%d, msg=%s\n",
    245                  pamrc, pam_strerror(h, pamrc));
     475
     476        VbglR3GuestPropDisconnect(uClientId);
     477    }
     478#endif /* VBOX_WITH_GUEST_PROPS */
     479
     480    if (fFallback)
     481    {
     482        pam_vbox_log(hPAM, "pam_vbox_authenticate: falling back to old method\n");
     483
     484        /* If anything went wrong in the code above we just do a credentials
     485         * check like it was before: Try retrieving the stuff and authenticating. */
     486        int rc2 = pam_vbox_check_creds(hPAM);
     487        if (RT_SUCCESS(rc))
     488            rc = rc2;
     489    }
     490
     491    pam_vbox_shutdown(hPAM);
     492
     493    pam_vbox_log(hPAM, "pam_vbox_authenticate: overall result rc=%Rrc\n", rc);
    246494
    247495    /* Never report an error here because if no credentials from the host are available or something
     
    256504
    257505/**
    258  * Performs authentication within the PAM framework.
    259  *
    260  * @todo
    261  */
    262 DECLEXPORT(int) pam_sm_authenticate(pam_handle_t *h, int flags,
    263                                     int argc, const char **argv)
    264 {
    265     /* Parse arguments. */
    266     int i;
    267     for (i = 0; i < argc; i++)
    268     {
    269         if (!RTStrICmp(argv[i], "debug"))
    270             g_verbosity = 1;
    271         else
    272             pam_vbox_error(h, "pam_sm_authenticate: unknown command line argument \"%s\"\n", argv[i]);
    273     }
    274     pam_vbox_log(h, "pam_vbox_authenticate called.\n");
    275 
    276     /* Do the actual check. */
    277     return pam_vbox_do_check(h);
    278 }
    279 
    280 
    281 /**
    282506 * Modifies / deletes user credentials
    283507 *
    284508 * @todo
    285509 */
    286 DECLEXPORT(int) pam_sm_setcred(pam_handle_t *h, int flags, int argc, const char **argv)
    287 {
    288     pam_vbox_log(h, "pam_vbox_setcred called.\n");
     510DECLEXPORT(int) pam_sm_setcred(pam_handle_t *hPAM, int iFlags, int argc, const char **argv)
     511{
     512    pam_vbox_log(hPAM, "pam_vbox_setcred called\n");
    289513    return PAM_SUCCESS;
    290514}
    291515
    292516
    293 DECLEXPORT(int) pam_sm_acct_mgmt(pam_handle_t *h, int flags, int argc, const char **argv)
    294 {
    295     pam_vbox_log(h, "pam_vbox_acct_mgmt called.\n");
     517DECLEXPORT(int) pam_sm_acct_mgmt(pam_handle_t *hPAM, int iFlags, int argc, const char **argv)
     518{
     519    pam_vbox_log(hPAM, "pam_vbox_acct_mgmt called\n");
    296520    return PAM_SUCCESS;
    297521}
    298522
    299523
    300 DECLEXPORT(int) pam_sm_open_session(pam_handle_t *h, int flags, int argc, const char **argv)
    301 {
    302     pam_vbox_log(h, "pam_vbox_open_session called.\n");
     524DECLEXPORT(int) pam_sm_open_session(pam_handle_t *hPAM, int iFlags, int argc, const char **argv)
     525{
     526    pam_vbox_log(hPAM, "pam_vbox_open_session called\n");
    303527    RTPrintf("This session was provided by VirtualBox Guest Additions. Have a lot of fun!\n");
    304528    return PAM_SUCCESS;
     
    306530
    307531
    308 DECLEXPORT(int) pam_sm_close_session(pam_handle_t *h, int flags, int argc, const char **argv)
    309 {
    310     pam_vbox_log(h, "pam_vbox_close_session called.\n");
     532DECLEXPORT(int) pam_sm_close_session(pam_handle_t *hPAM, int iFlags, int argc, const char **argv)
     533{
     534    pam_vbox_log(hPAM, "pam_vbox_close_session called\n");
    311535    return PAM_SUCCESS;
    312536}
    313537
    314 DECLEXPORT(int) pam_sm_chauthtok(pam_handle_t *h, int flags, int argc, const char **argv)
    315 {
    316     pam_vbox_log(h, "pam_vbox_sm_chauthtok called.\n");
     538DECLEXPORT(int) pam_sm_chauthtok(pam_handle_t *hPAM, int iFlags, int argc, const char **argv)
     539{
     540    pam_vbox_log(hPAM, "pam_vbox_sm_chauthtok called\n");
    317541    return PAM_SUCCESS;
    318542}
    319543
    320 #ifdef _DEBUG
     544#ifdef DEBUG
    321545DECLEXPORT(void) RTAssertMsg1Weak(const char *pszExpr, unsigned uLine, const char *pszFile, const char *pszFunction)
    322546{
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette