eliminated more compiler warnings

This commit is contained in:
Thomas Ries 2021-02-10 21:21:50 +01:00
parent 8890825142
commit 939551ec97
37 changed files with 54 additions and 99 deletions

View File

@ -31,8 +31,6 @@
#include "siproxd.h"
#include "log.h"
static char const ident[]="$Id$";
/* configuration storage */
extern struct siproxd_config configuration;

View File

@ -37,8 +37,6 @@
#include "siproxd.h"
#include "log.h"
static char const ident[]="$Id$";
/* configuration storage */
extern struct siproxd_config configuration;

View File

@ -55,8 +55,6 @@
#include "fwapi.h"
#include "log.h"
static char const ident[]="$Id$";
/*
* 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

View File

@ -40,8 +40,6 @@
#include "dejitter.h"
static char const ident[]="$Id$";
#ifdef GPL
/*

View File

@ -25,8 +25,6 @@
#include "fwapi.h"
#include "log.h"
static char const ident[]="$Id$";
int fwapi_start_rtp(int rtp_direction,
struct in_addr local_ipaddr, int local_port,
struct in_addr remote_ipaddr, int remote_port) {

View File

@ -40,8 +40,6 @@
#include <signal.h>
static char const ident[]="$Id$";
/* static functions */
static void output_to_stderr(const char *label, va_list ap, char *file,
int line, const char *format);

View File

