diff --git a/config.h.in b/config.h.in index 2c2fca5..1cd2156 100644 --- a/config.h.in +++ b/config.h.in @@ -127,6 +127,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_SYS_IOCTL_H +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_PRCTL_H + /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STAT_H @@ -167,6 +170,9 @@ /* Define to the one symbol short name of this package. */ #undef PACKAGE_TARNAME +/* Define to the home page for this package. */ +#undef PACKAGE_URL + /* Define to the version of this package. */ #undef PACKAGE_VERSION @@ -179,6 +185,11 @@ /* Define to 1 if your declares `struct tm'. */ #undef TM_IN_SYS_TIME +/* Enable large inode numbers on Mac OS X 10.5. */ +#ifndef _DARWIN_USE_64_BIT_INODE +# define _DARWIN_USE_64_BIT_INODE 1 +#endif + /* Number of bits in a file offset, on hosts where this is settable. */ #undef _FILE_OFFSET_BITS diff --git a/configure b/configure index f6c1514..8024399 100755 --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for cpm 0.27. +# Generated by GNU Autoconf 2.69 for cpm 0.28. # # Report bugs to . # @@ -548,8 +548,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='cpm' PACKAGE_TARNAME='cpm' -PACKAGE_VERSION='0.27' -PACKAGE_STRING='cpm 0.27' +PACKAGE_VERSION='0.28' +PACKAGE_STRING='cpm 0.28' PACKAGE_BUGREPORT='kwy@redpill-linpro.com' PACKAGE_URL='' @@ -1226,7 +1226,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures cpm 0.27 to adapt to many kinds of systems. +\`configure' configures cpm 0.28 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1287,7 +1287,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of cpm 0.27:";; + short | recursive ) echo "Configuration of cpm 0.28:";; esac cat <<\_ACEOF @@ -1392,7 +1392,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -cpm configure 0.27 +cpm configure 0.28 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -1815,7 +1815,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by cpm $as_me 0.27, which was +It was created by cpm $as_me 0.28, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -4633,6 +4633,18 @@ fi done +for ac_header in sys/prctl.h +do : + ac_fn_c_check_header_mongrel "$LINENO" "sys/prctl.h" "ac_cv_header_sys_prctl_h" "$ac_includes_default" +if test "x$ac_cv_header_sys_prctl_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_SYS_PRCTL_H 1 +_ACEOF + +fi + +done + # Checks for typedefs, structures, and compiler characteristics. { $as_echo "$as_me:${as_lineno-$LINENO}: checking typedefs, structures, and compiler characteristics" >&5 @@ -6300,7 +6312,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by cpm $as_me 0.27, which was +This file was extended by cpm $as_me 0.28, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -6362,7 +6374,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -cpm config.status 0.27 +cpm config.status 0.28 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff --git a/configure.in b/configure.in index e31403f..0f335ff 100644 --- a/configure.in +++ b/configure.in @@ -3,7 +3,7 @@ AC_MSG_NOTICE([general setup]) AC_PREREQ(2.59) -AC_INIT(cpm, 0.27, kwy@redpill-linpro.com) +AC_INIT(cpm, 0.28, kwy@redpill-linpro.com) AC_CONFIG_SRCDIR([config.h.in]) AC_CONFIG_HEADER([config.h]) @@ -372,6 +372,7 @@ AC_SUBST(LIBGPGME_CFLAGS) AC_MSG_NOTICE([checking header files]) AC_HEADER_STDC AC_CHECK_HEADERS([fcntl.h getopt.h libintl.h locale.h stdlib.h sys/fsuid.h sys/ioctl.h termios.h]) +AC_CHECK_HEADERS(sys/prctl.h) # Checks for typedefs, structures, and compiler characteristics. AC_MSG_NOTICE([checking typedefs, structures, and compiler characteristics]) diff --git a/cpm.h b/cpm.h index a946d0b..7bc13cc 100644 --- a/cpm.h +++ b/cpm.h @@ -30,6 +30,12 @@ #include "config.h" #define _GNU_SOURCE +#ifdef HAVE_STDLIB_H + #ifndef _SVID_SOURCE + #define _SVID_SOURCE + #endif + #include +#endif #include #ifdef HAVE_FCNTL_H #include @@ -43,9 +49,6 @@ #endif #include #include -#ifdef HAVE_STDLIB_H - #include -#endif #ifdef HAVE_STRINGS_H #include #endif diff --git a/interface_gui.c b/interface_gui.c index 638c692..9739879 100644 --- a/interface_gui.c +++ b/interface_gui.c @@ -432,6 +432,7 @@ int getInfodataLength(void) return max_x; else return STDBUFFERLENGTH; + (void)max_y; // remove unused var warning } @@ -1337,6 +1338,7 @@ int guiDialogHandleKeys(EObjectType cdktype, void* object, void* clientdata, while (!done); return 1; + (void) selection; // unused } diff --git a/interface_xml.c b/interface_xml.c index a4a8779..87dfdfd 100644 --- a/interface_xml.c +++ b/interface_xml.c @@ -383,7 +383,6 @@ void initXMLInterface(void) xmlNode* nodeFind(char* label) { xmlNode* curnode; - xmlNode* newnode; char* prop; TRACE(99, "nodeFind()", NULL); @@ -392,7 +391,6 @@ xmlNode* nodeFind(char* label) { return 0; } curnode = xmlwalklist[level - 1] -> children; - newnode = NULL; while (curnode) { if (curnode -> type == XML_ELEMENT_NODE && diff --git a/memory.c b/memory.c index 5ae7960..b21c361 100644 --- a/memory.c +++ b/memory.c @@ -44,7 +44,7 @@ long int memorycounter = 0; */ void* memDebugAlloc(const char* file, int line, size_t size) { - fprintf(stderr, "alloc %5d (%s, line %d)\n", size, file, line); + fprintf(stderr, "alloc %5lu (%s, line %d)\n", size, file, line); return memRealAlloc(size); } @@ -59,7 +59,7 @@ void* memDebugAlloc(const char* file, int line, size_t size) */ void memDebugFree(const char* file, int line, void* ptr, size_t size) { - fprintf(stderr, "free %5d (%s, line %d)\n", size, file, line); + fprintf(stderr, "free %5lu (%s, line %d)\n", size, file, line); memRealFree(ptr, size); } @@ -76,7 +76,7 @@ void memDebugFreeString(const char* file, int line, void* ptr) { if (ptr) { - fprintf(stderr, "free %5d (%s, line %d)\n", + fprintf(stderr, "free %5zd (%s, line %d)\n", strlen(ptr) + 1, file, line); } @@ -118,7 +118,7 @@ void* memRealAlloc(size_t size) ptr = malloc(size); if (!ptr) { - fprintf(stderr, _("out of memory error - tried to allocate %d byte.\n"), + fprintf(stderr, _("out of memory error - tried to allocate %lu byte.\n"), size); exit(1); } @@ -200,7 +200,7 @@ void* memRealRealloc(void* ptr, size_t size_old, size_t size_new) if (!ptr) { fprintf(stderr, - _("out of memory error - tried to reallocate %d byte.\n"), + _("out of memory error - tried to reallocate %lu byte.\n"), size_new); exit(1); } diff --git a/security.c b/security.c index 693f396..4735636 100644 --- a/security.c +++ b/security.c @@ -24,10 +24,13 @@ /* ############################################################################# * includes */ -#include + #include "cpm.h" +#include +#if defined(HAVE_SYS_PRCTL_H) #include #include +#endif #include #include #include @@ -495,7 +498,7 @@ int initSecurity(int* max_mem_lock, int* memory_safe, int* ptrace_safe, *memory_safe = 0; *ptrace_safe = 0; -#ifdef _SYS_PTRACE_H +#if defined(_SYS_PTRACE_H) && !defined(TRACE_DEBUG) /* Try to fork a child which then ptrace attaches to it's parent * This will safely prevent other processes (even root) to be able to attach to us */ { @@ -510,20 +513,22 @@ int initSecurity(int* max_mem_lock, int* memory_safe, int* ptrace_safe, } if (p == 0) { +#if defined(HAVE_SYS_PRCTL_H) // makes the child unattachable if (prctl(PR_SET_DUMPABLE, 0, 0, 0, 0) != 0) { fprintf(stderr, "Can not set child non dumpable\n"); _exit(1); } +#endif - if (ptrace(PTRACE_ATTACH, p0, 0, 0) != 0) { + if (ptrace(PT_ATTACH, p0, 0, 0) != 0) { // someone is already attached to us; shoot the parent in the head fprintf(stderr, "Can't attach to parent!\n"); kill(p0, SIGKILL); _exit(1); } while (1) { - if(ptrace(PTRACE_SYSCALL, p0, 0, 0) == 0) + if(ptrace(PT_SYSCALL, p0, 0, 0) == 0) waitpid(p0, &status, 0); if(errno == ESRCH && kill(p0, 0) == -1) exit(0); // parent is dead @@ -711,10 +716,9 @@ int initSecurity(int* max_mem_lock, int* memory_safe, int* ptrace_safe, /* NOTE: no file must be opened before this test! */ canary = dup(0); close(canary); - if (canary != 3) + if (canary < 3) { - fprintf(stderr, "%s\n", - _("stdin, stdout and/or stderr are invalid.")); + fprintf(stderr, "%s\n", _("stdin, stdout and/or stderr are invalid.")); return 1; } diff --git a/tests/encrypt-result.txt b/tests/encrypt-result.txt index 60656c3..a19791c 100644 --- a/tests/encrypt-result.txt +++ b/tests/encrypt-result.txt @@ -38,4 +38,4 @@ ]> -unknown