1diff -rNu3 libtirpc-0.3.2-old/src/Makefile.am libtirpc-0.3.2/src/Makefile.am
2--- libtirpc-0.3.2-old/src/Makefile.am 2015-07-28 15:17:49.248168000 +0300
3+++ libtirpc-0.3.2/src/Makefile.am 2015-07-28 15:18:04.870144456 +0300
4@@ -69,7 +69,7 @@
5 endif
6
7 libtirpc_la_SOURCES += key_call.c key_prot_xdr.c getpublickey.c
8-libtirpc_la_SOURCES += netname.c netnamer.c rtime.c
9+libtirpc_la_SOURCES += netname.c netnamer.c rpcdname.c rtime.c
10
11 CLEANFILES = cscope.* *~
12 DISTCLEANFILES = Makefile.in
13diff -rNu3 libtirpc-0.3.2-old/src/rpcdname.c libtirpc-0.3.2/src/rpcdname.c
14--- libtirpc-0.3.2-old/src/rpcdname.c 1970-01-01 03:00:00.000000000 +0300
15+++ libtirpc-0.3.2/src/rpcdname.c 2015-07-28 15:18:04.870144456 +0300
16@@ -0,0 +1,72 @@
17+/*
18+ * Copyright (c) 2009, Sun Microsystems, Inc.
19+ * All rights reserved.
20+ *
21+ * Redistribution and use in source and binary forms, with or without
22+ * modification, are permitted provided that the following conditions are met:
23+ * - Redistributions of source code must retain the above copyright notice,
24+ * this list of conditions and the following disclaimer.
25+ * - Redistributions in binary form must reproduce the above copyright notice,
26+ * this list of conditions and the following disclaimer in the documentation
27+ * and/or other materials provided with the distribution.
28+ * - Neither the name of Sun Microsystems, Inc. nor the names of its
29+ * contributors may be used to endorse or promote products derived
30+ * from this software without specific prior written permission.
31+ *
32+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
33+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
34+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
35+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
36+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
37+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
38+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
39+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
40+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
41+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
42+ * POSSIBILITY OF SUCH DAMAGE.
43+ */
44+
45+/*
46+ * rpcdname.c
47+ * Gets the default domain name
48+ */
49+
50+#include <stdlib.h>
51+#include <unistd.h>
52+#include <string.h>
53+
54+static char *default_domain = 0;
55+
56+static char *
57+get_default_domain()
58+{
59+ char temp[256];
60+
61+ if (default_domain)
62+ return (default_domain);
63+ if (getdomainname(temp, sizeof(temp)) < 0)
64+ return (0);
65+ if ((int) strlen(temp) > 0) {
66+ default_domain = (char *)malloc((strlen(temp)+(unsigned)1));
67+ if (default_domain == 0)
68+ return (0);
69+ (void) strcpy(default_domain, temp);
70+ return (default_domain);
71+ }
72+ return (0);
73+}
74+
75+/*
76+ * This is a wrapper for the system call getdomainname which returns a
77+ * ypclnt.h error code in the failure case. It also checks to see that
78+ * the domain name is non-null, knowing that the null string is going to
79+ * get rejected elsewhere in the NIS client package.
80+ */
81+int
82+__rpc_get_default_domain(domain)
83+ char **domain;
84+{
85+ if ((*domain = get_default_domain()) != 0)
86+ return (0);
87+ return (-1);
88+}