summaryrefslogtreecommitdiffstats
path: root/domount.c
blob: da85d215cf694dd0b7929184b300a9418c207e9b (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
/*
 *      @(#)domount.c	1.2 97/01/03 Connectathon testsuite
 *	1.1 Lachman ONC Test Suite source
 *
 * domount [-u] [args]
 *
 * NOTE: This program should be suid root to work properly.
 */

#include <stdio.h>
#ifdef LINUX
#include <stdlib.h>
#endif

main(argc, argv)
	int argc;
	char **argv;
{
	char *comm;
	extern char *getenv();

	if (argc > 1 && strcmp(argv[1], "-u") == 0) {
		if ((comm = getenv("UMOUNT")) != NULL)
			*++argv = comm;
		else
			*++argv = "/etc/umount";
	} else {
		if ((comm = getenv("MOUNT")) != NULL)
			*argv = comm;
		else
			*argv = "/etc/mount";
	}

	(void)setuid(0);

	(void)execv(*argv, argv);

	exit(1);
	/* NOTREACHED */
}