Imported Upstream version 3.18 52/176752/1 upstream/3.18
authorDongHun Kwak <dh0128.kwak@samsung.com>
Mon, 23 Apr 2018 07:25:56 +0000 (16:25 +0900)
committerDongHun Kwak <dh0128.kwak@samsung.com>
Mon, 23 Apr 2018 07:25:59 +0000 (16:25 +0900)
Change-Id: I51fe3d479ae56612cc71d6bde05e19fdc97fbcdf
Signed-off-by: DongHun Kwak <dh0128.kwak@samsung.com>
Makefile
debian/changelog
debian/compat
debian/control
debian/rules
hostname.1
hostname.c

index 4aa664b..c473641 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,4 @@
-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
@@ -9,7 +9,7 @@ MANDIR:=/usr/share/man
 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
index 2cd375d..40962dc 100644 (file)
@@ -1,3 +1,32 @@
+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
index 7ed6ff8..ec63514 100644 (file)
@@ -1 +1 @@
-5
+9
index 5533a75..0cbbb9e 100644 (file)
@@ -3,8 +3,8 @@ Section: admin
 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
index 09b46a3..83d8be9 100755 (executable)
@@ -45,7 +45,7 @@ clean:
 install: build
        dh_testdir
        dh_testroot
-       dh_clean -k
+       dh_prep
        dh_installdirs
 
        # Installing package
index 38c0a35..5e345e7 100644 (file)
@@ -70,7 +70,7 @@ function, while
 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
index 167e918..823ba82 100644 (file)
 #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);
        }
 
@@ -279,7 +276,7 @@ show_name(enum type_t type)
                        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()? */
@@ -410,7 +407,7 @@ read_file(char *filename, int boot)
        }
 
        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) {