199064799SGarrett Wollman /* 299064799SGarrett Wollman * Sun RPC is a product of Sun Microsystems, Inc. and is provided for 399064799SGarrett Wollman * unrestricted use provided that this legend is included on all tape 499064799SGarrett Wollman * media and as a part of the software program in whole or part. Users 599064799SGarrett Wollman * may copy or modify Sun RPC without charge, but are not authorized 699064799SGarrett Wollman * to license or distribute it to anyone else except as part of a product or 799064799SGarrett Wollman * program developed by the user. 899064799SGarrett Wollman * 999064799SGarrett Wollman * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE 1099064799SGarrett Wollman * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR 1199064799SGarrett Wollman * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. 1299064799SGarrett Wollman * 1399064799SGarrett Wollman * Sun RPC is provided with no support and without any obligation on the 1499064799SGarrett Wollman * part of Sun Microsystems, Inc. to assist in its use, correction, 1599064799SGarrett Wollman * modification or enhancement. 1699064799SGarrett Wollman * 1799064799SGarrett Wollman * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE 1899064799SGarrett Wollman * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC 1999064799SGarrett Wollman * OR ANY PART THEREOF. 2099064799SGarrett Wollman * 2199064799SGarrett Wollman * In no event will Sun Microsystems, Inc. be liable for any lost revenue 2299064799SGarrett Wollman * or profits or other special, indirect and consequential damages, even if 2399064799SGarrett Wollman * Sun has been advised of the possibility of such damages. 2499064799SGarrett Wollman * 2599064799SGarrett Wollman * Sun Microsystems, Inc. 2699064799SGarrett Wollman * 2550 Garcia Avenue 2799064799SGarrett Wollman * Mountain View, California 94043 2899064799SGarrett Wollman */ 2999064799SGarrett Wollman 3099064799SGarrett Wollman #if defined(LIBC_SCCS) && !defined(lint) 3199064799SGarrett Wollman /*static char *sccsid = "from: @(#)auth_none.c 1.19 87/08/11 Copyr 1984 Sun Micro";*/ 3299064799SGarrett Wollman /*static char *sccsid = "from: @(#)auth_none.c 2.1 88/07/29 4.0 RPCSRC";*/ 334c3af266SPoul-Henning Kamp static char *rcsid = "$Id: auth_none.c,v 1.2 1995/05/30 05:41:11 rgrimes Exp $"; 3499064799SGarrett Wollman #endif 3599064799SGarrett Wollman 3699064799SGarrett Wollman /* 3799064799SGarrett Wollman * auth_none.c 3899064799SGarrett Wollman * Creates a client authentication handle for passing "null" 3999064799SGarrett Wollman * credentials and verifiers to remote systems. 4099064799SGarrett Wollman * 4199064799SGarrett Wollman * Copyright (C) 1984, Sun Microsystems, Inc. 4299064799SGarrett Wollman */ 4399064799SGarrett Wollman 444c3af266SPoul-Henning Kamp #include <stdlib.h> 4599064799SGarrett Wollman #include <rpc/types.h> 4699064799SGarrett Wollman #include <rpc/xdr.h> 4799064799SGarrett Wollman #include <rpc/auth.h> 4899064799SGarrett Wollman #define MAX_MARSHEL_SIZE 20 4999064799SGarrett Wollman 5099064799SGarrett Wollman /* 5199064799SGarrett Wollman * Authenticator operations routines 5299064799SGarrett Wollman */ 5399064799SGarrett Wollman static void authnone_verf(); 5499064799SGarrett Wollman static void authnone_destroy(); 5599064799SGarrett Wollman static bool_t authnone_marshal(); 5699064799SGarrett Wollman static bool_t authnone_validate(); 5799064799SGarrett Wollman static bool_t authnone_refresh(); 5899064799SGarrett Wollman 5999064799SGarrett Wollman static struct auth_ops ops = { 6099064799SGarrett Wollman authnone_verf, 6199064799SGarrett Wollman authnone_marshal, 6299064799SGarrett Wollman authnone_validate, 6399064799SGarrett Wollman authnone_refresh, 6499064799SGarrett Wollman authnone_destroy 6599064799SGarrett Wollman }; 6699064799SGarrett Wollman 6799064799SGarrett Wollman static struct authnone_private { 6899064799SGarrett Wollman AUTH no_client; 6999064799SGarrett Wollman char marshalled_client[MAX_MARSHEL_SIZE]; 7099064799SGarrett Wollman u_int mcnt; 7199064799SGarrett Wollman } *authnone_private; 7299064799SGarrett Wollman 7399064799SGarrett Wollman AUTH * 7499064799SGarrett Wollman authnone_create() 7599064799SGarrett Wollman { 7699064799SGarrett Wollman register struct authnone_private *ap = authnone_private; 7799064799SGarrett Wollman XDR xdr_stream; 7899064799SGarrett Wollman register XDR *xdrs; 7999064799SGarrett Wollman 8099064799SGarrett Wollman if (ap == 0) { 8199064799SGarrett Wollman ap = (struct authnone_private *)calloc(1, sizeof (*ap)); 8299064799SGarrett Wollman if (ap == 0) 8399064799SGarrett Wollman return (0); 8499064799SGarrett Wollman authnone_private = ap; 8599064799SGarrett Wollman } 8699064799SGarrett Wollman if (!ap->mcnt) { 8799064799SGarrett Wollman ap->no_client.ah_cred = ap->no_client.ah_verf = _null_auth; 8899064799SGarrett Wollman ap->no_client.ah_ops = &ops; 8999064799SGarrett Wollman xdrs = &xdr_stream; 9099064799SGarrett Wollman xdrmem_create(xdrs, ap->marshalled_client, (u_int)MAX_MARSHEL_SIZE, 9199064799SGarrett Wollman XDR_ENCODE); 9299064799SGarrett Wollman (void)xdr_opaque_auth(xdrs, &ap->no_client.ah_cred); 9399064799SGarrett Wollman (void)xdr_opaque_auth(xdrs, &ap->no_client.ah_verf); 9499064799SGarrett Wollman ap->mcnt = XDR_GETPOS(xdrs); 9599064799SGarrett Wollman XDR_DESTROY(xdrs); 9699064799SGarrett Wollman } 9799064799SGarrett Wollman return (&ap->no_client); 9899064799SGarrett Wollman } 9999064799SGarrett Wollman 10099064799SGarrett Wollman /*ARGSUSED*/ 10199064799SGarrett Wollman static bool_t 10299064799SGarrett Wollman authnone_marshal(client, xdrs) 10399064799SGarrett Wollman AUTH *client; 10499064799SGarrett Wollman XDR *xdrs; 10599064799SGarrett Wollman { 10699064799SGarrett Wollman register struct authnone_private *ap = authnone_private; 10799064799SGarrett Wollman 10899064799SGarrett Wollman if (ap == 0) 10999064799SGarrett Wollman return (0); 11099064799SGarrett Wollman return ((*xdrs->x_ops->x_putbytes)(xdrs, 11199064799SGarrett Wollman ap->marshalled_client, ap->mcnt)); 11299064799SGarrett Wollman } 11399064799SGarrett Wollman 11499064799SGarrett Wollman static void 11599064799SGarrett Wollman authnone_verf() 11699064799SGarrett Wollman { 11799064799SGarrett Wollman } 11899064799SGarrett Wollman 11999064799SGarrett Wollman static bool_t 12099064799SGarrett Wollman authnone_validate() 12199064799SGarrett Wollman { 12299064799SGarrett Wollman 12399064799SGarrett Wollman return (TRUE); 12499064799SGarrett Wollman } 12599064799SGarrett Wollman 12699064799SGarrett Wollman static bool_t 12799064799SGarrett Wollman authnone_refresh() 12899064799SGarrett Wollman { 12999064799SGarrett Wollman 13099064799SGarrett Wollman return (FALSE); 13199064799SGarrett Wollman } 13299064799SGarrett Wollman 13399064799SGarrett Wollman static void 13499064799SGarrett Wollman authnone_destroy() 13599064799SGarrett Wollman { 13699064799SGarrett Wollman } 137