123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125 |
- #define __FORCE_GLIBC__
- #include <features.h>
- #include <rpc/types.h>
- #include <rpc/xdr.h>
- #include <rpc/auth.h>
- #define MAX_MARSHEL_SIZE 20
- static void authnone_verf();
- static void authnone_destroy();
- static bool_t authnone_marshal();
- static bool_t authnone_validate();
- static bool_t authnone_refresh();
- static struct auth_ops ops = {
- authnone_verf,
- authnone_marshal,
- authnone_validate,
- authnone_refresh,
- authnone_destroy
- };
- static struct authnone_private {
- AUTH no_client;
- char marshalled_client[MAX_MARSHEL_SIZE];
- u_int mcnt;
- } *authnone_private;
- AUTH *authnone_create()
- {
- register struct authnone_private *ap = authnone_private;
- XDR xdr_stream;
- register XDR *xdrs;
- if (ap == 0) {
- ap = (struct authnone_private *) calloc(1, sizeof(*ap));
- if (ap == 0)
- return (0);
- authnone_private = ap;
- }
- if (!ap->mcnt) {
- ap->no_client.ah_cred = ap->no_client.ah_verf = _null_auth;
- ap->no_client.ah_ops = &ops;
- xdrs = &xdr_stream;
- xdrmem_create(xdrs, ap->marshalled_client,
- (u_int) MAX_MARSHEL_SIZE, XDR_ENCODE);
- (void) xdr_opaque_auth(xdrs, &ap->no_client.ah_cred);
- (void) xdr_opaque_auth(xdrs, &ap->no_client.ah_verf);
- ap->mcnt = XDR_GETPOS(xdrs);
- XDR_DESTROY(xdrs);
- }
- return (&ap->no_client);
- }
- static bool_t authnone_marshal(client, xdrs)
- AUTH *client;
- XDR *xdrs;
- {
- register struct authnone_private *ap = authnone_private;
- if (ap == 0)
- return (0);
- return ((*xdrs->x_ops->x_putbytes) (xdrs,
- ap->marshalled_client, ap->mcnt));
- }
- static void authnone_verf()
- {
- }
- static bool_t authnone_validate()
- {
- return (TRUE);
- }
- static bool_t authnone_refresh()
- {
- return (FALSE);
- }
- static void authnone_destroy()
- {
- }
|