/[gentoo-projects]/pax-utils/scanelf.c
Gentoo

Diff of /pax-utils/scanelf.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.227 Revision 1.229
1/* 1/*
2 * Copyright 2003-2007 Gentoo Foundation 2 * Copyright 2003-2007 Gentoo Foundation
3 * Distributed under the terms of the GNU General Public License v2 3 * Distributed under the terms of the GNU General Public License v2
4 * $Header: /var/cvsroot/gentoo-projects/pax-utils/Attic/scanelf.c,v 1.227 2011/09/27 19:20:51 vapier Exp $ 4 * $Header: /var/cvsroot/gentoo-projects/pax-utils/Attic/scanelf.c,v 1.229 2011/09/27 19:29:19 vapier Exp $
5 * 5 *
6 * Copyright 2003-2007 Ned Ludd - <solar@gentoo.org> 6 * Copyright 2003-2007 Ned Ludd - <solar@gentoo.org>
7 * Copyright 2004-2007 Mike Frysinger - <vapier@gentoo.org> 7 * Copyright 2004-2007 Mike Frysinger - <vapier@gentoo.org>
8 */ 8 */
9 9
10static const char *rcsid = "$Id: scanelf.c,v 1.227 2011/09/27 19:20:51 vapier Exp $"; 10static const char *rcsid = "$Id: scanelf.c,v 1.229 2011/09/27 19:29:19 vapier Exp $";
11const char argv0[] = "scanelf"; 11const char argv0[] = "scanelf";
12 12
13#include "paxinc.h" 13#include "paxinc.h"
14 14
15#define IS_MODIFIER(c) (c == '%' || c == '#' || c == '+') 15#define IS_MODIFIER(c) (c == '%' || c == '#' || c == '+')
16 16
17/* prototypes */ 17/* prototypes */
18static int file_matches_list(const char *filename, char **matchlist); 18static int file_matches_list(const char *filename, char **matchlist);
19static int scanelf_elfobj(elfobj *elf);
20static int scanelf_elf(const char *filename, int fd, size_t len);
21static int scanelf_archive(const char *filename, int fd, size_t len);
22static int scanelf_file(const char *filename, const struct stat *st_cache);
23static int scanelf_dir(const char *path);
24static void scanelf_ldpath(void);
25static void scanelf_envpath(void);
26static void usage(int status);
27static char **get_split_env(const char *envvar);
28static void parseenv(void);
29static int parseargs(int argc, char *argv[]);
30 19
31/* variables to control behavior */ 20/* variables to control behavior */
32static char match_etypes[126] = ""; 21static char *match_etypes = NULL;
33static array_t _ldpaths = array_init_decl, *ldpaths = &_ldpaths; 22static array_t _ldpaths = array_init_decl, *ldpaths = &_ldpaths;
34static char scan_ldpath = 0; 23static char scan_ldpath = 0;
35static char scan_envpath = 0; 24static char scan_envpath = 0;
36static char scan_symlink = 1; 25static char scan_symlink = 1;
37static char scan_archives = 0; 26static char scan_archives = 0;
506 warnf("ELF %s has TEXTREL markings but doesnt appear to have any real TEXTREL's !?", elf->filename); 495 warnf("ELF %s has TEXTREL markings but doesnt appear to have any real TEXTREL's !?", elf->filename);
507 496
508 return NULL; 497 return NULL;
509} 498}
510 499
511static void rpath_security_checks(elfobj *, char *, const char *);
512static void rpath_security_checks(elfobj *elf, char *item, const char *dt_type) 500static void rpath_security_checks(elfobj *elf, char *item, const char *dt_type)
513{ 501{
514 struct stat st; 502 struct stat st;
515 switch (*item) { 503 switch (*item) {
516 case '/': break; 504 case '/': break;
694#define FLAG_S390_LIB64 0x0400 682#define FLAG_S390_LIB64 0x0400
695#define FLAG_POWERPC_LIB64 0x0500 683#define FLAG_POWERPC_LIB64 0x0500
696#define FLAG_MIPS64_LIBN32 0x0600 684#define FLAG_MIPS64_LIBN32 0x0600
697#define FLAG_MIPS64_LIBN64 0x0700 685#define FLAG_MIPS64_LIBN64 0x0700
698 686
699static char *lookup_cache_lib(elfobj *, char *);
700
701#if defined(__GLIBC__) || defined(__UCLIBC__) 687#if defined(__GLIBC__) || defined(__UCLIBC__)
702 688
703static char *lookup_cache_lib(elfobj *elf, char *fname) 689static char *lookup_cache_lib(elfobj *elf, char *fname)
704{ 690{
705 int fd; 691 int fd;
1446 if (elf->elf_class != ELFCLASS64) 1432 if (elf->elf_class != ELFCLASS64)
1447 goto label_done; 1433 goto label_done;
1448 break; 1434 break;
1449 default: break; 1435 default: break;
1450 } 1436 }
1451 if (strlen(match_etypes)) { 1437 if (match_etypes) {
1452 char sbuf[126]; 1438 char sbuf[126];
1453 strncpy(sbuf, match_etypes, sizeof(sbuf)); 1439 strncpy(sbuf, match_etypes, sizeof(sbuf));
1454 if (strchr(match_etypes, ',') != NULL) { 1440 if (strchr(match_etypes, ',') != NULL) {
1455 char *p; 1441 char *p;
1456 while ((p = strrchr(sbuf, ',')) != NULL) { 1442 while ((p = strrchr(sbuf, ',')) != NULL) {
1913 case 'f': 1899 case 'f':
1914 if (from_file) warn("You prob don't want to specify -f twice"); 1900 if (from_file) warn("You prob don't want to specify -f twice");
1915 from_file = optarg; 1901 from_file = optarg;
1916 break; 1902 break;
1917 case 'E': 1903 case 'E':
1918 strncpy(match_etypes, optarg, sizeof(match_etypes)); 1904 match_etypes = optarg;
1919 break; 1905 break;
1920 case 'M': 1906 case 'M':
1921 match_bits = atoi(optarg); 1907 match_bits = atoi(optarg);
1922 if (match_bits == 0) { 1908 if (match_bits == 0) {
1923 if (strcmp(optarg, "ELFCLASS32") == 0) 1909 if (strcmp(optarg, "ELFCLASS32") == 0)

Legend:
Removed from v.1.227  
changed lines
  Added in v.1.229

  ViewVC Help
Powered by ViewVC 1.1.20