}
static int pakfire_file_elf_dyn_walk(struct pakfire_file* file, Elf* elf,
- int (*callback)(struct pakfire_file* file, Elf64_Word key, const char* value, void* data),
+ int (*callback)(struct pakfire_file* file,
+ Elf* elf, const GElf_Shdr* shdr, const GElf_Dyn* dyn, void* data),
void* data) {
Elf_Scn* dynamic = NULL;
GElf_Shdr shdr;
Elf_Data* elf_data = NULL;
+ GElf_Dyn dyn;
int r;
// Find the dynamic linking information
return 1;
}
- GElf_Dyn dyn;
- const char* value = NULL;
-
// Walk through all entries...
for (unsigned int i = 0; ; i++) {
// Fetch the next entry
if (!gelf_getdyn(elf_data, i, &dyn))
break;
- // Fetch the value
- value = elf_strptr(elf, shdr.sh_link, dyn.d_un.d_val);
-
// Call the callback
- r = callback(file, dyn.d_tag, value, data);
+ r = callback(file, elf, &shdr, &dyn, data);
if (r)
return r;
}
}
// This file does not seem to have PT_GNU_RELRO set
- file->issues |= PAKFIRE_FILE_NO_PARTIALLY_RELRO;
+ file->issues |= PAKFIRE_FILE_NO_RELRO;
return 0;
}
static int pakfire_file_check_relro(struct pakfire_file* file) {
- return pakfire_file_open_elf(file, __pakfire_file_check_partially_relro, NULL);
+ return pakfire_file_open_elf(file, __pakfire_file_check_relro, NULL);
}
/*
RPATH/RUNPATH
*/
static int __pakfire_file_process_runpath(struct pakfire_file* file,
- Elf64_Word key, const char* value, void* data) {
+ Elf* elf, const GElf_Shdr* shdr, const GElf_Dyn* dyn, void* data) {
+ const char* value = NULL;
const char* runpath = NULL;
char buffer[PATH_MAX];
char* p = NULL;
int r;
- switch (key) {
+ switch (dyn->d_tag) {
case DT_RUNPATH:
case DT_RPATH:
+ // Fetch the value
+ value = elf_strptr(elf, shdr->sh_link, dyn->d_un.d_val);
+ if (!value)
+ return 1;
+
DEBUG(file->pakfire, "%s has a RUNPATH: %s\n", file->path, value);
// Copy the value into a buffer we can modify