Index: src/appl/gssftp/configure.in
--- src/appl/gssftp/configure.in.orig	2004-09-23 00:59:44 +0200
+++ src/appl/gssftp/configure.in	2005-01-31 19:55:02 +0100
@@ -20,6 +20,7 @@
 AC_REPLACE_FUNCS(getdtablesize)
 AC_CHECK_FUNCS(getcwd getdtablesize getusershell seteuid setreuid setresuid strerror getenv)
 AC_CHECK_LIB(crypt,crypt) dnl 
+AC_CHECK_TYPE(sig_t,[AC_DEFINE([HAVE_SIG_T])],,[#include <signal.h>]) dnl
 KRB5_AC_LIBUTIL
 dnl 
 dnl copied from appl/bsd/configure.in
Index: src/appl/gssftp/configure
--- src/appl/gssftp/configure.orig	2005-01-27 23:12:30 +0100
+++ src/appl/gssftp/configure	2005-01-31 19:57:12 +0100
@@ -8302,6 +8302,71 @@
 fi
 
 
+ echo "$as_me:$LINENO: checking for sig_t" >&5
+echo $ECHO_N "checking for sig_t... $ECHO_C" >&6
+if test "${ac_cv_type_sig_t+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <signal.h>
+
+int
+main ()
+{
+if ((sig_t *) 0)
+  return 0;
+if (sizeof (sig_t))
+  return 0;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_type_sig_t=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_type_sig_t=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_type_sig_t" >&5
+echo "${ECHO_T}$ac_cv_type_sig_t" >&6
+if test $ac_cv_type_sig_t = yes; then
+  cat >>confdefs.h <<\_ACEOF
+#define HAVE_SIG_T 1
+_ACEOF
+
+fi
+
+
 echo "$as_me:$LINENO: checking setenv" >&5
 echo $ECHO_N "checking setenv... $ECHO_C" >&6
 if test "${krb5_cv_setenv+set}" = set; then
Index: src/appl/gssftp/ftp/cmds.c
--- src/appl/gssftp/ftp/cmds.c.orig	2003-06-17 00:37:39.000000000 +0200
+++ src/appl/gssftp/ftp/cmds.c	2004-04-10 12:36:57.000000000 +0200
@@ -65,6 +65,10 @@
 #include <errno.h>
 #include <ctype.h>
 #include <time.h>
+#include <limits.h>
+#ifndef HAVE_SIG_T
+typedef void (*sig_t) (int);
+#endif
 
 #ifdef HAVE_GETCWD
 #define getwd(x) getcwd(x,MAXPATHLEN)
@@ -101,6 +105,30 @@
 static char *domap (char *);
 
 /*
+ * pipeprotect: protect against "special" local filenames by prepending
+ * "./". Special local filenames are "-" and "|..." AND "/...".
+ */
+static char *pipeprotect(char *name) 
+{
+	char *nu;
+	if (strcmp(name, "-") && *name!='|' && *name!='/') {
+		return name;
+	}
+
+	/* We're going to leak this memory. XXX. */
+	nu = malloc(strlen(name)+3);
+	if (nu==NULL) {
+		perror("malloc");
+		code = -1;
+		return NULL;
+	}
+	strcpy(nu, ".");
+	if (*name != '/') strcat(nu, "/");
+	strcat(nu, name);
+	return nu;
+}
+
+/*
  * `Another' gets another argument, and stores the new argc and argv.
  * It reverts to the top level (via main.c's intr()) on EOF/error.
  *
@@ -844,7 +872,15 @@
 
 	if (argc == 2) {
 		argc++;
-		argv[2] = argv[1];
+		/* 
+		 * Protect the user from accidentally retrieving special
+		 * local names.
+		 */
+		argv[2] = pipeprotect(argv[1]);
+		if (!argv[2]) {
+			code = -1;
+			return 0;
+		}
 		loc++;
 	}
 	if (argc < 2 && !another(&argc, &argv, "remote-file"))
@@ -1033,16 +1069,14 @@
 }
 
 char *
-remglob(argv,doswitch)
-	char *argv[];
-	int doswitch;
+remglob(char *argv[], int doswitch)
 {
 #ifdef _WIN32
 	char *temp = NULL;
 #else
 	char temp[16];
 #endif
-	static char buf[MAXPATHLEN];
+ 	static char buf[PATH_MAX];
 	static FILE *ftemp = NULL;
 	static char **args;
 	int oldverbose, oldhash;
Index: src/appl/gssftp/ftp/ftp.c
--- src/appl/gssftp/ftp/ftp.c.orig	2003-06-17 00:37:40.000000000 +0200
+++ src/appl/gssftp/ftp/ftp.c	2004-04-10 12:36:57.000000000 +0200
@@ -99,6 +99,10 @@
 #include <sys/select.h>
 #endif
 
+#ifndef HAVE_SIG_T
+typedef void (*sig_t) (int);
+#endif
+
 #include <netinet/in.h>
 #include <netinet/in_systm.h>
 #include <netinet/ip.h>
Index: src/appl/gssftp/ftp/ftp_var.h
--- src/appl/gssftp/ftp/ftp_var.h.orig	2003-06-17 00:37:40.000000000 +0200
+++ src/appl/gssftp/ftp/ftp_var.h	2004-04-10 12:36:57.000000000 +0200
@@ -57,9 +57,7 @@
 typedef void (*sig_t)(int);
 typedef void sigtype;
 #else
-#define sig_t my_sig_t
 #define sigtype krb5_sigtype
-typedef sigtype (*sig_t)();
 #endif
 
 /*
Index: src/lib/krb5/os/hst_realm.c
--- src/lib/krb5/os/hst_realm.c.orig	2002-10-16 00:51:50.000000000 +0200
+++ src/lib/krb5/os/hst_realm.c	2004-04-10 12:36:57.000000000 +0200
@@ -366,7 +366,7 @@
 	return EAFNOSUPPORT;
     case EAI_MEMORY:
 	return ENOMEM;
-#if EAI_NODATA != EAI_NONAME
+#if (defined EAI_NODATA) && (defined EAI_NONAME) && (EAI_NODATA != EAI_NONAME)
     case EAI_NODATA:
 	return KRB5_EAI_NODATA;
 #endif
Index: src/lib/krb5/os/locate_kdc.c
--- src/lib/krb5/os/locate_kdc.c.orig	2004-01-06 03:30:15.000000000 +0100
+++ src/lib/krb5/os/locate_kdc.c	2004-04-10 12:36:57.000000000 +0200
@@ -186,7 +186,7 @@
 #ifdef EAI_ADDRFAMILY
     case EAI_ADDRFAMILY:
 #endif
-#if EAI_NODATA != EAI_NONAME
+#if (defined EAI_NODATA) && (defined EAI_NONAME) && (EAI_NODATA != EAI_NONAME)
     case EAI_NODATA:
 #endif
     case EAI_NONAME:
Index: src/util/ss/pager.c
--- src/util/ss/pager.c.orig	2003-01-06 00:28:05.000000000 +0100
+++ src/util/ss/pager.c	2004-04-10 12:36:57.000000000 +0200
@@ -11,6 +11,7 @@
 #include "copyright.h"
 #include <errno.h>
 #include <stdio.h>
+#include <errno.h>
 #include <sys/types.h>
 #include <sys/file.h>
 #include <signal.h>
