add more spacing
[personal-kdebase.git] / workspace / kdm / backend / rpcauth.c
blobcd02b988e159938a17e8f939e19129b275a79774
1 /*
3 Copyright 1988, 1998 The Open Group
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.
11 The above copyright notice and this permission notice shall be included
12 in all copies or substantial portions of the Software.
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 COPYRIGHT HOLDERS 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.
22 Except as contained in this notice, the name of a copyright holder 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 copyright holder.
30 * xdm - display manager daemon
31 * Author: Keith Packard, MIT X Consortium
33 * generate SecureRPC authorization records
36 #include "dm.h"
37 #include "dm_auth.h"
38 #include "dm_error.h"
40 #include <rpc/rpc.h>
41 #include <rpc/key_prot.h>
43 /*ARGSUSED*/
44 void
45 secureRPCInitAuth( unsigned short name_len ATTR_UNUSED,
46 const char *name ATTR_UNUSED )
50 Xauth *
51 secureRPCGetAuth( unsigned short namelen, const char *name )
53 Xauth *new;
54 char key[MAXNETNAMELEN+1];
56 new = (Xauth *)Malloc( sizeof(*new) );
57 if (!new)
58 return (Xauth *)0;
59 new->family = FamilyWild;
60 new->address_length = 0;
61 new->address = 0;
62 new->number_length = 0;
63 new->number = 0;
65 getnetname( key );
66 debug( "system netname %s\n", key );
67 new->data_length = strlen( key );
68 new->data = (char *)Malloc( new->data_length );
69 if (!new->data) {
70 free( (char *)new );
71 return (Xauth *)0;
73 new->name = (char *)Malloc( namelen );
74 if (!new->name) {
75 free( (char *)new->data );
76 free( (char *)new );
77 return (Xauth *)0;
79 memmove( new->name, name, namelen );
80 new->name_length = namelen;
81 memmove( new->data, key, new->data_length );
82 return new;