summaryrefslogtreecommitdiff
path: root/xc/test/xsuite/xtest/tset/CH07/dsblaccssc/dsblaccssc.m
blob: e882401a759d39539ba42805ecdc85ba4e3c589d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
/*
 * Copyright 1990, 1991 by the Massachusetts Institute of Technology and
 * UniSoft Group Limited.
 * 
 * Permission to use, copy, modify, distribute, and sell this software and
 * its documentation for any purpose is hereby granted without fee,
 * provided that the above copyright notice appear in all copies and that
 * both that copyright notice and this permission notice appear in
 * supporting documentation, and that the names of MIT and UniSoft not be
 * used in advertising or publicity pertaining to distribution of the
 * software without specific, written prior permission.  MIT and UniSoft
 * make no representations about the suitability of this software for any
 * purpose.  It is provided "as is" without express or implied warranty.
 *
 * $XConsortium$
 */
>>TITLE XDisableAccessControl CH07
void

Display	*display = Dsp;
>>ASSERTION Good B 1
A call to xname
disables the use of the access control list at each connection setup.
>>STRATEGY
Get current host list.
Attempt to remove all hosts from list.
If this fails with BadAccess:
  Report that this host does not have permission to do this.
  (Will not have permission for the next part either).
  Result is untested.
Disable access control with xname.
Verify that state returned by XListHosts is DisableAccess.
Verify that a new connection can be made.
>>CODE
XHostAddress	*oldhosts;
XHostAddress	*list;
Display	*newclient;
int 	nhosts;
int 	njunk;
Bool	state;

	oldhosts = XListHosts(display, &nhosts, &state);

	CATCH_ERROR(display);
	XRemoveHosts(display, oldhosts, nhosts);
	RESTORE_ERROR(display);

	if (GET_ERROR(display) == BadAccess) {
		report("The client does not have permission to disable the acl");
		untested("  so this assertion cannot be tested.");
		return;
	}

	XCALL;

	list = XListHosts(display, &njunk, &state);
	if (state == DisableAccess)
		CHECK;
	else {
		report("Access control state was not DisableAccess (was %d)", state);
		FAIL;
	}

	newclient = XOpenDisplay(config.display);
	if (newclient != (Display*)0)
		CHECK;
	else {
		report("Connections could not be made to host");
		FAIL;
	}

	CHECKPASS(2);

	CATCH_ERROR(display);
	XAddHosts(display, oldhosts, nhosts);
	XSetAccessControl(display, state);
	RESTORE_ERROR(display);
	XFree((char*)oldhosts);
	XFree((char*)list);

>>ASSERTION Good B 1
When an attempt is made to disable the use of the access control list
from a client that is not authorised in a server-dependent way
to do so, then a
.S BadAccess
error occurs.
>>STRATEGY
Call xname.
If error occurs.
  If error is BadAccess
	Report Pass.
  else
	Report Fail.
else
  Report client is authorised.
  Result is untested.
>>CODE

>>SET no-error-status-check
	XCALL;

	if (geterr() != Success) {
		if (geterr() == BadAccess)
			PASS;
		else {
			report("Expecting BadAccess, was %s", errorname(geterr()));
			FAIL;
		}
	} else {
		untested("This client is authorised to disable the access list");
		untested("  so the assertion cannot be tested");
	}