home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / unix / volume6 / rpc2 / part06 / rpc / rpclib / auth_none.c next >
Encoding:
C/C++ Source or Header  |  1986-11-30  |  2.8 KB  |  121 lines

  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. #ifndef lint
  30. static char sccsid[] = "@(#)auth_none.c 1.1 86/02/03 Copyr 1984 Sun Micro";
  31. #endif
  32.  
  33. /*
  34.  * auth_none.c
  35.  * Creates a client authentication handle for passing "null" 
  36.  * credentials and verifiers to remote systems. 
  37.  * 
  38.  * Copyright (C) 1984, Sun Microsystems, Inc. 
  39.  */
  40.  
  41. #include "types.h"
  42. #include "xdr.h"
  43. #include "auth.h"
  44. #define NULL ((caddr_t)0)
  45. #define MAX_MARSHEL_SIZE 20
  46.  
  47. /*
  48.  * Authenticator operations routines
  49.  */
  50. static void    authnone_verf();
  51. static void    authnone_destroy();
  52. static bool_t    authnone_marshal();
  53. static bool_t    authnone_validate();
  54. static bool_t    authnone_refresh();
  55.  
  56. static struct auth_ops ops = {
  57.     authnone_verf,
  58.     authnone_marshal,
  59.     authnone_validate,
  60.     authnone_refresh,
  61.     authnone_destroy
  62. };
  63.  
  64. static AUTH    no_client;
  65. static char    marshalled_client[MAX_MARSHEL_SIZE];
  66. static u_int    mcnt;
  67.  
  68. AUTH *
  69. authnone_create()
  70. {
  71.     XDR xdr_stream;
  72.     register XDR *xdrs;
  73.  
  74.     if (! mcnt) {
  75.         no_client.ah_cred = no_client.ah_verf = _null_auth;
  76.         no_client.ah_ops = &ops;
  77.         xdrs = &xdr_stream;
  78.         xdrmem_create(xdrs, marshalled_client, (u_int)MAX_MARSHEL_SIZE,
  79.             XDR_ENCODE);
  80.         (void)xdr_opaque_auth(xdrs, &no_client.ah_cred);
  81.         (void)xdr_opaque_auth(xdrs, &no_client.ah_verf);
  82.         mcnt = XDR_GETPOS(xdrs);
  83.         XDR_DESTROY(xdrs);
  84.     }
  85.     return (&no_client);
  86. }
  87.  
  88. /*ARGSUSED*/
  89. static bool_t
  90. authnone_marshal(client, xdrs)
  91.     AUTH *client;
  92.     XDR *xdrs;
  93. {
  94.  
  95.     return ((*xdrs->x_ops->x_putbytes)(xdrs, marshalled_client, mcnt));
  96. }
  97.  
  98. static void 
  99. authnone_verf()
  100. {
  101. }
  102.  
  103. static bool_t
  104. authnone_validate()
  105. {
  106.  
  107.     return (TRUE);
  108. }
  109.  
  110. static bool_t
  111. authnone_refresh()
  112. {
  113.  
  114.     return (FALSE);
  115. }
  116.  
  117. static void
  118. authnone_destroy()
  119. {
  120. }
  121.