aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSören Tempel <soeren+git@soeren-tempel.net>2016-08-11 12:50:52 +0200
committerNatanael Copa <ncopa@alpinelinux.org>2016-08-12 16:34:59 +0200
commit5a256fe62326a15ce7a303733cfcb19800ebe914 (patch)
tree9103bfdf0faad7e9897ee5d467309f5f498d7f23
parentee6d86335ddea763bd3757ab288181b73c2f22e7 (diff)
downloadaports-5a256fe62326a15ce7a303733cfcb19800ebe914.tar.gz
aports-5a256fe62326a15ce7a303733cfcb19800ebe914.tar.bz2
aports-5a256fe62326a15ce7a303733cfcb19800ebe914.tar.xz
main/busybox: include whois fix from upstream
Fixes #4488 (cherry picked from commit 4eb826279c131257c3bc37d42f394208022ef07e)
-rw-r--r--main/busybox/0016-whois-make-it-actually-work.patch185
-rw-r--r--main/busybox/APKBUILD6
2 files changed, 190 insertions, 1 deletions
diff --git a/main/busybox/0016-whois-make-it-actually-work.patch b/main/busybox/0016-whois-make-it-actually-work.patch
new file mode 100644
index 0000000000..fe7cfe17ce
--- /dev/null
+++ b/main/busybox/0016-whois-make-it-actually-work.patch
@@ -0,0 +1,185 @@
+From f8e33d70806d0dee740e5451aedfe5089a4d156a Mon Sep 17 00:00:00 2001
+From: Denys Vlasenko <vda.linux@googlemail.com>
+Date: Wed, 6 Jul 2016 15:45:41 +0200
+Subject: [PATCH 16/16] whois: make it actually work
+
+It was doing way too simplistic work of just querying the server,
+no redirects, no query massaging. This required user to know a lot about whois,
+and enter at least three queries for each host to get meaningful information.
+
+function old new delta
+whois_main 209 646 +437
+
+Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
+---
+ networking/whois.c | 137 ++++++++++++++++++++++++++++++++++++++++++++++++-----
+ 1 file changed, 124 insertions(+), 13 deletions(-)
+
+diff --git a/networking/whois.c b/networking/whois.c
+index bf33033..5ef8367 100644
+--- a/networking/whois.c
++++ b/networking/whois.c
+@@ -28,36 +28,147 @@
+
+ #include "libbb.h"
+
+-static void pipe_out(int fd)
++static char *query(const char *host, int port, const char *domain)
+ {
++ int fd;
+ FILE *fp;
+- char buf[1024];
++ bool success;
++ char *redir = NULL;
++ const char *pfx = "";
++ char linebuf[1024];
++ char *buf = NULL;
++ unsigned bufpos = 0;
+
++ again:
++ printf("[Querying %s:%d '%s%s']\n", host, port, pfx, domain);
++ fd = create_and_connect_stream_or_die(host, port);
++ success = 0;
++ fdprintf(fd, "%s%s\r\n", pfx, domain);
+ fp = xfdopen_for_read(fd);
+- while (fgets(buf, sizeof(buf), fp)) {
+- char *p = strpbrk(buf, "\r\n");
+- if (p)
+- *p = '\0';
+- puts(buf);
+- }
+
++ while (fgets(linebuf, sizeof(linebuf), fp)) {
++ unsigned len = strcspn(linebuf, "\r\n");
++ linebuf[len++] = '\n';
++
++ buf = xrealloc(buf, bufpos + len + 1);
++ memcpy(buf + bufpos, linebuf, len);
++ bufpos += len;
++
++ if (!redir || !success) {
++ trim(linebuf);
++ str_tolower(linebuf);
++ if (!success) {
++ success = is_prefixed_with(linebuf, "domain:")
++ || is_prefixed_with(linebuf, "domain name:");
++ }
++ else if (!redir) {
++ char *p = is_prefixed_with(linebuf, "whois server:");
++ if (!p)
++ p = is_prefixed_with(linebuf, "whois:");
++ if (p)
++ redir = xstrdup(skip_whitespace(p));
++ }
++ }
++ }
+ fclose(fp); /* closes fd too */
++ if (!success && !pfx[0]) {
++ /*
++ * Looking at jwhois.conf, some whois servers use
++ * "domain = DOMAIN", "DOMAIN ID <DOMAIN>"
++ * and "domain=DOMAIN_WITHOUT_LAST_COMPONENT"
++ * formats, but those are rare.
++ * (There are a few even more contrived ones.)
++ * We are trying only "domain DOMAIN", the typical one.
++ */
++ pfx = "domain ";
++ bufpos = 0;
++ goto again;
++ }
++
++ /* Success */
++ if (redir && strcmp(redir, host) == 0) {
++ /* Redirect to self does not count */
++ free(redir);
++ redir = NULL;
++ }
++ if (!redir) {
++ /* Output saved text */
++ printf("[%s]\n", host);
++ buf[bufpos] = '\0';
++ fputs(buf, stdout);
++ }
++ free(buf);
++ return redir;
+ }
+
++static void recursive_query(const char *host, int port, const char *domain)
++{
++ char *free_me = NULL;
++ char *redir;
++ again:
++ redir = query(host, port, domain);
++ free(free_me);
++ if (redir) {
++ printf("[Redirected to %s]\n", redir);
++ host = free_me = redir;
++ port = 43;
++ goto again;
++ }
++}
++
++/* One of "big" whois implementations has these options:
++ *
++ * $ whois --help
++ * jwhois version 4.0, Copyright (C) 1999-2007 Free Software Foundation, Inc.
++ * -v, --verbose verbose debug output
++ * -c FILE, --config=FILE use FILE as configuration file
++ * -h HOST, --host=HOST explicitly query HOST
++ * -n, --no-redirect disable content redirection
++ * -s, --no-whoisservers disable whois-servers.net service support
++ * -a, --raw disable reformatting of the query
++ * -i, --display-redirections display all redirects instead of hiding them
++ * -p PORT, --port=PORT use port number PORT (in conjunction with HOST)
++ * -r, --rwhois force an rwhois query to be made
++ * --rwhois-display=DISPLAY sets the display option in rwhois queries
++ * --rwhois-limit=LIMIT sets the maximum number of matches to return
++ *
++ * Example of its output:
++ * $ whois cnn.com
++ * [Querying whois.verisign-grs.com]
++ * [Redirected to whois.corporatedomains.com]
++ * [Querying whois.corporatedomains.com]
++ * [whois.corporatedomains.com]
++ * ...text of the reply...
++ *
++ * With -i, reply from each server is printed, after all redirects are done:
++ * [Querying whois.verisign-grs.com]
++ * [Redirected to whois.corporatedomains.com]
++ * [Querying whois.corporatedomains.com]
++ * [whois.verisign-grs.com]
++ * ...text of the reply...
++ * [whois.corporatedomains.com]
++ * ...text of the reply...
++ *
++ * With -a, no "DOMAIN" -> "domain DOMAIN" transformation is attempted.
++
++ * With -n, the first reply is shown, redirects are not followed:
++ * [Querying whois.verisign-grs.com]
++ * [whois.verisign-grs.com]
++ * ...text of the reply...
++ */
++
+ int whois_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
+ int whois_main(int argc UNUSED_PARAM, char **argv)
+ {
+ int port = 43;
+- const char *host = "whois-servers.net";
++ const char *host = "whois.iana.org";
+
+ opt_complementary = "-1:p+";
+ getopt32(argv, "h:p:", &host, &port);
+-
+ argv += optind;
++
+ do {
+- int fd = create_and_connect_stream_or_die(host, port);
+- fdprintf(fd, "%s\r\n", *argv);
+- pipe_out(fd);
++ recursive_query(host, port, *argv);
+ }
+ while (*++argv);
+
+--
+2.9.1
+
diff --git a/main/busybox/APKBUILD b/main/busybox/APKBUILD
index 0a2bb49ca0..d5dca73abc 100644
--- a/main/busybox/APKBUILD
+++ b/main/busybox/APKBUILD
@@ -2,7 +2,7 @@
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=busybox
pkgver=1.24.2
-pkgrel=10
+pkgrel=11
pkgdesc="Size optimized toolbox of many common UNIX utilities"
url=http://busybox.net
arch="all"
@@ -57,6 +57,7 @@ source="http://busybox.net/downloads/$pkgname-$pkgver.tar.bz2
0001-df-use-f_frsize-instead-of-f_bsize-for-correct-sizes.patch
0001-gzip-fix-compression-level-bug.-Closes-9131.patch
+ 0016-whois-make-it-actually-work.patch
acpid.logrotate
busyboxconfig
@@ -203,6 +204,7 @@ a4d1cf64fd1835a284ccc6dbc78e3ce0 0001-ash-fix-error-during-recursive-processing
ab539a54dcd1c23eb0963e17e768fef7 0001-libbb-fix-time-parsing-of-CC-YY-MMDDhhmm-.SS.patch
d77da40a3c1291ab82513fb59c517e38 0001-df-use-f_frsize-instead-of-f_bsize-for-correct-sizes.patch
e8dea4f51fb8cf606e3c6a33e40fa644 0001-gzip-fix-compression-level-bug.-Closes-9131.patch
+6234d8817d3c0ee9f4c01e83bf6a96c4 0016-whois-make-it-actually-work.patch
4046b78ee6a25259954797d73b94f4bd acpid.logrotate
ab4a2e1385566b01002e526614dd38c2 busyboxconfig
befaac2c59c380e36a452b3f1c1d4a3a glibc.patch"
@@ -240,6 +242,7 @@ f712ce190ce86084d56977e125d1561615394f3d9b840e926537868260e19d79 0001-ash-backp
97dfec94c94f00b628a702ad81b235414af611e011bfc26c29be46c67063c101 0001-libbb-fix-time-parsing-of-CC-YY-MMDDhhmm-.SS.patch
8dba75a5de5c808760e9439ad38b35f643a2442e9e5aca4b40b918cfc66ac255 0001-df-use-f_frsize-instead-of-f_bsize-for-correct-sizes.patch
9ab63b013ad9edca66005c10ea58702e54b170155562baf7cb1d4a13f16196c6 0001-gzip-fix-compression-level-bug.-Closes-9131.patch
+1be53b0d1aa3c3f44bff31e092bc786259c7475de4b24dfaa71e70c50672f421 0016-whois-make-it-actually-work.patch
f7cbeb5a5a47395ad30454ce8262abcd3e91c33ef803c2ae31a9258d7142dd48 acpid.logrotate
a129ededc4c5ec3d0385e4da50a87e81f348ecc7541a2105dd98f0c8543a3a2f busyboxconfig
c604ef791c31d35a8c5ee4558d21428a46f37a6d762c4a7e29864f4037fc44a0 glibc.patch"
@@ -277,6 +280,7 @@ c14a632f9477c13ea99b24a73c81c9c44ead8b536970acd758e739b43a6260860039674341192ce7
6fc77e0edcbb61a64c179b0259e0634a82362ac0ca9a77f305eb75f6a89a10395e8a37cbcef925821b428c00237a0a3575af2c3ef194933f52ad55b0eb0dd6f2 0001-libbb-fix-time-parsing-of-CC-YY-MMDDhhmm-.SS.patch
a42d4b992b3ba3b33a605d7f919c574783034b99cd046fd394c040948360daef7f9fb5717994c5326187a185ee9f357b36f405e960ab632c2f59f5b9fba402f7 0001-df-use-f_frsize-instead-of-f_bsize-for-correct-sizes.patch
afa0aa2fee08b28b6f4a32bd761d9fd7ab6989a13651ffa9dc8a3a3c4de3c646ce0881c2abd1be96768ddb326451f2e06125e2959c42de6f339e90994461a803 0001-gzip-fix-compression-level-bug.-Closes-9131.patch
+09cb1bf25c9442986e7d9816277e75591a2af8ba78117869c5cba35d2e189db351455137e9511cf61788864812056133fc9ec5e204f9eb18ae86c34dd8493ae8 0016-whois-make-it-actually-work.patch
dadb4c953ebc755b88ee95c1489feb0c2d352f6e44abc716166024e6eea11ab9d10c84fad62c081775834d205cb04aa1be3c994676c88f4284495c54b9188e8b acpid.logrotate
580a6e15d6517641951bb1648c406cee2a82fab353552a60d37f29e5f58da664437d99d5bd313d88e260a92735c32886ffc1cad98f901bb27d1f5027fdce37d7 busyboxconfig
1d2739379dab1deb3eae7cffd4845300eb7d30f7343b4a1209b21a5680860d55080ad45fdefe098b249ce3040c01951fa7f0a79cd447b2d7b260eb000099d9dc glibc.patch"