From c885bf5cf94a12202f849477a845d728cbd12889 Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Sat, 3 Dec 2005 00:34:49 +0000 Subject: More hiding, including __mempcpy --- libc/inet/getaddrinfo.c | 6 ++- libc/inet/getnetbyad.c | 4 ++ libc/inet/getnetbynm.c | 4 ++ libc/inet/getnetent.c | 10 +++-- libc/inet/getservice.c | 85 ++++++++++++++++++++++-------------------- libc/inet/resolv.c | 1 + libc/inet/rpc/auth_none.c | 2 + libc/inet/rpc/auth_unix.c | 1 + libc/inet/rpc/bindresvport.c | 2 +- libc/inet/rpc/clnt_raw.c | 1 + libc/inet/rpc/clnt_tcp.c | 1 + libc/inet/rpc/clnt_udp.c | 1 + libc/inet/rpc/clnt_unix.c | 3 +- libc/inet/rpc/create_xid.c | 3 ++ libc/inet/rpc/pmap_clnt.c | 5 ++- libc/inet/rpc/pmap_rmt.c | 1 + libc/inet/rpc/rcmd.c | 3 +- libc/inet/rpc/rpc_dtablesize.c | 2 + libc/inet/rpc/ruserpass.c | 2 +- libc/inet/rpc/svc.c | 2 + libc/inet/rpc/svc_auth_unix.c | 2 + libc/inet/rpc/svc_raw.c | 2 + libc/inet/rpc/svc_udp.c | 1 + libc/inet/rpc/svc_unix.c | 2 +- libc/inet/rpc/xdr_mem.c | 5 ++- 25 files changed, 96 insertions(+), 55 deletions(-) (limited to 'libc/inet') diff --git a/libc/inet/getaddrinfo.c b/libc/inet/getaddrinfo.c index d2d0e151e..c467fed69 100644 --- a/libc/inet/getaddrinfo.c +++ b/libc/inet/getaddrinfo.c @@ -44,8 +44,10 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /* This software is Copyright 1996 by Craig Metz, All Rights Reserved. */ -/* strdupa is using these */ +#define getservbyname_r __getservbyname_r #if 0 +#define stpcpy __stpcpy +/* strdupa is using these */ #define memcpy __memcpy #define strlen __strlen #endif @@ -246,7 +248,7 @@ gaih_local (const char *name, const struct gaih_service *service, sizeof (sunp->sun_path)) return GAIH_OKIFUNSPEC | -EAI_SERVICE; - __stpcpy (__stpcpy (sunp->sun_path, P_tmpdir "/"), service->name); + stpcpy (stpcpy (sunp->sun_path, P_tmpdir "/"), service->name); } } else diff --git a/libc/inet/getnetbyad.c b/libc/inet/getnetbyad.c index 0776ed7cf..a257a1bd7 100644 --- a/libc/inet/getnetbyad.c +++ b/libc/inet/getnetbyad.c @@ -15,6 +15,10 @@ * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. */ +#define setnetent __setnetent +#define getnetent __getnetent +#define endnetent __endnetent + #define __FORCE_GLIBC #include #include diff --git a/libc/inet/getnetbynm.c b/libc/inet/getnetbynm.c index 5479c654b..f4e9b817e 100644 --- a/libc/inet/getnetbynm.c +++ b/libc/inet/getnetbynm.c @@ -15,6 +15,10 @@ * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. */ +#define setnetent __setnetent +#define getnetent __getnetent +#define endnetent __endnetent + #define __FORCE_GLIBC #include #include diff --git a/libc/inet/getnetent.c b/libc/inet/getnetent.c index 181c5adfe..fc21dfa03 100644 --- a/libc/inet/getnetent.c +++ b/libc/inet/getnetent.c @@ -44,7 +44,7 @@ static char *net_aliases[MAXALIASES]; int _net_stayopen; -void setnetent(int f) +void attribute_hidden __setnetent(int f) { LOCK; if (netf == NULL) @@ -55,8 +55,9 @@ void setnetent(int f) UNLOCK; return; } +strong_alias(__setnetent,setnetent) -void endnetent(void) +void attribute_hidden __endnetent(void) { LOCK; if (netf) { @@ -66,6 +67,7 @@ void endnetent(void) _net_stayopen = 0; UNLOCK; } +strong_alias(__endnetent,endnetent) static char * any(register char *cp, char *match) { @@ -80,7 +82,7 @@ static char * any(register char *cp, char *match) return ((char *)0); } -struct netent * getnetent(void) +struct netent attribute_hidden * __getnetent(void) { char *p; register char *cp, **q; @@ -139,4 +141,4 @@ again: UNLOCK; return (&net); } - +strong_alias(__getnetent,getnetent) diff --git a/libc/inet/getservice.c b/libc/inet/getservice.c index d5402ba3e..e4422246b 100644 --- a/libc/inet/getservice.c +++ b/libc/inet/getservice.c @@ -98,7 +98,7 @@ static void __initbuf(void) } } -void setservent(int f) +extern void attribute_hidden __setservent(int f) { LOCK; if (servf == NULL) @@ -108,8 +108,9 @@ void setservent(int f) serv_stayopen |= f; UNLOCK; } +strong_alias(__setservent,setservent) -void endservent(void) +extern void attribute_hidden __endservent(void) { LOCK; if (servf) { @@ -119,37 +120,9 @@ void endservent(void) serv_stayopen = 0; UNLOCK; } +strong_alias(__endservent,endservent) -struct servent * getservent(void) -{ - struct servent *result; - - __initbuf(); - getservent_r(&serv, servbuf, SBUFSIZE, &result); - return result; -} - - -struct servent *getservbyname(const char *name, const char *proto) -{ - struct servent *result; - - __initbuf(); - getservbyname_r(name, proto, &serv, servbuf, SBUFSIZE, &result); - return result; -} - - -struct servent * getservbyport(int port, const char *proto) -{ - struct servent *result; - - __initbuf(); - getservbyport_r(port, proto, &serv, servbuf, SBUFSIZE, &result); - return result; -} - -int getservent_r(struct servent * result_buf, +extern int attribute_hidden __getservent_r(struct servent * result_buf, char * buf, size_t buflen, struct servent ** result) { @@ -228,8 +201,18 @@ again: UNLOCK; return 0; } +strong_alias(__getservent_r,getservent_r) -int getservbyname_r(const char *name, const char *proto, +struct servent * getservent(void) +{ + struct servent *result; + + __initbuf(); + __getservent_r(&serv, servbuf, SBUFSIZE, &result); + return result; +} + +extern int attribute_hidden __getservbyname_r(const char *name, const char *proto, struct servent * result_buf, char * buf, size_t buflen, struct servent ** result) { @@ -237,8 +220,8 @@ int getservbyname_r(const char *name, const char *proto, int ret; LOCK; - setservent(serv_stayopen); - while (!(ret=getservent_r(result_buf, buf, buflen, result))) { + __setservent(serv_stayopen); + while (!(ret=__getservent_r(result_buf, buf, buflen, result))) { if (__strcmp(name, result_buf->s_name) == 0) goto gotname; for (cp = result_buf->s_aliases; *cp; cp++) @@ -250,27 +233,49 @@ gotname: break; } if (!serv_stayopen) - endservent(); + __endservent(); UNLOCK; return *result?0:ret; } +strong_alias(__getservbyname_r,getservbyname_r) + +struct servent *getservbyname(const char *name, const char *proto) +{ + struct servent *result; + + __initbuf(); + __getservbyname_r(name, proto, &serv, servbuf, SBUFSIZE, &result); + return result; +} + -int getservbyport_r(int port, const char *proto, +extern int attribute_hidden __getservbyport_r(int port, const char *proto, struct servent * result_buf, char * buf, size_t buflen, struct servent ** result) { int ret; LOCK; - setservent(serv_stayopen); - while (!(ret=getservent_r(result_buf, buf, buflen, result))) { + __setservent(serv_stayopen); + while (!(ret=__getservent_r(result_buf, buf, buflen, result))) { if (result_buf->s_port != port) continue; if (proto == 0 || __strcmp(result_buf->s_proto, proto) == 0) break; } if (!serv_stayopen) - endservent(); + __endservent(); UNLOCK; return *result?0:ret; } +strong_alias(__getservbyport_r,getservbyport_r) + +struct servent attribute_hidden * __getservbyport(int port, const char *proto) +{ + struct servent *result; + + __initbuf(); + __getservbyport_r(port, proto, &serv, servbuf, SBUFSIZE, &result); + return result; +} +strong_alias(__getservbyport,getservbyport) diff --git a/libc/inet/resolv.c b/libc/inet/resolv.c index 3313bfc85..18d186170 100644 --- a/libc/inet/resolv.c +++ b/libc/inet/resolv.c @@ -137,6 +137,7 @@ #define strncat __strncat #define strstr __strstr #define random __random +#define getservbyport __getservbyport #define __FORCE_GLIBC #include diff --git a/libc/inet/rpc/auth_none.c b/libc/inet/rpc/auth_none.c index e7b7aba53..9d1d42d03 100644 --- a/libc/inet/rpc/auth_none.c +++ b/libc/inet/rpc/auth_none.c @@ -35,6 +35,8 @@ * credentials and verifiers to remote systems. */ +#define xdrmem_create __xdrmem_create + #define __FORCE_GLIBC #include #include "rpc_private.h" diff --git a/libc/inet/rpc/auth_unix.c b/libc/inet/rpc/auth_unix.c index c02cc309b..0ae5fe6a9 100644 --- a/libc/inet/rpc/auth_unix.c +++ b/libc/inet/rpc/auth_unix.c @@ -40,6 +40,7 @@ #define sysconf __sysconf #define getegid __getegid +#define xdrmem_create __xdrmem_create #define __FORCE_GLIBC #include diff --git a/libc/inet/rpc/bindresvport.c b/libc/inet/rpc/bindresvport.c index 98ce691ee..1fb80d701 100644 --- a/libc/inet/rpc/bindresvport.c +++ b/libc/inet/rpc/bindresvport.c @@ -69,7 +69,7 @@ bindresvport (int sd, struct sockaddr_in *sin) if (port == 0) { - port = (getpid () % NPORTS) + STARTPORT; + port = (__getpid () % NPORTS) + STARTPORT; } res = -1; __set_errno (EADDRINUSE); diff --git a/libc/inet/rpc/clnt_raw.c b/libc/inet/rpc/clnt_raw.c index e21f40252..41143496a 100644 --- a/libc/inet/rpc/clnt_raw.c +++ b/libc/inet/rpc/clnt_raw.c @@ -43,6 +43,7 @@ static char sccsid[] = "@(#)clnt_raw.c 1.22 87/08/11 Copyr 1984 Sun Micro"; */ #define authnone_create __authnone_create +#define xdrmem_create __xdrmem_create #define __FORCE_GLIBC #include diff --git a/libc/inet/rpc/clnt_tcp.c b/libc/inet/rpc/clnt_tcp.c index ad2797a9e..11f790529 100644 --- a/libc/inet/rpc/clnt_tcp.c +++ b/libc/inet/rpc/clnt_tcp.c @@ -52,6 +52,7 @@ static char sccsid[] = "@(#)clnt_tcp.c 1.37 87/10/05 Copyr 1984 Sun Micro"; #define authnone_create __authnone_create #define xdrrec_create __xdrrec_create +#define xdrmem_create __xdrmem_create #define __FORCE_GLIBC #include diff --git a/libc/inet/rpc/clnt_udp.c b/libc/inet/rpc/clnt_udp.c index 5a7e35e80..bc032f205 100644 --- a/libc/inet/rpc/clnt_udp.c +++ b/libc/inet/rpc/clnt_udp.c @@ -41,6 +41,7 @@ static char sccsid[] = "@(#)clnt_udp.c 1.39 87/08/11 Copyr 1984 Sun Micro"; #define __cmsg_nxthdr __libc_cmsg_nxthdr #define authnone_create __authnone_create +#define xdrmem_create __xdrmem_create #define __FORCE_GLIBC #include diff --git a/libc/inet/rpc/clnt_unix.c b/libc/inet/rpc/clnt_unix.c index 93ea42afd..7372e51b9 100644 --- a/libc/inet/rpc/clnt_unix.c +++ b/libc/inet/rpc/clnt_unix.c @@ -48,6 +48,7 @@ #define authnone_create __authnone_create #define xdrrec_create __xdrrec_create +#define xdrmem_create __xdrmem_create #define getegid __getegid #define __FORCE_GLIBC @@ -506,7 +507,7 @@ __msgwrite (int sock, void *data, size_t cnt) /* XXX I'm not sure, if gete?id() is always correct, or if we should use get?id(). But since keyserv needs geteuid(), we have no other chance. It would be much better, if the kernel could pass both to the server. */ - cred.pid = getpid (); + cred.pid = __getpid (); cred.uid = geteuid (); cred.gid = getegid (); diff --git a/libc/inet/rpc/create_xid.c b/libc/inet/rpc/create_xid.c index 8a6dacad3..3ef1850dd 100644 --- a/libc/inet/rpc/create_xid.c +++ b/libc/inet/rpc/create_xid.c @@ -17,6 +17,9 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ +#define lrand48_r __lrand48_r +#define srand48_r __srand48_r + #define __FORCE_GLIBC #include diff --git a/libc/inet/rpc/pmap_clnt.c b/libc/inet/rpc/pmap_clnt.c index 5bbc81564..39d846f3b 100644 --- a/libc/inet/rpc/pmap_clnt.c +++ b/libc/inet/rpc/pmap_clnt.c @@ -112,8 +112,8 @@ static const struct timeval tottimeout = {60, 0}; * Set a mapping between program,version and port. * Calls the pmap service remotely to do the mapping. */ -bool_t -pmap_set (u_long program, u_long version, int protocol, u_short port) +bool_t attribute_hidden +__pmap_set (u_long program, u_long version, int protocol, u_short port) { struct sockaddr_in myaddress; int socket = -1; @@ -142,6 +142,7 @@ pmap_set (u_long program, u_long version, int protocol, u_short port) /* (void)__close(socket); CLNT_DESTROY closes it */ return rslt; } +strong_alias(__pmap_set,pmap_set) /* * Remove the mapping between program,version and port. diff --git a/libc/inet/rpc/pmap_rmt.c b/libc/inet/rpc/pmap_rmt.c index db875e987..5a78ba2c9 100644 --- a/libc/inet/rpc/pmap_rmt.c +++ b/libc/inet/rpc/pmap_rmt.c @@ -40,6 +40,7 @@ static char sccsid[] = "@(#)pmap_rmt.c 1.21 87/08/27 Copyr 1984 Sun Micro"; */ #define authunix_create_default __authunix_create_default +#define xdrmem_create __xdrmem_create #define inet_makeaddr __inet_makeaddr #define __FORCE_GLIBC diff --git a/libc/inet/rpc/rcmd.c b/libc/inet/rpc/rcmd.c index a51d09fcd..e050480ce 100644 --- a/libc/inet/rpc/rcmd.c +++ b/libc/inet/rpc/rcmd.c @@ -37,6 +37,7 @@ static char sccsid[] = "@(#)rcmd.c 8.3 (Berkeley) 3/26/94"; #define bcopy __bcopy #define sysconf __sysconf +#define getline __getline #define __FORCE_GLIBC #include @@ -88,7 +89,7 @@ int rcmd(ahost, rport, locuser, remuser, cmd, fd2p) int s, lport, timo; char c; - pid = getpid(); + pid = __getpid(); #ifdef __UCLIBC_HAS_REENTRANT_RPC__ hstbuflen = 1024; diff --git a/libc/inet/rpc/rpc_dtablesize.c b/libc/inet/rpc/rpc_dtablesize.c index b520b1b48..aa6d598ce 100644 --- a/libc/inet/rpc/rpc_dtablesize.c +++ b/libc/inet/rpc/rpc_dtablesize.c @@ -31,6 +31,8 @@ static char sccsid[] = "@(#)rpc_dtablesize.c 1.2 87/08/11 Copyr 1987 Sun Micro"; #endif +#define getdtablesize __getdtablesize + #define __FORCE_GLIBC #define __USE_BSD #include diff --git a/libc/inet/rpc/ruserpass.c b/libc/inet/rpc/ruserpass.c index 116a34276..ca040ada2 100644 --- a/libc/inet/rpc/ruserpass.c +++ b/libc/inet/rpc/ruserpass.c @@ -105,7 +105,7 @@ int ruserpass(const char *host, const char **aname, const char **apass) /* Give up when running a setuid or setgid app. */ if ((getuid() != geteuid()) || getgid() != getegid()) return -1; - hdir = getenv("HOME"); + hdir = __getenv("HOME"); if (hdir == NULL) { /* If we can't get HOME, fail instead of trying ".", which is no improvement. */ diff --git a/libc/inet/rpc/svc.c b/libc/inet/rpc/svc.c index a32c68bbc..5610277ee 100644 --- a/libc/inet/rpc/svc.c +++ b/libc/inet/rpc/svc.c @@ -36,6 +36,8 @@ * Copyright (C) 1984, Sun Microsystems, Inc. */ +#define pmap_set __pmap_set + #define _authenticate __libc__authenticate #define _rpc_dtablesize __libc__rpc_dtablesize diff --git a/libc/inet/rpc/svc_auth_unix.c b/libc/inet/rpc/svc_auth_unix.c index 256a42154..c84c42725 100644 --- a/libc/inet/rpc/svc_auth_unix.c +++ b/libc/inet/rpc/svc_auth_unix.c @@ -38,6 +38,8 @@ * Copyright (C) 1984, Sun Microsystems, Inc. */ +#define xdrmem_create __xdrmem_create + #define __FORCE_GLIBC #define _GNU_SOURCE #include diff --git a/libc/inet/rpc/svc_raw.c b/libc/inet/rpc/svc_raw.c index 05bf3109c..b55f0864f 100644 --- a/libc/inet/rpc/svc_raw.c +++ b/libc/inet/rpc/svc_raw.c @@ -40,6 +40,8 @@ static char sccsid[] = "@(#)svc_raw.c 1.15 87/08/11 Copyr 1984 Sun Micro"; * Copyright (C) 1984, Sun Microsystems, Inc. */ +#define xdrmem_create __xdrmem_create + #define __FORCE_GLIBC #include #include "rpc_private.h" diff --git a/libc/inet/rpc/svc_udp.c b/libc/inet/rpc/svc_udp.c index a37552a4b..ab6f96ee1 100644 --- a/libc/inet/rpc/svc_udp.c +++ b/libc/inet/rpc/svc_udp.c @@ -40,6 +40,7 @@ static char sccsid[] = "@(#)svc_udp.c 1.24 87/08/11 Copyr 1984 Sun Micro"; */ #define xprt_register __xprt_register +#define xdrmem_create __xdrmem_create #define __FORCE_GLIBC #define _GNU_SOURCE diff --git a/libc/inet/rpc/svc_unix.c b/libc/inet/rpc/svc_unix.c index d1568e4a7..5d3025876 100644 --- a/libc/inet/rpc/svc_unix.c +++ b/libc/inet/rpc/svc_unix.c @@ -376,7 +376,7 @@ __msgwrite (int sock, void *data, size_t cnt) /* XXX I'm not sure, if gete?id() is always correct, or if we should use get?id(). But since keyserv needs geteuid(), we have no other chance. It would be much better, if the kernel could pass both to the server. */ - cred.pid = getpid (); + cred.pid = __getpid (); cred.uid = geteuid (); cred.gid = getegid (); diff --git a/libc/inet/rpc/xdr_mem.c b/libc/inet/rpc/xdr_mem.c index 568d0e54a..56908c434 100644 --- a/libc/inet/rpc/xdr_mem.c +++ b/libc/inet/rpc/xdr_mem.c @@ -75,8 +75,8 @@ static const struct xdr_ops xdrmem_ops = * The procedure xdrmem_create initializes a stream descriptor for a * memory buffer. */ -void -xdrmem_create (XDR *xdrs, const caddr_t addr, u_int size, enum xdr_op op) +void attribute_hidden +__xdrmem_create (XDR *xdrs, const caddr_t addr, u_int size, enum xdr_op op) { xdrs->x_op = op; /* We have to add the const since the `struct xdr_ops' in `struct XDR' @@ -85,6 +85,7 @@ xdrmem_create (XDR *xdrs, const caddr_t addr, u_int size, enum xdr_op op) xdrs->x_private = xdrs->x_base = addr; xdrs->x_handy = size; } +strong_alias(__xdrmem_create,xdrmem_create) /* * Nothing needs to be done for the memory case. The argument is clearly -- cgit v1.2.3