2 * CDE - Common Desktop Environment
4 * Copyright (c) 1993-2012, The Open Group. All rights reserved.
6 * These libraries and programs are free software; you can
7 * redistribute them and/or modify them under the terms of the GNU
8 * Lesser General Public License as published by the Free Software
9 * Foundation; either version 2 of the License, or (at your option)
12 * These libraries and programs are distributed in the hope that
13 * they will be useful, but WITHOUT ANY WARRANTY; without even the
14 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU Lesser General Public License for more
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with these librararies and programs; if not, write
20 * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21 * Floor, Boston, MA 02110-1301 USA
23 /* $TOG: mitauth.c /main/7 1997/03/25 12:03:56 barstow $ */
24 /* (c) Copyright 1997 The Open Group */
26 * (c) Copyright 1993, 1994 Hewlett-Packard Company *
27 * (c) Copyright 1993, 1994 International Business Machines Corp. *
28 * (c) Copyright 1993, 1994 Sun Microsystems, Inc. *
29 * (c) Copyright 1993, 1994 Novell, Inc. *
38 * Revision 1.1.2.2 1995/04/21 13:05:26 Peter_Derr
39 * dtlogin auth key fixes from deltacde
40 * [1995/04/12 19:21:06 Peter_Derr]
42 * R6 xdm code with minor changes used in dtlogin to handle multiple
44 * [1995/04/12 18:05:42 Peter_Derr]
50 Copyright (c) 1988 X Consortium
52 Permission is hereby granted, free of charge, to any person obtaining
53 a copy of this software and associated documentation files (the
54 "Software"), to deal in the Software without restriction, including
55 without limitation the rights to use, copy, modify, merge, publish,
56 distribute, sublicense, and/or sell copies of the Software, and to
57 permit persons to whom the Software is furnished to do so, subject to
58 the following conditions:
60 The above copyright notice and this permission notice shall be included
61 in all copies or substantial portions of the Software.
63 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
64 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
65 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
66 IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR
67 OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
68 ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
69 OTHER DEALINGS IN THE SOFTWARE.
71 Except as contained in this notice, the name of the X Consortium shall
72 not be used in advertising or otherwise to promote the sale, use or
73 other dealings in this Software without prior written authorization
74 from the X Consortium.
79 * xdm - display manager daemon
80 * Author: Keith Packard, MIT X Consortium
84 * generate authorization keys
85 * for MIT-MAGIC-COOKIE-1 type authorization
91 # define AUTH_DATA_LEN 16 /* bytes of authorization data */
92 static char auth_name[256];
93 static int auth_name_len;
95 int MitInitAuth (name_len, name)
96 #if NeedWidePrototypes
97 unsigned int name_len;
99 unsigned short name_len;
100 #endif /* NeedWidePrototypes */
105 auth_name_len = name_len;
106 memmove( auth_name, name, name_len);
111 MitGetAuth (namelen, name)
112 #if NeedWidePrototypes
113 unsigned int namelen;
115 unsigned short namelen;
116 #endif /* NeedWidePrototypes */
120 new = (Xauth *) malloc (sizeof (Xauth));
124 new->family = FamilyWild;
125 new->address_length = 0;
127 new->number_length = 0;
130 new->data = (char *) malloc (AUTH_DATA_LEN);
136 new->name = (char *) malloc (namelen);
139 free ((char *) new->data);
143 memmove( (char *)new->name, name, namelen);
144 new->name_length = namelen;
145 GenerateAuthData (new->data, AUTH_DATA_LEN);
146 new->data_length = AUTH_DATA_LEN;