mirror of
https://gitlab.com/openconnect/ocserv.git
synced 2026-02-10 00:37:00 +08:00
server_st -> worker_st
This commit is contained in:
@@ -38,7 +38,7 @@
|
||||
|
||||
/* All the functions return zero on success and a negative value on error */
|
||||
|
||||
int store_cookie(server_st *server, const void* cookie, unsigned cookie_size,
|
||||
int store_cookie(worker_st *server, const void* cookie, unsigned cookie_size,
|
||||
const struct stored_cookie_st* sc)
|
||||
{
|
||||
GDBM_FILE dbf;
|
||||
@@ -70,7 +70,7 @@ finish:
|
||||
return ret;
|
||||
}
|
||||
|
||||
int retrieve_cookie(server_st *server, const void* cookie, unsigned cookie_size,
|
||||
int retrieve_cookie(worker_st *server, const void* cookie, unsigned cookie_size,
|
||||
struct stored_cookie_st* sc)
|
||||
{
|
||||
GDBM_FILE dbf;
|
||||
|
||||
@@ -8,11 +8,11 @@ struct __attribute__ ((__packed__)) stored_cookie_st {
|
||||
time_t expiration;
|
||||
};
|
||||
|
||||
int store_cookie(server_st *server, const void* cookie, unsigned cookie_size,
|
||||
int store_cookie(worker_st *server, const void* cookie, unsigned cookie_size,
|
||||
const struct stored_cookie_st* sc);
|
||||
void expire_cookies(struct cfg_st *cfg);
|
||||
|
||||
int retrieve_cookie(server_st *server, const void* cookie, unsigned cookie_size,
|
||||
int retrieve_cookie(worker_st *server, const void* cookie, unsigned cookie_size,
|
||||
struct stored_cookie_st* sc);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -53,7 +53,7 @@ const char login_msg[] = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n"
|
||||
"<input type=\"password\" name=\"password\" label=\"Password:\" />\r\n"
|
||||
"</form></auth>\r\n";
|
||||
|
||||
int get_auth_handler(server_st *server)
|
||||
int get_auth_handler(worker_st *server)
|
||||
{
|
||||
int ret;
|
||||
|
||||
@@ -71,7 +71,7 @@ int ret;
|
||||
}
|
||||
|
||||
static
|
||||
int get_cert_username(server_st *server, const gnutls_datum_t* raw,
|
||||
int get_cert_username(worker_st *server, const gnutls_datum_t* raw,
|
||||
char* username, size_t username_size)
|
||||
{
|
||||
gnutls_x509_crt_t crt;
|
||||
@@ -132,7 +132,7 @@ static int send_auth_req(int fd, const struct cmd_auth_req_st* r)
|
||||
return(sendmsg(fd, &hdr, 0));
|
||||
}
|
||||
|
||||
static int recv_auth_reply(server_st *server)
|
||||
static int recv_auth_reply(worker_st *server)
|
||||
{
|
||||
struct iovec iov[3];
|
||||
uint8_t cmd = 0;
|
||||
@@ -191,7 +191,7 @@ static int recv_auth_reply(server_st *server)
|
||||
|
||||
/* sends an authentication request to main thread and waits for
|
||||
* a reply */
|
||||
static int auth_user(server_st *server, const struct cmd_auth_req_st* areq)
|
||||
static int auth_user(worker_st *server, const struct cmd_auth_req_st* areq)
|
||||
{
|
||||
int ret;
|
||||
|
||||
@@ -203,7 +203,7 @@ int ret;
|
||||
}
|
||||
|
||||
static
|
||||
int get_cert_info(server_st *server, struct cmd_auth_req_st *areq, const char** reason)
|
||||
int get_cert_info(worker_st *server, struct cmd_auth_req_st *areq, const char** reason)
|
||||
{
|
||||
const gnutls_datum_t * cert;
|
||||
unsigned int ncerts;
|
||||
@@ -231,7 +231,7 @@ int ret;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int post_old_auth_handler(server_st *server)
|
||||
int post_old_auth_handler(worker_st *server)
|
||||
{
|
||||
int ret;
|
||||
struct req_data_st *req = server->parser->data;
|
||||
@@ -347,7 +347,7 @@ auth_fail:
|
||||
#define XMLUSER_END "</username>"
|
||||
#define XMLPASS_END "</password>"
|
||||
|
||||
int post_new_auth_handler(server_st *server)
|
||||
int post_new_auth_handler(worker_st *server)
|
||||
{
|
||||
int ret;
|
||||
struct req_data_st *req = server->parser->data;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
#ifndef AUTH_H
|
||||
#define AUTH_H
|
||||
|
||||
int get_auth_handler(server_st *server);
|
||||
int post_old_auth_handler(server_st *server);
|
||||
int post_new_auth_handler(server_st *server);
|
||||
int get_auth_handler(worker_st *server);
|
||||
int post_old_auth_handler(worker_st *server);
|
||||
int post_new_auth_handler(worker_st *server);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -64,7 +64,7 @@ const char *human_addr(const struct sockaddr *sa, socklen_t salen,
|
||||
}
|
||||
|
||||
int __attribute__ ((format(printf, 3, 4)))
|
||||
oclog(const server_st * server, int priority, const char *fmt, ...)
|
||||
oclog(const worker_st * server, int priority, const char *fmt, ...)
|
||||
{
|
||||
char buf[1024];
|
||||
char ipbuf[128];
|
||||
|
||||
@@ -349,7 +349,6 @@ int main(void)
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
||||
/* Initialize GnuTLS */
|
||||
gnutls_global_set_log_function(tls_log_func);
|
||||
gnutls_global_set_audit_log_function(tls_audit_log_func);
|
||||
@@ -361,6 +360,7 @@ int main(void)
|
||||
ret = gnutls_certificate_allocate_credentials(&creds.xcred);
|
||||
GNUTLS_FATAL_ERR(ret);
|
||||
|
||||
#warning Handle keys using the communication interface
|
||||
ret =
|
||||
gnutls_certificate_set_x509_key_file(creds.xcred, config.cert,
|
||||
config.key,
|
||||
|
||||
14
src/vpn.c
14
src/vpn.c
@@ -44,9 +44,9 @@
|
||||
|
||||
#include <http-parser/http_parser.h>
|
||||
|
||||
static int connect_handler(server_st *server);
|
||||
static int connect_handler(worker_st *server);
|
||||
|
||||
typedef int (*url_handler_fn)(server_st*);
|
||||
typedef int (*url_handler_fn)(worker_st*);
|
||||
struct known_urls_st {
|
||||
const char* url;
|
||||
url_handler_fn get_handler;
|
||||
@@ -192,8 +192,8 @@ void vpn_server(struct cfg_st *config, struct tls_st *creds,
|
||||
http_parser parser;
|
||||
http_parser_settings settings;
|
||||
struct req_data_st req;
|
||||
server_st _server;
|
||||
server_st *server;
|
||||
worker_st _server;
|
||||
worker_st *server;
|
||||
url_handler_fn fn;
|
||||
|
||||
memset(&_server, 0, sizeof(_server));
|
||||
@@ -360,13 +360,13 @@ fail:
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Returns information based on an VPN network stored in server_st but
|
||||
/* Returns information based on an VPN network stored in worker_st but
|
||||
* using real time information for many fields. Nothing is allocated,
|
||||
* the provided buffer is used.
|
||||
*
|
||||
* Returns 0 on success.
|
||||
*/
|
||||
static int get_rt_vpn_info(server_st * server,
|
||||
static int get_rt_vpn_info(worker_st * server,
|
||||
struct vpn_st* vinfo, char* buffer, size_t buffer_size)
|
||||
{
|
||||
unsigned int i;
|
||||
@@ -419,7 +419,7 @@ fail:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int connect_handler(server_st *server)
|
||||
static int connect_handler(worker_st *server)
|
||||
{
|
||||
int ret;
|
||||
struct req_data_st *req = server->parser->data;
|
||||
|
||||
@@ -71,7 +71,7 @@ struct tls_st {
|
||||
gnutls_priority_t cprio;
|
||||
};
|
||||
|
||||
typedef struct server_st {
|
||||
typedef struct worker_st {
|
||||
gnutls_session_t session;
|
||||
char tun_name[IFNAMSIZ];
|
||||
int tun_fd;
|
||||
@@ -82,7 +82,7 @@ typedef struct server_st {
|
||||
|
||||
struct sockaddr_storage remote_addr; /* peer's address */
|
||||
socklen_t remote_addr_len;
|
||||
} server_st;
|
||||
} worker_st;
|
||||
|
||||
#define MAX_USERNAME_SIZE 64
|
||||
#define MAX_PASSWORD_SIZE 64
|
||||
@@ -133,7 +133,7 @@ const char *human_addr(const struct sockaddr *sa, socklen_t salen,
|
||||
void *buf, size_t buflen);
|
||||
|
||||
int __attribute__ ((format(printf, 3, 4)))
|
||||
oclog(const server_st * server, int priority, const char *fmt, ...);
|
||||
oclog(const worker_st * server, int priority, const char *fmt, ...);
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user