aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNed Ludd <solar@gentoo.org>2005-04-01 19:09:15 +0000
committerNed Ludd <solar@gentoo.org>2005-04-01 19:09:15 +0000
commitdfc91acd940588e4f2033bb07ee039c4b9204216 (patch)
tree30ef9c2129928931f3205575092ae67598741de8
parent- fix memleak (diff)
downloadpax-utils-dfc91acd940588e4f2033bb07ee039c4b9204216.tar.gz
pax-utils-dfc91acd940588e4f2033bb07ee039c4b9204216.tar.bz2
pax-utils-dfc91acd940588e4f2033bb07ee039c4b9204216.zip
- removed a few more no longer needed elf programs that have been replaced by scanelf.
-rw-r--r--.depend2
-rw-r--r--Makefile4
-rw-r--r--README30
-rw-r--r--man/scanexec.162
-rw-r--r--scanexec.c154
5 files changed, 19 insertions, 233 deletions
diff --git a/.depend b/.depend
index 8ad5eb0..c2671f5 100644
--- a/.depend
+++ b/.depend
@@ -1,6 +1,4 @@
-scanexec.o: scanexec.c paxelf.h
scanelf.o: scanelf.c paxelf.h
-scanrpath.o: scanrpath.c paxelf.h
scan4sym.o: scan4sym.c paxelf.h
pspax.o: pspax.c paxelf.h
paxelf.o: paxelf.c paxelf.h
diff --git a/Makefile b/Makefile
index 201b476..a9cb67d 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,6 @@
# Copyright 2003 Ned Ludd <solar@linbsd.net>
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-projects/pax-utils/Makefile,v 1.15 2005/04/01 16:43:49 solar Exp $
+# $Header: /var/cvsroot/gentoo-projects/pax-utils/Makefile,v 1.16 2005/04/01 19:09:15 solar Exp $
####################################################################
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
@@ -28,7 +28,7 @@ STRIP := strip
MKDIR := mkdir -p
CP := cp
#####################################################
-TARGETS = scanexec scanelf scanrpath scan4sym pspax
+TARGETS = scanelf scan4sym pspax
OBJS = ${TARGETS:%=%.o} paxelf.o
MPAGES = ${TARGETS:%=man/%.1}
SOURCES = ${OBJS:%.o=%.c}
diff --git a/README b/README
index a96469d..e674313 100644
--- a/README
+++ b/README
@@ -1,19 +1,23 @@
-pax-utils is a small set of various PaX related utilities for ELF32,
+pax-utils is a small set of various PaX related utilities for ELF32,
ELF64 binaries.
-== scanexec ==
-Usage: scanexec [options] dir1 dir2 dirN...
- -p, --path : Scan all directories in PATH environment.
- -x, --pax : Display PaX flags when scanning.
- -h, --help : Print this help and exit.
- -v, --version : Print version and exit.
-
== scanelf ==
-Usage: scanelf [options] dir1 dir2 dirN...
- -p, --path : Scan all directories in PATH environment.
- -l, --ldpath : Scan all directories in /etc/ld.so.conf
- -h, --help : Print this help and exit.
- -v, --version : Print version and exit.
+Usage: scanelf [options] <dir1> [dir2 dirN ...]
+
+Options:
+ -p, --path × Scan all directories in PATH environment
+ -l, --ldpath × Scan all directories in /etc/ld.so.conf
+ -R, --recursive × Scan directories recursively
+
+ -x, --pax × Print PaX markings
+ -s, --stack × Print GNU_STACK/RELRO markings
+ -t, --textrel × Print TEXTREL information
+ -r, --rpath × Print RPATH information
+ -a, --all × Print all scanned info
+ -q, --quiet × Only output 'bad' things
+
+ -h, --help × Print this help and exit
+ -V, --version × Print version and exit
== pspax ==
Usage: pspax
diff --git a/man/scanexec.1 b/man/scanexec.1
deleted file mode 100644
index 1f49770..0000000
--- a/man/scanexec.1
+++ /dev/null
@@ -1,62 +0,0 @@
-.TH "scanexec" "1" "0.1" "Ned Ludd" ""
-.SH "NAME"
-.LP
-scanexec \-
-user-space utility to scan elf files
-.SH "SYNTAX"
-.LP
-scanexec [\fIoptions\fP] dir1 dir2 dirN...
-.BR
-.SH "DESCRIPTION"
-scanexec is a user-space utility to scan and list ELF ET_EXEC files, and optionaly list PaX flags.
-.BR
-The main use of the scanexec util is to quickly identify which files potentially should to be rebuilt as etdyn.
-.LP
-.SH "OPTIONS"
-.LP
-.TP
-\fBNote\fR
-long options are not supported on all platforms.
-.TP
-\fB\-h, \-\-help\fR
-Output help information and exit.
-.TP
-\fB\-v, \-\-version\fR
-Output version information and exit.
-.TP
-\fB \-x, \-\-pax\fR
-Lists PaX flags for each ELF ET_EXEC file.
-.TP
-\fB\-p, \-\-path\fR
-Scans paths in order they are listed in the environment $PATH
-.TP
-.BR
-.SH "FILES"
-.LP
-\fInone\fP
-.SH "ENVIRONMENT VARIABLES"
-.LP
-.TP
-\fBPATH\fP
-When the -p option is used the environment variable PATH will be search and used.
-.SH "EXAMPLES"
-.LP
-To run this program the standard way type:
-.LP
-scanexec -p
-scanexec -x
-.LP
-Alternativly you can run it like:
-.LP
-scanexec -x -p /bin /usr/bin /lib
-.SH "REPORTING BUGS"
-Please include as much information as possible (using any available debugging
-options) and send bug reports to pax-utils <solar@gentoo.org>.
-.SH "SEE ALSO"
-.BR chpax (1),
-.BR gradm (8),
-.BR isetdyn (1),
-.BR scanelf (1),
-.BR scanexec(1)
-.SH "AUTHORS"
-scanexec was written by <solar@gentoo.org>
diff --git a/scanexec.c b/scanexec.c
deleted file mode 100644
index b9095e9..0000000
--- a/scanexec.c
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
- * Copyright 2003 Ned Ludd <solar@gentoo.org>
- * Copyright 1999-2005 Gentoo Foundation
- * Distributed under the terms of the GNU General Public License v2
- * $Header: /var/cvsroot/gentoo-projects/pax-utils/scanexec.c,v 1.7 2005/03/29 23:37:03 vapier Exp $
- *
- ********************************************************************
- * 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., 59 Temple Place - Suite 330, Boston,
- * MA 02111-1307, USA.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <sys/types.h>
-#include <string.h>
-#include <unistd.h>
-#include <sys/stat.h>
-#include <dirent.h>
-#include <getopt.h>
-
-#include "paxelf.h"
-
-static const char *rcsid =
- "$Id: scanexec.c,v 1.7 2005/03/29 23:37:03 vapier Exp $";
-
-int display_pax_flags = 0;
-
-#define PARSE_FLAGS "hvxp"
-static struct option const long_options[] = {
- {"help", no_argument, 0, 'h'},
- {"version", no_argument, 0, 'v'},
- {"pax", no_argument, 0, 'x'},
- {"path", no_argument, 0, 'p'},
- {NULL, no_argument, NULL, 0}
-};
-
-/* scan a directory for ET_EXEC files and print when we find one */
-void scanexec(const char *path)
-{
- elfobj *elf = NULL;
- register DIR *dir;
- register struct dirent *dentry;
-
- if (chdir(path) == 0) {
- if ((dir = opendir(path))) {
- while ((dentry = readdir(dir))) {
- /* verify this is real ELF ET_EXEC. */
- if ((elf = readelf(dentry->d_name)) != NULL) {
- if (!check_elf_header(elf->ehdr))
- if (IS_ELF_ET_EXEC(elf))
- printf("%s%s%s/%s\n",
- ((display_pax_flags) ?
- pax_short_hf_flags(PAX_FLAGS(elf)) : ""),
- ((display_pax_flags) ? " " : "")
- , path, dentry->d_name);
-
- if (elf != NULL) {
- munmap(elf->data, elf->len);
- free(elf);
- elf = NULL;
- }
- }
- }
- closedir(dir);
- }
- }
-}
-
-
-/* display usage and exit */
-int usage(char **argv)
-{
- fprintf(stderr, "Usage: %s [options] dir1 dir2 dirN...\n",
- (*argv != NULL) ? argv[0] : __FILE__ "\b\b");
- exit(EXIT_FAILURE);
-}
-
-
-void showopt(int c, char *data)
-{
- int i;
- for (i = 0; long_options[i].name; i++)
- if (long_options[i].val == c)
- fprintf(stderr, " -%c, --%s\t: %s\n", c, long_options[i].name, data);
-}
-
-/* parse command line arguments and preform needed actions */
-void parseargs(int argc, char **argv)
-{
- int flag;
- char *p, *path;
- opterr = 0;
-
- while ((flag = (int) getopt_long(argc, argv, PARSE_FLAGS,
- long_options, NULL)) != EOF) {
- switch (flag) {
- case 'h':
- showopt('p', "Scan all directories in PATH environment.");
- showopt('x', "Display PaX flags when scanning.");
- showopt('h', "Print this help and exit.");
- showopt('v', "Print version and exit.");
- exit(EXIT_SUCCESS);
- case 'v':
- fprintf(stderr, "%s compiled %s\n", __FILE__, __DATE__);
- fprintf(stderr,
- "%s written for Gentoo Linux <solar@gentoo.org>\n\t%s\n",
- (*argv != NULL) ? argv[0] : __FILE__ "\b\b", rcsid);
- exit(EXIT_SUCCESS);
- case 'x':
- display_pax_flags = 1;
- break;
- case 'p':
- if ((path = strdup(getenv("PATH"))) == NULL) {
- perror("strdup");
- exit(EXIT_FAILURE);
- }
- /* split string into dirs */
- while ((p = strrchr(path, ':')) != NULL) {
- scanexec(p + 1);
- *p = 0;
- }
- if (path != NULL)
- free(path);
- break;
- case '?':
- default:
- break;
- }
- }
- while (optind < argc)
- scanexec(argv[optind++]);
-}
-
-int main(int argc, char **argv)
-{
- if (argc < 2)
- usage(argv);
-
- parseargs(argc, argv);
-
- return 0;
-}