home *** CD-ROM | disk | FTP | other *** search
/ Gold Fish 3 / goldfish_volume_3.bin / files / comm / tcp / amitcp-sdk / src / rpclib / auth_none.c next >
Encoding:
C/C++ Source or Header  |  1994-09-29  |  2.4 KB  |  112 lines

  1. /*
  2.  *      $Id: auth_none.c,v 4.2 1994/09/29 23:48:50 jraja Exp $
  3.  *
  4.  *      Creates a client authentication handle for passing "null" 
  5.  *      credentials and verifiers to remote systems. 
  6.  *      
  7.  *      Copyright © 1994 AmiTCP/IP Group,
  8.  *                       Network Solutions Development Inc.
  9.  *                       All rights reserved. 
  10.  */
  11.  
  12. /* @(#)auth_none.c    2.1 88/07/29 4.0 RPCSRC */
  13. #if !defined(lint) && defined(SCCSIDS)
  14. static char sccsid[] = "@(#)auth_none.c 1.19 87/08/11 Copyr 1984 Sun Micro";
  15. #endif
  16.  
  17. /*
  18.  * Copyright (C) 1984, Sun Microsystems, Inc. 
  19.  */
  20.  
  21. #include <sys/param.h>
  22. #include <rpc/types.h>
  23. #include <rpc/xdr.h>
  24. #include <rpc/auth.h>
  25. #define MAX_MARSHEL_SIZE 20
  26.  
  27. /*
  28.  * Authenticator operations routines
  29.  */
  30. static void    authnone_verf(AUTH *);
  31. static bool_t    authnone_marshal(AUTH * client, XDR * xdrs);
  32. static bool_t    authnone_validate(AUTH *, struct opaque_auth *);
  33. static bool_t    authnone_refresh(AUTH *);
  34. static void    authnone_destroy(AUTH *);
  35.  
  36. static struct auth_ops ops = {
  37.     authnone_verf,
  38.     authnone_marshal,
  39.     authnone_validate,
  40.     authnone_refresh,
  41.     authnone_destroy
  42. };
  43.  
  44. static struct authnone_private {
  45.     AUTH    no_client;
  46.     char    marshalled_client[MAX_MARSHEL_SIZE];
  47.     u_int    mcnt;
  48. } *authnone_private;
  49.  
  50. AUTH *
  51. authnone_create()
  52. {
  53.     register struct authnone_private *ap = authnone_private;
  54.     XDR xdr_stream;
  55.     register XDR *xdrs;
  56.  
  57.     if (ap == 0) {
  58.         ap = (struct authnone_private *)mem_calloc(1, sizeof (*ap));
  59.         if (ap == 0)
  60.             return (0);
  61.         authnone_private = ap;
  62.     }
  63.     if (!ap->mcnt) {
  64.         ap->no_client.ah_cred = ap->no_client.ah_verf = _null_auth;
  65.         ap->no_client.ah_ops = &ops;
  66.         xdrs = &xdr_stream;
  67.         xdrmem_create(xdrs, ap->marshalled_client, (u_int)MAX_MARSHEL_SIZE,
  68.             XDR_ENCODE);
  69.         (void)xdr_opaque_auth(xdrs, &ap->no_client.ah_cred);
  70.         (void)xdr_opaque_auth(xdrs, &ap->no_client.ah_verf);
  71.         ap->mcnt = XDR_GETPOS(xdrs);
  72.         XDR_DESTROY(xdrs);
  73.     }
  74.     return (&ap->no_client);
  75. }
  76.  
  77. /*ARGSUSED*/
  78. static bool_t
  79. authnone_marshal(client, xdrs)
  80.     AUTH *client;
  81.     XDR *xdrs;
  82. {
  83.     register struct authnone_private *ap = authnone_private;
  84.  
  85.     if (ap == 0)
  86.         return (0);
  87.     return ((*xdrs->x_ops->x_putbytes)(xdrs,
  88.         ap->marshalled_client, ap->mcnt));
  89. }
  90.  
  91. static void 
  92. authnone_verf(AUTH *client)
  93. {
  94. }
  95.  
  96. static bool_t
  97. authnone_validate(AUTH *client, struct opaque_auth *verfp)
  98. {
  99.     return (TRUE);
  100. }
  101.  
  102. static bool_t
  103. authnone_refresh(AUTH * client)
  104. {
  105.     return (FALSE);
  106. }
  107.  
  108. static void
  109. authnone_destroy(AUTH * client)
  110. {
  111. }
  112.