1 | /** @file
|
---|
2 | * VirtualBox External Authentication Library Interface.
|
---|
3 | */
|
---|
4 |
|
---|
5 | /*
|
---|
6 | * Copyright (C) 2006-2017 Oracle Corporation
|
---|
7 | *
|
---|
8 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
9 | * available from http://www.virtualbox.org. This file is free software;
|
---|
10 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
11 | * General Public License (GPL) as published by the Free Software
|
---|
12 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
13 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
14 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
15 | *
|
---|
16 | * The contents of this file may alternatively be used under the terms
|
---|
17 | * of the Common Development and Distribution License Version 1.0
|
---|
18 | * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
|
---|
19 | * VirtualBox OSE distribution, in which case the provisions of the
|
---|
20 | * CDDL are applicable instead of those of the GPL.
|
---|
21 | *
|
---|
22 | * You may elect to license modified versions of this file under the
|
---|
23 | * terms and conditions of either the GPL or the CDDL or both.
|
---|
24 | */
|
---|
25 |
|
---|
26 | #ifndef ___VBox_vboxauth_h
|
---|
27 | #define ___VBox_vboxauth_h
|
---|
28 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
29 | # pragma once
|
---|
30 | #endif
|
---|
31 |
|
---|
32 | /** @defgroup grp_vboxauth VirtualBox External Authentication Library Interface
|
---|
33 | * @{
|
---|
34 | */
|
---|
35 |
|
---|
36 | /* The following 2 enums are 32 bits values.*/
|
---|
37 | typedef enum AuthResult
|
---|
38 | {
|
---|
39 | AuthResultAccessDenied = 0,
|
---|
40 | AuthResultAccessGranted = 1,
|
---|
41 | AuthResultDelegateToGuest = 2,
|
---|
42 | AuthResultSizeHack = 0x7fffffff
|
---|
43 | } AuthResult;
|
---|
44 |
|
---|
45 | typedef enum AuthGuestJudgement
|
---|
46 | {
|
---|
47 | AuthGuestNotAsked = 0,
|
---|
48 | AuthGuestAccessDenied = 1,
|
---|
49 | AuthGuestNoJudgement = 2,
|
---|
50 | AuthGuestAccessGranted = 3,
|
---|
51 | AuthGuestNotReacted = 4,
|
---|
52 | AuthGuestSizeHack = 0x7fffffff
|
---|
53 | } AuthGuestJudgement;
|
---|
54 |
|
---|
55 | /** UUID memory representation. Array of 16 bytes.
|
---|
56 | *
|
---|
57 | * @note VirtualBox uses a consistent binary representation of UUIDs on all platforms. For this reason
|
---|
58 | * the integer fields comprising the UUID are stored as little endian values. If you want to pass such
|
---|
59 | * UUIDs to code which assumes that the integer fields are big endian (often also called network byte
|
---|
60 | * order), you need to adjust the contents of the UUID to e.g. achieve the same string representation.
|
---|
61 | *
|
---|
62 | * The required changes are:
|
---|
63 | * - reverse the order of byte 0, 1, 2 and 3
|
---|
64 | * - reverse the order of byte 4 and 5
|
---|
65 | * - reverse the order of byte 6 and 7.
|
---|
66 | *
|
---|
67 | * Using this conversion you will get identical results when converting the binary UUID to the string
|
---|
68 | * representation.
|
---|
69 | */
|
---|
70 | typedef unsigned char AUTHUUID[16];
|
---|
71 | typedef AUTHUUID *PAUTHUUID;
|
---|
72 |
|
---|
73 | /** The library entry point calling convention. */
|
---|
74 | #ifdef _MSC_VER
|
---|
75 | # define AUTHCALL __cdecl
|
---|
76 | #elif defined(__GNUC__)
|
---|
77 | # define AUTHCALL
|
---|
78 | #else
|
---|
79 | # error "Unsupported compiler"
|
---|
80 | #endif
|
---|
81 |
|
---|
82 |
|
---|
83 | /**
|
---|
84 | * Authentication library entry point.
|
---|
85 | *
|
---|
86 | * @param pUuid Pointer to the UUID of the accessed virtual machine. Can be NULL.
|
---|
87 | * @param guestJudgement Result of the guest authentication.
|
---|
88 | * @param pszUser User name passed in by the client (UTF8).
|
---|
89 | * @param pszPassword Password passed in by the client (UTF8).
|
---|
90 | * @param pszDomain Domain passed in by the client (UTF8).
|
---|
91 | *
|
---|
92 | * Return code:
|
---|
93 | *
|
---|
94 | * @retval AuthAccessDenied Client access has been denied.
|
---|
95 | * @retval AuthAccessGranted Client has the right to use the virtual machine.
|
---|
96 | * @retval AuthDelegateToGuest Guest operating system must
|
---|
97 | * authenticate the client and the
|
---|
98 | * library must be called again with
|
---|
99 | * the result of the guest
|
---|
100 | * authentication.
|
---|
101 | */
|
---|
102 | typedef AuthResult AUTHCALL FNAUTHENTRY(PAUTHUUID pUuid,
|
---|
103 | AuthGuestJudgement guestJudgement,
|
---|
104 | const char *pszUser,
|
---|
105 | const char *pszPassword,
|
---|
106 | const char *pszDomain);
|
---|
107 | /** Pointer to a FNAUTHENTRY function. */
|
---|
108 | typedef FNAUTHENTRY *PFNAUTHENTRY;
|
---|
109 | /** @deprecated */
|
---|
110 | typedef FNAUTHENTRY AUTHENTRY;
|
---|
111 | /** @deprecated */
|
---|
112 | typedef PFNAUTHENTRY PAUTHENTRY;
|
---|
113 | /** Name of the FNAUTHENTRY entry point. */
|
---|
114 | #define AUTHENTRY_NAME "VRDPAuth"
|
---|
115 |
|
---|
116 | /**
|
---|
117 | * Authentication library entry point version 2.
|
---|
118 | *
|
---|
119 | * @param pUuid Pointer to the UUID of the accessed virtual machine. Can be NULL.
|
---|
120 | * @param guestJudgement Result of the guest authentication.
|
---|
121 | * @param pszUser User name passed in by the client (UTF8).
|
---|
122 | * @param pszPassword Password passed in by the client (UTF8).
|
---|
123 | * @param pszDomain Domain passed in by the client (UTF8).
|
---|
124 | * @param fLogon Boolean flag. Indicates whether the entry point is
|
---|
125 | * called for a client logon or the client disconnect.
|
---|
126 | * @param clientId Server side unique identifier of the client.
|
---|
127 | *
|
---|
128 | * @retval AuthAccessDenied Client access has been denied.
|
---|
129 | * @retval AuthAccessGranted Client has the right to use the virtual machine.
|
---|
130 | * @retval AuthDelegateToGuest Guest operating system must
|
---|
131 | * authenticate the client and the
|
---|
132 | * library must be called again with
|
---|
133 | * the result of the guest authentication.
|
---|
134 | *
|
---|
135 | * @note When @a fLogon is 0, only @a pUuid and @a clientId are valid and the
|
---|
136 | * return code is ignored.
|
---|
137 | */
|
---|
138 | typedef AuthResult AUTHCALL FNAUTHENTRY2(PAUTHUUID pUuid,
|
---|
139 | AuthGuestJudgement guestJudgement,
|
---|
140 | const char *pszUser,
|
---|
141 | const char *pszPassword,
|
---|
142 | const char *pszDomain,
|
---|
143 | int fLogon,
|
---|
144 | unsigned clientId);
|
---|
145 | /** Pointer to a FNAUTHENTRY2 function. */
|
---|
146 | typedef FNAUTHENTRY2 *PFNAUTHENTRY2;
|
---|
147 | /** @deprecated */
|
---|
148 | typedef FNAUTHENTRY2 AUTHENTRY2;
|
---|
149 | /** @deprecated */
|
---|
150 | typedef PFNAUTHENTRY2 PAUTHENTRY2;
|
---|
151 | /** Name of the FNAUTHENTRY2 entry point. */
|
---|
152 | #define AUTHENTRY2_NAME "VRDPAuth2"
|
---|
153 |
|
---|
154 | /**
|
---|
155 | * Authentication library entry point version 3.
|
---|
156 | *
|
---|
157 | * @param pszCaller The name of the component which calls the library (UTF8).
|
---|
158 | * @param pUuid Pointer to the UUID of the accessed virtual machine. Can be NULL.
|
---|
159 | * @param guestJudgement Result of the guest authentication.
|
---|
160 | * @param pszUser User name passed in by the client (UTF8).
|
---|
161 | * @param pszPassword Password passed in by the client (UTF8).
|
---|
162 | * @param pszDomain Domain passed in by the client (UTF8).
|
---|
163 | * @param fLogon Boolean flag. Indicates whether the entry point is
|
---|
164 | * called for a client logon or the client disconnect.
|
---|
165 | * @param clientId Server side unique identifier of the client.
|
---|
166 | *
|
---|
167 | * @retval AuthResultAccessDenied Client access has been denied.
|
---|
168 | * @retval AuthResultAccessGranted Client has the right to use the
|
---|
169 | * virtual machine.
|
---|
170 | * @retval AuthResultDelegateToGuest Guest operating system must
|
---|
171 | * authenticate the client and the
|
---|
172 | * library must be called again with
|
---|
173 | * the result of the guest
|
---|
174 | * authentication.
|
---|
175 | *
|
---|
176 | * @note When @a fLogon is 0, only @a pszCaller, @a pUuid and @a clientId are
|
---|
177 | * valid and the return code is ignored.
|
---|
178 | */
|
---|
179 | typedef AuthResult AUTHCALL FNAUTHENTRY3(const char *pszCaller,
|
---|
180 | PAUTHUUID pUuid,
|
---|
181 | AuthGuestJudgement guestJudgement,
|
---|
182 | const char *pszUser,
|
---|
183 | const char *pszPassword,
|
---|
184 | const char *pszDomain,
|
---|
185 | int fLogon,
|
---|
186 | unsigned clientId);
|
---|
187 | /** Pointer to a FNAUTHENTRY3 function. */
|
---|
188 | typedef FNAUTHENTRY3 *PFNAUTHENTRY3;
|
---|
189 | /** @deprecated */
|
---|
190 | typedef FNAUTHENTRY3 AUTHENTRY3;
|
---|
191 | /** @deprecated */
|
---|
192 | typedef PFNAUTHENTRY3 PAUTHENTRY3;
|
---|
193 |
|
---|
194 | /** Name of the FNAUTHENTRY3 entry point. */
|
---|
195 | #define AUTHENTRY3_NAME "AuthEntry"
|
---|
196 |
|
---|
197 | /** @} */
|
---|
198 |
|
---|
199 | #endif
|
---|