1274f7445SRobert Watson /*-
2274f7445SRobert Watson * Copyright (c) 2001 Robert N. M. Watson
3274f7445SRobert Watson * All rights reserved.
4274f7445SRobert Watson *
5274f7445SRobert Watson * Redistribution and use in source and binary forms, with or without
6274f7445SRobert Watson * modification, are permitted provided that the following conditions
7274f7445SRobert Watson * are met:
8274f7445SRobert Watson * 1. Redistributions of source code must retain the above copyright
9274f7445SRobert Watson * notice, this list of conditions and the following disclaimer.
10274f7445SRobert Watson * 2. Redistributions in binary form must reproduce the above copyright
11274f7445SRobert Watson * notice, this list of conditions and the following disclaimer in the
12274f7445SRobert Watson * documentation and/or other materials provided with the distribution.
13274f7445SRobert Watson *
14274f7445SRobert Watson * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15274f7445SRobert Watson * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16274f7445SRobert Watson * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17274f7445SRobert Watson * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18274f7445SRobert Watson * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19274f7445SRobert Watson * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20274f7445SRobert Watson * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21274f7445SRobert Watson * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22274f7445SRobert Watson * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23274f7445SRobert Watson * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24274f7445SRobert Watson * SUCH DAMAGE.
25274f7445SRobert Watson */
26274f7445SRobert Watson
27274f7445SRobert Watson #include <sys/types.h>
28274f7445SRobert Watson
29274f7445SRobert Watson #include <stdio.h>
30274f7445SRobert Watson #include <unistd.h>
31274f7445SRobert Watson
32274f7445SRobert Watson #include "scenario.h"
33274f7445SRobert Watson
34274f7445SRobert Watson int
main(int argc,char * argv[])35274f7445SRobert Watson main(int argc, char *argv[])
36274f7445SRobert Watson {
37274f7445SRobert Watson int error;
38274f7445SRobert Watson
39274f7445SRobert Watson fprintf(stderr, "test capabilities: ");
40274f7445SRobert Watson #ifdef SETSUGID_SUPPORTED
41274f7445SRobert Watson fprintf(stderr, "[SETSUGID_SUPPORTED] ");
42274f7445SRobert Watson #endif
43274f7445SRobert Watson #ifdef SETSUGID_SUPPORTED_BUT_NO_LIBC_STUB
44274f7445SRobert Watson fprintf(stderr, "[SETSUGID_SUPPORTED_BUT_NO_LIBC_STUB] ");
45274f7445SRobert Watson #endif
46274f7445SRobert Watson #ifdef CHECK_CRED_SET
47274f7445SRobert Watson fprintf(stderr, "[CHECK_CRED_SET] ");
48274f7445SRobert Watson #endif
49274f7445SRobert Watson fprintf(stderr, "\n");
50274f7445SRobert Watson
51274f7445SRobert Watson error = setugid(1);
52274f7445SRobert Watson if (error) {
53274f7445SRobert Watson perror("setugid");
54274f7445SRobert Watson fprintf(stderr,
55274f7445SRobert Watson "This test suite requires options REGRESSION\n");
56274f7445SRobert Watson return (-1);
57274f7445SRobert Watson }
58274f7445SRobert Watson
59274f7445SRobert Watson enact_scenarios();
60274f7445SRobert Watson
61274f7445SRobert Watson return (0);
62274f7445SRobert Watson }
63274f7445SRobert Watson
64