eliminated more compiler warnings
This commit is contained in:
parent
8890825142
commit
939551ec97
@ -31,8 +31,6 @@
|
|||||||
#include "siproxd.h"
|
#include "siproxd.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
|
||||||
static char const ident[]="$Id$";
|
|
||||||
|
|
||||||
/* configuration storage */
|
/* configuration storage */
|
||||||
extern struct siproxd_config configuration;
|
extern struct siproxd_config configuration;
|
||||||
|
|
||||||
|
|||||||
@ -37,8 +37,6 @@
|
|||||||
#include "siproxd.h"
|
#include "siproxd.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
|
||||||
static char const ident[]="$Id$";
|
|
||||||
|
|
||||||
/* configuration storage */
|
/* configuration storage */
|
||||||
extern struct siproxd_config configuration;
|
extern struct siproxd_config configuration;
|
||||||
|
|
||||||
|
|||||||
@ -55,8 +55,6 @@
|
|||||||
#include "fwapi.h"
|
#include "fwapi.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
|
||||||
static char const ident[]="$Id$";
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* some prototypes of util.c - so I don't have to suck in the
|
* some prototypes of util.c - so I don't have to suck in the
|
||||||
* whole bunch of include files. You probably will not use this
|
* whole bunch of include files. You probably will not use this
|
||||||
|
|||||||
@ -40,8 +40,6 @@
|
|||||||
|
|
||||||
#include "dejitter.h"
|
#include "dejitter.h"
|
||||||
|
|
||||||
static char const ident[]="$Id$";
|
|
||||||
|
|
||||||
#ifdef GPL
|
#ifdef GPL
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@ -25,8 +25,6 @@
|
|||||||
#include "fwapi.h"
|
#include "fwapi.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
|
||||||
static char const ident[]="$Id$";
|
|
||||||
|
|
||||||
int fwapi_start_rtp(int rtp_direction,
|
int fwapi_start_rtp(int rtp_direction,
|
||||||
struct in_addr local_ipaddr, int local_port,
|
struct in_addr local_ipaddr, int local_port,
|
||||||
struct in_addr remote_ipaddr, int remote_port) {
|
struct in_addr remote_ipaddr, int remote_port) {
|
||||||
|
|||||||
@ -40,8 +40,6 @@
|
|||||||
|
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
|
|
||||||
static char const ident[]="$Id$";
|
|
||||||
|
|
||||||
/* static functions */
|
/* static functions */
|
||||||
static void output_to_stderr(const char *label, va_list ap, char *file,
|
static void output_to_stderr(const char *label, va_list ap, char *file,
|
||||||
int line, const char *format);
|
int line, const char *format);
|
||||||
|
|||||||
@ -40,8 +40,6 @@
|
|||||||
#include "plugins.h"
|
#include "plugins.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
|
||||||
static char const ident[]="$Id$";
|
|
||||||
|
|
||||||
/*&&&+++ Workaround sqlite3 3.3.6 (header/symbol errors)*/
|
/*&&&+++ Workaround sqlite3 3.3.6 (header/symbol errors)*/
|
||||||
#define sqlite3_clear_bindings UNDEFINED_SYMBOL
|
#define sqlite3_clear_bindings UNDEFINED_SYMBOL
|
||||||
#define sqlite3_prepare_v2 UNDEFINED_SYMBOL
|
#define sqlite3_prepare_v2 UNDEFINED_SYMBOL
|
||||||
@ -604,7 +602,7 @@ static int sqlite_begin(void){
|
|||||||
|
|
||||||
/* create prepared statements */
|
/* create prepared statements */
|
||||||
DEBUGC(DBCLASS_BABBLE, "PLUGIN_INIT: preparing %li statements",
|
DEBUGC(DBCLASS_BABBLE, "PLUGIN_INIT: preparing %li statements",
|
||||||
sizeof(sql_statement) / sizeof(sql_statement[0]));
|
(long int)(sizeof(sql_statement) / sizeof(sql_statement[0])));
|
||||||
for (i=0; i < sizeof(sql_statement) / sizeof(sql_statement[0]); i++) {
|
for (i=0; i < sizeof(sql_statement) / sizeof(sql_statement[0]); i++) {
|
||||||
if (sql_statement[i].sql_query == NULL) {
|
if (sql_statement[i].sql_query == NULL) {
|
||||||
DEBUGC(DBCLASS_BABBLE, "PLUGIN_INIT: skiping empty SQL statement");
|
DEBUGC(DBCLASS_BABBLE, "PLUGIN_INIT: skiping empty SQL statement");
|
||||||
|
|||||||
@ -37,8 +37,6 @@
|
|||||||
#include "plugins.h"
|
#include "plugins.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
|
||||||
static char const ident[]="$Id$";
|
|
||||||
|
|
||||||
/* Plug-in identification */
|
/* Plug-in identification */
|
||||||
static char name[]="plugin_codecfilter";
|
static char name[]="plugin_codecfilter";
|
||||||
static char desc[]="Allows filtering the codec list in SDP";
|
static char desc[]="Allows filtering the codec list in SDP";
|
||||||
|
|||||||
@ -35,8 +35,6 @@
|
|||||||
#include "plugins.h"
|
#include "plugins.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
|
||||||
static char const ident[]="$Id$";
|
|
||||||
|
|
||||||
/* Plug-in identification */
|
/* Plug-in identification */
|
||||||
static char name[]="plugin_defaulttarget";
|
static char name[]="plugin_defaulttarget";
|
||||||
static char desc[]="Forwards all unknown calls to a default internal location";
|
static char desc[]="Forwards all unknown calls to a default internal location";
|
||||||
|
|||||||
@ -35,9 +35,6 @@
|
|||||||
#include "plugins.h"
|
#include "plugins.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
|
||||||
|
|
||||||
static char const ident[]="$Id$";
|
|
||||||
|
|
||||||
/* Plug-in identification */
|
/* Plug-in identification */
|
||||||
static char name[]="plugin_demo";
|
static char name[]="plugin_demo";
|
||||||
static char desc[]="This is just a demo plugin without any purpose";
|
static char desc[]="This is just a demo plugin without any purpose";
|
||||||
|
|||||||
@ -35,8 +35,6 @@
|
|||||||
#include "plugins.h"
|
#include "plugins.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
|
||||||
static char const ident[]="$Id$";
|
|
||||||
|
|
||||||
/* Plug-in identification */
|
/* Plug-in identification */
|
||||||
static char name[]="plugin_fix_DTAG";
|
static char name[]="plugin_fix_DTAG";
|
||||||
static char desc[]="Fixes issues with DTAG (t-online.de) broken SIP headers";
|
static char desc[]="Fixes issues with DTAG (t-online.de) broken SIP headers";
|
||||||
|
|||||||
@ -36,8 +36,6 @@
|
|||||||
#include "plugins.h"
|
#include "plugins.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
|
||||||
static char const ident[]="$Id$";
|
|
||||||
|
|
||||||
/* Plug-in identification */
|
/* Plug-in identification */
|
||||||
static char name[]="plugin_fix_bogus_via";
|
static char name[]="plugin_fix_bogus_via";
|
||||||
static char desc[]="Fixes broken VIA headers on incoming calls";
|
static char desc[]="Fixes broken VIA headers on incoming calls";
|
||||||
|
|||||||
@ -36,8 +36,6 @@
|
|||||||
#include "plugins.h"
|
#include "plugins.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
|
||||||
static char const ident[]="$Id$";
|
|
||||||
|
|
||||||
/* Plug-in identification */
|
/* Plug-in identification */
|
||||||
static char name[]="plugin_fix_fbox_anoncall";
|
static char name[]="plugin_fix_fbox_anoncall";
|
||||||
static char desc[]="Fixes issues with incoming anonymous calls on Fritzbox UAs";
|
static char desc[]="Fixes issues with incoming anonymous calls on Fritzbox UAs";
|
||||||
|
|||||||
@ -35,8 +35,6 @@
|
|||||||
#include "plugins.h"
|
#include "plugins.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
|
||||||
static char const ident[]="$Id$";
|
|
||||||
|
|
||||||
/* Plug-in identification */
|
/* Plug-in identification */
|
||||||
static char name[]="plugin_logcall";
|
static char name[]="plugin_logcall";
|
||||||
static char desc[]="Logs calls to syslog";
|
static char desc[]="Logs calls to syslog";
|
||||||
|
|||||||
@ -48,8 +48,6 @@
|
|||||||
#include "redirect_cache.h"
|
#include "redirect_cache.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
|
||||||
static char const ident[]="$Id$";
|
|
||||||
|
|
||||||
/* Plug-in identification */
|
/* Plug-in identification */
|
||||||
static char name[]="plugin_prefix";
|
static char name[]="plugin_prefix";
|
||||||
static char desc[]="Adds a dial-prefix as defined in config file";
|
static char desc[]="Adds a dial-prefix as defined in config file";
|
||||||
|
|||||||
@ -45,8 +45,6 @@
|
|||||||
#include "redirect_cache.h"
|
#include "redirect_cache.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
|
||||||
static char const ident[]="$Id$";
|
|
||||||
|
|
||||||
/* Plug-in identification */
|
/* Plug-in identification */
|
||||||
static char name[]="plugin_regex";
|
static char name[]="plugin_regex";
|
||||||
static char desc[]="Use regular expressions to rewrite SIP targets";
|
static char desc[]="Use regular expressions to rewrite SIP targets";
|
||||||
|
|||||||
@ -37,8 +37,6 @@
|
|||||||
#include "plugins.h"
|
#include "plugins.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
|
||||||
static char const ident[]="$Id$";
|
|
||||||
|
|
||||||
/* Plug-in identification */
|
/* Plug-in identification */
|
||||||
static char name[]="plugin_shortdial";
|
static char name[]="plugin_shortdial";
|
||||||
static char desc[]="Handles Dial shortcuts as defined in config file";
|
static char desc[]="Handles Dial shortcuts as defined in config file";
|
||||||
|
|||||||
@ -37,8 +37,6 @@
|
|||||||
#include "plugins.h"
|
#include "plugins.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
|
||||||
static char const ident[]="$Id$";
|
|
||||||
|
|
||||||
/* Plug-in identification */
|
/* Plug-in identification */
|
||||||
static char name[]="plugin_siptrunk";
|
static char name[]="plugin_siptrunk";
|
||||||
static char desc[]="Handles SIP trunks with multiple numbers on same SIP account";
|
static char desc[]="Handles SIP trunks with multiple numbers on same SIP account";
|
||||||
|
|||||||
@ -41,9 +41,6 @@
|
|||||||
#include "plugins.h"
|
#include "plugins.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
|
||||||
|
|
||||||
static char const ident[]="$Id$";
|
|
||||||
|
|
||||||
/* Plug-in identification */
|
/* Plug-in identification */
|
||||||
static char name[]="plugin_stats";
|
static char name[]="plugin_stats";
|
||||||
static char desc[]="Upon receiving SIGUSR1, dump some call statistics";
|
static char desc[]="Upon receiving SIGUSR1, dump some call statistics";
|
||||||
|
|||||||
@ -37,8 +37,6 @@
|
|||||||
#include "plugins.h"
|
#include "plugins.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
|
||||||
static char const ident[]="$Id$";
|
|
||||||
|
|
||||||
/* Plug-in identification */
|
/* Plug-in identification */
|
||||||
static char name[]="plugin_stripheader";
|
static char name[]="plugin_stripheader";
|
||||||
static char desc[]="Allows removing SIP headers";
|
static char desc[]="Allows removing SIP headers";
|
||||||
|
|||||||
@ -39,8 +39,6 @@
|
|||||||
#include "plugins.h"
|
#include "plugins.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
|
||||||
static char const ident[]="$Id$";
|
|
||||||
|
|
||||||
/* Plug-in identification */
|
/* Plug-in identification */
|
||||||
static char name[]="plugin_stun";
|
static char name[]="plugin_stun";
|
||||||
static char desc[]="Use an external STUN server to determine my public IP";
|
static char desc[]="Use an external STUN server to determine my public IP";
|
||||||
|
|||||||
@ -35,8 +35,6 @@
|
|||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "plugins.h"
|
#include "plugins.h"
|
||||||
|
|
||||||
static char const ident[]="$Id$";
|
|
||||||
|
|
||||||
/* configuration storage */
|
/* configuration storage */
|
||||||
extern struct siproxd_config configuration;
|
extern struct siproxd_config configuration;
|
||||||
|
|
||||||
|
|||||||
@ -37,8 +37,6 @@
|
|||||||
#include "plugins.h"
|
#include "plugins.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
|
||||||
static char const ident[]="$Id$";
|
|
||||||
|
|
||||||
/* configuration storage */
|
/* configuration storage */
|
||||||
extern struct siproxd_config configuration; /* defined in siproxd.c */
|
extern struct siproxd_config configuration; /* defined in siproxd.c */
|
||||||
|
|
||||||
|
|||||||
@ -32,8 +32,6 @@
|
|||||||
#include "siproxd.h"
|
#include "siproxd.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
|
||||||
static char const ident[]="$Id$";
|
|
||||||
|
|
||||||
/* configuration storage */
|
/* configuration storage */
|
||||||
extern struct siproxd_config configuration;
|
extern struct siproxd_config configuration;
|
||||||
|
|
||||||
|
|||||||
@ -35,8 +35,6 @@
|
|||||||
#include "redirect_cache.h"
|
#include "redirect_cache.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
|
||||||
static char const ident[]="$Id$";
|
|
||||||
|
|
||||||
#define CACHE_TIMEOUT 20
|
#define CACHE_TIMEOUT 20
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@ -35,8 +35,6 @@
|
|||||||
#include "siproxd.h"
|
#include "siproxd.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
|
||||||
static char const ident[]="$Id$";
|
|
||||||
|
|
||||||
/* configuration storage */
|
/* configuration storage */
|
||||||
extern struct siproxd_config configuration;
|
extern struct siproxd_config configuration;
|
||||||
|
|
||||||
@ -56,7 +54,7 @@ void register_init(void) {
|
|||||||
FILE *stream;
|
FILE *stream;
|
||||||
int sts, i;
|
int sts, i;
|
||||||
char buff[128];
|
char buff[128];
|
||||||
// char *c;
|
char *t;
|
||||||
|
|
||||||
memset(urlmap, 0, sizeof(urlmap));
|
memset(urlmap, 0, sizeof(urlmap));
|
||||||
|
|
||||||
@ -74,14 +72,15 @@ void register_init(void) {
|
|||||||
/* read the url table from file */
|
/* read the url table from file */
|
||||||
DEBUGC(DBCLASS_REG,"loading registration table, size=%i",URLMAP_SIZE);
|
DEBUGC(DBCLASS_REG,"loading registration table, size=%i",URLMAP_SIZE);
|
||||||
for (i=0;i < URLMAP_SIZE; i++) {
|
for (i=0;i < URLMAP_SIZE; i++) {
|
||||||
fgets(buff, sizeof(buff), stream);
|
t=fgets(buff, sizeof(buff), stream);
|
||||||
|
if (t==NULL) { break;}
|
||||||
sts=sscanf(buff, "****:%i:%i", &urlmap[i].active, &urlmap[i].expires);
|
sts=sscanf(buff, "****:%i:%i", &urlmap[i].active, &urlmap[i].expires);
|
||||||
if (sts == 0) break; /* format error */
|
if (sts == 0) break; /* format error */
|
||||||
if (urlmap[i].active) {
|
if (urlmap[i].active) {
|
||||||
#define R(X) {\
|
#define R(X) {\
|
||||||
sts=osip_uri_init(&X); \
|
sts=osip_uri_init(&X); \
|
||||||
if (sts == 0) { \
|
if (sts == 0) { \
|
||||||
fgets(buff, sizeof(buff), stream);\
|
t=fgets(buff, sizeof(buff), stream);\
|
||||||
buff[sizeof(buff)-1]='\0';\
|
buff[sizeof(buff)-1]='\0';\
|
||||||
if (strchr(buff, 10)) *strchr(buff, 10)='\0';\
|
if (strchr(buff, 10)) *strchr(buff, 10)='\0';\
|
||||||
if (strchr(buff, 13)) *strchr(buff, 13)='\0';\
|
if (strchr(buff, 13)) *strchr(buff, 13)='\0';\
|
||||||
@ -403,11 +402,10 @@ int register_client(sip_ticket_t *ticket, int force_lcl_masq) {
|
|||||||
configuration.masked_host.string[j]);
|
configuration.masked_host.string[j]);
|
||||||
|
|
||||||
if (strcmp(urlmap[i].masq_url->host, configuration.masked_host.string[j]) != 0) {
|
if (strcmp(urlmap[i].masq_url->host, configuration.masked_host.string[j]) != 0) {
|
||||||
|
int len=strlen(configuration.masked_host.string[j])+1;
|
||||||
/* new/different host, update urlmap (+1 includes terminating \0) */
|
/* new/different host, update urlmap (+1 includes terminating \0) */
|
||||||
urlmap[i].masq_url->host=realloc(urlmap[i].masq_url->host,
|
urlmap[i].masq_url->host=realloc(urlmap[i].masq_url->host, len);
|
||||||
strlen(configuration.masked_host.string[j])+1);
|
strncpy(urlmap[i].masq_url->host, configuration.masked_host.string[j], len);
|
||||||
strncpy(urlmap[i].masq_url->host, configuration.masked_host.string[j],
|
|
||||||
strlen(configuration.masked_host.string[j])+1);
|
|
||||||
urlmap[i].masq_url->host[strlen(configuration.masked_host.string[j])]='\0';
|
urlmap[i].masq_url->host[strlen(configuration.masked_host.string[j])]='\0';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -454,17 +452,17 @@ int register_client(sip_ticket_t *ticket, int force_lcl_masq) {
|
|||||||
addrstr);
|
addrstr);
|
||||||
|
|
||||||
if (strcmp(urlmap[i].masq_url->host, addrstr) != 0) {
|
if (strcmp(urlmap[i].masq_url->host, addrstr) != 0) {
|
||||||
|
int len=strlen(addrstr)+1;
|
||||||
/* new address, update urlmap (+1 includes terminating \0) */
|
/* new address, update urlmap (+1 includes terminating \0) */
|
||||||
urlmap[i].masq_url->host=realloc(urlmap[i].masq_url->host,
|
urlmap[i].masq_url->host=realloc(urlmap[i].masq_url->host, len);
|
||||||
strlen(addrstr)+1);
|
strncpy(urlmap[i].masq_url->host, addrstr, len);
|
||||||
strncpy(urlmap[i].masq_url->host, addrstr, strlen(addrstr)+1);
|
|
||||||
urlmap[i].masq_url->host[strlen(addrstr)]='\0';
|
urlmap[i].masq_url->host[strlen(addrstr)]='\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
/* port number if required */
|
/* port number if required */
|
||||||
if (configuration.sip_listen_port != SIP_PORT) {
|
if (configuration.sip_listen_port != SIP_PORT) {
|
||||||
urlmap[i].masq_url->port=realloc(urlmap[i].masq_url->port, 16);
|
urlmap[i].masq_url->port=realloc(urlmap[i].masq_url->port, PORTSTRING_SIZE);
|
||||||
snprintf(urlmap[i].masq_url->port, 16, "%i",
|
snprintf(urlmap[i].masq_url->port, PORTSTRING_SIZE, "%i",
|
||||||
configuration.sip_listen_port);
|
configuration.sip_listen_port);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -37,9 +37,6 @@
|
|||||||
|
|
||||||
#define USE_NAPTR 0
|
#define USE_NAPTR 0
|
||||||
|
|
||||||
static char const ident[]="$Id$";
|
|
||||||
|
|
||||||
|
|
||||||
/* local functions */
|
/* local functions */
|
||||||
static int _resolve(char *name, int class, int type,
|
static int _resolve(char *name, int class, int type,
|
||||||
char *dname, int dnamelen, int *port);
|
char *dname, int dnamelen, int *port);
|
||||||
|
|||||||
@ -35,8 +35,6 @@
|
|||||||
#include "siproxd.h"
|
#include "siproxd.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
|
||||||
static char const ident[]="$Id$";
|
|
||||||
|
|
||||||
/* configuration storage */
|
/* configuration storage */
|
||||||
extern struct siproxd_config configuration; /* defined in siproxd.c */
|
extern struct siproxd_config configuration; /* defined in siproxd.c */
|
||||||
|
|
||||||
|
|||||||
@ -30,8 +30,6 @@
|
|||||||
#include "rtpproxy.h"
|
#include "rtpproxy.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
|
||||||
static char const ident[]="$Id$";
|
|
||||||
|
|
||||||
/* configuration storage */
|
/* configuration storage */
|
||||||
extern struct siproxd_config configuration;
|
extern struct siproxd_config configuration;
|
||||||
|
|
||||||
|
|||||||
@ -46,8 +46,6 @@
|
|||||||
#include "dejitter.h"
|
#include "dejitter.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static char const ident[]="$Id$";
|
|
||||||
|
|
||||||
/* configuration storage */
|
/* configuration storage */
|
||||||
extern struct siproxd_config configuration;
|
extern struct siproxd_config configuration;
|
||||||
|
|
||||||
@ -149,7 +147,12 @@ int rtp_relay_init( void ) {
|
|||||||
uid=getuid();
|
uid=getuid();
|
||||||
euid=geteuid();
|
euid=geteuid();
|
||||||
DEBUGC(DBCLASS_RTP,"uid=%i, euid=%i", uid, euid);
|
DEBUGC(DBCLASS_RTP,"uid=%i, euid=%i", uid, euid);
|
||||||
if (uid != euid) seteuid(0);
|
if (uid != euid) {
|
||||||
|
if (seteuid(0) != 0) {
|
||||||
|
ERROR("rtp_relay_init: seteuid() failed while "
|
||||||
|
"setting DSCP value: %s", strerror(errno));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (geteuid()==0) {
|
if (geteuid()==0) {
|
||||||
#endif
|
#endif
|
||||||
@ -176,7 +179,12 @@ int rtp_relay_init( void ) {
|
|||||||
INFO("Unable to use realtime scheduling for RTP proxy");
|
INFO("Unable to use realtime scheduling for RTP proxy");
|
||||||
INFO("You may want to start siproxd as root and switch UID afterwards");
|
INFO("You may want to start siproxd as root and switch UID afterwards");
|
||||||
}
|
}
|
||||||
if (uid != euid) seteuid(euid);
|
if (uid != euid) {
|
||||||
|
if (seteuid(euid) != 0) {
|
||||||
|
ERROR("rtp_relay_init: seteuid() failed while "
|
||||||
|
"setting DSCP value: %s", strerror(errno));
|
||||||
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -725,7 +733,12 @@ int rtp_relay_start_fwd (osip_call_id_t *callid, client_id_t client_id,
|
|||||||
uid=getuid();
|
uid=getuid();
|
||||||
euid=geteuid();
|
euid=geteuid();
|
||||||
DEBUGC(DBCLASS_RTP,"uid=%i, euid=%i", uid, euid);
|
DEBUGC(DBCLASS_RTP,"uid=%i, euid=%i", uid, euid);
|
||||||
if (uid != euid) seteuid(0);
|
if (uid != euid) {
|
||||||
|
if (seteuid(0) != 0) {
|
||||||
|
ERROR("rtp_relay_start_fwd: seteuid() failed while "
|
||||||
|
"setting DSCP value: %s", strerror(errno));
|
||||||
|
}
|
||||||
|
}
|
||||||
if (geteuid()==0) {
|
if (geteuid()==0) {
|
||||||
/* now I'm root */
|
/* now I'm root */
|
||||||
if (!(configuration.rtp_dscp & ~0x3f)) {
|
if (!(configuration.rtp_dscp & ~0x3f)) {
|
||||||
@ -745,7 +758,12 @@ int rtp_relay_start_fwd (osip_call_id_t *callid, client_id_t client_id,
|
|||||||
configuration.rtp_dscp = 0; /* inhibit further attempts */
|
configuration.rtp_dscp = 0; /* inhibit further attempts */
|
||||||
}
|
}
|
||||||
/* drop privileges */
|
/* drop privileges */
|
||||||
if (uid != euid) seteuid(euid);
|
if (uid != euid) {
|
||||||
|
if (seteuid(euid) != 0) {
|
||||||
|
ERROR("rtp_relay_start_fwd: seteuid() failed while "
|
||||||
|
"setting DSCP value: %s", strerror(errno));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* write entry into rtp_proxytable slot (freeidx) */
|
/* write entry into rtp_proxytable slot (freeidx) */
|
||||||
|
|||||||
@ -33,8 +33,6 @@
|
|||||||
#include "siproxd.h"
|
#include "siproxd.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
|
||||||
static char const ident[]="$Id$";
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* do security and integrity checks on the received packet
|
* do security and integrity checks on the received packet
|
||||||
* (raw buffer, \0 terminated)
|
* (raw buffer, \0 terminated)
|
||||||
|
|||||||
@ -21,8 +21,6 @@
|
|||||||
#include <osipparser2/osip_parser.h>
|
#include <osipparser2/osip_parser.h>
|
||||||
#include <log.h>
|
#include <log.h>
|
||||||
|
|
||||||
static char const ident[]="$Id$";
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This file contains wrapper functions to call the osip2_ library.
|
* This file contains wrapper functions to call the osip2_ library.
|
||||||
* depending on the used version of libosip2, the calling arguments
|
* depending on the used version of libosip2, the calling arguments
|
||||||
|
|||||||
@ -42,9 +42,6 @@
|
|||||||
#include "digcalc.h"
|
#include "digcalc.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
|
||||||
static char const ident[]="$Id$";
|
|
||||||
|
|
||||||
|
|
||||||
/* configuration storage */
|
/* configuration storage */
|
||||||
extern struct siproxd_config configuration;
|
extern struct siproxd_config configuration;
|
||||||
|
|
||||||
@ -590,16 +587,17 @@ int sip_add_myvia (sip_ticket_t *ticket, int interface) {
|
|||||||
|
|
||||||
myaddr=utils_inet_ntoa(addr);
|
myaddr=utils_inet_ntoa(addr);
|
||||||
if (ticket->protocol == PROTO_UDP) {
|
if (ticket->protocol == PROTO_UDP) {
|
||||||
sprintf(tmp, "SIP/2.0/UDP %s:%i;branch=%s%s",
|
snprintf(tmp, URL_STRING_SIZE, "SIP/2.0/UDP %s:%i;branch=%s%s",
|
||||||
myaddr, configuration.sip_listen_port,
|
myaddr, configuration.sip_listen_port,
|
||||||
branch_id,
|
branch_id,
|
||||||
(add_rport)? ";rport":"");
|
(add_rport)? ";rport":"");
|
||||||
} else {
|
} else {
|
||||||
sprintf(tmp, "SIP/2.0/TCP %s:%i;branch=%s%s",
|
snprintf(tmp, URL_STRING_SIZE, "SIP/2.0/TCP %s:%i;branch=%s%s",
|
||||||
myaddr, configuration.sip_listen_port,
|
myaddr, configuration.sip_listen_port,
|
||||||
branch_id,
|
branch_id,
|
||||||
(add_rport)? ";rport":"");
|
(add_rport)? ";rport":"");
|
||||||
}
|
}
|
||||||
|
tmp[URL_STRING_SIZE-1]='\0';
|
||||||
|
|
||||||
DEBUGC(DBCLASS_BABBLE,"adding VIA:%s",tmp);
|
DEBUGC(DBCLASS_BABBLE,"adding VIA:%s",tmp);
|
||||||
|
|
||||||
|
|||||||
@ -41,8 +41,6 @@
|
|||||||
#include "plugins.h"
|
#include "plugins.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
|
||||||
static char const ident[]="$Id$";
|
|
||||||
|
|
||||||
/* configuration storage */
|
/* configuration storage */
|
||||||
struct siproxd_config configuration;
|
struct siproxd_config configuration;
|
||||||
/* instructions for config parser */
|
/* instructions for config parser */
|
||||||
|
|||||||
@ -311,7 +311,7 @@ int unload_plugins(void);
|
|||||||
#define PASSWORD_SIZE 128 /* max string length of a password (auth) */
|
#define PASSWORD_SIZE 128 /* max string length of a password (auth) */
|
||||||
#define IPSTRING_SIZE 16 /* stringsize of IP address xxx.xxx.xxx.xxx\0 */
|
#define IPSTRING_SIZE 16 /* stringsize of IP address xxx.xxx.xxx.xxx\0 */
|
||||||
#define PORTSTRING_SIZE 6 /* stringsize of port number xxxxx\0 */
|
#define PORTSTRING_SIZE 6 /* stringsize of port number xxxxx\0 */
|
||||||
#define VIA_BRANCH_SIZE 128 /* max string length for via branch param */
|
#define VIA_BRANCH_SIZE 64 /* max string length for via branch param */
|
||||||
/* scratch buffer for gethostbyname_r() */
|
/* scratch buffer for gethostbyname_r() */
|
||||||
|
|
||||||
#if defined(PR_NETDB_BUF_SIZE)
|
#if defined(PR_NETDB_BUF_SIZE)
|
||||||
|
|||||||
18
src/sock.c
18
src/sock.c
@ -39,9 +39,6 @@
|
|||||||
#include "siproxd.h"
|
#include "siproxd.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
|
||||||
static char const ident[]="$Id$";
|
|
||||||
|
|
||||||
|
|
||||||
/* configuration storage */
|
/* configuration storage */
|
||||||
extern struct siproxd_config configuration;
|
extern struct siproxd_config configuration;
|
||||||
|
|
||||||
@ -95,7 +92,12 @@ int sipsock_listen (void) {
|
|||||||
uid=getuid();
|
uid=getuid();
|
||||||
euid=geteuid();
|
euid=geteuid();
|
||||||
DEBUGC(DBCLASS_SIP,"uid=%i, euid=%i", uid, euid);
|
DEBUGC(DBCLASS_SIP,"uid=%i, euid=%i", uid, euid);
|
||||||
if (uid != euid) seteuid(0);
|
if (uid != euid) {
|
||||||
|
if (seteuid(0) != 0) {
|
||||||
|
ERROR("sipsock_listen: seteuid() failed while "
|
||||||
|
"setting DSCP value: %s", strerror(errno));
|
||||||
|
}
|
||||||
|
}
|
||||||
if (geteuid()==0) {
|
if (geteuid()==0) {
|
||||||
/* now I'm root */
|
/* now I'm root */
|
||||||
if (!(configuration.sip_dscp & ~0x3f)) {
|
if (!(configuration.sip_dscp & ~0x3f)) {
|
||||||
@ -115,7 +117,13 @@ int sipsock_listen (void) {
|
|||||||
configuration.rtp_dscp = 0; /* inhibit further attempts */
|
configuration.rtp_dscp = 0; /* inhibit further attempts */
|
||||||
}
|
}
|
||||||
/* drop privileges */
|
/* drop privileges */
|
||||||
if (uid != euid) seteuid(euid);
|
if (uid != euid) {
|
||||||
|
if (seteuid(euid) != 0) {
|
||||||
|
ERROR("sipsock_listen: seteuid() failed while "
|
||||||
|
"setting DSCP value: %s", strerror(errno));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* listen on TCP port */
|
/* listen on TCP port */
|
||||||
|
|||||||
@ -50,8 +50,6 @@
|
|||||||
#include "siproxd.h"
|
#include "siproxd.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
|
||||||
static char const ident[]="$Id$";
|
|
||||||
|
|
||||||
/* configuration storage */
|
/* configuration storage */
|
||||||
extern struct siproxd_config configuration;
|
extern struct siproxd_config configuration;
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user