@ -40,8 +40,6 @@
#include "plugins.h"
#include "log.h"
static char const ident[]="$Id$";
/*&&&+++ Workaround sqlite3 3.3.6 (header/symbol errors)*/
#define sqlite3_clear_bindings UNDEFINED_SYMBOL
#define sqlite3_prepare_v2 UNDEFINED_SYMBOL
@ -604,7 +602,7 @@ static int sqlite_begin(void){
/* create prepared 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++) {
if (sql_statement[i].sql_query == NULL) {
DEBUGC(DBCLASS_BABBLE, "PLUGIN_INIT: skiping empty SQL statement");

View File

@ -37,8 +37,6 @@
#include "plugins.h"
#include "log.h"
static char const ident[]="$Id$";
/* Plug-in identification */
static char name[]="plugin_codecfilter";
static char desc[]="Allows filtering the codec list in SDP";

View File

@ -35,8 +35,6 @@
#include "plugins.h"
#include "log.h"
static char const ident[]="$Id$";
/* Plug-in identification */
static char name[]="plugin_defaulttarget";
static char desc[]="Forwards all unknown calls to a default internal location";

View File

@ -35,9 +35,6 @@
#include "plugins.h"
#include "log.h"
static char const ident[]="$Id$";
/* Plug-in identification */
static char name[]="plugin_demo";
static char desc[]="This is just a demo plugin without any purpose";

View File

@ -35,8 +35,6 @@
#include "plugins.h"
#include "log.h"
static char const ident[]="$Id$";
/* Plug-in identification */
static char name[]="plugin_fix_DTAG";
static char desc[]="Fixes issues with DTAG (t-online.de) broken SIP headers";

View File

@ -36,8 +36,6 @@
#include "plugins.h"
#include "log.h"
static char const ident[]="$Id$";
/* Plug-in identification */
static char name[]="plugin_fix_bogus_via";
static char desc[]="Fixes broken VIA headers on incoming calls";

View File

@ -36,8 +36,6 @@
#include "plugins.h"
#include "log.h"
static char const ident[]="$Id$";
/* Plug-in identification */
static char name[]="plugin_fix_fbox_anoncall";
static char desc[]="Fixes issues with incoming anonymous calls on Fritzbox UAs";

View File

@ -35,8 +35,6 @@
#include "plugins.h"
#include "log.h"
static char const ident[]="$Id$";
/* Plug-in identification */
static char name[]="plugin_logcall";
static char desc[]="Logs calls to syslog";

View File

@ -48,8 +48,6 @@
#include "redirect_cache.h"
#include "log.h"
static char const ident[]="$Id$";
/* Plug-in identification */
static char name[]="plugin_prefix";
static char desc[]="Adds a dial-prefix as defined in config file";

View File

@ -45,8 +45,6 @@
#include "redirect_cache.h"
#include "log.h"
static char const ident[]="$Id$";
/* Plug-in identification */
static char name[]="plugin_regex";
static char desc[]="Use regular expressions to rewrite SIP targets";

View File

@ -37,8 +37,6 @@
#include "plugins.h"
#include "log.h"
static char const ident[]="$Id$";
/* Plug-in identification */
static char name[]="plugin_shortdial";
static char desc[]="Handles Dial shortcuts as defined in config file";

View File

@ -37,8 +37,6 @@
#include "plugins.h"
#include "log.h"
static char const ident[]="$Id$";
/* Plug-in identification */
static char name[]="plugin_siptrunk";
static char desc[]="Handles SIP trunks with multiple numbers on same SIP account";

View File

@ -41,9 +41,6 @@
#include "plugins.h"
#include "log.h"
static char const ident[]="$Id$";
/* Plug-in identification */
static char name[]="plugin_stats";
static char desc[]="Upon receiving SIGUSR1, dump some call statistics";

View File

@ -37,8 +37,6 @@
#include "plugins.h"
#include "log.h"
static char const ident[]="$Id$";
/* Plug-in identification */
static char name[]="plugin_stripheader";
static char desc[]="Allows removing SIP headers";

View File

@ -39,8 +39,6 @@
#include "plugins.h"
#include "log.h"
static char const ident[]="$Id$";
/* Plug-in identification */
static char name[]="plugin_stun";
static char desc[]="Use an external STUN server to determine my public IP";

View File

@ -35,8 +35,6 @@
#include "log.h"
#include "plugins.h"
static char const ident[]="$Id$";
/* configuration storage */
extern struct siproxd_config configuration;

View File

@ -37,8 +37,6 @@
#include "plugins.h"
#include "log.h"
static char const ident[]="$Id$";
/* configuration storage */
extern struct siproxd_config configuration; /* defined in siproxd.c */

View File

@ -32,8 +32,6 @@
#include "siproxd.h"
#include "log.h"
static char const ident[]="$Id$";
/* configuration storage */
extern struct siproxd_config configuration;

View File

@ -35,8 +35,6 @@
#include "redirect_cache.h"
#include "log.h"
static char const ident[]="$Id$";
#define CACHE_TIMEOUT 20
/*

View File

@ -35,8 +35,6 @@
#include "siproxd.h"
#include "log.h"
static char const ident[]="$Id$";
/* configuration storage */
extern struct siproxd_config configuration;
@ -56,7 +54,7 @@ void register_init(void) {
FILE *stream;
int sts, i;
char buff[128];
// char *c;
char *t;
memset(urlmap, 0, sizeof(urlmap));
@ -74,14 +72,15 @@ void register_init(void) {
/* read the url table from file */
DEBUGC(DBCLASS_REG,"loading registration table, size=%i",URLMAP_SIZE);
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);
if (sts == 0) break; /* format error */
if (urlmap[i].active) {
#define R(X) {\
sts=osip_uri_init(&X); \
if (sts == 0) { \
fgets(buff, sizeof(buff), stream);\
t=fgets(buff, sizeof(buff), stream);\
buff[sizeof(buff)-1]='\0';\
if (strchr(buff, 10)) *strchr(buff, 10)='\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]);
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) */
urlmap[i].masq_url->host=realloc(urlmap[i].masq_url->host,
strlen(configuration.masked_host.string[j])+1);
strncpy(urlmap[i].masq_url->host, configuration.masked_host.string[j],
strlen(configuration.masked_host.string[j])+1);
urlmap[i].masq_url->host=realloc(urlmap[i].masq_url->host, len);
strncpy(urlmap[i].masq_url->host, configuration.masked_host.string[j], len);
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);
if (strcmp(urlmap[i].masq_url->host, addrstr) != 0) {
int len=strlen(addrstr)+1;
/* new address, update urlmap (+1 includes terminating \0) */
urlmap[i].masq_url->host=realloc(urlmap[i].masq_url->host,
strlen(addrstr)+1);
strncpy(urlmap[i].masq_url->host, addrstr, strlen(addrstr)+1);
urlmap[i].masq_url->host=realloc(urlmap[i].masq_url->host, len);
strncpy(urlmap[i].masq_url->host, addrstr, len);
urlmap[i].masq_url->host[strlen(addrstr)]='\0';
}
/* port number if required */
if (configuration.sip_listen_port != SIP_PORT) {
urlmap[i].masq_url->port=realloc(urlmap[i].masq_url->port, 16);
snprintf(urlmap[i].masq_url->port, 16, "%i",
urlmap[i].masq_url->port=realloc(urlmap[i].masq_url->port, PORTSTRING_SIZE);
snprintf(urlmap[i].masq_url->port, PORTSTRING_SIZE, "%i",
configuration.sip_listen_port);
}

View File

@ -37,9 +37,6 @@
#define USE_NAPTR 0
static char const ident[]="$Id$";
/* local functions */
static int _resolve(char *name, int class, int type,
char *dname, int dnamelen, int *port);

View File

@ -35,8 +35,6 @@
#include "siproxd.h"
#include "log.h"
static char const ident[]="$Id$";
/* configuration storage */
extern struct siproxd_config configuration; /* defined in siproxd.c */

View File

@ -30,8 +30,6 @@
#include "rtpproxy.h"
#include "log.h"
static char const ident[]="$Id$";
/* configuration storage */
extern struct siproxd_config configuration;

View File

@ -46,8 +46,6 @@
#include "dejitter.h"
#endif
static char const ident[]="$Id$";
/* configuration storage */
extern struct siproxd_config configuration;
@ -149,7 +147,12 @@ int rtp_relay_init( void ) {
uid=getuid();
euid=geteuid();
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) {
#endif
@ -176,7 +179,12 @@ int rtp_relay_init( void ) {
INFO("Unable to use realtime scheduling for RTP proxy");
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
@ -725,7 +733,12 @@ int rtp_relay_start_fwd (osip_call_id_t *callid, client_id_t client_id,
uid=getuid();
euid=geteuid();
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) {
/* now I'm root */
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 */
}
/* 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) */

View File

@ -33,8 +33,6 @@
#include "siproxd.h"
#include "log.h"
static char const ident[]="$Id$";
/*
* do security and integrity checks on the received packet
* (raw buffer, \0 terminated)

View File

@ -21,8 +21,6 @@
#include <osipparser2/osip_parser.h>
#include <log.h>
static char const ident[]="$Id$";
/*
* This file contains wrapper functions to call the osip2_ library.
* depending on the used version of libosip2, the calling arguments

View File

@ -42,9 +42,6 @@
#include "digcalc.h"
#include "log.h"
static char const ident[]="$Id$";
/* configuration storage */
extern struct siproxd_config configuration;
@ -590,16 +587,17 @@ int sip_add_myvia (sip_ticket_t *ticket, int interface) {
myaddr=utils_inet_ntoa(addr);
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,
branch_id,
(add_rport)? ";rport":"");
} 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,
branch_id,
(add_rport)? ";rport":"");
}
tmp[URL_STRING_SIZE-1]='\0';
DEBUGC(DBCLASS_BABBLE,"adding VIA:%s",tmp);

View File

@ -41,8 +41,6 @@
#include "plugins.h"
#include "log.h"
static char const ident[]="$Id$";
/* configuration storage */
struct siproxd_config configuration;
/* instructions for config parser */

View File

@ -311,7 +311,7 @@ int unload_plugins(void);
#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 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() */
#if defined(PR_NETDB_BUF_SIZE)

View File

@ -39,9 +39,6 @@
#include "siproxd.h"
#include "log.h"
static char const ident[]="$Id$";
/* configuration storage */
extern struct siproxd_config configuration;
@ -95,7 +92,12 @@ int sipsock_listen (void) {
uid=getuid();
euid=geteuid();
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) {
/* now I'm root */
if (!(configuration.sip_dscp & ~0x3f)) {
@ -115,7 +117,13 @@ int sipsock_listen (void) {
configuration.rtp_dscp = 0; /* inhibit further attempts */
}
/* 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 */

View File

@ -50,8 +50,6 @@
#include "siproxd.h"
#include "log.h"
static char const ident[]="$Id$";
/* configuration storage */
extern struct siproxd_config configuration;