Coin, Better use xgethostname instead of defining a nasty constant.
For people in a hurry, packages are available here :
http://packages.hurdfr.org/
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 2001-09-17 06:42:47.000000000 +0200
+++ krb4-1.2.2/appl/bsd/rshd.c 2004-06-14 21:01:05.000000000 +0200
@@ -199,7 +199,7 @@
const char *errorhost = "";
char *errorstr;
char *cp, sig, buf[DES_RW_MAXWRITE];
- char cmdbuf[NCARGS+1], locuser[16], remuser[16];
+ char cmdbuf[NCARGS], locuser[16], remuser[16];
char remotehost[2 * MaxHostNameLen + 1];
uid_t uid;
char shell_path[MAXPATHLEN];
diff -Naur krb4-1.2.2.orig/lib/kafs/kafs.h krb4-1.2.2/lib/kafs/kafs.h
--- krb4-1.2.2.orig/lib/kafs/kafs.h 2001-09-10 18:05:31.000000000 +0200
+++ krb4-1.2.2/lib/kafs/kafs.h 2004-06-14 21:01:05.000000000 +0200
@@ -49,6 +49,11 @@
#define _VICEIOCTL(id) ((unsigned int ) _IOW('V', id, struct ViceIoctl))
#endif /* _VICEIOCTL */
+#ifdef __GNU__
+#define _IOT_ViceIoctl /* Hurd ioctl type field. */ \
+ _IOT (_IOTS (caddr_t), 2, _IOTS (short), 2, 0, 0)
+#endif
+
#define VIOCSETAL _VICEIOCTL(1)
#define VIOCGETAL _VICEIOCTL(2)
#define VIOCSETTOK _VICEIOCTL(3)
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
--- 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 2005-01-25 12:12:56.000000000 +0100
@@ -165,11 +165,14 @@
static char *myhostname(void)
{
- static char name[MAXHOSTNAMELEN + 1] = "";
+ static char *name = NULL;
- if (name[0] == 0) {
- gethostname(name, sizeof(name));
- name[MAXHOSTNAMELEN] = 0;
+ if (! name) {
+ name = xgethostname();
+ if (! name) {
+ perror ("xgethostname");
+ exit(1);
+ }
}
return (name);
}
@@ -277,4 +280,107 @@
}
return (NO);
}
+
+/* Copyright (c) 2001 Neal H Walfield <[EMAIL PROTECTED]>.
+
+ This file is placed into the public domain. Its distribution
+ is unlimited.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY
+ DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+ IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/* NAME
+
+ xgethostname - get the host name.
+
+ SYNOPSIS
+
+ char *xgethostname (void);
+
+ DESCRIPTION
+
+ The xhostname function is intended to replace gethostname(2), a
+ function used to access the host name. The old interface is
+ inflexable given that it assumes the existance of the
+ MAXHOSTNAMELEN macro, which neither POSIX nor the proposed
+ Single Unix Specification version 3 guarantee to be defined.
+
+ RETURN VALUE
+
+ On success, a malloced, null terminated (possibly truncated)
+ string containing the host name is returned. On failure,
+ NULL is returned and errno is set.
+ */
+
+#include <sys/param.h> /* For MAXHOSTNAMELEN */
+#include <stdlib.h>
+#include <errno.h>
+#include <unistd.h>
+
+char *
+xgethostname (void)
+{
+ int size = 0;
+ int addnull = 0;
+ char *buf;
+ int err;
+
+#ifdef MAXHOSTNAMELEN
+ size = MAXHOSTNAMELEN;
+ addnull = 1;
+#else /* MAXHOSTNAMELEN */
+#ifdef _SC_HOST_NAME_MAX
+ size = sysconf (_SC_HOST_NAME_MAX);
+ addnull = 1;
+#endif /* _SC_HOST_NAME_MAX */
+ if (size <= 0)
+ size = 256;
+#endif /* MAXHOSTNAMELEN */
+
+ buf = malloc (size + addnull);
+ if (! buf)
+ {
+ errno = ENOMEM;
+ return NULL;
+ }
+
+ err = gethostname (buf, size);
+ while (err == -1 && errno == ENAMETOOLONG)
+ {
+ free (buf);
+
+ size *= 2;
+ buf = malloc (size + addnull);
+ if (! buf)
+ {
+ errno = ENOMEM;
+ return NULL;
+ }
+
+ err = gethostname (buf, size);
+ }
+
+ if (err)
+ {
+ if (buf)
+ free (buf);
+ errno = err;
+ return NULL;
+ }
+
+ if (addnull)
+ buf[size] = '\0';
+
+ return buf;
+}
#endif /* LOGIN_ACCES */
-- Marc DequÃnes (Duck)
pgpWER1L5XHS2.pgp
Description: PGP signature

