diff options
author | Ulrich Drepper <drepper@redhat.com> | 1998-08-03 16:47:01 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 1998-08-03 16:47:01 +0000 |
commit | 7cabd57c0d64a2ee5ca0c5218c877ff700727880 (patch) | |
tree | 4db8d28a07bfb0ee5705e9199fcf1f59d5b27403 /sunrpc | |
parent | 2698e32c2c2fae23c5c5f39f73b09553158b482d (diff) | |
download | glibc-7cabd57c0d64a2ee5ca0c5218c877ff700727880.tar.gz glibc-7cabd57c0d64a2ee5ca0c5218c877ff700727880.tar.xz glibc-7cabd57c0d64a2ee5ca0c5218c877ff700727880.zip |
Update.
1998-08-03 16:36 Ulrich Drepper <drepper@cygnus.com> * catgets/catgets.c: Use mmap/munmap only is _POSIX_MAPPED_FILES is defined. * catgets/open_catalog.c: Likewise. * iconv/iconv_prog.c: Likewise. * intl/loadmsgcat.c: Likewise. * locale/findlocale.c: Likewise. * locale/loadlocale.c: Likewise. * locale/programs/localedef.c: Likewise. * malloc/malloc.c: Likewise. * elf/elf.h: Fix typo. * math/Makefile: Use $(LN_S) instead of ln. * sysdeps/generic/getpgid.c: Fix return type. 1998-08-01 02:49 -0400 Zack Weinberg <zack@rabi.phys.columbia.edu> * sysdeps/posix/tempname.c (__stdio_gen_tempname): Rename to __gen_tempname and simplify the interface. Strip out the code to do path search and create FILE objects. This function now takes a mktemp() style template and returns either a name or a file descriptor. (__path_search): New function; searches for directories for temp files. * sysdeps/generic/tempname.c: Stub out __gen_tempname and __path_search, not __stdio_gen_tempname. * libio/stdio.h: Prototype __gen_tempname and __path_search, not __stdio_gen_tempname. * stdio/stdio.h: Likewise. * stdio-common/tempnam.c: Use __path_search and __gen_tempname. * stdio-common/tmpfile.c: Likewise. * stdio-common/tmpfile64.c: Likewise. * stdio-common/tmpnam.c: Likewise. * stdio-common/tmpnam_r.c: Likewise. * misc/mkstemp.c: New file. Use __gen_tempname. * misc/mktemp.c: Likewise. * sysdeps/posix/mkstemp.c: Removed. * sysdeps/posix/mktemp.c: Removed. * sysdeps/generic/mkstemp.c: Removed. * sysdeps/generic/mktemp.c: Removed. 1998-08-02 Thorsten Kukuk <kukuk@vt.uni-paderborn.de> * configure.in: Check, if door add-on is installed. * config.make.in: Add have_doors. * sunrpc/Makefile: Add HAVE_DOOR define. * sunrpc/key_call.c: Add keyserv/door interface. * sunrpc/svc_unix.c: Call setsockopt only if SO_PASSCRED is defined. * sunrpc/clnt_unix.c: Likewise. 1998-08-02 Andreas Jaeger <aj@arthur.rhein-neckar.de> * inet/netinet/in.h (IN_CLASSC): Correct mask. Reported by Ian Staniforth <I.Staniforth@sheffield.ac.uk> [fixes PR libc/727]. 1998-08-03 10:23 Ulrich Drepper <drepper@cygnus.com> * misc/Makefile: Fix installation problem with --disable-shared. * posix/Makefile: Likewise. 1998-08-02 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> * posix/regex.c (re_search_2): Optimize searching for anchored pattern if '^' cannot match at embedded newlines. (regerror): Renamed from __regerror, which it should only be called if _LIBC. 1998-07-31 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> * sunrpc/svc_unix.c (__msgread): Check setsockopt return value. 1998-07-31 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> * sysdeps/generic/glob.c: Remove obsolete cast. 1998-07-31 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> * Rules (tests): Fix last change.
Diffstat (limited to 'sunrpc')
-rw-r--r-- | sunrpc/Makefile | 4 | ||||
-rw-r--r-- | sunrpc/clnt_unix.c | 5 | ||||
-rw-r--r-- | sunrpc/key_call.c | 87 | ||||
-rw-r--r-- | sunrpc/svc_unix.c | 5 |
4 files changed, 96 insertions, 5 deletions
diff --git a/sunrpc/Makefile b/sunrpc/Makefile index 2dac9937f3..c96fe4fa64 100644 --- a/sunrpc/Makefile +++ b/sunrpc/Makefile @@ -109,6 +109,10 @@ CFLAGS-xnfs_prot.c = -Wno-unused CFLAGS-xrquota.c = -Wno-unused CFLAGS-xkey_prot.c = -Wno-unused +ifeq (yes,$(have_doors)) +CPPFLAGS-key_call.c += -DHAVE_DOORS=1 +endif + include ../Rules $(objpfx)rpcgen: $(addprefix $(objpfx),$(rpcgen-objs)) \ diff --git a/sunrpc/clnt_unix.c b/sunrpc/clnt_unix.c index 64b9ca9731..ad12d5fa89 100644 --- a/sunrpc/clnt_unix.c +++ b/sunrpc/clnt_unix.c @@ -458,7 +458,10 @@ __msgread (int sock, void *buf, size_t cnt) msg.msg_controllen = sizeof(struct cmessage); msg.msg_flags = 0; - setsockopt (sock, SOL_SOCKET, SO_PASSCRED, &on, sizeof (on)); +#ifdef SO_PASSCRED + if (setsockopt (sock, SOL_SOCKET, SO_PASSCRED, &on, sizeof (on))) + return -1; +#endif return recvmsg (sock, &msg, 0); } diff --git a/sunrpc/key_call.c b/sunrpc/key_call.c index 0219eaf5ad..0aa49cc78a 100644 --- a/sunrpc/key_call.c +++ b/sunrpc/key_call.c @@ -32,8 +32,8 @@ /* * The original source is from the RPCSRC 4.0 package from Sun Microsystems. - * The Interface to keyserver protocoll 2 was added by - * Thorsten Kukuk <kukuk@vt.uni-paderborn.de> + * The Interface to keyserver protocoll 2, RPC over AF_UNIX und Linux/doors + * was added by Thorsten Kukuk <kukuk@vt.uni-paderborn.de> */ #include <stdio.h> @@ -50,6 +50,10 @@ #include <rpc/key_prot.h> #include <bits/libc-lock.h> +#ifdef HAVE_DOORS +# include "door/door.h" +#endif + #define KEY_TIMEOUT 5 /* per-try timeout in seconds */ #define KEY_NRETRY 12 /* number of retries */ @@ -479,13 +483,82 @@ key_call_socket (u_long proc, xdrproc_t xdr_arg, char *arg, return result; } -/* returns 0 on failure, 1 on success */ +#ifdef HAVE_DOORS +/* returns 0 on failure, 1 on success */ +static int +internal_function +key_call_door (u_long proc, xdrproc_t xdr_arg, char *arg, + xdrproc_t xdr_rslt, char *rslt) +{ + XDR xdrs; + int fd; + door_arg_t args; + char *data_ptr; + u_long data_len = 0; + char res[255]; + + if ((fd = open("/var/run/keyservdoor", O_RDONLY)) < 0) + return 0; + res[0] = 0; + + data_len = xdr_sizeof (xdr_arg, arg); + data_ptr = calloc (1, data_len + 2 * sizeof (u_long)); + if (data_ptr == NULL) + return 0; + + xdrmem_create (&xdrs, &data_ptr[2 * sizeof (u_long)], data_len, XDR_ENCODE); + if (!xdr_arg (&xdrs, arg)) + { + xdr_destroy (&xdrs); + free (data_ptr); + return 0; + } + xdr_destroy (&xdrs); + + memcpy (data_ptr, &proc, sizeof (u_long)); + memcpy (&data_ptr[sizeof (proc)], &data_len, sizeof (u_long)); + + args.data_ptr = data_ptr; + args.data_size = data_len + 2 * sizeof (u_long); + args.desc_ptr = NULL; + args.desc_num = 0; + args.rbuf = res; + args.rsize = sizeof (res); + + if (__door_call (fd, &args) < 0) + return 0; + + free (data_ptr); + close (fd); + + memcpy (&data_len, args.data_ptr, sizeof (u_long)); + if (data_len != 0) + return 0; + + memcpy (&data_len, &args.data_ptr[sizeof (u_long)], sizeof (u_long)); + xdrmem_create (&xdrs, &args.data_ptr[2 * sizeof (u_long)], + data_len, XDR_DECODE); + if (!xdr_rslt (&xdrs, rslt)) + { + xdr_destroy (&xdrs); + return 0; + } + xdr_destroy (&xdrs); + + return 1; +} +#endif + +/* returns 0 on failure, 1 on success */ static int internal_function key_call (u_long proc, xdrproc_t xdr_arg, char *arg, xdrproc_t xdr_rslt, char *rslt) { static int use_keyenvoy = 0; +#ifdef HAVE_DOORS + static int use_doors = 1; +#endif if (proc == KEY_ENCRYPT_PK && __key_encryptsession_pk_LOCAL) { @@ -509,6 +582,14 @@ key_call (u_long proc, xdrproc_t xdr_arg, char *arg, return 1; } +#ifdef HAVE_DOORS + if (use_doors) + { + if (key_call_door (proc, xdr_arg, arg, xdr_rslt, rslt)) + return 1; + use_doors = 0; + } +#endif if (!use_keyenvoy) { if (key_call_socket (proc, xdr_arg, arg, xdr_rslt, rslt)) diff --git a/sunrpc/svc_unix.c b/sunrpc/svc_unix.c index a8ed53463e..c42d30ed83 100644 --- a/sunrpc/svc_unix.c +++ b/sunrpc/svc_unix.c @@ -307,7 +307,10 @@ __msgread (int sock, void *buf, size_t cnt) msg.msg_controllen = sizeof (struct cmessage); msg.msg_flags = 0; - setsockopt (sock, SOL_SOCKET, SO_PASSCRED, &on, sizeof (on)); +#ifdef SO_PASSCRED + if (setsockopt (sock, SOL_SOCKET, SO_PASSCRED, &on, sizeof (on))) + return -1; +#endif return recvmsg (sock, &msg, 0); } |