summaryrefslogtreecommitdiff
path: root/open-vm-tools/vmware-user-suid-wrapper/wrapper.h
blob: 21dd4ab02d9483e28e0190b0e9be77896287a26c (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
/*********************************************************
 * Copyright (C) 2007-2015 VMware, Inc. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as published
 * by the Free Software Foundation version 2.1 and no later version.
 *
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
 * or FITNESS FOR A PARTICULAR PURPOSE.  See the Lesser GNU General Public
 * License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program; if not, write to the Free Software Foundation, Inc.,
 * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA.
 *
 *********************************************************/

/*
 * wrapper.h --
 *
 *      Platform independent definitions for the VMware User Agent setuid
 *      wrapper.
 */

#ifndef _WRAPPER_H_
#define _WRAPPER_H_

#include <sys/types.h>

#include <stdio.h>

#include "vm_basic_types.h"
#include "vmblock.h"

#define progname                "vmware-user"
#define Error(fmt, args...)     fprintf(stderr, "%s: " fmt, progname, ##args);


/*
 * XXX Document official VMware Tools releases vs. Open VM Tools and the
 * use of the locations database in the former vs. compile-time pathing
 * in the latter.
 */
#ifdef USES_LOCATIONS_DB
#   define LOCATIONS_PATH       "/etc/vmware-tools/locations"

/*
 * Locations DB query selector.  Values in this enum are used as array
 * indexes, so any updates to this enum must follow updating
 * main.c::queryMappings.
 */

typedef enum {
   QUERY_LIBDIR = 0,    /* Ask for "LIBDIR" */
   QUERY_BINDIR,        /* Ask for "BINDIR" */
   QUERY_SBINDIR,       /* Ask for "SBINDIR" */
   QUERY_MAX            /* Upper limit -- Insert other queries above only. */
} Selector;
#else
#   ifndef VMTOOLSD_PATH
#      error This program requires either USES_LOCATIONS_DB or VMTOOLSD_PATH.
#   endif // ifndef VMTOOLSD_PATH
#endif // ifdef USES_LOCATIONS_DB


/*
 * Global functions
 */

extern Bool CompatExec(const char *, char * const [], char * const []);
extern Bool BuildExecPath(char *, size_t);

/* See above re: USES_LOCATIONS_DB. */
#ifdef USES_LOCATIONS_DB
extern Bool QueryLocationsDB(const char *, Selector, char *, size_t);
#endif // ifdef USES_LOCATIONS_DB


#endif // ifndef _WRAPPER_H_