Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
sudo-project
GitHub Repository: sudo-project/sudo
Path: blob/main/logsrvd/sendlog.h
1532 views
1
/*
2
* SPDX-License-Identifier: ISC
3
*
4
* Copyright (c) 2019-2020 Todd C. Miller <[email protected]>
5
*
6
* Permission to use, copy, modify, and distribute this software for any
7
* purpose with or without fee is hereby granted, provided that the above
8
* copyright notice and this permission notice appear in all copies.
9
*
10
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17
*/
18
19
#ifndef SUDO_SENDLOG_H
20
#define SUDO_SENDLOG_H
21
22
#include <log_server.pb-c.h>
23
#if PROTOBUF_C_VERSION_NUMBER < 1003000
24
# error protobuf-c version 1.30 or higher required
25
#endif
26
27
#include <config.h>
28
29
#if defined(HAVE_OPENSSL)
30
# if defined(HAVE_WOLFSSL)
31
# include <wolfssl/options.h>
32
# endif
33
# include <openssl/ssl.h>
34
# include <openssl/err.h>
35
#endif
36
37
#include "logsrv_util.h"
38
#include <tls_common.h>
39
40
enum client_state {
41
ERROR,
42
RECV_HELLO,
43
SEND_RESTART,
44
SEND_ACCEPT,
45
SEND_REJECT,
46
SEND_IO,
47
SEND_EXIT,
48
CLOSING,
49
FINISHED
50
};
51
52
struct client_closure {
53
TAILQ_ENTRY(client_closure) entries;
54
int sock;
55
bool accept_only;
56
bool read_instead_of_write;
57
bool write_instead_of_read;
58
bool temporary_write_event;
59
struct timespec restart;
60
struct timespec stop_after;
61
struct timespec elapsed;
62
struct timespec committed;
63
struct timing_closure timing;
64
struct sudo_event_base *evbase;
65
struct connection_buffer read_buf;
66
struct connection_buffer_list write_bufs;
67
struct connection_buffer_list free_bufs;
68
#if defined(HAVE_OPENSSL)
69
struct tls_client_closure tls_client;
70
#endif
71
struct sudo_event *read_ev;
72
struct sudo_event *write_ev;
73
struct eventlog *evlog;
74
struct iolog_file iolog_files[IOFD_MAX];
75
const char *iolog_id;
76
char *reject_reason;
77
char *buf; /* XXX */
78
size_t bufsize; /* XXX */
79
enum client_state state;
80
};
81
82
#endif /* SUDO_SENDLOG_H */
83
84