mirror of
https://gitlab.com/openconnect/ocserv.git
synced 2026-02-10 08:46:58 +08:00
chroot_dir, occtl_socket_file and socket_file_prefix were moved to permanent config options
This commit is contained in:
@@ -110,20 +110,20 @@ int ctl_handler_init(main_server_st * s)
|
||||
struct sockaddr_un sa;
|
||||
int sd, e;
|
||||
|
||||
if (s->config->use_occtl == 0 || s->config->occtl_socket_file == NULL)
|
||||
if (s->config->use_occtl == 0 || s->perm_config->occtl_socket_file == NULL)
|
||||
return 0;
|
||||
|
||||
mslog(s, NULL, LOG_DEBUG, "initializing control unix socket: %s", s->config->occtl_socket_file);
|
||||
mslog(s, NULL, LOG_DEBUG, "initializing control unix socket: %s", s->perm_config->occtl_socket_file);
|
||||
memset(&sa, 0, sizeof(sa));
|
||||
sa.sun_family = AF_UNIX;
|
||||
strlcpy(sa.sun_path, s->config->occtl_socket_file, sizeof(sa.sun_path));
|
||||
remove(s->config->occtl_socket_file);
|
||||
strlcpy(sa.sun_path, s->perm_config->occtl_socket_file, sizeof(sa.sun_path));
|
||||
remove(s->perm_config->occtl_socket_file);
|
||||
|
||||
sd = socket(AF_UNIX, SOCK_STREAM, 0);
|
||||
if (sd == -1) {
|
||||
e = errno;
|
||||
mslog(s, NULL, LOG_ERR, "could not create socket '%s': %s",
|
||||
s->config->occtl_socket_file, strerror(e));
|
||||
s->perm_config->occtl_socket_file, strerror(e));
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -132,22 +132,22 @@ int ctl_handler_init(main_server_st * s)
|
||||
if (ret == -1) {
|
||||
e = errno;
|
||||
mslog(s, NULL, LOG_ERR, "could not bind socket '%s': %s",
|
||||
s->config->occtl_socket_file, strerror(e));
|
||||
s->perm_config->occtl_socket_file, strerror(e));
|
||||
return -1;
|
||||
}
|
||||
|
||||
ret = chown(s->config->occtl_socket_file, s->perm_config->uid, s->perm_config->gid);
|
||||
ret = chown(s->perm_config->occtl_socket_file, s->perm_config->uid, s->perm_config->gid);
|
||||
if (ret == -1) {
|
||||
e = errno;
|
||||
mslog(s, NULL, LOG_ERR, "could not chown socket '%s': %s",
|
||||
s->config->occtl_socket_file, strerror(e));
|
||||
s->perm_config->occtl_socket_file, strerror(e));
|
||||
}
|
||||
|
||||
ret = listen(sd, 1024);
|
||||
if (ret == -1) {
|
||||
e = errno;
|
||||
mslog(s, NULL, LOG_ERR, "could not listen to socket '%s': %s",
|
||||
s->config->occtl_socket_file, strerror(e));
|
||||
s->perm_config->occtl_socket_file, strerror(e));
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user