source: rtems-libbsd/services/librpc/src/rpc/auth_none.c @ cd450d2

4.1155-freebsd-126-freebsd-12freebsd-9.3
Last change on this file since cd450d2 was cd450d2, checked in by Joel Sherrill <joel.sherrill@…>, on 08/06/12 at 00:10:35

librpc: now compiles

  • Property mode set to 100644
File size: 3.5 KB
Line 
1/*
2 * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
3 * unrestricted use provided that this legend is included on all tape
4 * media and as a part of the software program in whole or part.  Users
5 * may copy or modify Sun RPC without charge, but are not authorized
6 * to license or distribute it to anyone else except as part of a product or
7 * program developed by the user.
8 *
9 * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
10 * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
11 * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
12 *
13 * Sun RPC is provided with no support and without any obligation on the
14 * part of Sun Microsystems, Inc. to assist in its use, correction,
15 * modification or enhancement.
16 *
17 * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
18 * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
19 * OR ANY PART THEREOF.
20 *
21 * In no event will Sun Microsystems, Inc. be liable for any lost revenue
22 * or profits or other special, indirect and consequential damages, even if
23 * Sun has been advised of the possibility of such damages.
24 *
25 * Sun Microsystems, Inc.
26 * 2550 Garcia Avenue
27 * Mountain View, California  94043
28 */
29
30#if defined(LIBC_SCCS) && !defined(lint)
31/*static char *sccsid = "from: @(#)auth_none.c 1.19 87/08/11 Copyr 1984 Sun Micro";*/
32/*static char *sccsid = "from: @(#)auth_none.c  2.1 88/07/29 4.0 RPCSRC";*/
33static char *rcsid = "$FreeBSD: src/lib/libc/rpc/auth_none.c,v 1.9 1999/08/28 00:00:32 peter Exp $";
34#endif
35
36/*
37 * auth_none.c
38 * Creates a client authentication handle for passing "null"
39 * credentials and verifiers to remote systems.
40 *
41 * Copyright (C) 1984, Sun Microsystems, Inc.
42 */
43
44#ifdef HAVE_CONFIG_H
45#include "config.h"
46#endif
47
48#include <freebsd/bsd.h>
49#include <rpc/types.h>
50#include <rpc/xdr.h>
51#include <rpc/auth.h>
52#define MAX_MARSHAL_SIZE 20
53
54/*
55 * Authenticator operations routines
56 */
57static void     authnone_verf(AUTH*);
58static void     authnone_destroy(AUTH*);
59static int      authnone_marshal(AUTH*, XDR*);
60static int      authnone_validate(AUTH*, struct opaque_auth *);
61static int      authnone_refresh(AUTH*);
62
63static struct auth_ops ops = {
64        authnone_verf,
65        authnone_marshal,
66        authnone_validate,
67        authnone_refresh,
68        authnone_destroy
69};
70
71static struct authnone_private {
72        AUTH    no_client;
73        char    marshalled_client[MAX_MARSHAL_SIZE];
74        u_int   mcnt;
75} *authnone_private;
76
77AUTH *
78authnone_create(void)
79{
80        struct authnone_private *ap = authnone_private;
81        XDR xdr_stream;
82        XDR *xdrs;
83
84        if (ap == 0) {
85                ap = (struct authnone_private *)calloc(1, sizeof (*ap));
86                if (ap == 0)
87                        return (0);
88                authnone_private = ap;
89        }
90        if (!ap->mcnt) {
91                ap->no_client.ah_cred = ap->no_client.ah_verf = _null_auth;
92                ap->no_client.ah_ops = &ops;
93                xdrs = &xdr_stream;
94                xdrmem_create(xdrs, ap->marshalled_client, (u_int)MAX_MARSHAL_SIZE,
95                    XDR_ENCODE);
96                (void)xdr_opaque_auth(xdrs, &ap->no_client.ah_cred);
97                (void)xdr_opaque_auth(xdrs, &ap->no_client.ah_verf);
98                ap->mcnt = XDR_GETPOS(xdrs);
99                XDR_DESTROY(xdrs);
100        }
101        return (&ap->no_client);
102}
103
104/*ARGSUSED*/
105static int
106authnone_marshal(AUTH *client, XDR *xdrs)
107{
108        struct authnone_private *ap = authnone_private;
109
110        if (ap == 0)
111                return (0);
112        return ((*xdrs->x_ops->x_putbytes)(xdrs,
113            ap->marshalled_client, ap->mcnt));
114}
115
116static void
117authnone_verf(AUTH *client)
118{
119}
120
121static int
122authnone_validate(AUTH *client, struct opaque_auth *opaque)
123{
124
125        return (TRUE);
126}
127
128static int
129authnone_refresh(AUTH *client)
130{
131
132        return (FALSE);
133}
134
135static void
136authnone_destroy(AUTH *client)
137{
138}
Note: See TracBrowser for help on using the repository browser.