OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [linux/] [uClibc/] [libc/] [inet/] [rpc/] [auth_none.c] - Blame information for rev 1325

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1325 phoenix
/*
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
 * Copyright (C) 1984, Sun Microsystems, Inc.
31
 */
32
/*
33
 * auth_none.c
34
 * Creates a client authentication handle for passing "null"
35
 * credentials and verifiers to remote systems.
36
 */
37
 
38
#define __FORCE_GLIBC
39
#include <features.h>
40
#include "rpc_private.h"
41
 
42
#define MAX_MARSHEL_SIZE 20
43
 
44
/*
45
 * Authenticator operations routines
46
 */
47
static void authnone_verf (AUTH *);
48
static void authnone_destroy (AUTH *);
49
static bool_t authnone_marshal (AUTH *, XDR *);
50
static bool_t authnone_validate (AUTH *, struct opaque_auth *);
51
static bool_t authnone_refresh (AUTH *);
52
 
53
static struct auth_ops ops = {
54
  authnone_verf,
55
  authnone_marshal,
56
  authnone_validate,
57
  authnone_refresh,
58
  authnone_destroy
59
};
60
 
61
struct authnone_private_s {
62
  AUTH no_client;
63
  char marshalled_client[MAX_MARSHEL_SIZE];
64
  u_int mcnt;
65
};
66
#ifdef __UCLIBC_HAS_THREADS__
67
#define authnone_private ((struct authnone_private_s *)RPC_THREAD_VARIABLE(authnone_private_s))
68
#else
69
static struct authnone_private_s *authnone_private;
70
#endif
71
 
72
AUTH *
73
authnone_create (void)
74
{
75
  struct authnone_private_s *ap;
76
  XDR xdr_stream;
77
  XDR *xdrs;
78
 
79
  ap = (struct authnone_private_s *) authnone_private;
80
  if (ap == NULL)
81
    {
82
      ap = (struct authnone_private_s *) calloc (1, sizeof (*ap));
83
      if (ap == NULL)
84
        return NULL;
85
      authnone_private = ap;
86
    }
87
  if (!ap->mcnt)
88
    {
89
      ap->no_client.ah_cred = ap->no_client.ah_verf = _null_auth;
90
      ap->no_client.ah_ops = &ops;
91
      xdrs = &xdr_stream;
92
      xdrmem_create (xdrs, ap->marshalled_client, (u_int) MAX_MARSHEL_SIZE,
93
                     XDR_ENCODE);
94
      (void) xdr_opaque_auth (xdrs, &ap->no_client.ah_cred);
95
      (void) xdr_opaque_auth (xdrs, &ap->no_client.ah_verf);
96
      ap->mcnt = XDR_GETPOS (xdrs);
97
      XDR_DESTROY (xdrs);
98
    }
99
  return (&ap->no_client);
100
}
101
 
102
/*ARGSUSED */
103
static bool_t
104
authnone_marshal (AUTH *client, XDR *xdrs)
105
{
106
  struct authnone_private_s *ap;
107
 
108
  ap = (struct authnone_private_s *) authnone_private;
109
  if (ap == NULL)
110
    return FALSE;
111
  return (*xdrs->x_ops->x_putbytes) (xdrs, ap->marshalled_client, ap->mcnt);
112
}
113
 
114
static void
115
authnone_verf (AUTH *auth)
116
{
117
}
118
 
119
static bool_t
120
authnone_validate (AUTH *auth, struct opaque_auth *oa)
121
{
122
  return TRUE;
123
}
124
 
125
static bool_t
126
authnone_refresh (AUTH *auth)
127
{
128
  return FALSE;
129
}
130
 
131
static void
132
authnone_destroy (AUTH *auth)
133
{
134
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.