Home | History | Annotate | Line # | Download | only in xdm
      1 /*
      2 
      3 Copyright 1988, 1998  The Open Group
      4 
      5 Permission to use, copy, modify, distribute, and sell this software and its
      6 documentation for any purpose is hereby granted without fee, provided that
      7 the above copyright notice appear in all copies and that both that
      8 copyright notice and this permission notice appear in supporting
      9 documentation.
     10 
     11 The above copyright notice and this permission notice shall be included
     12 in all copies or substantial portions of the Software.
     13 
     14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
     15 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
     16 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
     17 IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
     18 OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
     19 ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
     20 OTHER DEALINGS IN THE SOFTWARE.
     21 
     22 Except as contained in this notice, the name of The Open Group shall
     23 not be used in advertising or otherwise to promote the sale, use or
     24 other dealings in this Software without prior written authorization
     25 from The Open Group.
     26 
     27 */
     28 
     29 /*
     30  * xdm - display manager daemon
     31  * Author:  Keith Packard, MIT X Consortium
     32  *
     33  * rpcauth
     34  *
     35  * generate SecureRPC authorization records
     36  */
     37 
     38 #include   <X11/Xos.h>
     39 #include   <rpc/rpc.h>
     40 #include   <rpc/key_prot.h>
     41 
     42 #include   "dm.h"
     43 #include   "dm_auth.h"
     44 #include   "dm_error.h"
     45 
     46 /*ARGSUSED*/
     47 void
     48 SecureRPCInitAuth (unsigned short name_len, char *name)
     49 {
     50 }
     51 
     52 Xauth *
     53 SecureRPCGetAuth (
     54     unsigned short  namelen,
     55     char	    *name)
     56 {
     57     char    key[MAXNETNAMELEN+1];
     58     Xauth   *new;
     59 
     60     new = malloc (sizeof *new);
     61     if (!new)
     62 	return (Xauth *) 0;
     63     new->family = FamilyWild;
     64     new->address_length = 0;
     65     new->address = 0;
     66     new->number_length = 0;
     67     new->number = 0;
     68 
     69     getnetname (key);
     70     Debug ("System netname %s\n", key);
     71     new->data_length = strlen(key);
     72     new->data = malloc (new->data_length);
     73     if (!new->data)
     74     {
     75 	free (new);
     76 	return (Xauth *) 0;
     77     }
     78     new->name = malloc (namelen);
     79     if (!new->name)
     80     {
     81 	free (new->data);
     82 	free (new);
     83 	return (Xauth *) 0;
     84     }
     85     memcpy(new->name, name, namelen);
     86     new->name_length = namelen;
     87     memcpy(new->data, key, new->data_length);
     88     return new;
     89 }
     90