Implement RTLD_NEXT and fix RTLD_DEFAULT for HP-UX.
This commit is contained in:
@@ -77,13 +77,26 @@ sudo_dlsym(void *vhandle, const char *symbol)
|
|||||||
shl_t handle = vhandle;
|
shl_t handle = vhandle;
|
||||||
void *value = NULL;
|
void *value = NULL;
|
||||||
|
|
||||||
/* RTLD_NEXT is not unsupported with shl_findsym(). */
|
/*
|
||||||
if (vhandle == RTLD_DEFAULT)
|
* Note that the behavior of of RTLD_NEXT and RTLD_SELF
|
||||||
(void)shl_findsym(NULL, symbol, TYPE_UNDEFINED, &value);
|
* differs from most implementations when called from
|
||||||
else if (vhandle == RTLD_SELF)
|
* a shared library.
|
||||||
(void)shl_findsym(PROG_HANDLE, symbol, TYPE_UNDEFINED, &value);
|
*/
|
||||||
else if (vhandle != RTLD_NEXT)
|
if (vhandle == RTLD_NEXT) {
|
||||||
|
/* Iterate over all shared libs looking for symbol. */
|
||||||
|
struct shl_descriptor *desc;
|
||||||
|
int idx = 0;
|
||||||
|
while (shl_get(idx++, &desc) == 0) {
|
||||||
|
if (shl_findsym(&desc->handle, symbol, TYPE_UNDEFINED, &value) == 0)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (vhandle == RTLD_DEFAULT)
|
||||||
|
handle = NULL;
|
||||||
|
else if (vhandle == RTLD_SELF)
|
||||||
|
handle = PROG_HANDLE;
|
||||||
(void)shl_findsym(&handle, symbol, TYPE_UNDEFINED, &value);
|
(void)shl_findsym(&handle, symbol, TYPE_UNDEFINED, &value);
|
||||||
|
}
|
||||||
|
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user