Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
sudo-project
GitHub Repository: sudo-project/sudo
Path: blob/main/include/intercept.pb-c.h
1532 views
1
/* Generated by the protocol buffer compiler. DO NOT EDIT! */
2
/* Generated from: intercept.proto */
3
4
#ifndef PROTOBUF_C_intercept_2eproto__INCLUDED
5
#define PROTOBUF_C_intercept_2eproto__INCLUDED
6
7
#include <protobuf-c/protobuf-c.h>
8
9
PROTOBUF_C__BEGIN_DECLS
10
11
#if PROTOBUF_C_VERSION_NUMBER < 1003000
12
# error This file was generated by a newer version of protobuf-c which is incompatible with your libprotobuf-c headers. Please update your headers.
13
#elif 1005002 < PROTOBUF_C_MIN_COMPILER_VERSION
14
# error This file was generated by an older version of protobuf-c which is incompatible with your libprotobuf-c headers. Please regenerate this file with a newer version of protobuf-c.
15
#endif
16
17
18
typedef struct InterceptRequest InterceptRequest;
19
typedef struct InterceptHello InterceptHello;
20
typedef struct HelloResponse HelloResponse;
21
typedef struct PolicyCheckRequest PolicyCheckRequest;
22
typedef struct PolicyAcceptMessage PolicyAcceptMessage;
23
typedef struct PolicyRejectMessage PolicyRejectMessage;
24
typedef struct PolicyErrorMessage PolicyErrorMessage;
25
typedef struct InterceptResponse InterceptResponse;
26
27
28
/* --- enums --- */
29
30
31
/* --- messages --- */
32
33
typedef enum {
34
INTERCEPT_REQUEST__TYPE__NOT_SET = 0,
35
INTERCEPT_REQUEST__TYPE_POLICY_CHECK_REQ = 1,
36
INTERCEPT_REQUEST__TYPE_HELLO = 2
37
PROTOBUF_C__FORCE_ENUM_TO_BE_INT_SIZE(INTERCEPT_REQUEST__TYPE__CASE)
38
} InterceptRequest__TypeCase;
39
40
/*
41
* Intercept message from sudo_intercept.so. Messages on the
42
* wire are prefixed with a 32-bit size in network byte order.
43
*/
44
struct InterceptRequest
45
{
46
ProtobufCMessage base;
47
InterceptRequest__TypeCase type_case;
48
union {
49
InterceptHello *hello;
50
PolicyCheckRequest *policy_check_req;
51
} u;
52
};
53
#define INTERCEPT_REQUEST__INIT \
54
{ PROTOBUF_C_MESSAGE_INIT (&intercept_request__descriptor) \
55
, INTERCEPT_REQUEST__TYPE__NOT_SET, {0} }
56
57
58
/*
59
* Hello message from sudo_intercept.so to main sudo process.
60
* Sudo sends back the token and localhost port number.
61
*/
62
struct InterceptHello
63
{
64
ProtobufCMessage base;
65
int32_t pid;
66
};
67
#define INTERCEPT_HELLO__INIT \
68
{ PROTOBUF_C_MESSAGE_INIT (&intercept_hello__descriptor) \
69
, 0 }
70
71
72
/*
73
* Sudo response to an InterceptHello from sudo_intercept.so.
74
* The client uses the port number and token to connect back to sudo.
75
* If log_only is set there is no InterceptResponse to a PolicyCheckRequest.
76
*/
77
struct HelloResponse
78
{
79
ProtobufCMessage base;
80
uint64_t token_lo;
81
uint64_t token_hi;
82
int32_t portno;
83
protobuf_c_boolean log_only;
84
};
85
#define HELLO_RESPONSE__INIT \
86
{ PROTOBUF_C_MESSAGE_INIT (&hello_response__descriptor) \
87
, 0, 0, 0, 0 }
88
89
90
/*
91
* Policy check request from sudo_intercept.so.
92
* Note that the plugin API only currently supports passing
93
* the new environment in to the open() function.
94
*/
95
struct PolicyCheckRequest
96
{
97
ProtobufCMessage base;
98
char *command;
99
char *cwd;
100
size_t n_argv;
101
char **argv;
102
size_t n_envp;
103
char **envp;
104
int32_t intercept_fd;
105
};
106
#define POLICY_CHECK_REQUEST__INIT \
107
{ PROTOBUF_C_MESSAGE_INIT (&policy_check_request__descriptor) \
108
, (char *)protobuf_c_empty_string, (char *)protobuf_c_empty_string, 0,NULL, 0,NULL, 0 }
109
110
111
struct PolicyAcceptMessage
112
{
113
ProtobufCMessage base;
114
char *run_command;
115
size_t n_run_argv;
116
char **run_argv;
117
size_t n_run_envp;
118
char **run_envp;
119
};
120
#define POLICY_ACCEPT_MESSAGE__INIT \
121
{ PROTOBUF_C_MESSAGE_INIT (&policy_accept_message__descriptor) \
122
, (char *)protobuf_c_empty_string, 0,NULL, 0,NULL }
123
124
125
struct PolicyRejectMessage
126
{
127
ProtobufCMessage base;
128
char *reject_message;
129
};
130
#define POLICY_REJECT_MESSAGE__INIT \
131
{ PROTOBUF_C_MESSAGE_INIT (&policy_reject_message__descriptor) \
132
, (char *)protobuf_c_empty_string }
133
134
135
struct PolicyErrorMessage
136
{
137
ProtobufCMessage base;
138
char *error_message;
139
};
140
#define POLICY_ERROR_MESSAGE__INIT \
141
{ PROTOBUF_C_MESSAGE_INIT (&policy_error_message__descriptor) \
142
, (char *)protobuf_c_empty_string }
143
144
145
typedef enum {
146
INTERCEPT_RESPONSE__TYPE__NOT_SET = 0,
147
INTERCEPT_RESPONSE__TYPE_HELLO_RESP = 1,
148
INTERCEPT_RESPONSE__TYPE_ACCEPT_MSG = 2,
149
INTERCEPT_RESPONSE__TYPE_REJECT_MSG = 3,
150
INTERCEPT_RESPONSE__TYPE_ERROR_MSG = 4
151
PROTOBUF_C__FORCE_ENUM_TO_BE_INT_SIZE(INTERCEPT_RESPONSE__TYPE__CASE)
152
} InterceptResponse__TypeCase;
153
154
/*
155
* Response sent back to sudo_intercept.so.
156
*/
157
struct InterceptResponse
158
{
159
ProtobufCMessage base;
160
InterceptResponse__TypeCase type_case;
161
union {
162
PolicyAcceptMessage *accept_msg;
163
PolicyErrorMessage *error_msg;
164
HelloResponse *hello_resp;
165
PolicyRejectMessage *reject_msg;
166
} u;
167
};
168
#define INTERCEPT_RESPONSE__INIT \
169
{ PROTOBUF_C_MESSAGE_INIT (&intercept_response__descriptor) \
170
, INTERCEPT_RESPONSE__TYPE__NOT_SET, {0} }
171
172
173
/* InterceptRequest methods */
174
void intercept_request__init
175
(InterceptRequest *message);
176
size_t intercept_request__get_packed_size
177
(const InterceptRequest *message);
178
size_t intercept_request__pack
179
(const InterceptRequest *message,
180
uint8_t *out);
181
size_t intercept_request__pack_to_buffer
182
(const InterceptRequest *message,
183
ProtobufCBuffer *buffer);
184
InterceptRequest *
185
intercept_request__unpack
186
(ProtobufCAllocator *allocator,
187
size_t len,
188
const uint8_t *data);
189
void intercept_request__free_unpacked
190
(InterceptRequest *message,
191
ProtobufCAllocator *allocator);
192
/* InterceptHello methods */
193
void intercept_hello__init
194
(InterceptHello *message);
195
size_t intercept_hello__get_packed_size
196
(const InterceptHello *message);
197
size_t intercept_hello__pack
198
(const InterceptHello *message,
199
uint8_t *out);
200
size_t intercept_hello__pack_to_buffer
201
(const InterceptHello *message,
202
ProtobufCBuffer *buffer);
203
InterceptHello *
204
intercept_hello__unpack
205
(ProtobufCAllocator *allocator,
206
size_t len,
207
const uint8_t *data);
208
void intercept_hello__free_unpacked
209
(InterceptHello *message,
210
ProtobufCAllocator *allocator);
211
/* HelloResponse methods */
212
void hello_response__init
213
(HelloResponse *message);
214
size_t hello_response__get_packed_size
215
(const HelloResponse *message);
216
size_t hello_response__pack
217
(const HelloResponse *message,
218
uint8_t *out);
219
size_t hello_response__pack_to_buffer
220
(const HelloResponse *message,
221
ProtobufCBuffer *buffer);
222
HelloResponse *
223
hello_response__unpack
224
(ProtobufCAllocator *allocator,
225
size_t len,
226
const uint8_t *data);
227
void hello_response__free_unpacked
228
(HelloResponse *message,
229
ProtobufCAllocator *allocator);
230
/* PolicyCheckRequest methods */
231
void policy_check_request__init
232
(PolicyCheckRequest *message);
233
size_t policy_check_request__get_packed_size
234
(const PolicyCheckRequest *message);
235
size_t policy_check_request__pack
236
(const PolicyCheckRequest *message,
237
uint8_t *out);
238
size_t policy_check_request__pack_to_buffer
239
(const PolicyCheckRequest *message,
240
ProtobufCBuffer *buffer);
241
PolicyCheckRequest *
242
policy_check_request__unpack
243
(ProtobufCAllocator *allocator,
244
size_t len,
245
const uint8_t *data);
246
void policy_check_request__free_unpacked
247
(PolicyCheckRequest *message,
248
ProtobufCAllocator *allocator);
249
/* PolicyAcceptMessage methods */
250
void policy_accept_message__init
251
(PolicyAcceptMessage *message);
252
size_t policy_accept_message__get_packed_size
253
(const PolicyAcceptMessage *message);
254
size_t policy_accept_message__pack
255
(const PolicyAcceptMessage *message,
256
uint8_t *out);
257
size_t policy_accept_message__pack_to_buffer
258
(const PolicyAcceptMessage *message,
259
ProtobufCBuffer *buffer);
260
PolicyAcceptMessage *
261
policy_accept_message__unpack
262
(ProtobufCAllocator *allocator,
263
size_t len,
264
const uint8_t *data);
265
void policy_accept_message__free_unpacked
266
(PolicyAcceptMessage *message,
267
ProtobufCAllocator *allocator);
268
/* PolicyRejectMessage methods */
269
void policy_reject_message__init
270
(PolicyRejectMessage *message);
271
size_t policy_reject_message__get_packed_size
272
(const PolicyRejectMessage *message);
273
size_t policy_reject_message__pack
274
(const PolicyRejectMessage *message,
275
uint8_t *out);
276
size_t policy_reject_message__pack_to_buffer
277
(const PolicyRejectMessage *message,
278
ProtobufCBuffer *buffer);
279
PolicyRejectMessage *
280
policy_reject_message__unpack
281
(ProtobufCAllocator *allocator,
282
size_t len,
283
const uint8_t *data);
284
void policy_reject_message__free_unpacked
285
(PolicyRejectMessage *message,
286
ProtobufCAllocator *allocator);
287
/* PolicyErrorMessage methods */
288
void policy_error_message__init
289
(PolicyErrorMessage *message);
290
size_t policy_error_message__get_packed_size
291
(const PolicyErrorMessage *message);
292
size_t policy_error_message__pack
293
(const PolicyErrorMessage *message,
294
uint8_t *out);
295
size_t policy_error_message__pack_to_buffer
296
(const PolicyErrorMessage *message,
297
ProtobufCBuffer *buffer);
298
PolicyErrorMessage *
299
policy_error_message__unpack
300
(ProtobufCAllocator *allocator,
301
size_t len,
302
const uint8_t *data);
303
void policy_error_message__free_unpacked
304
(PolicyErrorMessage *message,
305
ProtobufCAllocator *allocator);
306
/* InterceptResponse methods */
307
void intercept_response__init
308
(InterceptResponse *message);
309
size_t intercept_response__get_packed_size
310
(const InterceptResponse *message);
311
size_t intercept_response__pack
312
(const InterceptResponse *message,
313
uint8_t *out);
314
size_t intercept_response__pack_to_buffer
315
(const InterceptResponse *message,
316
ProtobufCBuffer *buffer);
317
InterceptResponse *
318
intercept_response__unpack
319
(ProtobufCAllocator *allocator,
320
size_t len,
321
const uint8_t *data);
322
void intercept_response__free_unpacked
323
(InterceptResponse *message,
324
ProtobufCAllocator *allocator);
325
/* --- per-message closures --- */
326
327
typedef void (*InterceptRequest_Closure)
328
(const InterceptRequest *message,
329
void *closure_data);
330
typedef void (*InterceptHello_Closure)
331
(const InterceptHello *message,
332
void *closure_data);
333
typedef void (*HelloResponse_Closure)
334
(const HelloResponse *message,
335
void *closure_data);
336
typedef void (*PolicyCheckRequest_Closure)
337
(const PolicyCheckRequest *message,
338
void *closure_data);
339
typedef void (*PolicyAcceptMessage_Closure)
340
(const PolicyAcceptMessage *message,
341
void *closure_data);
342
typedef void (*PolicyRejectMessage_Closure)
343
(const PolicyRejectMessage *message,
344
void *closure_data);
345
typedef void (*PolicyErrorMessage_Closure)
346
(const PolicyErrorMessage *message,
347
void *closure_data);
348
typedef void (*InterceptResponse_Closure)
349
(const InterceptResponse *message,
350
void *closure_data);
351
352
/* --- services --- */
353
354
355
/* --- descriptors --- */
356
357
extern const ProtobufCMessageDescriptor intercept_request__descriptor;
358
extern const ProtobufCMessageDescriptor intercept_hello__descriptor;
359
extern const ProtobufCMessageDescriptor hello_response__descriptor;
360
extern const ProtobufCMessageDescriptor policy_check_request__descriptor;
361
extern const ProtobufCMessageDescriptor policy_accept_message__descriptor;
362
extern const ProtobufCMessageDescriptor policy_reject_message__descriptor;
363
extern const ProtobufCMessageDescriptor policy_error_message__descriptor;
364
extern const ProtobufCMessageDescriptor intercept_response__descriptor;
365
366
PROTOBUF_C__END_DECLS
367
368
369
#endif /* PROTOBUF_C_intercept_2eproto__INCLUDED */
370
371