1 /* $NetBSD: auth_none.c,v 1.16 2013/03/11 20:19:28 tron Exp $ */
4 * Copyright (c) 2010, Oracle America, Inc.
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are
10 * * Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * * Redistributions in binary form must reproduce the above
13 * copyright notice, this list of conditions and the following
14 * disclaimer in the documentation and/or other materials
15 * provided with the distribution.
16 * * Neither the name of the "Oracle America, Inc." nor the names of its
17 * contributors may be used to endorse or promote products derived
18 * from this software without specific prior written permission.
20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
23 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
24 * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
25 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
27 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
29 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
30 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34 #include <sys/cdefs.h>
35 #if defined(LIBC_SCCS) && !defined(lint)
37 static char *sccsid
= "@(#)auth_none.c 1.19 87/08/11 Copyr 1984 Sun Micro";
38 static char *sccsid
= "@(#)auth_none.c 2.1 88/07/29 4.0 RPCSRC";
40 __RCSID("$NetBSD: auth_none.c,v 1.16 2013/03/11 20:19:28 tron Exp $");
46 * Creates a client authentication handle for passing "null"
47 * credentials and verifiers to remote systems.
49 * Copyright (C) 1984, Sun Microsystems, Inc.
52 #include "namespace.h"
57 #include <rpc/types.h>
62 __weak_alias(authnone_create
,_authnone_create
)
65 #define MAX_MARSHAL_SIZE 20
68 * Authenticator operations routines
71 static bool_t
authnone_marshal(AUTH
*, XDR
*);
72 static void authnone_verf(AUTH
*);
73 static bool_t
authnone_validate(AUTH
*, struct opaque_auth
*);
74 static bool_t
authnone_refresh(AUTH
*);
75 static void authnone_destroy(AUTH
*);
77 static const struct auth_ops ops
= {
85 static struct authnone_private
{
87 char marshalled_client
[MAX_MARSHAL_SIZE
];
94 struct authnone_private
*ap
= authnone_private
;
99 ap
= (struct authnone_private
*)calloc(1, sizeof (*ap
));
102 authnone_private
= ap
;
105 ap
->no_client
.ah_cred
= ap
->no_client
.ah_verf
= _null_auth
;
106 ap
->no_client
.ah_ops
= &ops
;
108 xdrmem_create(xdrs
, ap
->marshalled_client
,
109 (u_int
)MAX_MARSHAL_SIZE
, XDR_ENCODE
);
110 (void)xdr_opaque_auth(xdrs
, &ap
->no_client
.ah_cred
);
111 (void)xdr_opaque_auth(xdrs
, &ap
->no_client
.ah_verf
);
112 ap
->mcnt
= XDR_GETPOS(xdrs
);
115 return (&ap
->no_client
);
120 authnone_marshal(AUTH
*client
, XDR
*xdrs
)
122 struct authnone_private
*ap
= authnone_private
;
124 _DIAGASSERT(xdrs
!= NULL
);
128 return ((*xdrs
->x_ops
->x_putbytes
)(xdrs
,
129 ap
->marshalled_client
, ap
->mcnt
));
134 authnone_verf(AUTH
*client
)
140 authnone_validate(AUTH
*client
, struct opaque_auth
*auth
)
148 authnone_refresh(AUTH
*client
)
156 authnone_destroy(AUTH
*client
)