The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/rpc/auth_none.c

Version: -  FREEBSD  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-2  -  FREEBSD-11-1  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-4  -  FREEBSD-10-3  -  FREEBSD-10-2  -  FREEBSD-10-1  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-3  -  FREEBSD-9-2  -  FREEBSD-9-1  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-4  -  FREEBSD-8-3  -  FREEBSD-8-2  -  FREEBSD-8-1  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-4  -  FREEBSD-7-3  -  FREEBSD-7-2  -  FREEBSD-7-1  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-4  -  FREEBSD-6-3  -  FREEBSD-6-2  -  FREEBSD-6-1  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-5  -  FREEBSD-5-4  -  FREEBSD-5-3  -  FREEBSD-5-2  -  FREEBSD-5-1  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  linux-2.6  -  linux-2.4.22  -  MK83  -  MK84  -  PLAN9  -  DFBSD  -  NETBSD  -  NETBSD5  -  NETBSD4  -  NETBSD3  -  NETBSD20  -  OPENBSD  -  xnu-517  -  xnu-792  -  xnu-792.6.70  -  xnu-1228  -  xnu-1456.1.26  -  xnu-1699.24.8  -  xnu-2050.18.24  -  OPENSOLARIS  -  minix-3-1-1 
SearchContext: -  none  -  3  -  10 

    1 /*      $NetBSD: auth_none.c,v 1.13 2000/01/22 22:19:17 mycroft Exp $   */
    2 
    3 /*-
    4  * Copyright (c) 2009, Sun Microsystems, Inc.
    5  * All rights reserved.
    6  *
    7  * Redistribution and use in source and binary forms, with or without 
    8  * modification, are permitted provided that the following conditions are met:
    9  * - Redistributions of source code must retain the above copyright notice, 
   10  *   this list of conditions and the following disclaimer.
   11  * - Redistributions in binary form must reproduce the above copyright notice, 
   12  *   this list of conditions and the following disclaimer in the documentation 
   13  *   and/or other materials provided with the distribution.
   14  * - Neither the name of Sun Microsystems, Inc. nor the names of its 
   15  *   contributors may be used to endorse or promote products derived 
   16  *   from this software without specific prior written permission.
   17  * 
   18  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 
   19  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 
   20  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 
   21  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 
   22  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
   23  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
   24  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
   25  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
   26  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
   27  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
   28  * POSSIBILITY OF SUCH DAMAGE.
   29  */
   30 
   31 #if defined(LIBC_SCCS) && !defined(lint)
   32 static char *sccsid2 = "@(#)auth_none.c 1.19 87/08/11 Copyr 1984 Sun Micro";
   33 static char *sccsid = "@(#)auth_none.c  2.1 88/07/29 4.0 RPCSRC";
   34 #endif
   35 #include <sys/cdefs.h>
   36 __FBSDID("$FreeBSD: releng/10.2/sys/rpc/auth_none.c 261046 2014-01-22 23:45:27Z mav $");
   37 
   38 /*
   39  * auth_none.c
   40  * Creates a client authentication handle for passing "null"
   41  * credentials and verifiers to remote systems.
   42  *
   43  * Copyright (C) 1984, Sun Microsystems, Inc.
   44  */
   45 
   46 #include <sys/param.h>
   47 #include <sys/systm.h>
   48 #include <sys/kernel.h>
   49 #include <sys/lock.h>
   50 #include <sys/malloc.h>
   51 #include <sys/mutex.h>
   52 
   53 #include <rpc/types.h>
   54 #include <rpc/xdr.h>
   55 #include <rpc/auth.h>
   56 #include <rpc/clnt.h>
   57 
   58 #define MAX_MARSHAL_SIZE 20
   59 
   60 /*
   61  * Authenticator operations routines
   62  */
   63 
   64 static bool_t authnone_marshal (AUTH *, uint32_t, XDR *, struct mbuf *);
   65 static void authnone_verf (AUTH *);
   66 static bool_t authnone_validate (AUTH *, uint32_t, struct opaque_auth *,
   67     struct mbuf **);
   68 static bool_t authnone_refresh (AUTH *, void *);
   69 static void authnone_destroy (AUTH *);
   70 
   71 static struct auth_ops authnone_ops = {
   72         .ah_nextverf =          authnone_verf,
   73         .ah_marshal =           authnone_marshal,
   74         .ah_validate =          authnone_validate,
   75         .ah_refresh =           authnone_refresh,
   76         .ah_destroy =           authnone_destroy,
   77 };
   78 
   79 struct authnone_private {
   80         AUTH    no_client;
   81         char    mclient[MAX_MARSHAL_SIZE];
   82         u_int   mcnt;
   83 };
   84 
   85 static struct authnone_private authnone_private;
   86 
   87 static void
   88 authnone_init(void *dummy)
   89 {
   90         struct authnone_private *ap = &authnone_private;
   91         XDR xdrs;
   92 
   93         ap->no_client.ah_cred = ap->no_client.ah_verf = _null_auth;
   94         ap->no_client.ah_ops = &authnone_ops;
   95         xdrmem_create(&xdrs, ap->mclient, MAX_MARSHAL_SIZE, XDR_ENCODE);
   96         xdr_opaque_auth(&xdrs, &ap->no_client.ah_cred);
   97         xdr_opaque_auth(&xdrs, &ap->no_client.ah_verf);
   98         ap->mcnt = XDR_GETPOS(&xdrs);
   99         XDR_DESTROY(&xdrs);
  100 }
  101 SYSINIT(authnone_init, SI_SUB_KMEM, SI_ORDER_ANY, authnone_init, NULL);
  102 
  103 AUTH *
  104 authnone_create()
  105 {
  106         struct authnone_private *ap = &authnone_private;
  107 
  108         return (&ap->no_client);
  109 }
  110 
  111 /*ARGSUSED*/
  112 static bool_t
  113 authnone_marshal(AUTH *client, uint32_t xid, XDR *xdrs, struct mbuf *args)
  114 {
  115         struct authnone_private *ap = &authnone_private;
  116 
  117         KASSERT(xdrs != NULL, ("authnone_marshal: xdrs is null"));
  118 
  119         if (!XDR_PUTBYTES(xdrs, ap->mclient, ap->mcnt))
  120                 return (FALSE);
  121 
  122         xdrmbuf_append(xdrs, args);
  123 
  124         return (TRUE);
  125 }
  126 
  127 /* All these unused parameters are required to keep ANSI-C from grumbling */
  128 /*ARGSUSED*/
  129 static void
  130 authnone_verf(AUTH *client)
  131 {
  132 }
  133 
  134 /*ARGSUSED*/
  135 static bool_t
  136 authnone_validate(AUTH *client, uint32_t xid, struct opaque_auth *opaque,
  137     struct mbuf **mrepp)
  138 {
  139 
  140         return (TRUE);
  141 }
  142 
  143 /*ARGSUSED*/
  144 static bool_t
  145 authnone_refresh(AUTH *client, void *dummy)
  146 {
  147 
  148         return (FALSE);
  149 }
  150 
  151 /*ARGSUSED*/
  152 static void
  153 authnone_destroy(AUTH *client)
  154 {
  155 }

Cache object: 0859c16f93700e64737f9e29ef18be14


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.