Changeset 81251 in vbox for trunk/src/VBox/Runtime
- Timestamp:
- Oct 14, 2019 11:41:46 AM (5 years ago)
- svn:sync-xref-src-repo-rev:
- 133946
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/r3/posix/process-creation-posix.cpp
r80569 r81251 80 80 #endif 81 81 82 #ifdef RT_OS_DARWIN 83 # include <mach-o/dyld.h> 82 #if !defined(IPRT_USE_PAM) && ( defined(RT_OS_DARWIN) || defined(RT_OS_FREEBSD) || defined(RT_OS_NETBSD) || defined(RT_OS_OPENBSD) ) 83 # define IPRT_USE_PAM 84 #endif 85 #ifdef IPRT_USE_PAM 86 # ifdef RT_OS_DARWIN 87 # include <mach-o/dyld.h> 88 # define IPRT_LIBPAM_FILE "libpam.dylib" 89 # define IPRT_PAM_SERVICE_NAME "login" /** @todo we've been abusing 'login' here, probably not needed? */ 90 # else 91 # define IPRT_LIBPAM_FILE "libpam.so" 92 # define IPRT_PAM_SERVICE_NAME "iprt-as-user" 93 # endif 84 94 # include <security/pam_appl.h> 85 95 # include <stdlib.h> … … 126 136 * Structures and Typedefs * 127 137 *********************************************************************************************************************************/ 128 #ifdef RT_OS_DARWIN138 #ifdef IPRT_USE_PAM 129 139 /** For passing info between rtCheckCredentials and rtPamConv. */ 130 140 typedef struct RTPROCPAMARGS … … 138 148 139 149 140 #ifdef RT_OS_DARWIN150 #ifdef IPRT_USE_PAM 141 151 /** 142 152 * Worker for rtCheckCredentials that feeds password and maybe username to PAM. … … 183 193 return PAM_SUCCESS; 184 194 } 185 #endif /* RT_OS_DARWIN*/186 187 188 #if def IPRT_WITH_DYNAMIC_CRYPT_R195 #endif /* IPRT_USE_PAM */ 196 197 198 #if defined(IPRT_WITH_DYNAMIC_CRYPT_R) && !defined(IPRT_USE_PAM) 189 199 /** Pointer to crypt_r(). */ 190 200 typedef char *(*PFNCRYPTR)(const char *, const char *, struct crypt_data *); … … 230 240 static int rtCheckCredentials(const char *pszUser, const char *pszPasswd, gid_t *pGid, uid_t *pUid) 231 241 { 232 #if defined(RT_OS_DARWIN)242 #ifdef IPRT_USE_PAM 233 243 RTLogPrintf("rtCheckCredentials\n"); 234 244 … … 251 261 * Note! libpam.2.dylib was introduced with 10.6.x (OpenPAM). 252 262 */ 253 void *hModPam = dlopen( "libpam.dylib", RTLD_LAZY | RTLD_GLOBAL);263 void *hModPam = dlopen(IPRT_LIBPAM_FILE, RTLD_LAZY | RTLD_GLOBAL); 254 264 if (hModPam) 255 265 { … … 271 281 && pfnPamEnd) 272 282 { 273 #define pam_start pfnPamStart 274 #define pam_authenticate pfnPamAuthenticate 275 #define pam_acct_mgmt pfnPamAcctMgmt 276 #define pam_set_item pfnPamSetItem 277 #define pam_end pfnPamEnd 278 279 /* Do the PAM stuff. 280 Note! Abusing 'login' here for now... */ 283 # define pam_start pfnPamStart 284 # define pam_authenticate pfnPamAuthenticate 285 # define pam_acct_mgmt pfnPamAcctMgmt 286 # define pam_set_item pfnPamSetItem 287 # define pam_end pfnPamEnd 288 289 /* Do the PAM stuff. */ 281 290 pam_handle_t *hPam = NULL; 282 291 RTPROCPAMARGS PamConvArgs = { pszUser, pszPasswd }; … … 285 294 PamConversation.appdata_ptr = &PamConvArgs; 286 295 PamConversation.conv = rtPamConv; 287 int rc = pam_start( "login", pszUser, &PamConversation, &hPam);296 int rc = pam_start(IPRT_PAM_SERVICE_NAME, pszUser, &PamConversation, &hPam); 288 297 if (rc == PAM_SUCCESS) 289 298 { … … 316 325 } 317 326 else 318 Log(("rtCheckCredentials: Loading libpam.dylibfailed\n"));327 Log(("rtCheckCredentials: Loading " IPRT_LIBPAM_FILE " failed\n")); 319 328 return VERR_AUTHENTICATION_FAILURE; 320 329
Note:
See TracChangeset
for help on using the changeset viewer.