2021-08-09 15:50:25 -06:00
/* Generated by the protocol buffer compiler. DO NOT EDIT! */
/* Generated from: intercept.proto */
# ifndef PROTOBUF_C_intercept_2eproto__INCLUDED
# define PROTOBUF_C_intercept_2eproto__INCLUDED
# include <protobuf-c/protobuf-c.h>
PROTOBUF_C__BEGIN_DECLS
# if PROTOBUF_C_VERSION_NUMBER < 1003000
# error This file was generated by a newer version of protoc-c which is incompatible with your libprotobuf-c headers. Please update your headers.
2022-06-03 12:50:31 -06:00
# elif 1004000 < PROTOBUF_C_MIN_COMPILER_VERSION
2021-08-09 15:50:25 -06:00
# error This file was generated by an older version of protoc-c which is incompatible with your libprotobuf-c headers. Please regenerate this file with a newer version of protoc-c.
# endif
2022-06-03 12:50:31 -06:00
typedef struct InterceptRequest InterceptRequest ;
typedef struct InterceptHello InterceptHello ;
typedef struct HelloResponse HelloResponse ;
typedef struct PolicyCheckRequest PolicyCheckRequest ;
typedef struct PolicyAcceptMessage PolicyAcceptMessage ;
typedef struct PolicyRejectMessage PolicyRejectMessage ;
typedef struct PolicyErrorMessage PolicyErrorMessage ;
typedef struct InterceptResponse InterceptResponse ;
2021-08-09 15:50:25 -06:00
/* --- enums --- */
/* --- messages --- */
typedef enum {
2021-08-25 14:24:36 -06:00
INTERCEPT_REQUEST__TYPE__NOT_SET = 0 ,
INTERCEPT_REQUEST__TYPE_POLICY_CHECK_REQ = 1 ,
INTERCEPT_REQUEST__TYPE_HELLO = 2
2022-06-03 12:50:31 -06:00
PROTOBUF_C__FORCE_ENUM_TO_BE_INT_SIZE ( INTERCEPT_REQUEST__TYPE__CASE )
2021-08-25 14:24:36 -06:00
} InterceptRequest__TypeCase ;
2021-08-09 15:50:25 -06:00
/*
* Intercept message from sudo_intercept . so . Messages on the
* wire are prefixed with a 32 - bit size in network byte order .
*/
2022-06-03 12:50:31 -06:00
struct InterceptRequest
2021-08-09 15:50:25 -06:00
{
ProtobufCMessage base ;
2021-08-25 14:24:36 -06:00
InterceptRequest__TypeCase type_case ;
2021-08-09 15:50:25 -06:00
union {
PolicyCheckRequest * policy_check_req ;
2021-09-15 11:19:03 -06:00
InterceptHello * hello ;
2021-08-09 15:50:25 -06:00
} u ;
} ;
2021-08-25 14:24:36 -06:00
# define INTERCEPT_REQUEST__INIT \
{ PROTOBUF_C_MESSAGE_INIT ( & intercept_request__descriptor ) \
, INTERCEPT_REQUEST__TYPE__NOT_SET , { 0 } }
/*
* Hello message from sudo_intercept . so to main sudo process .
2021-09-01 10:17:26 -06:00
* Sudo sends back the token and localhost port number .
2021-08-25 14:24:36 -06:00
*/
2022-06-03 12:50:31 -06:00
struct InterceptHello
2021-08-25 14:24:36 -06:00
{
ProtobufCMessage base ;
int32_t pid ;
} ;
2021-09-15 11:19:03 -06:00
# define INTERCEPT_HELLO__INIT \
{ PROTOBUF_C_MESSAGE_INIT ( & intercept_hello__descriptor ) \
2021-08-25 14:24:36 -06:00
, 0 }
/*
2021-09-15 11:19:03 -06:00
* Sudo response to an InterceptHello from sudo_intercept . so .
2021-09-01 10:17:26 -06:00
* The client uses the port number and token to connect back to sudo .
2022-06-30 13:35:07 -06:00
* If log_only is set there is no InterceptResponse to a PolicyCheckRequest .
2021-08-25 14:24:36 -06:00
*/
2022-06-03 12:50:31 -06:00
struct HelloResponse
2021-08-25 14:24:36 -06:00
{
ProtobufCMessage base ;
2021-09-01 10:17:26 -06:00
uint64_t token_lo ;
uint64_t token_hi ;
2021-08-25 14:24:36 -06:00
int32_t portno ;
2022-06-30 13:35:07 -06:00
protobuf_c_boolean log_only ;
2021-08-25 14:24:36 -06:00
} ;
# define HELLO_RESPONSE__INIT \
{ PROTOBUF_C_MESSAGE_INIT ( & hello_response__descriptor ) \
2022-06-30 13:35:07 -06:00
, 0 , 0 , 0 , 0 }
2021-08-09 15:50:25 -06:00
/*
* Policy check request from sudo_intercept . so .
* Note that the plugin API only currently supports passing
* the new environment in to the open ( ) function .
*/
2022-06-03 12:50:31 -06:00
struct PolicyCheckRequest
2021-08-09 15:50:25 -06:00
{
ProtobufCMessage base ;
char * command ;
2021-08-27 15:58:19 -06:00
char * cwd ;
2021-08-09 15:50:25 -06:00
size_t n_argv ;
char * * argv ;
size_t n_envp ;
char * * envp ;
2021-08-25 14:24:36 -06:00
int32_t intercept_fd ;
2021-08-09 15:50:25 -06:00
} ;
# define POLICY_CHECK_REQUEST__INIT \
{ PROTOBUF_C_MESSAGE_INIT ( & policy_check_request__descriptor ) \
2021-08-31 16:33:54 -06:00
, ( char * ) protobuf_c_empty_string , ( char * ) protobuf_c_empty_string , 0 , NULL , 0 , NULL , 0 }
2021-08-09 15:50:25 -06:00
2022-06-03 12:50:31 -06:00
struct PolicyAcceptMessage
2021-08-09 15:50:25 -06:00
{
ProtobufCMessage base ;
char * run_command ;
size_t n_run_argv ;
char * * run_argv ;
size_t n_run_envp ;
char * * run_envp ;
} ;
# define POLICY_ACCEPT_MESSAGE__INIT \
{ PROTOBUF_C_MESSAGE_INIT ( & policy_accept_message__descriptor ) \
, ( char * ) protobuf_c_empty_string , 0 , NULL , 0 , NULL }
2022-06-03 12:50:31 -06:00
struct PolicyRejectMessage
2021-08-09 15:50:25 -06:00
{
ProtobufCMessage base ;
char * reject_message ;
} ;
# define POLICY_REJECT_MESSAGE__INIT \
{ PROTOBUF_C_MESSAGE_INIT ( & policy_reject_message__descriptor ) \
, ( char * ) protobuf_c_empty_string }
2022-06-03 12:50:31 -06:00
struct PolicyErrorMessage
2021-08-09 15:50:25 -06:00
{
ProtobufCMessage base ;
char * error_message ;
} ;
# define POLICY_ERROR_MESSAGE__INIT \
{ PROTOBUF_C_MESSAGE_INIT ( & policy_error_message__descriptor ) \
, ( char * ) protobuf_c_empty_string }
typedef enum {
2021-08-25 14:24:36 -06:00
INTERCEPT_RESPONSE__TYPE__NOT_SET = 0 ,
INTERCEPT_RESPONSE__TYPE_HELLO_RESP = 1 ,
INTERCEPT_RESPONSE__TYPE_ACCEPT_MSG = 2 ,
INTERCEPT_RESPONSE__TYPE_REJECT_MSG = 3 ,
INTERCEPT_RESPONSE__TYPE_ERROR_MSG = 4
2022-06-03 12:50:31 -06:00
PROTOBUF_C__FORCE_ENUM_TO_BE_INT_SIZE ( INTERCEPT_RESPONSE__TYPE__CASE )
2021-08-25 14:24:36 -06:00
} InterceptResponse__TypeCase ;
2021-08-09 15:50:25 -06:00
/*
2021-08-25 14:24:36 -06:00
* Response sent back to sudo_intercept . so .
2021-08-09 15:50:25 -06:00
*/
2022-06-03 12:50:31 -06:00
struct InterceptResponse
2021-08-09 15:50:25 -06:00
{
ProtobufCMessage base ;
2021-08-25 14:24:36 -06:00
InterceptResponse__TypeCase type_case ;
2021-08-09 15:50:25 -06:00
union {
2021-08-25 14:24:36 -06:00
HelloResponse * hello_resp ;
2021-08-09 15:50:25 -06:00
PolicyAcceptMessage * accept_msg ;
PolicyRejectMessage * reject_msg ;
PolicyErrorMessage * error_msg ;
} u ;
} ;
2021-08-25 14:24:36 -06:00
# define INTERCEPT_RESPONSE__INIT \
{ PROTOBUF_C_MESSAGE_INIT ( & intercept_response__descriptor ) \
, INTERCEPT_RESPONSE__TYPE__NOT_SET , { 0 } }
/* InterceptRequest methods */
void intercept_request__init
( InterceptRequest * message ) ;
size_t intercept_request__get_packed_size
( const InterceptRequest * message ) ;
size_t intercept_request__pack
( const InterceptRequest * message ,
uint8_t * out ) ;
size_t intercept_request__pack_to_buffer
( const InterceptRequest * message ,
ProtobufCBuffer * buffer ) ;
InterceptRequest *
intercept_request__unpack
( ProtobufCAllocator * allocator ,
size_t len ,
const uint8_t * data ) ;
void intercept_request__free_unpacked
( InterceptRequest * message ,
ProtobufCAllocator * allocator ) ;
2021-09-15 11:19:03 -06:00
/* InterceptHello methods */
void intercept_hello__init
( InterceptHello * message ) ;
size_t intercept_hello__get_packed_size
( const InterceptHello * message ) ;
size_t intercept_hello__pack
( const InterceptHello * message ,
2021-08-09 15:50:25 -06:00
uint8_t * out ) ;
2021-09-15 11:19:03 -06:00
size_t intercept_hello__pack_to_buffer
( const InterceptHello * message ,
2021-08-09 15:50:25 -06:00
ProtobufCBuffer * buffer ) ;
2021-09-15 11:19:03 -06:00
InterceptHello *
intercept_hello__unpack
2021-08-09 15:50:25 -06:00
( ProtobufCAllocator * allocator ,
size_t len ,
const uint8_t * data ) ;
2021-09-15 11:19:03 -06:00
void intercept_hello__free_unpacked
( InterceptHello * message ,
2021-08-25 14:24:36 -06:00
ProtobufCAllocator * allocator ) ;
/* HelloResponse methods */
void hello_response__init
( HelloResponse * message ) ;
size_t hello_response__get_packed_size
( const HelloResponse * message ) ;
size_t hello_response__pack
( const HelloResponse * message ,
uint8_t * out ) ;
size_t hello_response__pack_to_buffer
( const HelloResponse * message ,
ProtobufCBuffer * buffer ) ;
HelloResponse *
hello_response__unpack
( ProtobufCAllocator * allocator ,
size_t len ,
const uint8_t * data ) ;
void hello_response__free_unpacked
( HelloResponse * message ,
2021-08-09 15:50:25 -06:00
ProtobufCAllocator * allocator ) ;
/* PolicyCheckRequest methods */
void policy_check_request__init
( PolicyCheckRequest * message ) ;
size_t policy_check_request__get_packed_size
( const PolicyCheckRequest * message ) ;
size_t policy_check_request__pack
( const PolicyCheckRequest * message ,
uint8_t * out ) ;
size_t policy_check_request__pack_to_buffer
( const PolicyCheckRequest * message ,
ProtobufCBuffer * buffer ) ;
PolicyCheckRequest *
policy_check_request__unpack
( ProtobufCAllocator * allocator ,
size_t len ,
const uint8_t * data ) ;
void policy_check_request__free_unpacked
( PolicyCheckRequest * message ,
ProtobufCAllocator * allocator ) ;
/* PolicyAcceptMessage methods */
void policy_accept_message__init
( PolicyAcceptMessage * message ) ;
size_t policy_accept_message__get_packed_size
( const PolicyAcceptMessage * message ) ;
size_t policy_accept_message__pack
( const PolicyAcceptMessage * message ,
uint8_t * out ) ;
size_t policy_accept_message__pack_to_buffer
( const PolicyAcceptMessage * message ,
ProtobufCBuffer * buffer ) ;
PolicyAcceptMessage *
policy_accept_message__unpack
( ProtobufCAllocator * allocator ,
size_t len ,
const uint8_t * data ) ;
void policy_accept_message__free_unpacked
( PolicyAcceptMessage * message ,
ProtobufCAllocator * allocator ) ;
/* PolicyRejectMessage methods */
void policy_reject_message__init
( PolicyRejectMessage * message ) ;
size_t policy_reject_message__get_packed_size
( const PolicyRejectMessage * message ) ;
size_t policy_reject_message__pack
( const PolicyRejectMessage * message ,
uint8_t * out ) ;
size_t policy_reject_message__pack_to_buffer
( const PolicyRejectMessage * message ,
ProtobufCBuffer * buffer ) ;
PolicyRejectMessage *
policy_reject_message__unpack
( ProtobufCAllocator * allocator ,
size_t len ,
const uint8_t * data ) ;
void policy_reject_message__free_unpacked
( PolicyRejectMessage * message ,
ProtobufCAllocator * allocator ) ;
/* PolicyErrorMessage methods */
void policy_error_message__init
( PolicyErrorMessage * message ) ;
size_t policy_error_message__get_packed_size
( const PolicyErrorMessage * message ) ;
size_t policy_error_message__pack
( const PolicyErrorMessage * message ,
uint8_t * out ) ;
size_t policy_error_message__pack_to_buffer
( const PolicyErrorMessage * message ,
ProtobufCBuffer * buffer ) ;
PolicyErrorMessage *
policy_error_message__unpack
( ProtobufCAllocator * allocator ,
size_t len ,
const uint8_t * data ) ;
void policy_error_message__free_unpacked
( PolicyErrorMessage * message ,
ProtobufCAllocator * allocator ) ;
2021-08-25 14:24:36 -06:00
/* InterceptResponse methods */
void intercept_response__init
( InterceptResponse * message ) ;
size_t intercept_response__get_packed_size
( const InterceptResponse * message ) ;
size_t intercept_response__pack
( const InterceptResponse * message ,
2021-08-09 15:50:25 -06:00
uint8_t * out ) ;
2021-08-25 14:24:36 -06:00
size_t intercept_response__pack_to_buffer
( const InterceptResponse * message ,
2021-08-09 15:50:25 -06:00
ProtobufCBuffer * buffer ) ;
2021-08-25 14:24:36 -06:00
InterceptResponse *
intercept_response__unpack
2021-08-09 15:50:25 -06:00
( ProtobufCAllocator * allocator ,
size_t len ,
const uint8_t * data ) ;
2021-08-25 14:24:36 -06:00
void intercept_response__free_unpacked
( InterceptResponse * message ,
2021-08-09 15:50:25 -06:00
ProtobufCAllocator * allocator ) ;
/* --- per-message closures --- */
2021-08-25 14:24:36 -06:00
typedef void ( * InterceptRequest_Closure )
( const InterceptRequest * message ,
void * closure_data ) ;
2021-09-15 11:19:03 -06:00
typedef void ( * InterceptHello_Closure )
( const InterceptHello * message ,
2021-08-25 14:24:36 -06:00
void * closure_data ) ;
typedef void ( * HelloResponse_Closure )
( const HelloResponse * message ,
2021-08-09 15:50:25 -06:00
void * closure_data ) ;
typedef void ( * PolicyCheckRequest_Closure )
( const PolicyCheckRequest * message ,
void * closure_data ) ;
typedef void ( * PolicyAcceptMessage_Closure )
( const PolicyAcceptMessage * message ,
void * closure_data ) ;
typedef void ( * PolicyRejectMessage_Closure )
( const PolicyRejectMessage * message ,
void * closure_data ) ;
typedef void ( * PolicyErrorMessage_Closure )
( const PolicyErrorMessage * message ,
void * closure_data ) ;
2021-08-25 14:24:36 -06:00
typedef void ( * InterceptResponse_Closure )
( const InterceptResponse * message ,
2021-08-09 15:50:25 -06:00
void * closure_data ) ;
/* --- services --- */
/* --- descriptors --- */
2021-08-25 14:24:36 -06:00
extern const ProtobufCMessageDescriptor intercept_request__descriptor ;
2021-09-15 11:19:03 -06:00
extern const ProtobufCMessageDescriptor intercept_hello__descriptor ;
2021-08-25 14:24:36 -06:00
extern const ProtobufCMessageDescriptor hello_response__descriptor ;
2021-08-09 15:50:25 -06:00
extern const ProtobufCMessageDescriptor policy_check_request__descriptor ;
extern const ProtobufCMessageDescriptor policy_accept_message__descriptor ;
extern const ProtobufCMessageDescriptor policy_reject_message__descriptor ;
extern const ProtobufCMessageDescriptor policy_error_message__descriptor ;
2021-08-25 14:24:36 -06:00
extern const ProtobufCMessageDescriptor intercept_response__descriptor ;
2021-08-09 15:50:25 -06:00
PROTOBUF_C__END_DECLS
# endif /* PROTOBUF_C_intercept_2eproto__INCLUDED */