summaryrefslogtreecommitdiffstats
path: root/libc/inet
diff options
context:
space:
mode:
authorCarmelo Amoroso <carmelo.amoroso@st.com>2007-11-20 10:09:16 +0000
committerCarmelo Amoroso <carmelo.amoroso@st.com>2007-11-20 10:09:16 +0000
commit244539cd0852bbcf8f21507d7ff866d8e7fcff18 (patch)
tree5a04e6a195814b645007e4ccecb128d8c7b31ee7 /libc/inet
parent1cac0350028cc4a47715f63e61379d3318b0c965 (diff)
downloaduClibc-alpine-244539cd0852bbcf8f21507d7ff866d8e7fcff18.tar.bz2
uClibc-alpine-244539cd0852bbcf8f21507d7ff866d8e7fcff18.tar.xz
Fix Makefile.in and synch them with trunk. Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
Diffstat (limited to 'libc/inet')
-rw-r--r--libc/inet/Makefile.in2
-rw-r--r--libc/inet/getaddrinfo.c2
-rw-r--r--libc/inet/inet_net.c48
-rw-r--r--libc/inet/rpc/Makefile.in4
-rw-r--r--libc/inet/rpc/rcmd.c6
5 files changed, 28 insertions, 34 deletions
diff --git a/libc/inet/Makefile.in b/libc/inet/Makefile.in
index 4fc094340..66a84c06f 100644
--- a/libc/inet/Makefile.in
+++ b/libc/inet/Makefile.in
@@ -42,8 +42,6 @@ INET_SRC := $(patsubst %.c,$(INET_DIR)/%.c,$(CSRC))
INET_OBJ := $(patsubst %.c,$(INET_OUT)/%.o,$(CSRC))
libc-y += $(INET_OBJ)
-libc-a-y += $(INET_OBJ)
-libc-so-y += $(INET_OBJ:.o=.os)
objclean-y += inet_objclean
diff --git a/libc/inet/getaddrinfo.c b/libc/inet/getaddrinfo.c
index 1c593fc4f..23a1e988e 100644
--- a/libc/inet/getaddrinfo.c
+++ b/libc/inet/getaddrinfo.c
@@ -54,8 +54,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <assert.h>
#include <errno.h>
#include <netdb.h>
-#include <resolv.h>
#include <stdio.h>
+#include <resolv.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
diff --git a/libc/inet/inet_net.c b/libc/inet/inet_net.c
index f8148c274..71ed8dc88 100644
--- a/libc/inet/inet_net.c
+++ b/libc/inet/inet_net.c
@@ -50,55 +50,51 @@ libc_hidden_proto(__ctype_b)
*/
libc_hidden_proto(inet_network)
in_addr_t
-inet_network(const char *cp)
+inet_network(cp)
+ register const char *cp;
{
- register in_addr_t val, base, n;
+ register u_int32_t val, base, n, i;
register char c;
- in_addr_t parts[4], *pp = parts;
- register unsigned int i;
+ u_int32_t parts[4], *pp = parts;
+ int digit;
again:
- /*
- * Collect number up to ``.''.
- * Values are specified as for C:
- * 0x=hex, 0=octal, other=decimal.
- */
- val = 0; base = 10;
- /*
- * The 4.4BSD version of this file also accepts 'x__' as a hexa
- * number. I don't think this is correct. -- Uli
- */
- if (*cp == '0') {
- if (*++cp == 'x' || *cp == 'X')
- base = 16, cp++;
- else
- base = 8;
- }
- while ((c = *cp)) {
+ val = 0; base = 10; digit = 0;
+ if (*cp == '0')
+ digit = 1, base = 8, cp++;
+ if (*cp == 'x' || *cp == 'X')
+ base = 16, cp++;
+ while ((c = *cp) != 0) {
if (isdigit(c)) {
+ if (base == 8 && (c == '8' || c == '9'))
+ return (INADDR_NONE);
val = (val * base) + (c - '0');
cp++;
+ digit = 1;
continue;
}
if (base == 16 && isxdigit(c)) {
- val = (val << 4) + (c + 10 - (islower(c) ? 'a' : 'A'));
+ val = (val << 4) + (tolower (c) + 10 - 'a');
cp++;
+ digit = 1;
continue;
}
break;
}
+ if (!digit)
+ return (INADDR_NONE);
+ if (pp >= parts + 4 || val > 0xff)
+ return (INADDR_NONE);
if (*cp == '.') {
- if (pp >= parts + 4)
- return (INADDR_NONE);
*pp++ = val, cp++;
goto again;
}
if (*cp && !isspace(*cp))
return (INADDR_NONE);
+ if (pp >= parts + 4 || val > 0xff)
+ return (INADDR_NONE);
*pp++ = val;
n = pp - parts;
- if (n > 4)
- return (INADDR_NONE);
for (val = 0, i = 0; i < n; i++) {
val <<= 8;
val |= parts[i] & 0xff;
diff --git a/libc/inet/rpc/Makefile.in b/libc/inet/rpc/Makefile.in
index c292834a0..af047c0df 100644
--- a/libc/inet/rpc/Makefile.in
+++ b/libc/inet/rpc/Makefile.in
@@ -32,14 +32,10 @@ INET_RPC_OBJ:=$(patsubst $(INET_RPC_DIR)/%.c,$(INET_RPC_OUT)/%.o,$(INET_RPC_SRC)
libc-static-$(UCLIBC_HAS_RPC)+=$(INET_RPC_OUT)/rpc_thread.o
libc-shared-$(UCLIBC_HAS_RPC)+=$(INET_RPC_OUT)/rpc_thread.oS
-libc-a-$(UCLIBC_HAS_RPC)+=$(INET_RPC_OUT)/rpc_thread.o
-libc-so-$(UCLIBC_HAS_RPC)+=$(INET_RPC_OUT)/rpc_thread.oS
libc-nomulti-$(UCLIBC_HAS_RPC) += $(INET_RPC_OUT)/rpc_thread.o
libc-$(UCLIBC_HAS_RPC)+=$(INET_RPC_OBJ)
-libc-a-$(UCLIBC_HAS_RPC)+=$(INET_RPC_OBJ)
-libc-so-$(UCLIBC_HAS_RPC)+=$(INET_RPC_OBJ:.o=.os)
objclean-y+=inet_rpc_objclean
diff --git a/libc/inet/rpc/rcmd.c b/libc/inet/rpc/rcmd.c
index 6009d6d31..ccab7d60a 100644
--- a/libc/inet/rpc/rcmd.c
+++ b/libc/inet/rpc/rcmd.c
@@ -368,7 +368,11 @@ int rresvport(int *alport)
}
libc_hidden_def(rresvport)
-static int __check_rhosts_file = 1;
+/* This needs to be exported ... while it is not a documented interface
+ * for rcp related apps, it's a required one that is used to control the
+ * rhost behavior. Legacy sucks.
+ */
+int __check_rhosts_file = 1;
int ruserok(rhost, superuser, ruser, luser)
const char *rhost, *ruser, *luser;