Changeset 29624 in vbox for trunk/src/VBox
- Timestamp:
- May 18, 2010 12:36:13 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/r3/posix/process-posix.cpp
r29602 r29624 39 39 #include <fcntl.h> 40 40 #include <signal.h> 41 #if defined(RT_OS_LINUX) 41 #if defined(RT_OS_LINUX) || defined(RT_OS_SOLARIS) 42 42 # include <crypt.h> 43 43 # include <pwd.h> … … 101 101 *gid = pw->pw_gid; 102 102 *uid = pw->pw_uid; 103 return VINF_SUCCESS; 104 #elif defined(RT_OS_SOLARIS) 105 struct passwd *ppw, pw; 106 char szBuf[1024]; 107 108 if (getpwnam_r(pszUser, &pw, szBuf, sizeof(szBuf), &ppw) != 0 || ppw == NULL) 109 return VERR_PERMISSION_DENIED; 110 111 if (!pszPasswd) 112 pszPasswd = ""; 113 114 struct spwd spwd; 115 char szPwdBuf[1024]; 116 /* works only if /etc/shadow is accessible */ 117 if (getspnam_r(pszUser, &spwd, szPwdBuf, sizeof(szPwdBuf)) != NULL) 118 ppw->pw_passwd = spwd.sp_pwdp; 119 120 char *pszEncPasswd = crypt(pszPasswd, ppw->pw_passwd); 121 if (strcmp(pszEncPasswd, ppw->pw_passwd)) 122 return VERR_PERMISSION_DENIED; 123 124 *gid = ppw->pw_gid; 125 *uid = ppw->pw_uid; 103 126 return VINF_SUCCESS; 104 127 #else
Note:
See TracChangeset
for help on using the changeset viewer.