diff -urNp krb4-1.2.2.orig/debian/patches/037_hurd krb4-1.2.2/debian/patches/037_hurd
--- krb4-1.2.2.orig/debian/patches/037_hurd	1970-01-01 01:00:00.000000000 +0100
+++ krb4-1.2.2/debian/patches/037_hurd	2005-08-08 00:10:02.538492840 +0200
@@ -0,0 +1,254 @@
+diff -Naur krb4-1.2.2.orig/appl/bsd/login_access.c krb4-1.2.2/appl/bsd/login_access.c
+--- krb4-1.2.2.orig/appl/bsd/login_access.c	2001-06-04 16:08:39.000000000 +0200
++++ krb4-1.2.2/appl/bsd/login_access.c	2004-06-14 21:01:05.000000000 +0200
+@@ -165,12 +165,12 @@
+ 
+ static char *myhostname(void)
+ {
+-    static char name[MAXHOSTNAMELEN + 1] = "";
++    static char name[MaxHostNameLen + 1] = "";
+ 
+     if (name[0] == 0) {
+ 	gethostname(name, sizeof(name));
+-	name[MAXHOSTNAMELEN] = 0;
++	name[MaxHostNameLen] = 0;
+     }
+     return (name);
+ }
+
+diff -Naur krb4-1.2.2.orig/appl/bsd/rshd.c krb4-1.2.2/appl/bsd/rshd.c
+--- krb4-1.2.2.orig/appl/bsd/rshd.c	2005-08-07 21:33:29.953382816 +0200
++++ krb4-1.2.2/appl/bsd/rshd.c	2005-08-07 21:33:54.104711256 +0200
+@@ -172,20 +172,48 @@
+ char	*envinit[] =
+ {homedir, shell, path, username, 0};
+ 
+-static void
+-xgetstr(char *buf, int cnt, char *err)
++static char *
++xgetstr(const char *err)
+ {
+-    char c;
++  size_t buf_len = 100;
++  char *buf = malloc (buf_len), *end = buf;
+ 
+-    do {
+-	if (read(STDIN_FILENO, &c, 1) != 1)
+-	    exit(1);
+-	*buf++ = c;
+-	if (--cnt == 0) {
+-	    error("%s too long\n", err);
+-	    exit(1);
++  if (! buf)
++    {
++      error ("Out of space reading %s\n", err);
++      exit (1);
++    }
++
++  do
++    {
++      /* Oh this is efficient, oh yes.  [But what can be done?] */
++      int rd = read (STDIN_FILENO, end, 1);
++      if (rd <= 0)
++	{
++	  if (rd == 0)
++	    error ("EOF reading %s\n", err);
++	  else
++	    perror (err);
++	  exit (1);
+ 	}
+-    } while (c != 0);
++
++      end += rd;
++      if ((buf + buf_len - end) < (buf_len >> 3))
++	{
++	  /* Not very much room left in our buffer, grow it. */
++	  size_t end_offs = end - buf;
++	  buf_len += buf_len;
++	  buf = realloc (buf, buf_len);
++	  if (! buf)
++	    {
++	      error ("Out of space reading %s\n", err);
++	      exit (1);
++	    }
++	  end = buf + end_offs;
++	}
++    } while (*(end - 1));
++
++  return buf;
+ }
+ 
+ static void
+@@ -199,7 +227,7 @@
+     const char *errorhost = "";
+     char *errorstr;
+     char *cp, sig, buf[DES_RW_MAXWRITE];
+-    char cmdbuf[NCARGS+1], locuser[16], remuser[16];
++    char *cmdbuf, *locuser, *remuser;
+     char remotehost[2 * MaxHostNameLen + 1];
+     uid_t uid;
+     char shell_path[MAXPATHLEN];
+@@ -328,10 +356,10 @@
+ 	    exit(1);
+ 	}
+     } else
+-	xgetstr(remuser, sizeof(remuser), "remuser");
++	remuser = xgetstr("remuser");
+ 
+-    xgetstr(locuser, sizeof(locuser), "locuser");
+-    xgetstr(cmdbuf, sizeof(cmdbuf), "command");
++    locuser = xgetstr("locuser");
++    cmdbuf = xgetstr("command");
+     setpwent();
+     pwd = k_getpwnam(locuser);
+     if (pwd == NULL) {
+diff -ur krb4-1.2.2.orig/appl/ftp/ftpd/ls.c krb4-1.2.2/appl/ftp/ftpd/ls.c
+--- krb4-1.2.2.orig/appl/ftp/ftpd/ls.c	2002-08-22 04:31:03.000000000 -0400
++++ krb4-1.2.2/appl/ftp/ftpd/ls.c	2005-08-07 10:34:21.000000000 -0400
+@@ -371,14 +371,14 @@
+  * have to fetch them.
+  */
+ 
+-#ifdef KRB4
++#if defined(KRB4) && !defined(NO_AFS)
+ static int do_the_afs_dance = 1;
+ #endif
+ 
+ static int
+ lstat_file (const char *file, struct stat *sb)
+ {
+-#ifdef KRB4
++#if defined(KRB4) && !defined(NO_AFS)
+     if (do_the_afs_dance &&
+ 	k_hasafs() 
+ 	&& strcmp(file, ".")
+diff -ur krb4-1.2.2.orig/configure krb4-1.2.2/configure
+--- krb4-1.2.2.orig/configure	2005-08-07 10:45:06.000000000 -0400
++++ krb4-1.2.2/configure	2005-08-07 09:25:35.000000000 -0400
+@@ -41771,7 +41771,7 @@
+ 
+ fi;
+ 
+-if test "$enabls_afs_support" = no; then
++if test "$enable_afs_support" = no; then
+ 
+ cat >>confdefs.h <<\_ACEOF
+ #define NO_AFS 1
+diff -ur krb4-1.2.2.orig/configure.in krb4-1.2.2/configure.in
+--- krb4-1.2.2.orig/configure.in	2003-03-16 23:01:50.000000000 -0500
++++ krb4-1.2.2/configure.in	2005-08-07 09:24:32.000000000 -0400
+@@ -175,7 +175,7 @@
+ 	AC_HELP_STRING([--disable-afs-support],
+ 		[if you don't want support for AFS]))
+ 
+-if test "$enabls_afs_support" = no; then
++if test "$enable_afs_support" = no; then
+ 	AC_DEFINE(NO_AFS, 1, [Define if you don't wan't support for AFS.])
+ fi
+ 
+diff -ur krb4-1.2.2.orig/kuser/klist.c krb4-1.2.2/kuser/klist.c
+--- krb4-1.2.2.orig/kuser/klist.c	2002-06-28 13:40:49.000000000 -0400
++++ krb4-1.2.2/kuser/klist.c	2005-08-07 10:18:07.000000000 -0400
+@@ -235,6 +235,7 @@
+ static void
+ display_tokens(void)
+ {
++#ifndef NO_AFS
+     u_int32_t i;
+     unsigned char t[128];
+     struct ViceIoctl parms;
+@@ -285,6 +286,7 @@
+ 	    printf(" (%d)", ct.AuthHandle);
+ 	putchar('\n');
+     }
++#endif
+ }
+ 
+ static void
+diff -ur krb4-1.2.2.orig/lib/kafs/afssys.c krb4-1.2.2/lib/kafs/afssys.c
+--- krb4-1.2.2.orig/lib/kafs/afssys.c	2000-07-08 08:06:03.000000000 -0400
++++ krb4-1.2.2/lib/kafs/afssys.c	2005-08-07 09:52:23.000000000 -0400
+@@ -169,20 +169,28 @@
+ int
+ k_afs_cell_of_file(const char *path, char *cell, int len)
+ {
++#ifndef NO_AFS
+     struct ViceIoctl parms;
+     parms.in = NULL;
+     parms.in_size = 0;
+     parms.out = cell;
+     parms.out_size = len;
+     return k_pioctl((char*)path, VIOC_FILE_CELL_NAME, &parms, 1);
++#else
++    return -1;
++#endif
+ }
+ 
+ int
+ k_unlog(void)
+ {
++#ifndef NO_AFS
+     struct ViceIoctl parms;
+     memset(&parms, 0, sizeof(parms));
+     return k_pioctl(0, VIOCUNLOG, &parms, 0);
++#else
++    return -1;
++#endif
+ }
+ 
+ int
+diff -ur krb4-1.2.2.orig/lib/kafs/common.c krb4-1.2.2/lib/kafs/common.c
+--- krb4-1.2.2.orig/lib/kafs/common.c	2002-05-30 22:43:51.000000000 -0400
++++ krb4-1.2.2/lib/kafs/common.c	2005-08-07 09:54:18.000000000 -0400
+@@ -59,6 +59,7 @@
+ int
+ kafs_settoken(const char *cell, uid_t uid, CREDENTIALS *c)
+ {
++#ifndef NO_AFS
+     struct ViceIoctl parms;
+     struct ClearToken ct;
+     int32_t sizeof_x;
+@@ -136,6 +137,9 @@
+     parms.out_size = 0;
+     ret = k_pioctl(0, VIOCSETTOK, &parms, 0);
+     return ret;
++#else
++    return -1;
++#endif
+ }
+ 
+ /* Try to get a db-server for an AFS cell from a AFSDB record */
+diff -Naur krb4-1.2.2.orig/lib/roken/getaddrinfo_hostspec.c krb4-1.2.2/lib/roken/getaddrinfo_hostspec.c
+--- krb4-1.2.2.orig/lib/roken/getaddrinfo_hostspec.c	2000-07-15 14:50:32.000000000 +0200
++++ krb4-1.2.2/lib/roken/getaddrinfo_hostspec.c	2004-06-14 20:55:15.000000000 +0200
+@@ -48,9 +48,9 @@
+ {
+     const char *p;
+     char portstr[NI_MAXSERV];
+-    char host[MAXHOSTNAMELEN];
++    char *host;
+     struct addrinfo hints;
+-    int hostspec_len;
++    int hostspec_len, res;
+ 
+     struct hst {
+ 	const char *prefix;
+@@ -91,8 +91,16 @@
+     }
+     snprintf (portstr, sizeof(portstr), "%u", port);
+     
+-    snprintf (host, sizeof(host), "%.*s", hostspec_len, hostspec);
+-    return getaddrinfo (host, portstr, &hints, ai);
++    host = malloc(hostspec_len);
++    if (host == NULL) {
++	res = EAI_MEMORY;
++    } else {
++	snprintf (host, hostspec_len, "%.*s", hostspec_len, hostspec);
++	res = getaddrinfo (host, portstr, &hints, ai);
++	free (host);
++    }
++    
++    return res;
+ }
+ 
+ int
diff -urNp krb4-1.2.2.orig/debian/rules krb4-1.2.2/debian/rules
--- krb4-1.2.2.orig/debian/rules	2005-08-08 00:04:55.216212928 +0200
+++ krb4-1.2.2/debian/rules	2005-08-08 00:09:48.001702768 +0200
@@ -62,6 +62,13 @@ libss_major=`ls $(BUILD_TREE)/lib/sl/.li
  awk '{if (match($$0,/\.so\.[0-9]+$$/)) print substr($$0,RSTART+4)}'`
 
 
+# The Hurd doesn't have AFS.
+DEB_HOST_GNU_SYSTEM := $(shell dpkg-architecture -qDEB_HOST_GNU_SYSTEM)
+ifeq ($(DEB_HOST_GNU_SYSTEM),gnu)
+DISABLE_AFS = --disable-afs-support
+else
+DISABLE_AFS =
+endif
 
 # Uncomment this to turn on verbose mode.
 # export DH_VERBOSE=1
@@ -101,7 +108,8 @@ $(STAMP_DIR)/build-stamp: $(patched)
 		 --with-db-dir=/var/lib/kerberos			\
 		 --with-cracklib=/usr/lib				\
 		 --with-dictpath=/var/cache/cracklib/cracklib_dict	\
-		 --with-mailspool=/var/spool/mail 
+		 --with-mailspool=/var/spool/mail \
+		 $(DISABLE_AFS)
 
 	# Add here commands to compile the package.
 	$(MAKE) -C $(BUILD_TREE)
