diff options
author | Waldemar Brodkorb <wbx@openadk.org> | 2017-03-20 18:10:36 +0100 |
---|---|---|
committer | Waldemar Brodkorb <wbx@openadk.org> | 2017-03-20 18:10:36 +0100 |
commit | a1a8064169aeda79e3266a2db9cce25e361a86dc (patch) | |
tree | 526902649b5dfb9e1e9f6c632349df475a6bb597 /libc/inet | |
parent | 2d8ea0524b016d29cf28615449b22b96dd5067b2 (diff) |
remove RPC implementation
The included RPC implementation is ipv4 only.
Other C library projects have either deprecated the internal
RPC implementation (GNU C Library) or never implemented such
functionality (musl C Library). The latest rpcbind release (0.2.4)
checks for libtirpc and does not allow to be build with uClibc-ng
RPC without patching. The common use case for RPC nowadays is to
use rpcbind together with nfs-utils to provide NFS server or client
support to a system.
The included RPC implementation does create issues with duplicate
symbol failures when statically compiling with RPC enabled.
Diffstat (limited to 'libc/inet')
54 files changed, 0 insertions, 12297 deletions
diff --git a/libc/inet/Makefile.in b/libc/inet/Makefile.in index 3bfe4b29e..332e70e53 100644 --- a/libc/inet/Makefile.in +++ b/libc/inet/Makefile.in @@ -7,8 +7,6 @@ subdirs += libc/inet -include $(top_srcdir)libc/inet/rpc/Makefile.in - INET_DIR := $(top_srcdir)libc/inet INET_OUT := $(top_builddir)libc/inet V4_OR_V6 := $(findstring y,$(UCLIBC_HAS_IPV4)$(UCLIBC_HAS_IPV6)) diff --git a/libc/inet/rpc/.indent.pro b/libc/inet/rpc/.indent.pro deleted file mode 100644 index 492ecf1c7..000000000 --- a/libc/inet/rpc/.indent.pro +++ /dev/null @@ -1,33 +0,0 @@ ---blank-lines-after-declarations ---blank-lines-after-procedures ---break-before-boolean-operator ---no-blank-lines-after-commas ---braces-on-if-line ---braces-on-struct-decl-line ---comment-indentation25 ---declaration-comment-column25 ---no-comment-delimiters-on-blank-lines ---cuddle-else ---continuation-indentation4 ---case-indentation0 ---else-endif-column33 ---space-after-cast ---line-comments-indentation0 ---declaration-indentation1 ---dont-format-first-column-comments ---dont-format-comments ---honour-newlines ---indent-level4 -/* changed from 0 to 4 */ ---parameter-indentation4 ---line-length78 /* changed from 75 */ ---continue-at-parentheses ---no-space-after-function-call-names ---dont-break-procedure-type ---dont-star-comments ---leave-optional-blank-lines ---dont-space-special-semicolon ---tab-size4 -/* additions by Mark */ ---case-brace-indentation0 ---leave-preprocessor-space diff --git a/libc/inet/rpc/Makefile b/libc/inet/rpc/Makefile deleted file mode 100644 index 4a8f4a072..000000000 --- a/libc/inet/rpc/Makefile +++ /dev/null @@ -1,13 +0,0 @@ -# Makefile for uClibc -# -# Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org> -# -# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. -# - -top_srcdir=../../../ -top_builddir=../../../ -all: objs -include $(top_builddir)Rules.mak -include Makefile.in -include $(top_srcdir)Makerules diff --git a/libc/inet/rpc/Makefile.in b/libc/inet/rpc/Makefile.in deleted file mode 100644 index 9abe85dc8..000000000 --- a/libc/inet/rpc/Makefile.in +++ /dev/null @@ -1,42 +0,0 @@ -# Makefile for uClibc -# -# Copyright (C) 2000-2008 Erik Andersen <andersen@uclibc.org> -# -# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. -# - -subdirs += libc/inet/rpc - -CFLAGS-y-libc/inet/rpc := -fno-strict-aliasing - -# For now, only compile the stuff needed to do an NFS mount.... -CSRC_NFS = authunix_prot.c auth_none.c auth_unix.c bindresvport.c \ - clnt_perror.c clnt_simple.c clnt_tcp.c clnt_udp.c \ - create_xid.c getrpcent.c \ - pmap_clnt.c pm_getmaps.c pm_getport.c pmap_prot.c pmap_prot2.c \ - rcmd.c rexec.c rpc_cmsg.c rpc_commondata.c rpc_dtablesize.c \ - rpc_prot.c rpc_thread.c rtime.c ruserpass.c sa_len.c \ - svc.c svc_auth.c svc_authux.c \ - xdr.c xdr_array.c xdr_mem.c xdr_rec.c xdr_reference.c - -INET_RPC_DIR:=$(top_srcdir)libc/inet/rpc -INET_RPC_OUT:=$(top_builddir)libc/inet/rpc - -CSRC_ALL = $(notdir $(wildcard $(INET_RPC_DIR)/*.c)) -CSRC-y := $(if $(UCLIBC_HAS_FULL_RPC),$(CSRC_ALL),$(CSRC_NFS)) -# rpc_thread.oS is better, because the header adds unneeded references -# to __pthread_internal_tsd* -CSRC-y := $(filter-out rpc_thread.c,$(CSRC-y)) - -INET_RPC_SRC:=$(patsubst %.c,$(INET_RPC_DIR)/%.c,$(CSRC-y)) -INET_RPC_OBJ:=$(patsubst %.c,$(INET_RPC_OUT)/%.o,$(CSRC-y)) - -libc-static-$(UCLIBC_HAS_RPC) += $(INET_RPC_OUT)/rpc_thread.o -libc-shared-$(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) - -objclean-y+=CLEAN_libc/inet/rpc - -CLEAN_libc/inet/rpc: - $(do_rm) $(addprefix $(INET_RPC_OUT)/*., o os oS) diff --git a/libc/inet/rpc/auth_none.c b/libc/inet/rpc/auth_none.c deleted file mode 100644 index 4bf37cb10..000000000 --- a/libc/inet/rpc/auth_none.c +++ /dev/null @@ -1,140 +0,0 @@ -/* - * Sun RPC is a product of Sun Microsystems, Inc. and is provided for - * unrestricted use provided that this legend is included on all tape - * media and as a part of the software program in whole or part. Users - * may copy or modify Sun RPC without charge, but are not authorized - * to license or distribute it to anyone else except as part of a product or - * program developed by the user. - * - * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE - * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR - * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * - * Sun RPC is provided with no support and without any obligation on the - * part of Sun Microsystems, Inc. to assist in its use, correction, - * modification or enhancement. - * - * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE - * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC - * OR ANY PART THEREOF. - * - * In no event will Sun Microsystems, Inc. be liable for any lost revenue - * or profits or other special, indirect and consequential damages, even if - * Sun has been advised of the possibility of such damages. - * - * Sun Microsystems, Inc. - * 2550 Garcia Avenue - * Mountain View, California 94043 - */ -/* - * Copyright (C) 1984, Sun Microsystems, Inc. - */ -/* - * auth_none.c - * Creates a client authentication handle for passing "null" - * credentials and verifiers to remote systems. - */ - -#include "rpc_private.h" - - -#define MAX_MARSHAL_SIZE 20 - -/* - * Authenticator operations routines - */ -static void authnone_verf (AUTH *); -static void authnone_destroy (AUTH *); -static bool_t authnone_marshal (AUTH *, XDR *); -static bool_t authnone_validate (AUTH *, struct opaque_auth *); -static bool_t authnone_refresh (AUTH *); - -static const struct auth_ops ops = { - authnone_verf, - authnone_marshal, - authnone_validate, - authnone_refresh, - authnone_destroy -}; - -/* Internal data and routines */ - -struct authnone_private_s { - AUTH no_client; - char marshalled_client[MAX_MARSHAL_SIZE]; - u_int mcnt; -}; - -static struct authnone_private_s authnone_private; -#ifdef __UCLIBC_HAS_THREADS__ -__libc_once_define(static, authnone_private_guard); -#endif - -static void authnone_create_once (void); - -static void -authnone_create_once (void) -{ - struct authnone_private_s *ap; - XDR xdr_stream; - XDR *xdrs; - - ap = &authnone_private; - - ap->no_client.ah_cred = ap->no_client.ah_verf = _null_auth; - ap->no_client.ah_ops = (struct auth_ops *) &ops; - xdrs = &xdr_stream; - xdrmem_create(xdrs, ap->marshalled_client, - (u_int) MAX_MARSHAL_SIZE, XDR_ENCODE); - (void) xdr_opaque_auth(xdrs, &ap->no_client.ah_cred); - (void) xdr_opaque_auth(xdrs, &ap->no_client.ah_verf); - ap->mcnt = XDR_GETPOS (xdrs); - XDR_DESTROY (xdrs); -} - -AUTH * -authnone_create (void) -{ -#ifdef __UCLIBC_HAS_THREADS__ - __libc_once (authnone_private_guard, authnone_create_once); -#else - authnone_create_once(); -#endif - return &authnone_private.no_client; -} -libc_hidden_def(authnone_create) - -static bool_t -authnone_marshal (AUTH *client, XDR *xdrs) -{ - struct authnone_private_s *ap; - - /* authnone_create returned authnone_private->no_client, which is - the first field of struct authnone_private_s. */ - ap = (struct authnone_private_s *) client; - if (ap == NULL) - return FALSE; - return (*xdrs->x_ops->x_putbytes) (xdrs, ap->marshalled_client, ap->mcnt); -} - -static void -authnone_verf (AUTH *auth attribute_unused) -{ -} - -static bool_t -authnone_validate (AUTH *auth attribute_unused, struct opaque_auth *oa attribute_unused) -{ - return TRUE; -} - -static bool_t -authnone_refresh (AUTH *auth attribute_unused) -{ - return FALSE; -} - -static void -authnone_destroy (AUTH *auth attribute_unused) -{ -} diff --git a/libc/inet/rpc/auth_unix.c b/libc/inet/rpc/auth_unix.c deleted file mode 100644 index 86c5ce956..000000000 --- a/libc/inet/rpc/auth_unix.c +++ /dev/null @@ -1,323 +0,0 @@ -/* - * Sun RPC is a product of Sun Microsystems, Inc. and is provided for - * unrestricted use provided that this legend is included on all tape - * media and as a part of the software program in whole or part. Users - * may copy or modify Sun RPC without charge, but are not authorized - * to license or distribute it to anyone else except as part of a product or - * program developed by the user. - * - * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE - * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR - * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * - * Sun RPC is provided with no support and without any obligation on the - * part of Sun Microsystems, Inc. to assist in its use, correction, - * modification or enhancement. - * - * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE - * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC - * OR ANY PART THEREOF. - * - * In no event will Sun Microsystems, Inc. be liable for any lost revenue - * or profits or other special, indirect and consequential damages, even if - * Sun has been advised of the possibility of such damages. - * - * Sun Microsystems, Inc. - * 2550 Garcia Avenue - * Mountain View, California 94043 - */ -/* - * Copyright (C) 1984, Sun Microsystems, Inc. - */ -/* - * auth_unix.c, Implements UNIX style authentication parameters. - * - * The system is very weak. The client uses no encryption for it's - * credentials and only sends null verifiers. The server sends backs - * null verifiers or optionally a verifier that suggests a new short hand - * for the credentials. - */ - -#include <limits.h> -#include <stdio.h> -#include <string.h> -#include <unistd.h> -#include <sys/param.h> - -#include <rpc/types.h> -#include <rpc/xdr.h> -#include <rpc/auth.h> -#include <rpc/auth_unix.h> - -/* - * Unix authenticator operations vector - */ -static void authunix_nextverf (AUTH *); -static bool_t authunix_marshal (AUTH *, XDR *); -static bool_t authunix_validate (AUTH *, struct opaque_auth *); -static bool_t authunix_refresh (AUTH *); -static void authunix_destroy (AUTH *); - -static const struct auth_ops auth_unix_ops = { - authunix_nextverf, - authunix_marshal, - authunix_validate, - authunix_refresh, - authunix_destroy -}; - -/* - * This struct is pointed to by the ah_private field of an auth_handle. - */ -struct audata { - struct opaque_auth au_origcred; /* original credentials */ - struct opaque_auth au_shcred; /* short hand cred */ - u_long au_shfaults; /* short hand cache faults */ - char au_marshed[MAX_AUTH_BYTES]; - u_int au_mpos; /* xdr pos at end of marshed */ -}; -#define AUTH_PRIVATE(auth) ((struct audata *)auth->ah_private) - -static bool_t marshal_new_auth (AUTH *) internal_function; - - -/* - * Create a unix style authenticator. - * Returns an auth handle with the given stuff in it. - */ -AUTH * -authunix_create (char *machname, uid_t uid, gid_t gid, int len, - gid_t *aup_gids) -{ - struct authunix_parms aup; - char mymem[MAX_AUTH_BYTES]; - struct timeval now; - XDR xdrs; - AUTH *auth; - struct audata *au; - - /* - * Allocate and set up auth handle - */ - auth = (AUTH *) mem_alloc (sizeof (*auth)); - au = (struct audata *) mem_alloc (sizeof (*au)); - if (auth == NULL || au == NULL) - { -no_memory: - (void) fputs ("authunix_create: out of memory\n", stderr); - mem_free (auth, sizeof (*auth)); - mem_free (au, sizeof (*au)); - return NULL; - } - auth->ah_ops = &auth_unix_ops; - auth->ah_private = (caddr_t) au; - auth->ah_verf = au->au_shcred = _null_auth; - au->au_shfaults = 0; - - /* - * fill in param struct from the given params - */ - (void) gettimeofday (&now, (struct timezone *) 0); - aup.aup_time = now.tv_sec; - aup.aup_machname = machname; - aup.aup_uid = uid; - aup.aup_gid = gid; - aup.aup_len = (u_int) len; - aup.aup_gids = aup_gids; - - /* - * Serialize the parameters into origcred - */ - xdrmem_create (&xdrs, mymem, MAX_AUTH_BYTES, XDR_ENCODE); - if (!xdr_authunix_parms (&xdrs, &aup)) - abort (); - au->au_origcred.oa_length = len = XDR_GETPOS (&xdrs); - au->au_origcred.oa_flavor = AUTH_UNIX; - au->au_origcred.oa_base = mem_alloc ((u_int) len); - if (au->au_origcred.oa_base == NULL) - goto no_memory; - memcpy(au->au_origcred.oa_base, mymem, (u_int) len); - - /* - * set auth handle to reflect new cred. - */ - auth->ah_cred = au->au_origcred; - marshal_new_auth (auth); - return auth; -} -libc_hidden_def(authunix_create) - -/* - * Returns an auth handle with parameters determined by doing lots of - * syscalls. - */ -AUTH * -authunix_create_default (void) -{ - int len; - char machname[MAX_MACHINE_NAME + 1]; - uid_t uid; - gid_t gid; - int max_nr_groups = sysconf (_SC_NGROUPS_MAX); - gid_t *gids = NULL; - AUTH *ret_auth; - - if (max_nr_groups) { - gids = (gid_t*)malloc(sizeof(*gids) * max_nr_groups); - if (gids == NULL) - abort (); - } - - if (gethostname (machname, MAX_MACHINE_NAME) == -1) - abort (); - machname[MAX_MACHINE_NAME] = 0; - uid = geteuid (); - gid = getegid (); - - if ((len = getgroups (max_nr_groups, gids)) < 0) - abort (); - /* This braindamaged Sun code forces us here to truncate the - list of groups to NGRPS members since the code in - authuxprot.c transforms a fixed array. Grrr. */ - ret_auth = authunix_create (machname, uid, gid, MIN (NGRPS, len), gids); - free (gids); - return ret_auth; -} -libc_hidden_def(authunix_create_default) - -/* - * authunix operations - */ - -static void -authunix_nextverf (AUTH *auth attribute_unused) -{ - /* no action necessary */ -} - -static bool_t -authunix_marshal (AUTH *auth, XDR *xdrs) -{ - struct audata *au = AUTH_PRIVATE (auth); - - return XDR_PUTBYTES (xdrs, au->au_marshed, au->au_mpos); -} - -static bool_t -authunix_validate (AUTH *auth, struct opaque_auth *verf) -{ - struct audata *au; - XDR xdrs; - - if (verf->oa_flavor == AUTH_SHORT) - { - au = AUTH_PRIVATE (auth); - xdrmem_create (&xdrs, verf->oa_base, verf->oa_length, - XDR_DECODE); - - if (au->au_shcred.oa_base != NULL) - { - mem_free (au->au_shcred.oa_base, - au->au_shcred.oa_length); - au->au_shcred.oa_base = NULL; - } - if (xdr_opaque_auth (&xdrs, &au->au_shcred)) - { - auth->ah_cred = au->au_shcred; - } - else - { - xdrs.x_op = XDR_FREE; - (void) xdr_opaque_auth (&xdrs, &au->au_shcred); - au->au_shcred.oa_base = NULL; - auth->ah_cred = au->au_origcred; - } - marshal_new_auth (auth); - } - return TRUE; -} - -static bool_t -authunix_refresh (AUTH *auth) -{ - struct audata *au = AUTH_PRIVATE (auth); - struct authunix_parms aup; - struct timeval now; - XDR xdrs; - int stat; - - if (auth->ah_cred.oa_base == au->au_origcred.oa_base) - { - /* there is no hope. Punt */ - return FALSE; - } - au->au_shfaults++; - - /* first deserialize the creds back into a struct authunix_parms */ - aup.aup_machname = NULL; - aup.aup_gids = (gid_t *) NULL; - xdrmem_create (&xdrs, au->au_origcred.oa_base, - au->au_origcred.oa_length, XDR_DECODE); - stat = xdr_authunix_parms (&xdrs, &aup); - if (!stat) - goto done; - - /* update the time and serialize in place */ - (void) gettimeofday (&now, (struct timezone *) 0); - aup.aup_time = now.tv_sec; - xdrs.x_op = XDR_ENCODE; - XDR_SETPOS (&xdrs, 0); - stat = xdr_authunix_parms (&xdrs, &aup); - if (!stat) - goto done; - auth->ah_cred = au->au_origcred; - marshal_new_auth (auth); -done: - /* free the struct authunix_parms created by deserializing */ - xdrs.x_op = XDR_FREE; - (void) xdr_authunix_parms (&xdrs, &aup); - XDR_DESTROY (&xdrs); - return stat; -} - -static void -authunix_destroy (AUTH *auth) -{ - struct audata *au = AUTH_PRIVATE (auth); - - mem_free (au->au_origcred.oa_base, au->au_origcred.oa_length); - - if (au->au_shcred.oa_base != NULL) - mem_free (au->au_shcred.oa_base, au->au_shcred.oa_length); - - mem_free (auth->ah_private, sizeof (struct audata)); - - if (auth->ah_verf.oa_base != NULL) - mem_free (auth->ah_verf.oa_base, auth->ah_verf.oa_length); - - mem_free ((caddr_t) auth, sizeof (*auth)); -} - -/* - * Marshals (pre-serializes) an auth struct. - * sets private data, au_marshed and au_mpos - */ -static bool_t -internal_function -marshal_new_auth (AUTH *auth) -{ - XDR xdr_stream; - XDR *xdrs = &xdr_stream; - struct audata *au = AUTH_PRIVATE (auth); - - xdrmem_create (xdrs, au->au_marshed, MAX_AUTH_BYTES, XDR_ENCODE); - if ((!xdr_opaque_auth (xdrs, &(auth->ah_cred))) || - (!xdr_opaque_auth (xdrs, &(auth->ah_verf)))) - perror ("auth_unix.c - Fatal marshalling problem"); - else - au->au_mpos = XDR_GETPOS (xdrs); - - XDR_DESTROY (xdrs); - - return TRUE; -} diff --git a/libc/inet/rpc/authunix_prot.c b/libc/inet/rpc/authunix_prot.c deleted file mode 100644 index 272990056..000000000 --- a/libc/inet/rpc/authunix_prot.c +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Sun RPC is a product of Sun Microsystems, Inc. and is provided for - * unrestricted use provided that this legend is included on all tape - * media and as a part of the software program in whole or part. Users - * may copy or modify Sun RPC without charge, but are not authorized - * to license or distribute it to anyone else except as part of a product or - * program developed by the user. - * - * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE - * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR - * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * - * Sun RPC is provided with no support and without any obligation on the - * part of Sun Microsystems, Inc. to assist in its use, correction, - * modification or enhancement. - * - * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE - * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC - * OR ANY PART THEREOF. - * - * In no event will Sun Microsystems, Inc. be liable for any lost revenue - * or profits or other special, indirect and consequential damages, even if - * Sun has been advised of the possibility of such damages. - * - * Sun Microsystems, Inc. - * 2550 Garcia Avenue - * Mountain View, California 94043 - */ -/* - * Copyright (C) 1984, Sun Microsystems, Inc. - */ -/* - * authunix_prot.c - * XDR for UNIX style authentication parameters for RPC - */ - -#include <rpc/types.h> -#include <rpc/xdr.h> -#include <rpc/auth.h> -#include <rpc/auth_unix.h> - - -/* - * XDR for unix authentication parameters. - * Unfortunately, none of these can be declared const. - */ -bool_t -xdr_authunix_parms (XDR * xdrs, struct authunix_parms *p) -{ - if (xdr_u_long (xdrs, &(p->aup_time)) - && xdr_string (xdrs, &(p->aup_machname), MAX_MACHINE_NAME) - && (sizeof (uid_t) == sizeof (short int) - ? xdr_u_short (xdrs, (u_short *) & (p->aup_uid)) - : xdr_u_int (xdrs, (u_int *) & (p->aup_uid))) - && (sizeof (gid_t) == sizeof (short int) - ? xdr_u_short (xdrs, (u_short *) & (p->aup_gid)) - : xdr_u_int (xdrs, (u_int *) & (p->aup_gid))) - && xdr_array (xdrs, (caddr_t *) & (p->aup_gids), - & (p->aup_len), NGRPS, sizeof (gid_t), - (sizeof (gid_t) == sizeof (short int) - ? (xdrproc_t) xdr_u_short : (xdrproc_t) xdr_u_int))) - { - return TRUE; - } - return FALSE; -} -libc_hidden_def(xdr_authunix_parms) diff --git a/lib |