-CFLAGS+=-O2 -Wall
+CFLAGS+=-O2 -Wall -D_GNU_SOURCE
# uncomment the following line if you want to install to a different base dir.
#BASEDIR=/mnt/test
OBJS=hostname.o
hostname: $(OBJS)
- $(CC) $(CFLAGS) -o $@ $(OBJS) $(LDFLAGS) -lnsl
+ $(CC) $(CFLAGS) -o $@ $(OBJS) $(LDFLAGS)
ln -fs hostname dnsdomainname
ln -fs hostname domainname
ln -fs hostname ypdomainname
+hostname (3.18) unstable; urgency=medium
+
+ * Make sure memory is initialized to zero before attempting to read hostname.
+ Thanks to Marko Dimjašević <marko@cs.utah.edu> (Closes: #829010)
+ * Bumped Standards-Version to 3.9.8, no changes needed.
+ * Updated to debhelper 9.
+
+ -- Michael Meskes <meskes@debian.org> Sun, 03 Jul 2016 21:26:17 +0200
+
+hostname (3.17) unstable; urgency=medium
+
+ * Applied patch by Szabolcs Nagy <nsz@port70.net> (Ccloses: #787780) to:
+ * Use _GNU_SOURCE feature test macro, instead of glibc internal __USE_GNU.
+ * Use getdomainname instead of yp_get_default_domain because it is more
+ widely available and avoids the -lnsl dependency.
+ * localnisdomain is kept, even though it should be the same as localdomain,
+ so the behaviour is not changed in case of an error.
+ * Replace 'dh-clean -k' with 'dh-prep'
+
+ -- Michael Meskes <meskes@debian.org> Fri, 19 Feb 2016 13:00:23 +0100
+
+hostname (3.16) unstable; urgency=medium
+
+ * Changed buffer size to the recommended 255 character when working with
+ names instead of IPs. (Closes: #796922)
+ * Bumped Standards-Version to 3.9.6, no changes needed.
+
+ -- Michael Meskes <meskes@debian.org> Tue, 01 Sep 2015 12:32:18 +0200
+
hostname (3.15) unstable; urgency=low
* Applied patch to make it possible to install binaries and man pages into
Priority: required
Maintainer: Debian Hostname Team <hostname-devel@lists.alioth.debian.org>
Uploaders: Michael Meskes <meskes@debian.org>
-Standards-Version: 3.9.4
-Build-Depends: debhelper (>= 5)
+Standards-Version: 3.9.8
+Build-Depends: debhelper (>= 9)
Package: hostname
Architecture: any
install: build
dh_testdir
dh_testroot
- dh_clean -k
+ dh_prep
dh_installdirs
# Installing package
and
.BR nisdomainname
use the
-.BR yp_get_default_domain (3).
+.BR getdomainname (2).
.LP
.B dnsdomainname
will print the domain part of the FQDN (Fully Qualified Domain Name). The
#include <stdio.h>
#include <unistd.h>
#include <getopt.h>
-#define __USE_GNU 1
#include <string.h>
#include <netdb.h>
#include <errno.h>
#include <ctype.h>
#include <err.h>
-#include <rpcsvc/ypclnt.h>
-#define VERSION "3.15"
+#define VERSION "3.18"
enum type_t { DEFAULT, DNS, FQDN, SHORT, ALIAS, IP, NIS, NIS_DEF, ALL_FQDNS, ALL_IPS };
char *progname;
/*
- * Return the name of the nis default domain. This is just a wrapper for
- * yp_get_default_domain. If something goes wrong, program exits.
+ * Return the name of the nis default domain. Same as localdomain below,
+ * but reports failure for unset domain.
*/
char *
localnisdomain()
{
- char *buf = 0;
+ /* The historical NIS limit is 1024, the limit on Linux is 64. */
+ static char buf[1025];
int myerror = 0;
- myerror = yp_get_default_domain(&buf);
-
- /* yp_get_default_domain failed, abort. */
- if (myerror) {
- printf("%s: %s\n", progname, yperr_string(myerror));
+ myerror = getdomainname(buf, sizeof buf);
+ if (myerror || strcmp(buf, "(none)") == 0) {
+ printf("%s: Local domain name not set\n", progname);
exit (1);
}
break;
case ALL_IPS:
case ALL_FQDNS: {
- char buf[INET6_ADDRSTRLEN];
+ char buf[255];
int flags, ret, family, addrlen;
/* What kind of information do we want from getnameinfo()? */
}
if (fstat(fileno(fp), &st) == -1
- || (buf = (char *) malloc(st.st_size + 1)) == NULL)
+ || (buf = (char *) calloc(st.st_size + 1, sizeof(char))) == NULL)
err(1, NULL);
while (fgets(buf, st.st_size + 1, fp) != NULL) {