Search
j0ke.net Open Build Service
>
Projects
>
server:mail
:
el
>
sophie
> sophie-net_addr.patch
Sign Up
|
Log In
Username
Password
Cancel
Overview
Repositories
Revisions
Requests
Users
Advanced
Attributes
Meta
File sophie-net_addr.patch of Package sophie
--- sophie_init.c.orig 2012-08-06 21:08:39.407799549 +0200 +++ sophie_init.c 2012-08-06 21:16:49.543795199 +0200 @@ -80,6 +80,7 @@ config.socket_check = -1; #ifdef SOPHIE_NET config.net_port = -1; + memset(config.net_addr, 0 , sizeof(config.net_addr)); memset(config.net_tempdir, 0, sizeof(config.net_tempdir)); #endif } @@ -306,6 +307,9 @@ } #ifdef SOPHIE_NET + if (STRNCMP(option, "net_addr", 11)) + strncpy(config.net_addr, value, sizeof(config.net_addr)-1); + if ( (STRNCMP(option, "net_port", 8)) && (sophie_isnumeric(value)) ) config.net_port = atoi(value); @@ -436,6 +440,11 @@ } #ifdef SOPHIE_NET + if (config.net_addr[0] == '\0') + { + sophie_print(0, "%s config.net_addr is empty: setting to %s", NOTESTR, DEFAULT_NET_ADDR); + strncpy(config.net_addr, DEFAULT_NET_ADDR, sizeof(config.net_addr)-1); + } if (config.net_port == -1) { sophie_print(0, "%s config.net_port is set to -1: setting to %d", NOTESTR, DEFAULT_NET_PORT); --- etc/sophie.cfg.orig 2012-08-06 21:18:29.847794926 +0200 +++ etc/sophie.cfg 2012-08-06 21:19:16.883795921 +0200 @@ -113,6 +113,11 @@ # Network settings # #################### +# address on which Sophie will bind to +# +# Chanage requires: RESTART +net_addr: 127.0.0.1 + # Port on which Sophie will listen for network connections # # Change requires: RESTART --- sophie.h.orig 2012-08-06 21:10:46.875795511 +0200 +++ sophie.h 2012-08-06 21:30:58.543796041 +0200 @@ -67,6 +67,7 @@ #define DEFAULT_LIMIT_DECOMPR 1000 #define DEFAULT_SOCKET_CHECK 0 #ifdef SOPHIE_NET +#define DEFAULT_NET_ADDR "0.0.0.0" #define DEFAULT_NET_PORT 4009 #define DEFAULT_NET_TEMPDIR "/tmp" #endif @@ -98,6 +99,7 @@ int limit_decompr; int socket_check; #ifdef SOPHIE_NET + char net_addr[15]; int net_port; char net_tempdir[256]; #endif --- sophie.c.orig 2012-08-06 21:08:27.047795936 +0200 +++ sophie.c 2012-08-06 21:44:05.103795835 +0200 @@ -536,7 +536,7 @@ bzero((char *) &tcp_sock_data, sizeof(tcp_sock_data)); tcp_sock_data.sin_family = AF_INET; - tcp_sock_data.sin_addr.s_addr = htonl(INADDR_ANY); /* FIXME: configurable? */ + tcp_sock_data.sin_addr.s_addr = inet_addr(config.net_addr); tcp_sock_data.sin_port = htons(config.net_port); setsockopt(tcp_sock, SOL_SOCKET, SO_REUSEADDR, &reuse_addr, sizeof(reuse_addr));