|
|
1.1 root 1: /***********************************************************
2: Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts,
3: and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
4:
5: All Rights Reserved
6:
7: Permission to use, copy, modify, and distribute this software and its
8: documentation for any purpose and without fee is hereby granted,
9: provided that the above copyright notice appear in all copies and that
10: both that copyright notice and this permission notice appear in
11: supporting documentation, and that the names of Digital or MIT not be
12: used in advertising or publicity pertaining to distribution of the
13: software without specific, written prior permission.
14:
15: DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
16: ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
17: DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
18: ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
19: WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
20: ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
21: SOFTWARE.
22:
23: ******************************************************************/
24:
25: /* $Header: access.c,v 1.18 87/09/03 14:24:02 toddb Exp $ */
26:
27: #include "X.h"
28: #include "Xproto.h"
29: #include "misc.h"
30: #include <errno.h>
31: #undef NULL
32: #include <stdio.h>
33: #include "dixstruct.h"
34: #include "osdep.h"
35:
36:
37: typedef struct _host {
38: short family;
39: short len;
40: unsigned char addr[4]; /* will need to be bigger eventually */
41: struct _host *next;
42: } HOST;
43:
44: static HOST *selfhosts = NULL;
45: static HOST *validhosts = NULL;
46: static int AccessEnabled = TRUE;
47:
48: /* Define this host for access control. Find all the hosts the OS knows about
49: * for this fd and add them to the selfhosts list.
50: */
51: DefineSelf (fd)
52: int fd;
53: {}
54:
55: /* Reset access control list to initial hosts */
56: ResetHosts (display)
57: char *display;
58: {}
59:
60: /* Add a host to the access control list. This is the external interface
61: * called from the dispatcher */
62:
63: int
64: AddHost (client, family, length, pAddr)
65: int client;
66: int family;
67: int length; /* of bytes in pAddr */
68: pointer pAddr;
69: {}
70:
71: /* Add a host to the access control list. This is the internal interface
72: * called when starting or resetting the server */
73: NewHost (family, addr)
74: short family;
75: pointer addr;
76: {}
77:
78: /* Remove a host from the access control list */
79:
80: int
81: RemoveHost (client, family, length, pAddr)
82: int client;
83: int family;
84: int length; /* of bytes in pAddr */
85: pointer pAddr;
86: {}
87:
88: /* Get all hosts in the access control list */
89: int
90: GetHosts (data, pnHosts, pEnabled)
91: pointer *data;
92: int *pnHosts;
93: BOOL *pEnabled;
94: {
95: *pEnabled = AccessEnabled ? EnableAccess : DisableAccess;
96: *pnHosts = 0;
97: return (0);
98: }
99:
100: ChangeAccessControl(client, fEnabled)
101: ClientPtr client;
102: int fEnabled;
103: {}
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.