VirtualBox

Changeset 79559 in vbox for trunk/src/VBox/Runtime/r3/posix


Ignore:
Timestamp:
Jul 5, 2019 3:42:51 PM (6 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
131847
Message:

IPRT/process-creation-posix.cpp: Try to dynamically resolve crypt_r on linux. [adjustments] ticketref:18682

Location:
trunk/src/VBox/Runtime/r3/posix
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/r3/posix/ldrNative-posix.cpp

    r79003 r79559  
    148148    size_t const cchFilename = strlen(pszFilename);
    149149    size_t const cchSuffix   = strlen(pszExt);
    150     char *pszTmp = (char *)alloca(cchFilename + cchSuffix + 1);
     150    char *pszTmp = (char *)alloca(cchFilename + cchSuffix + 16 + 1);
    151151    memcpy(pszTmp, pszFilename, cchFilename);
    152152    memcpy(&pszTmp[cchFilename], pszExt, cchSuffix);
    153153    pszTmp[cchFilename + cchSuffix] = '\0';
    154154
    155     return RTLdrLoadEx(pszTmp, phLdrMod, fFlags, NULL);
     155    int rc = RTLdrLoadEx(pszTmp, phLdrMod, fFlags, NULL);
     156
     157#if !defined(RT_OS_DARWIN) && !defined(RT_OS_OS2) && !defined(RT_OS_WINDOWS)
     158    /*
     159     * If no version was given after the .so and do .so.MAJOR search according
     160     * to the range in the fFlags.
     161     */
     162    if (RT_FAILURE(rc) && !(fFlags & RTLDRLOAD_FLAGS_NO_SUFFIX))
     163    {
     164        const char *pszActualSuff = RTPathSuffix(pszTmp);
     165        if (pszActualSuff && strcmp(pszActualSuff, ".so") == 0)
     166        {
     167            uint32_t const uBegin = (fFlags & RTLDRLOAD_FLAGS_SO_VER_BEGIN_MASK) >> RTLDRLOAD_FLAGS_SO_VER_BEGIN_SHIFT;
     168            uint32_t const uEnd   = (fFlags & RTLDRLOAD_FLAGS_SO_VER_END_MASK)   >> RTLDRLOAD_FLAGS_SO_VER_END_SHIFT;
     169            int32_t const  iIncr  = uBegin <= uEnd ? 1 : -1;
     170            for (uint32_t uMajorVer = uBegin; uMajorVer != uEnd; uMajorVer += iIncr)
     171            {
     172                RTStrPrintf(&pszTmp[cchFilename + cchSuffix], 16 + 1, ".%u", uMajorVer);
     173                rc = RTLdrLoadEx(pszTmp, phLdrMod, fFlags, NULL);
     174                if (RT_SUCCESS(rc))
     175                    break;
     176            }
     177        }
     178    }
     179#endif
     180
     181    return rc;
    156182}
    157183
  • trunk/src/VBox/Runtime/r3/posix/process-creation-posix.cpp

    r79014 r79559  
    204204        return pfnCryptR(pszKey, pszSalt, pData);
    205205
    206     pfnCryptR = (PFNCRYPTR)(uintptr_t)RTLdrGetSystemSymbol("libcrypt.so", "crypt_r");
     206    pfnCryptR = (PFNCRYPTR)(uintptr_t)RTLdrGetSystemSymbolEx("libcrypt.so", "crypt_r", RTLDRLOAD_FLAGS_SO_VER_RANGE(1, 6));
    207207    if (!pfnCryptR)
    208         pfnCryptR = (PFNCRYPTR)(uintptr_t)RTLdrGetSystemSymbol("libxcrypt.so", "crypt_r");
     208        pfnCryptR = (PFNCRYPTR)(uintptr_t)RTLdrGetSystemSymbolEx("libxcrypt.so", "crypt_r", RTLDRLOAD_FLAGS_SO_VER_RANGE(1, 32));
    209209    if (pfnCryptR)
    210210    {
Note: See TracChangeset for help on using the changeset viewer.

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