projects
/
cascardo
/
rnetproxy.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Accept GNUTLS priority in configuration file.
[cascardo/rnetproxy.git]
/
popproxy.c
diff --git
a/popproxy.c
b/popproxy.c
index
e2a58a3
..
47c2e94
100644
(file)
--- a/
popproxy.c
+++ b/
popproxy.c
@@
-42,6
+42,7
@@
struct pop_address
char *server;
char *port;
int ssl;
char *server;
char *port;
int ssl;
+ char *priority;
};
static HCConn *
};
static HCConn *
@@
-79,7
+80,7
@@
server_conn_new (char *server, char *port, int ssl)
}
static HCConn *
}
static HCConn *
-client_conn_new (int fd)
+client_conn_new (int fd
, struct pop_address *address
)
{
HCConn *conn;
HCConn *ssl_conn;
{
HCConn *conn;
HCConn *ssl_conn;
@@
-93,8
+94,12
@@
client_conn_new (int fd)
close (fd);
return NULL;
}
close (fd);
return NULL;
}
+
ssl_conn = hc_conn_new (NULL, NULL);
hc_conn_set_driver_ssl_server (ssl_conn, conn);
ssl_conn = hc_conn_new (NULL, NULL);
hc_conn_set_driver_ssl_server (ssl_conn, conn);
+ if (address && address->priority)
+ hc_conn_ssl_server_set_priority (ssl_conn, address->priority);
+
if (r != 0)
{
hc_conn_close (ssl_conn);
if (r != 0)
{
hc_conn_close (ssl_conn);
@@
-169,7
+174,7
@@
new_client (int fd, struct sockaddr *addr, socklen_t saddr, gpointer data)
g_message ("Received connection from %s.",
inet_ntoa (((struct sockaddr_in *) addr)->sin_addr));
g_message ("Received connection from %s.",
inet_ntoa (((struct sockaddr_in *) addr)->sin_addr));
- client_conn = client_conn_new (fd);
+ client_conn = client_conn_new (fd
, address
);
if (client_conn == NULL)
{
return;
if (client_conn == NULL)
{
return;
@@
-203,6
+208,7
@@
int main (int argc, char **argv)
gchar *server_address;
gchar *server_port;
int server_ssl;
gchar *server_address;
gchar *server_port;
int server_ssl;
+ gchar *server_priority;
gchar *certfile;
gchar *ssl_keyfile;
gchar *policy;
gchar *certfile;
gchar *ssl_keyfile;
gchar *policy;
@@
-297,6
+303,14
@@
int main (int argc, char **argv)
server_ssl = 0;
g_error_free (error);
}
server_ssl = 0;
g_error_free (error);
}
+ error = NULL;
+ server_priority = g_key_file_get_string (keyfile, "global", "priority",
+ &error);
+ if (server_priority == NULL && error != NULL)
+ {
+ server_priority = g_strdup ("NORMAL");
+ g_error_free (error);
+ }
error = NULL;
policy = g_key_file_get_string (keyfile, "global", "policy",
error = NULL;
policy = g_key_file_get_string (keyfile, "global", "policy",
@@
-315,6
+329,7
@@
int main (int argc, char **argv)
pop_address.server = server_address;
pop_address.port = server_port;
pop_address.ssl = server_ssl;
pop_address.server = server_address;
pop_address.port = server_port;
pop_address.ssl = server_ssl;
+ pop_address.priority = server_priority;
server_fd = hc_tcp_server (port);
if (server_fd < 0)
server_fd = hc_tcp_server (port);
if (server_fd < 0)