[PATCH] admin, sendsms bind to interface

Nisan Bloch <[email protected]>
Newsgroups gmane.comp.mobile.kannel.devel
Message-ID <[email protected]>
Hi All

Patches to the bb_http.c and smsbox.c to allow the admin and sendsms http 
interface to bind to a specified interface.

files patched: gw/smsbox.c, gw/bb_http.c, gwlib/cfg.def

Nisan

--- ../cvs/gateway/gw/smsbox.c Thu Nov 14 12:11:38 2002
+++ ../gateway-cvsup/gw/smsbox.c Sun Nov 17 22:51:45 2002
@@ -44,6 +44,7 @@
static long bb_port;
static int bb_ssl = 0;
static long sendsms_port = 0;
+static Octstr *sendsms_interface = NULL;
static Octstr *smsbox_id = NULL;
static Octstr *sendsms_url = NULL;
static Octstr *sendota_url = NULL;
@@ -2930,6 +2937,7 @@
}
cfg_get_integer(&sendsms_port, grp, octstr_imm("sendsms-port"));
+ sendsms_interface= cfg_get(grp, octstr_imm("sendsms-interface"));
cfg_get_integer(&sms_max_length, grp, octstr_imm("sms-length"));
#ifdef HAVE_LIBSSL
@@ -2977,7 +2985,7 @@
cfg_get_integer(&http_queue_delay, grp, octstr_imm("http-queue-delay"));
if (sendsms_port > 0) {
- if (http_open_port(sendsms_port, ssl) == -1) {
+ if (http_open_port_if(sendsms_port, ssl,sendsms_interface) == -1) {
if (only_try_http)
error(0, "Failed to open HTTP socket, ignoring it");
else
@@ -3111,6 +3119,7 @@
octstr_destroy(reply_requestfailed);
octstr_destroy(reply_couldnotfetch);
octstr_destroy(reply_couldnotrepresent);
+ octstr_destroy(sendsms_interface);
numhash_destroy(black_list);
numhash_destroy(white_list); cfg_destroy(cfg);


--- ../cvs/gateway/gw/bb_http.c Wed Aug 7 21:03:48 2002
+++ ../gateway-cvsup/gw/bb_http.c Sun Nov 17 20:54:04 2002
@@ -24,6 +24,7 @@
static volatile sig_atomic_t httpadmin_running;
static long ha_port;
+static Octstr *ha_interface;
static Octstr *ha_password;
static Octstr *ha_status_pw;
static Octstr *ha_allow_ip;
@@ -364,6 +365,8 @@
if (cfg_get_integer(&ha_port, grp, octstr_imm("admin-port")) == -1)
panic(0, "Missing admin-port variable, cannot start HTTP admin");
+ ha_interface = cfg_get(grp, octstr_imm("admin-interface"));
+
ha_password = cfg_get(grp, octstr_imm("admin-password"));
if (ha_password == NULL)
panic(0, "You MUST set HTTP admin-password");
@@ -398,7 +401,7 @@
octstr_destroy(ssl_server_key_file);
#endif /* HAVE_LIBSSL */
- http_open_port(ha_port, ssl);
+ http_open_port_if(ha_port, ssl, ha_interface);
if (gwthread_create(httpadmin_run, NULL) == -1)
panic(0, "Failed to start a new thread for HTTP admin");
@@ -413,6 +416,7 @@
http_close_all_ports();
gwthread_join_every(httpadmin_run);
octstr_destroy(ha_password);
+ octstr_destroy(ha_interface);
octstr_destroy(ha_status_pw);
octstr_destroy(ha_allow_ip); octstr_destroy(ha_deny_ip);

--- ../cvs/gateway/gwlib/cfg.def Mon Nov 18 08:02:12 2002
+++ ../gateway-cvsup/gwlib/cfg.def Mon Nov 18 11:36:26 2002
@@ -21,6 +21,7 @@
SINGLE_GROUP(core,
OCTSTR(admin-port)
OCTSTR(admin-port-ssl)
+ OCTSTR(admin-interface)
OCTSTR(admin-password)
OCTSTR(status-password)
OCTSTR(admin-deny-ip)
@@ -137,6 +138,7 @@
OCTSTR(bearerbox-host)
OCTSTR(sendsms-port)
OCTSTR(sendsms-port-ssl)
+ OCTSTR(sendsms-interface)
OCTSTR(sendsms-url)
OCTSTR(sendota-url)
OCTSTR(xmlrpc-url)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.