aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2017-07-18 22:55:09 +0200
committerChristian Grothoff <christian@grothoff.org>2017-07-18 22:55:09 +0200
commit29f76b6fe373cd5ca7504be2ffdaad5500406b8b (patch)
tree876288c547157e4e39ea3c6f110babcc4326e44c /src
parentcd8ffdb973670871d8fae691671fc0eb0f3c7ba3 (diff)
downloadgnunet-29f76b6fe373cd5ca7504be2ffdaad5500406b8b.tar.gz
gnunet-29f76b6fe373cd5ca7504be2ffdaad5500406b8b.zip
simplify installation of nss plugins in build system, require user(s) to move plugins into place manually (#5078)
Diffstat (limited to 'src')
-rw-r--r--src/gns/Makefile.am2
-rw-r--r--src/gns/nss/Makefile.am26
-rwxr-xr-xsrc/gns/nss/install-nss-plugin.sh8
-rwxr-xr-xsrc/gns/nss/uninstall-nss-plugin.sh8
-rw-r--r--src/util/Makefile.am8
-rw-r--r--src/util/resolver_api.c85
6 files changed, 60 insertions, 77 deletions
diff --git a/src/gns/Makefile.am b/src/gns/Makefile.am
index 464bbbca1..977eb87e3 100644
--- a/src/gns/Makefile.am
+++ b/src/gns/Makefile.am
@@ -2,10 +2,8 @@
2AM_CPPFLAGS = -I$(top_srcdir)/src/include 2AM_CPPFLAGS = -I$(top_srcdir)/src/include
3 3
4if HAVE_GLIBCNSS 4if HAVE_GLIBCNSS
5if INSTALL_NSS
6NSS_SUBDIR = nss 5NSS_SUBDIR = nss
7endif 6endif
8endif
9 7
10SUBDIRS = . $(NSS_SUBDIR) 8SUBDIRS = . $(NSS_SUBDIR)
11 9
diff --git a/src/gns/nss/Makefile.am b/src/gns/nss/Makefile.am
index 2551b9562..5d42f777f 100644
--- a/src/gns/nss/Makefile.am
+++ b/src/gns/nss/Makefile.am
@@ -18,28 +18,17 @@
18# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 18# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
19# USA. 19# USA.
20 20
21EXTRA_DIST = map-file \ 21EXTRA_DIST = map-file
22 install-nss-plugin.sh \
23 uninstall-nss-plugin.sh
24 22
25AM_LDFLAGS=-avoid-version -module -export-dynamic 23AM_LDFLAGS=-avoid-version -module -export-dynamic
26 24
27nssdir = $(NSS_DIR) 25nssdir = $(libdir)/gnunet/nss
28
29LIBTOOL = $(LIBTOOL_SUDO_BINARY) $(SHELL) $(top_builddir)/libtool
30 26
31if !MINGW 27if !MINGW
32if INSTALL_NSS
33nss_LTLIBRARIES = \ 28nss_LTLIBRARIES = \
34 libnss_gns.la \ 29 libnss_gns.la \
35 libnss_gns4.la \ 30 libnss_gns4.la \
36 libnss_gns6.la 31 libnss_gns6.la
37
38install-nssLTLIBRARIES:
39 LIBTOOL_SUDO_BINARY=$(SUDO_BINARY)
40uninstall-nssLTLIBRARIES:
41 LIBTOOL_SUDO_BINARY=$(SUDO_BINARY)
42endif
43endif 32endif
44 33
45sources = nss_gns_query.h nss_gns_query.c 34sources = nss_gns_query.h nss_gns_query.c
@@ -57,14 +46,3 @@ libnss_gns6_la_SOURCES=$(libnss_gns_la_SOURCES)
57libnss_gns6_la_CFLAGS=$(libnss_gns_la_CFLAGS) -DNSS_IPV6_ONLY=1 46libnss_gns6_la_CFLAGS=$(libnss_gns_la_CFLAGS) -DNSS_IPV6_ONLY=1
58libnss_gns6_la_LDFLAGS=$(libnss_gns_la_LDFLAGS) 47libnss_gns6_la_LDFLAGS=$(libnss_gns_la_LDFLAGS)
59 48
60if INSTALL_NSS
61if !MINGW
62install-data-hook:
63 $(top_srcdir)/src/gns/nss/install-nss-plugin.sh $(SHELL) $(top_builddir) $(DESTDIR)$(nssdir) $(SUDO_BINARY)
64
65uninstall-hook:
66 $(top_srcdir)/src/gns/nss/uninstall-nss-plugin.sh $(SHELL) $(top_builddir) "rm -f $(nssdir)/libnss_gns.so.2" $(SUDO_BINARY)
67 $(top_srcdir)/src/gns/nss/uninstall-nss-plugin.sh $(SHELL) $(top_builddir) "rm -f $(nssdir)/libnss_gns4.so.2" $(SUDO_BINARY)
68 $(top_srcdir)/src/gns/nss/uninstall-nss-plugin.sh $(SHELL) $(top_builddir) "rm -f $(nssdir)/libnss_gns6.so.2" $(SUDO_BINARY)
69endif
70endif
diff --git a/src/gns/nss/install-nss-plugin.sh b/src/gns/nss/install-nss-plugin.sh
deleted file mode 100755
index 1aab8ca69..000000000
--- a/src/gns/nss/install-nss-plugin.sh
+++ /dev/null
@@ -1,8 +0,0 @@
1#!/bin/sh
2# $1 - shell
3# $2 - top_builddir
4# $3 - nssdir
5# $4 - sudo binary (empty if root)
6$4 $1 $2/libtool --mode=finish $3
7echo LTINST: $4 $1 $2/libtool --mode=finish $3
8$4 rm -f $3/libnss_gns.la $3/libnss_gns4.la $3/libnss_gns6.la
diff --git a/src/gns/nss/uninstall-nss-plugin.sh b/src/gns/nss/uninstall-nss-plugin.sh
deleted file mode 100755
index 3d8cec110..000000000
--- a/src/gns/nss/uninstall-nss-plugin.sh
+++ /dev/null
@@ -1,8 +0,0 @@
1#!/bin/sh
2# $1 - shell
3# $2 - top_builddir
4# $3 - nssdir+path of library to remove
5# $4 - sudo binary (empty if root)
6$4 $1 $2/libtool --mode=uninstall $3
7
8
diff --git a/src/util/Makefile.am b/src/util/Makefile.am
index 9be572bb6..c26e3e84b 100644
--- a/src/util/Makefile.am
+++ b/src/util/Makefile.am
@@ -336,10 +336,10 @@ test_client_unix_nc_SOURCES = \
336test_client_unix_nc_LDADD = \ 336test_client_unix_nc_LDADD = \
337 libgnunetutil.la 337 libgnunetutil.la
338 338
339test_socks_nc_SOURCES = \ 339#test_socks_nc_SOURCES = \
340 test_socks.c 340# test_socks.c
341test_socks_nc_LDADD = \ 341#test_socks_nc_LDADD = \
342 libgnunetutil.la 342# libgnunetutil.la
343 343
344test_common_allocation_SOURCES = \ 344test_common_allocation_SOURCES = \
345 test_common_allocation.c 345 test_common_allocation.c
diff --git a/src/util/resolver_api.c b/src/util/resolver_api.c
index e7bba3000..33a340729 100644
--- a/src/util/resolver_api.c
+++ b/src/util/resolver_api.c
@@ -179,7 +179,6 @@ static int
179check_config () 179check_config ()
180{ 180{
181 char *hostname; 181 char *hostname;
182 unsigned int i;
183 struct sockaddr_in v4; 182 struct sockaddr_in v4;
184 struct sockaddr_in6 v6; 183 struct sockaddr_in6 v6;
185 184
@@ -206,15 +205,16 @@ check_config ()
206 "resolver"); 205 "resolver");
207 return GNUNET_SYSERR; 206 return GNUNET_SYSERR;
208 } 207 }
209 if ((1 == inet_pton (AF_INET, hostname, &v4)) || 208 if ( (1 == inet_pton (AF_INET, hostname, &v4)) ||
210 (1 == inet_pton (AF_INET6, hostname, &v6))) 209 (1 == inet_pton (AF_INET6, hostname, &v6)) )
211 { 210 {
212 GNUNET_free (hostname); 211 GNUNET_free (hostname);
213 return GNUNET_OK; 212 return GNUNET_OK;
214 } 213 }
215 i = 0; 214 for (unsigned int i = 0;
216 while (NULL != loopback[i]) 215 NULL != loopback[i];
217 if (0 == strcasecmp (loopback[i++], hostname)) 216 i++)
217 if (0 == strcasecmp (loopback[i], hostname))
218 { 218 {
219 GNUNET_free (hostname); 219 GNUNET_free (hostname);
220 return GNUNET_OK; 220 return GNUNET_OK;
@@ -297,9 +297,9 @@ shutdown_task (void *cls)
297static void 297static void
298check_disconnect () 298check_disconnect ()
299{ 299{
300 struct GNUNET_RESOLVER_RequestHandle *rh; 300 for (struct GNUNET_RESOLVER_RequestHandle *rh = req_head;
301 301 NULL != rh;
302 for (rh = req_head; NULL != rh; rh = rh->next) 302 rh = rh->next)
303 if (GNUNET_SYSERR != rh->was_transmitted) 303 if (GNUNET_SYSERR != rh->was_transmitted)
304 return; 304 return;
305 if (NULL != r_task) 305 if (NULL != r_task)
@@ -336,7 +336,10 @@ no_resolve (int af,
336 if (ip_len != sizeof (struct in_addr)) 336 if (ip_len != sizeof (struct in_addr))
337 return NULL; 337 return NULL;
338 if (NULL == 338 if (NULL ==
339 inet_ntop (AF_INET, ip, buf, sizeof (buf))) 339 inet_ntop (AF_INET,
340 ip,
341 buf,
342 sizeof (buf)))
340 { 343 {
341 LOG_STRERROR (GNUNET_ERROR_TYPE_WARNING, 344 LOG_STRERROR (GNUNET_ERROR_TYPE_WARNING,
342 "inet_ntop"); 345 "inet_ntop");
@@ -347,7 +350,10 @@ no_resolve (int af,
347 if (ip_len != sizeof (struct in6_addr)) 350 if (ip_len != sizeof (struct in6_addr))
348 return NULL; 351 return NULL;
349 if (NULL == 352 if (NULL ==
350 inet_ntop (AF_INET6, ip, buf, sizeof (buf))) 353 inet_ntop (AF_INET6,
354 ip,
355 buf,
356 sizeof (buf)))
351 { 357 {
352 LOG_STRERROR (GNUNET_ERROR_TYPE_WARNING, 358 LOG_STRERROR (GNUNET_ERROR_TYPE_WARNING,
353 "inet_ntop"); 359 "inet_ntop");
@@ -422,8 +428,8 @@ process_requests ()
422 msg->direction = htonl (rh->direction); 428 msg->direction = htonl (rh->direction);
423 msg->af = htonl (rh->af); 429 msg->af = htonl (rh->af);
424 GNUNET_memcpy (&msg[1], 430 GNUNET_memcpy (&msg[1],
425 &rh[1], 431 &rh[1],
426 rh->data_len); 432 rh->data_len);
427 LOG (GNUNET_ERROR_TYPE_DEBUG, 433 LOG (GNUNET_ERROR_TYPE_DEBUG,
428 "Transmitting DNS resolution request to DNS service\n"); 434 "Transmitting DNS resolution request to DNS service\n");
429 GNUNET_MQ_send (mq, 435 GNUNET_MQ_send (mq,
@@ -611,14 +617,19 @@ numeric_resolution (void *cls)
611 v6.sin6_len = sizeof (v6); 617 v6.sin6_len = sizeof (v6);
612#endif 618#endif
613 hostname = (const char *) &rh[1]; 619 hostname = (const char *) &rh[1];
614 if (((rh->af == AF_UNSPEC) || (rh->af == AF_INET)) && 620 if ( ( (rh->af == AF_UNSPEC) ||
615 (1 == inet_pton (AF_INET, hostname, &v4.sin_addr))) 621 (rh->af == AF_INET) ) &&
622 (1 == inet_pton (AF_INET,
623 hostname,
624 &v4.sin_addr)) )
616 { 625 {
617 rh->addr_callback (rh->cls, 626 rh->addr_callback (rh->cls,
618 (const struct sockaddr *) &v4, 627 (const struct sockaddr *) &v4,
619 sizeof (v4)); 628 sizeof (v4));
620 if ((rh->af == AF_UNSPEC) && 629 if ( (rh->af == AF_UNSPEC) &&
621 (1 == inet_pton (AF_INET6, hostname, &v6.sin6_addr))) 630 (1 == inet_pton (AF_INET6,
631 hostname,
632 &v6.sin6_addr)) )
622 { 633 {
623 /* this can happen on some systems IF "hostname" is "localhost" */ 634 /* this can happen on some systems IF "hostname" is "localhost" */
624 rh->addr_callback (rh->cls, 635 rh->addr_callback (rh->cls,
@@ -872,7 +883,6 @@ GNUNET_RESOLVER_ip_get (const char *hostname,
872{ 883{
873 struct GNUNET_RESOLVER_RequestHandle *rh; 884 struct GNUNET_RESOLVER_RequestHandle *rh;
874 size_t slen; 885 size_t slen;
875 unsigned int i;
876 struct in_addr v4; 886 struct in_addr v4;
877 struct in6_addr v6; 887 struct in6_addr v6;
878 888
@@ -897,19 +907,26 @@ GNUNET_RESOLVER_ip_get (const char *hostname,
897 rh->timeout = GNUNET_TIME_relative_to_absolute (timeout); 907 rh->timeout = GNUNET_TIME_relative_to_absolute (timeout);
898 rh->direction = GNUNET_NO; 908 rh->direction = GNUNET_NO;
899 /* first, check if this is a numeric address */ 909 /* first, check if this is a numeric address */
900 if (((1 == inet_pton (AF_INET, hostname, &v4)) && 910 if ( ( (1 == inet_pton (AF_INET,
901 ((af == AF_INET) || (af == AF_UNSPEC))) || 911 hostname,
902 ((1 == inet_pton (AF_INET6, hostname, &v6)) && 912 &v4)) &&
903 ((af == AF_INET6) || (af == AF_UNSPEC)))) 913 ( (af == AF_INET) ||
914 (af == AF_UNSPEC) ) ) ||
915 ( (1 == inet_pton (AF_INET6,
916 hostname,
917 &v6)) &&
918 ( (af == AF_INET6) ||
919 (af == AF_UNSPEC)) ) )
904 { 920 {
905 rh->task = GNUNET_SCHEDULER_add_now (&numeric_resolution, 921 rh->task = GNUNET_SCHEDULER_add_now (&numeric_resolution,
906 rh); 922 rh);
907 return rh; 923 return rh;
908 } 924 }
909 /* then, check if this is a loopback address */ 925 /* then, check if this is a loopback address */
910 i = 0; 926 for (unsigned int i = 0;
911 while (NULL != loopback[i]) 927 NULL != loopback[i];
912 if (0 == strcasecmp (loopback[i++], 928 i++)
929 if (0 == strcasecmp (loopback[i],
913 hostname)) 930 hostname))
914 { 931 {
915 rh->task = GNUNET_SCHEDULER_add_now (&loopback_resolution, 932 rh->task = GNUNET_SCHEDULER_add_now (&loopback_resolution,
@@ -1029,8 +1046,8 @@ GNUNET_RESOLVER_hostname_get (const struct sockaddr *sa,
1029 rh->af = sa->sa_family; 1046 rh->af = sa->sa_family;
1030 rh->timeout = GNUNET_TIME_relative_to_absolute (timeout); 1047 rh->timeout = GNUNET_TIME_relative_to_absolute (timeout);
1031 GNUNET_memcpy (&rh[1], 1048 GNUNET_memcpy (&rh[1],
1032 ip, 1049 ip,
1033 ip_len); 1050 ip_len);
1034 rh->data_len = ip_len; 1051 rh->data_len = ip_len;
1035 rh->direction = GNUNET_YES; 1052 rh->direction = GNUNET_YES;
1036 rh->received_response = GNUNET_NO; 1053 rh->received_response = GNUNET_NO;
@@ -1067,7 +1084,8 @@ GNUNET_RESOLVER_local_fqdn_get ()
1067{ 1084{
1068 char hostname[GNUNET_OS_get_hostname_max_length () + 1]; 1085 char hostname[GNUNET_OS_get_hostname_max_length () + 1];
1069 1086
1070 if (0 != gethostname (hostname, sizeof (hostname) - 1)) 1087 if (0 != gethostname (hostname,
1088 sizeof (hostname) - 1))
1071 { 1089 {
1072 LOG_STRERROR (GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, 1090 LOG_STRERROR (GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK,
1073 "gethostname"); 1091 "gethostname");
@@ -1082,7 +1100,10 @@ GNUNET_RESOLVER_local_fqdn_get ()
1082 int ret; 1100 int ret;
1083 char *rval; 1101 char *rval;
1084 1102
1085 if (0 != (ret = getaddrinfo (hostname, NULL, NULL, &ai))) 1103 if (0 != (ret = getaddrinfo (hostname,
1104 NULL,
1105 NULL,
1106 &ai)))
1086 { 1107 {
1087 LOG (GNUNET_ERROR_TYPE_ERROR, 1108 LOG (GNUNET_ERROR_TYPE_ERROR,
1088 _("Could not resolve our FQDN: %s\n"), 1109 _("Could not resolve our FQDN: %s\n"),
@@ -1100,9 +1121,11 @@ GNUNET_RESOLVER_local_fqdn_get ()
1100 { 1121 {
1101 struct hostent *host; 1122 struct hostent *host;
1102 1123
1103 host = gethostbyname2 (hostname, AF_INET); 1124 host = gethostbyname2 (hostname,
1125 AF_INET);
1104 if (NULL == host) 1126 if (NULL == host)
1105 host = gethostbyname2 (hostname, AF_INET6); 1127 host = gethostbyname2 (hostname,
1128 AF_INET6);
1106 if (NULL == host) 1129 if (NULL == host)
1107 { 1130 {
1108 LOG (GNUNET_ERROR_TYPE_ERROR, 1131 LOG (GNUNET_ERROR_TYPE_ERROR,