From ba4ea09a445944d34fcde9b749ebd1f8854cdb66 Mon Sep 17 00:00:00 2001 From: netblue30 Date: Fri, 19 Oct 2018 10:51:46 -0400 Subject: testing --- src/include/ldd_utils.h | 46 ------------------------------------ src/lib/ldd_utils.c | 62 ------------------------------------------------- 2 files changed, 108 deletions(-) delete mode 100644 src/include/ldd_utils.h delete mode 100644 src/lib/ldd_utils.c (limited to 'src') diff --git a/src/include/ldd_utils.h b/src/include/ldd_utils.h deleted file mode 100644 index 28f5be7bf..000000000 --- a/src/include/ldd_utils.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (C) 2014-2018 Firejail Authors - * - * This file is part of firejail project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -*/ - -#ifndef LDD_UTILS_H -#define LDD_UTILS_H - -#include "../include/common.h" -#include - -#ifdef __LP64__ -#define Elf_Ehdr Elf64_Ehdr -#define Elf_Phdr Elf64_Phdr -#define Elf_Shdr Elf64_Shdr -#define Elf_Dyn Elf64_Dyn -#else -#define Elf_Ehdr Elf32_Ehdr -#define Elf_Phdr Elf32_Phdr -#define Elf_Shdr Elf32_Shdr -#define Elf_Dyn Elf32_Dyn -#endif - -extern const char * const default_lib_paths[]; - -// return 1 if this is a 64 bit program/library -int is_lib_64(const char *exe); - - - -#endif \ No newline at end of file diff --git a/src/lib/ldd_utils.c b/src/lib/ldd_utils.c deleted file mode 100644 index b8a7aeed2..000000000 --- a/src/lib/ldd_utils.c +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (C) 2014-2018 Firejail Authors - * - * This file is part of firejail project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -*/ - -#include "../include/ldd_utils.h" -#include -#include -#include - -const char * const default_lib_paths[] = { - "/usr/lib/x86_64-linux-gnu", // Debian & friends - "/lib/x86_64-linux-gnu", // CentOS, Fedora - "/usr/lib", - "/lib", - "/lib64", - LIBDIR, - "/usr/local/lib", - "/usr/lib/x86_64-linux-gnu/mesa", // libGL.so is sometimes a symlink into this directory - "/usr/lib/x86_64-linux-gnu/mesa-egl", // libGL.so is sometimes a symlink into this directory -// "/usr/lib/x86_64-linux-gnu/plasma-discover", - NULL -}; - -// return 1 if this is a 64 bit program/library -int is_lib_64(const char *exe) { - int retval = 0; - int fd = open(exe, O_RDONLY); - if (fd < 0) - return 0; - - unsigned char buf[EI_NIDENT]; - ssize_t len = 0; - while (len < EI_NIDENT) { - ssize_t sz = read(fd, buf, EI_NIDENT); - if (sz <= 0) - goto doexit; - len += sz; - } - - if (buf[EI_CLASS] == ELFCLASS64) - retval = 1; - -doexit: - close(fd); - return retval; -} -- cgit v1.2.3-70-g09d2