home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / X / mit / clients / xdm / rpcauth.c < prev    next >
Encoding:
C/C++ Source or Header  |  1991-07-18  |  1.9 KB  |  77 lines

  1. /*
  2.  * xdm - display manager daemon
  3.  *
  4.  * $XConsortium: rpcauth.c,v 1.2 91/07/18 18:55:01 rws Exp $
  5.  *
  6.  * Copyright 1988 Massachusetts Institute of Technology
  7.  *
  8.  * Permission to use, copy, modify, and distribute this software and its
  9.  * documentation for any purpose and without fee is hereby granted, provided
  10.  * that the above copyright notice appear in all copies and that both that
  11.  * copyright notice and this permission notice appear in supporting
  12.  * documentation, and that the name of M.I.T. not be used in advertising or
  13.  * publicity pertaining to distribution of the software without specific,
  14.  * written prior permission.  M.I.T. makes no representations about the
  15.  * suitability of this software for any purpose.  It is provided "as is"
  16.  * without express or implied warranty.
  17.  *
  18.  * Author:  Keith Packard, MIT X Consortium
  19.  */
  20.  
  21. /*
  22.  * rpcauth
  23.  *
  24.  * generate SecureRPC authorization records
  25.  */
  26.  
  27. # include   <X11/Xos.h>
  28. # include   <rpc/rpc.h>
  29. # include   <rpc/key_prot.h>
  30. # include   "dm.h"
  31.  
  32. /*ARGSUSED*/
  33. SecureRPCInitAuth (name_len, name)
  34.     unsigned short  name_len;
  35.     char        *name;
  36. {
  37. }
  38.  
  39. Xauth *
  40. SecureRPCGetAuth (namelen, name)
  41.     unsigned short  namelen;
  42.     char        *name;
  43. {
  44.     char    key[MAXNETNAMELEN+1];
  45.     Xauth   *new;
  46.  
  47.     new = (Xauth *) malloc (sizeof *new);
  48.     if (!new)
  49.     return (Xauth *) 0;
  50.     new->family = FamilyWild;
  51.     new->address_length = 0;
  52.     new->address = 0;
  53.     new->number_length = 0;
  54.     new->number = 0;
  55.  
  56.     getnetname (key);
  57.     Debug ("System netname %s\n", key);
  58.     new->data_length = strlen(key);
  59.     new->data = (char *) malloc (new->data_length);
  60.     if (!new->data)
  61.     {
  62.     free ((char *) new);
  63.     return (Xauth *) 0;
  64.     }
  65.     new->name = (char *) malloc (namelen);
  66.     if (!new->name)
  67.     {
  68.     free ((char *) new->data);
  69.     free ((char *) new);
  70.     return (Xauth *) 0;
  71.     }
  72.     bcopy (name, new->name, namelen);
  73.     new->name_length = namelen;
  74.     bcopy (key, new->data, new->data_length);
  75.     return new;
  76. }
  77.