mirror of
https://github.com/asterisk/asterisk.git
synced 2026-07-27 16:07:15 -07:00
Go through and fix a bunch of places where character strings were being interpreted as format strings. Most of these changes are solely to make compiling with -Wsecurity and -Wformat=2 happy, and were not
actual problems, per se. I also added format attributes to any printf wrapper functions I found that didn't have them. -Wsecurity and -Wmissing-format-attribute added to --enable-dev-mode. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@109447 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -229,7 +229,7 @@ ASTCFLAGS+=-Wall -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations
|
||||
ASTCFLAGS+=-include $(ASTTOPDIR)/include/asterisk/autoconfig.h
|
||||
|
||||
ifeq ($(AST_DEVMODE),yes)
|
||||
ASTCFLAGS+=-Werror -Wunused -Wundef $(AST_DECLARATION_AFTER_STATEMENT)
|
||||
ASTCFLAGS+=-Werror -Wunused -Wundef $(AST_DECLARATION_AFTER_STATEMENT) -Wmissing-format-attribute -Wformat-security #-Wformat=2
|
||||
endif
|
||||
|
||||
ifneq ($(findstring BSD,$(OSARCH)),)
|
||||
|
||||
+18
-6
@@ -327,11 +327,21 @@ static int festival_exec(struct ast_channel *chan, void *vdata)
|
||||
if (!(cachedir = ast_variable_retrieve(cfg, "general", "cachedir"))) {
|
||||
cachedir = "/tmp/";
|
||||
}
|
||||
|
||||
data = ast_strdupa(vdata);
|
||||
AST_STANDARD_APP_ARGS(args, data);
|
||||
|
||||
if (!(festivalcommand = ast_variable_retrieve(cfg, "general", "festivalcommand"))) {
|
||||
festivalcommand = "(tts_textasterisk \"%s\" 'file)(quit)\n";
|
||||
const char *startcmd = "(tts_textasterisk \"";
|
||||
const char *endcmd = "\" 'file)(quit)\n";
|
||||
|
||||
strln = strlen(startcmd) + strlen(args.text) + strlen(endcmd) + 1;
|
||||
newfestivalcommand = alloca(strln);
|
||||
snprintf(newfestivalcommand, strln, "%s%s%s", startcmd, args.text, endcmd);
|
||||
festivalcommand = newfestivalcommand;
|
||||
} else { /* This else parses the festivalcommand that we're sent from the config file for \n's, etc */
|
||||
int i, j;
|
||||
newfestivalcommand = alloca(strlen(festivalcommand) + 1);
|
||||
newfestivalcommand = alloca(strlen(festivalcommand) + strlen(args.text) + 1);
|
||||
|
||||
for (i = 0, j = 0; i < strlen(festivalcommand); i++) {
|
||||
if (festivalcommand[i] == '\\' && festivalcommand[i + 1] == 'n') {
|
||||
@@ -340,6 +350,10 @@ static int festival_exec(struct ast_channel *chan, void *vdata)
|
||||
} else if (festivalcommand[i] == '\\') {
|
||||
newfestivalcommand[j++] = festivalcommand[i + 1];
|
||||
i++;
|
||||
} else if (festivalcommand[i] == '%' && festivalcommand[i + 1] == 's') {
|
||||
sprintf(&newfestivalcommand[j], "%s", args.text); /* we know it is big enough */
|
||||
j += strlen(args.text);
|
||||
i++;
|
||||
} else
|
||||
newfestivalcommand[j++] = festivalcommand[i];
|
||||
}
|
||||
@@ -347,9 +361,6 @@ static int festival_exec(struct ast_channel *chan, void *vdata)
|
||||
festivalcommand = newfestivalcommand;
|
||||
}
|
||||
|
||||
data = ast_strdupa(vdata);
|
||||
AST_STANDARD_APP_ARGS(args, data);
|
||||
|
||||
if (args.interrupt && !strcasecmp(args.interrupt, "any"))
|
||||
args.interrupt = AST_DIGIT_ANY;
|
||||
|
||||
@@ -440,7 +451,8 @@ static int festival_exec(struct ast_channel *chan, void *vdata)
|
||||
} else {
|
||||
ast_debug(1, "Passing text to festival...\n");
|
||||
fs = fdopen(dup(fd), "wb");
|
||||
fprintf(fs, festivalcommand, args.text);
|
||||
|
||||
fprintf(fs, "%s", festivalcommand);
|
||||
fflush(fs);
|
||||
fclose(fs);
|
||||
}
|
||||
|
||||
+4
-4
@@ -955,9 +955,9 @@ static char *meetme_cmd(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a
|
||||
int hr, min, sec;
|
||||
int i = 0, total = 0;
|
||||
time_t now;
|
||||
char *header_format = "%-14s %-14s %-10s %-8s %-8s %-6s\n";
|
||||
char *data_format = "%-12.12s %4.4d %4.4s %02d:%02d:%02d %-8s %-6s\n";
|
||||
char cmdline[1024] = "";
|
||||
#define MC_HEADER_FORMAT "%-14s %-14s %-10s %-8s %-8s %-6s\n"
|
||||
#define MC_DATA_FORMAT "%-12.12s %4.4d %4.4s %02d:%02d:%02d %-8s %-6s\n"
|
||||
|
||||
switch (cmd) {
|
||||
case CLI_INIT:
|
||||
@@ -989,7 +989,7 @@ static char *meetme_cmd(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a
|
||||
return CLI_SUCCESS;
|
||||
}
|
||||
if (!concise)
|
||||
ast_cli(a->fd, header_format, "Conf Num", "Parties", "Marked", "Activity", "Creation", "Locked");
|
||||
ast_cli(a->fd, MC_HEADER_FORMAT, "Conf Num", "Parties", "Marked", "Activity", "Creation", "Locked");
|
||||
AST_LIST_TRAVERSE(&confs, cnf, list) {
|
||||
if (cnf->markedusers == 0)
|
||||
strcpy(cmdline, "N/A ");
|
||||
@@ -999,7 +999,7 @@ static char *meetme_cmd(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a
|
||||
min = ((now - cnf->start) % 3600) / 60;
|
||||
sec = (now - cnf->start) % 60;
|
||||
if (!concise)
|
||||
ast_cli(a->fd, data_format, cnf->confno, cnf->users, cmdline, hr, min, sec, cnf->isdynamic ? "Dynamic" : "Static", cnf->locked ? "Yes" : "No");
|
||||
ast_cli(a->fd, MC_DATA_FORMAT, cnf->confno, cnf->users, cmdline, hr, min, sec, cnf->isdynamic ? "Dynamic" : "Static", cnf->locked ? "Yes" : "No");
|
||||
else {
|
||||
ast_cli(a->fd, "%s!%d!%d!%02d:%02d:%02d!%d!%d\n",
|
||||
cnf->confno,
|
||||
|
||||
+14
-14
@@ -1560,10 +1560,10 @@ static int leave_voicemail(struct ast_channel *chan, char *username, struct leav
|
||||
duration < global_vmminmessage ? "IGNORED" : "OK",
|
||||
vmu->accountcode
|
||||
);
|
||||
fprintf(txt, logbuf);
|
||||
fprintf(txt, "%s", logbuf);
|
||||
if (minivmlogfile) {
|
||||
ast_mutex_lock(&minivmloglock);
|
||||
fprintf(minivmlogfile, logbuf);
|
||||
fprintf(minivmlogfile, "%s", logbuf);
|
||||
ast_mutex_unlock(&minivmloglock);
|
||||
}
|
||||
|
||||
@@ -2475,7 +2475,7 @@ static int load_config(int reload)
|
||||
static char *handle_minivm_list_templates(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
|
||||
{
|
||||
struct minivm_template *this;
|
||||
char *output_format = "%-15s %-10s %-10s %-15.15s %-50s\n";
|
||||
#define HVLT_OUTPUT_FORMAT "%-15s %-10s %-10s %-15.15s %-50s\n"
|
||||
int count = 0;
|
||||
|
||||
switch (cmd) {
|
||||
@@ -2498,10 +2498,10 @@ static char *handle_minivm_list_templates(struct ast_cli_entry *e, int cmd, stru
|
||||
AST_LIST_UNLOCK(&message_templates);
|
||||
return CLI_FAILURE;
|
||||
}
|
||||
ast_cli(a->fd, output_format, "Template name", "Charset", "Locale", "Attach media", "Subject");
|
||||
ast_cli(a->fd, output_format, "-------------", "-------", "------", "------------", "-------");
|
||||
ast_cli(a->fd, HVLT_OUTPUT_FORMAT, "Template name", "Charset", "Locale", "Attach media", "Subject");
|
||||
ast_cli(a->fd, HVLT_OUTPUT_FORMAT, "-------------", "-------", "------", "------------", "-------");
|
||||
AST_LIST_TRAVERSE(&message_templates, this, list) {
|
||||
ast_cli(a->fd, output_format, this->name,
|
||||
ast_cli(a->fd, HVLT_OUTPUT_FORMAT, this->name,
|
||||
this->charset ? this->charset : "-",
|
||||
this->locale ? this->locale : "-",
|
||||
this->attachment ? "Yes" : "No",
|
||||
@@ -2541,7 +2541,7 @@ static char *complete_minivm_show_users(const char *line, const char *word, int
|
||||
static char *handle_minivm_show_users(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
|
||||
{
|
||||
struct minivm_account *vmu;
|
||||
char *output_format = "%-23s %-15s %-15s %-10s %-10s %-50s\n";
|
||||
#define HMSU_OUTPUT_FORMAT "%-23s %-15s %-15s %-10s %-10s %-50s\n"
|
||||
int count = 0;
|
||||
|
||||
switch (cmd) {
|
||||
@@ -2566,14 +2566,14 @@ static char *handle_minivm_show_users(struct ast_cli_entry *e, int cmd, struct a
|
||||
AST_LIST_UNLOCK(&minivm_accounts);
|
||||
return CLI_FAILURE;
|
||||
}
|
||||
ast_cli(a->fd, output_format, "User", "E-Template", "P-template", "Zone", "Format", "Full name");
|
||||
ast_cli(a->fd, output_format, "----", "----------", "----------", "----", "------", "---------");
|
||||
ast_cli(a->fd, HMSU_OUTPUT_FORMAT, "User", "E-Template", "P-template", "Zone", "Format", "Full name");
|
||||
ast_cli(a->fd, HMSU_OUTPUT_FORMAT, "----", "----------", "----------", "----", "------", "---------");
|
||||
AST_LIST_TRAVERSE(&minivm_accounts, vmu, list) {
|
||||
char tmp[256] = "";
|
||||
if ((a->argc == 3) || ((a->argc == 5) && !strcmp(a->argv[4], vmu->domain))) {
|
||||
count++;
|
||||
snprintf(tmp, sizeof(tmp), "%s@%s", vmu->username, vmu->domain);
|
||||
ast_cli(a->fd, output_format, tmp, vmu->etemplate ? vmu->etemplate : "-",
|
||||
ast_cli(a->fd, HMSU_OUTPUT_FORMAT, tmp, vmu->etemplate ? vmu->etemplate : "-",
|
||||
vmu->ptemplate ? vmu->ptemplate : "-",
|
||||
vmu->zonetag ? vmu->zonetag : "-",
|
||||
vmu->attachfmt ? vmu->attachfmt : "-",
|
||||
@@ -2589,7 +2589,7 @@ static char *handle_minivm_show_users(struct ast_cli_entry *e, int cmd, struct a
|
||||
static char *handle_minivm_show_zones(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
|
||||
{
|
||||
struct minivm_zone *zone;
|
||||
char *output_format = "%-15s %-20s %-45s\n";
|
||||
#define HMSZ_OUTPUT_FORMAT "%-15s %-20s %-45s\n"
|
||||
char *res = CLI_SUCCESS;
|
||||
|
||||
switch (cmd) {
|
||||
@@ -2608,10 +2608,10 @@ static char *handle_minivm_show_zones(struct ast_cli_entry *e, int cmd, struct a
|
||||
|
||||
AST_LIST_LOCK(&minivm_zones);
|
||||
if (!AST_LIST_EMPTY(&minivm_zones)) {
|
||||
ast_cli(a->fd, output_format, "Zone", "Timezone", "Message Format");
|
||||
ast_cli(a->fd, output_format, "----", "--------", "--------------");
|
||||
ast_cli(a->fd, HMSZ_OUTPUT_FORMAT, "Zone", "Timezone", "Message Format");
|
||||
ast_cli(a->fd, HMSZ_OUTPUT_FORMAT, "----", "--------", "--------------");
|
||||
AST_LIST_TRAVERSE(&minivm_zones, zone, list) {
|
||||
ast_cli(a->fd, output_format, zone->name, zone->timezone, zone->msg_format);
|
||||
ast_cli(a->fd, HMSZ_OUTPUT_FORMAT, zone->name, zone->timezone, zone->msg_format);
|
||||
}
|
||||
} else {
|
||||
ast_cli(a->fd, "There are no voicemail zones currently defined\n");
|
||||
|
||||
+2
-2
@@ -1232,13 +1232,13 @@ static void queue_set_param(struct call_queue *q, const char *param, const char
|
||||
while ((s = strsep(&buf, ",|"))) {
|
||||
if (!q->sound_periodicannounce[i])
|
||||
q->sound_periodicannounce[i] = ast_str_create(16);
|
||||
ast_str_set(&q->sound_periodicannounce[i], 0, s);
|
||||
ast_str_set(&q->sound_periodicannounce[i], 0, "%s", s);
|
||||
i++;
|
||||
if (i == MAX_PERIODIC_ANNOUNCEMENTS)
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
ast_str_set(&q->sound_periodicannounce[0], 0, val);
|
||||
ast_str_set(&q->sound_periodicannounce[0], 0, "%s", val);
|
||||
}
|
||||
} else if (!strcasecmp(param, "periodic-announce-frequency")) {
|
||||
q->periodicannouncefrequency = atoi(val);
|
||||
|
||||
+8
-16
@@ -645,7 +645,6 @@ static char *pagerbody = NULL;
|
||||
static char *pagersubject = NULL;
|
||||
static char fromstring[100];
|
||||
static char pagerfromstring[100];
|
||||
static char emailtitle[100];
|
||||
static char charset[32] = "ISO-8859-1";
|
||||
|
||||
static unsigned char adsifdn[4] = "\x00\x00\x00\x0F";
|
||||
@@ -2021,9 +2020,6 @@ static void make_email_file(FILE *p, char *srcemail, struct ast_vm_user *vmu, in
|
||||
ast_channel_free(ast);
|
||||
} else
|
||||
ast_log(LOG_WARNING, "Cannot allocate the channel for variables substitution\n");
|
||||
} else if (!ast_strlen_zero(emailtitle)) {
|
||||
fprintf(p, emailtitle, msgnum + 1, mailbox) ;
|
||||
fprintf(p, ENDL) ;
|
||||
} else if (ast_test_flag((&globalflags), VM_PBXSKIP))
|
||||
fprintf(p, "Subject: New message %d in mailbox %s" ENDL, msgnum + 1, mailbox);
|
||||
else
|
||||
@@ -7802,7 +7798,7 @@ static char *complete_voicemail_show_users(const char *line, const char *word, i
|
||||
static char *handle_voicemail_show_users(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
|
||||
{
|
||||
struct ast_vm_user *vmu;
|
||||
char *output_format = "%-10s %-5s %-25s %-10s %6s\n";
|
||||
#define HVSU_OUTPUT_FORMAT "%-10s %-5s %-25s %-10s %6s\n"
|
||||
const char *context = NULL;
|
||||
int users_counter = 0;
|
||||
|
||||
@@ -7840,7 +7836,7 @@ static char *handle_voicemail_show_users(struct ast_cli_entry *e, int cmd, struc
|
||||
return CLI_FAILURE;
|
||||
}
|
||||
if (a->argc == 3)
|
||||
ast_cli(a->fd, output_format, "Context", "Mbox", "User", "Zone", "NewMsg");
|
||||
ast_cli(a->fd, HVSU_OUTPUT_FORMAT, "Context", "Mbox", "User", "Zone", "NewMsg");
|
||||
else {
|
||||
int count = 0;
|
||||
AST_LIST_TRAVERSE(&users, vmu, list) {
|
||||
@@ -7848,7 +7844,7 @@ static char *handle_voicemail_show_users(struct ast_cli_entry *e, int cmd, struc
|
||||
count++;
|
||||
}
|
||||
if (count) {
|
||||
ast_cli(a->fd, output_format, "Context", "Mbox", "User", "Zone", "NewMsg");
|
||||
ast_cli(a->fd, HVSU_OUTPUT_FORMAT, "Context", "Mbox", "User", "Zone", "NewMsg");
|
||||
} else {
|
||||
ast_cli(a->fd, "No such voicemail context \"%s\"\n", context);
|
||||
AST_LIST_UNLOCK(&users);
|
||||
@@ -7863,7 +7859,7 @@ static char *handle_voicemail_show_users(struct ast_cli_entry *e, int cmd, struc
|
||||
snprintf(tmp, sizeof(tmp), "%s@%s", vmu->mailbox, ast_strlen_zero(vmu->context) ? "default" : vmu->context);
|
||||
inboxcount(tmp, &newmsgs, &oldmsgs);
|
||||
snprintf(count, sizeof(count), "%d", newmsgs);
|
||||
ast_cli(a->fd, output_format, vmu->context, vmu->mailbox, vmu->fullname, vmu->zonetag, count);
|
||||
ast_cli(a->fd, HVSU_OUTPUT_FORMAT, vmu->context, vmu->mailbox, vmu->fullname, vmu->zonetag, count);
|
||||
users_counter++;
|
||||
}
|
||||
}
|
||||
@@ -7876,7 +7872,7 @@ static char *handle_voicemail_show_users(struct ast_cli_entry *e, int cmd, struc
|
||||
static char *handle_voicemail_show_zones(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
|
||||
{
|
||||
struct vm_zone *zone;
|
||||
char *output_format = "%-15s %-20s %-45s\n";
|
||||
#define HVSZ_OUTPUT_FORMAT "%-15s %-20s %-45s\n"
|
||||
char *res = CLI_SUCCESS;
|
||||
|
||||
switch (cmd) {
|
||||
@@ -7895,9 +7891,9 @@ static char *handle_voicemail_show_zones(struct ast_cli_entry *e, int cmd, struc
|
||||
|
||||
AST_LIST_LOCK(&zones);
|
||||
if (!AST_LIST_EMPTY(&zones)) {
|
||||
ast_cli(a->fd, output_format, "Zone", "Timezone", "Message Format");
|
||||
ast_cli(a->fd, HVSZ_OUTPUT_FORMAT, "Zone", "Timezone", "Message Format");
|
||||
AST_LIST_TRAVERSE(&zones, zone, list) {
|
||||
ast_cli(a->fd, output_format, zone->name, zone->timezone, zone->msg_format);
|
||||
ast_cli(a->fd, HVSZ_OUTPUT_FORMAT, zone->name, zone->timezone, zone->msg_format);
|
||||
}
|
||||
} else {
|
||||
ast_cli(a->fd, "There are no voicemail zones currently defined\n");
|
||||
@@ -8720,7 +8716,6 @@ static int load_config(int reload)
|
||||
}
|
||||
memset(fromstring, 0, sizeof(fromstring));
|
||||
memset(pagerfromstring, 0, sizeof(pagerfromstring));
|
||||
memset(emailtitle, 0, sizeof(emailtitle));
|
||||
strcpy(charset, "ISO-8859-1");
|
||||
if (emailbody) {
|
||||
ast_free(emailbody);
|
||||
@@ -8758,13 +8753,10 @@ static int load_config(int reload)
|
||||
memcpy(&adsisec[x], &tmpadsi[x], 1);
|
||||
}
|
||||
}
|
||||
if ((val = ast_variable_retrieve(cfg, "general", "adsiver")))
|
||||
if ((val = ast_variable_retrieve(cfg, "general", "adsiver"))) {
|
||||
if (atoi(val)) {
|
||||
adsiver = atoi(val);
|
||||
}
|
||||
if ((val = ast_variable_retrieve(cfg, "general", "emailtitle"))) {
|
||||
ast_log(LOG_NOTICE, "Keyword 'emailtitle' is DEPRECATED, please use 'emailsubject' instead.\n");
|
||||
ast_copy_string(emailtitle, val, sizeof(emailtitle));
|
||||
}
|
||||
if ((val = ast_variable_retrieve(cfg, "general", "emailsubject")))
|
||||
emailsubject = ast_strdup(val);
|
||||
|
||||
@@ -102,7 +102,7 @@ static int load_column_config(const char *tmp)
|
||||
return -1;
|
||||
}
|
||||
if (!column_string->used)
|
||||
ast_str_set(&column_string, 0, escaped);
|
||||
ast_str_set(&column_string, 0, "%s", escaped);
|
||||
else
|
||||
ast_str_append(&column_string, 0, ",%s", escaped);
|
||||
sqlite3_free(escaped);
|
||||
|
||||
+10
-13
@@ -788,7 +788,7 @@ static void iax_error_output(const char *data)
|
||||
ast_log(LOG_WARNING, "%s", data);
|
||||
}
|
||||
|
||||
static void jb_error_output(const char *fmt, ...)
|
||||
static void __attribute__((format (printf, 1, 2))) jb_error_output(const char *fmt, ...)
|
||||
{
|
||||
va_list args;
|
||||
char buf[1024];
|
||||
@@ -797,10 +797,10 @@ static void jb_error_output(const char *fmt, ...)
|
||||
vsnprintf(buf, sizeof(buf), fmt, args);
|
||||
va_end(args);
|
||||
|
||||
ast_log(LOG_ERROR, buf);
|
||||
ast_log(LOG_ERROR, "%s", buf);
|
||||
}
|
||||
|
||||
static void jb_warning_output(const char *fmt, ...)
|
||||
static void __attribute__((format (printf, 1, 2))) jb_warning_output(const char *fmt, ...)
|
||||
{
|
||||
va_list args;
|
||||
char buf[1024];
|
||||
@@ -809,10 +809,10 @@ static void jb_warning_output(const char *fmt, ...)
|
||||
vsnprintf(buf, sizeof(buf), fmt, args);
|
||||
va_end(args);
|
||||
|
||||
ast_log(LOG_WARNING, buf);
|
||||
ast_log(LOG_WARNING, "%s", buf);
|
||||
}
|
||||
|
||||
static void jb_debug_output(const char *fmt, ...)
|
||||
static void __attribute__((format (printf, 1, 2))) jb_debug_output(const char *fmt, ...)
|
||||
{
|
||||
va_list args;
|
||||
char buf[1024];
|
||||
@@ -821,7 +821,7 @@ static void jb_debug_output(const char *fmt, ...)
|
||||
vsnprintf(buf, sizeof(buf), fmt, args);
|
||||
va_end(args);
|
||||
|
||||
ast_verbose(buf);
|
||||
ast_verbose("%s", buf);
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -5173,11 +5173,12 @@ static int ast_cli_netstats(struct mansession *s, int fd, int limit_fmt)
|
||||
{
|
||||
int x;
|
||||
int numchans = 0;
|
||||
#define ACN_FORMAT1 "%-25.25s %4d %4d %4d %5d %3d %5d %4d %6d %4d %4d %5d %3d %5d %4d %6d\n"
|
||||
#define ACN_FORMAT2 "%s %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d\n"
|
||||
for (x=0;x<IAX_MAX_CALLS;x++) {
|
||||
ast_mutex_lock(&iaxsl[x]);
|
||||
if (iaxs[x]) {
|
||||
int localjitter, localdelay, locallost, locallosspct, localdropped, localooo;
|
||||
char *fmt;
|
||||
jb_info jbinfo;
|
||||
|
||||
if(ast_test_flag(iaxs[x], IAX_USEJITTERBUF)) {
|
||||
@@ -5196,13 +5197,9 @@ static int ast_cli_netstats(struct mansession *s, int fd, int limit_fmt)
|
||||
localdropped = 0;
|
||||
localooo = -1;
|
||||
}
|
||||
if (limit_fmt)
|
||||
fmt = "%-25.25s %4d %4d %4d %5d %3d %5d %4d %6d %4d %4d %5d %3d %5d %4d %6d\n";
|
||||
else
|
||||
fmt = "%s %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d\n";
|
||||
if (s)
|
||||
|
||||
astman_append(s, fmt,
|
||||
astman_append(s, limit_fmt ? ACN_FORMAT1 : ACN_FORMAT2,
|
||||
iaxs[x]->owner ? iaxs[x]->owner->name : "(None)",
|
||||
iaxs[x]->pingtime,
|
||||
localjitter,
|
||||
@@ -5220,7 +5217,7 @@ static int ast_cli_netstats(struct mansession *s, int fd, int limit_fmt)
|
||||
iaxs[x]->remote_rr.ooo,
|
||||
iaxs[x]->remote_rr.packets/1000);
|
||||
else
|
||||
ast_cli(fd, fmt,
|
||||
ast_cli(fd, limit_fmt ? ACN_FORMAT1 : ACN_FORMAT2,
|
||||
iaxs[x]->owner ? iaxs[x]->owner->name : "(None)",
|
||||
iaxs[x]->pingtime,
|
||||
localjitter,
|
||||
|
||||
@@ -5709,7 +5709,7 @@ void chan_misdn_log(int level, int port, char *tmpl, ...)
|
||||
va_end(ap);
|
||||
|
||||
if (level == -1)
|
||||
ast_log(LOG_WARNING, buf);
|
||||
ast_log(LOG_WARNING, "%s", buf);
|
||||
|
||||
else if (misdn_debug_only[port] ?
|
||||
(level == 1 && misdn_debug[port]) || (level == misdn_debug[port])
|
||||
|
||||
+1
-1
@@ -2634,7 +2634,7 @@ static void ast_sip_ouraddrfor(struct in_addr *them, struct sockaddr_in *us)
|
||||
}
|
||||
|
||||
/*! \brief Append to SIP dialog history with arg list */
|
||||
static void append_history_va(struct sip_pvt *p, const char *fmt, va_list ap)
|
||||
static __attribute__((format (printf, 2, 0))) void append_history_va(struct sip_pvt *p, const char *fmt, va_list ap)
|
||||
{
|
||||
char buf[80], *c = buf; /* max history length */
|
||||
struct sip_history *hist;
|
||||
|
||||
+2
-2
@@ -67,14 +67,14 @@ static int function_enum(struct ast_channel *chan, const char *cmd, char *data,
|
||||
buf[0] = '\0';
|
||||
|
||||
if (ast_strlen_zero(data)) {
|
||||
ast_log(LOG_WARNING, synopsis);
|
||||
ast_log(LOG_WARNING, "%s", synopsis);
|
||||
return -1;
|
||||
}
|
||||
|
||||
AST_STANDARD_APP_ARGS(args, data);
|
||||
|
||||
if (args.argc < 1) {
|
||||
ast_log(LOG_WARNING, synopsis);
|
||||
ast_log(LOG_WARNING, "%s", synopsis);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
@@ -810,7 +810,7 @@ extern "C" {
|
||||
* descriptor.
|
||||
*/
|
||||
#define ASTOBJ_CONTAINER_DUMP(fd,s,slen,container) \
|
||||
ASTOBJ_CONTAINER_TRAVERSE(container, 1, do { ASTOBJ_DUMP(s,slen,iterator); ast_cli(fd, s); } while(0))
|
||||
ASTOBJ_CONTAINER_TRAVERSE(container, 1, do { ASTOBJ_DUMP(s,slen,iterator); ast_cli(fd, "%s", s); } while(0))
|
||||
|
||||
#if defined(__cplusplus) || defined(c_plusplus)
|
||||
}
|
||||
|
||||
@@ -218,7 +218,7 @@ int ast_build_string(char **buffer, size_t *space, const char *fmt, ...) __attri
|
||||
\param fmt printf-style format string
|
||||
\param ap varargs list of arguments for format
|
||||
*/
|
||||
int ast_build_string_va(char **buffer, size_t *space, const char *fmt, va_list ap);
|
||||
int ast_build_string_va(char **buffer, size_t *space, const char *fmt, va_list ap) __attribute__((format (printf, 3, 0)));
|
||||
|
||||
/*!
|
||||
* \brief Make sure something is true.
|
||||
|
||||
@@ -554,6 +554,7 @@ char * attribute_malloc _ast_strndup(const char *str, size_t len, const char *fi
|
||||
_ast_asprintf((ret), __FILE__, __LINE__, __PRETTY_FUNCTION__, fmt, __VA_ARGS__)
|
||||
|
||||
AST_INLINE_API(
|
||||
__attribute__((format (printf, 5, 6)))
|
||||
int _ast_asprintf(char **ret, const char *file, int lineno, const char *func, const char *fmt, ...),
|
||||
{
|
||||
int res;
|
||||
@@ -580,6 +581,7 @@ int _ast_asprintf(char **ret, const char *file, int lineno, const char *func, co
|
||||
_ast_vasprintf((ret), __FILE__, __LINE__, __PRETTY_FUNCTION__, (fmt), (ap))
|
||||
|
||||
AST_INLINE_API(
|
||||
__attribute__((format (printf, 5, 0)))
|
||||
int _ast_vasprintf(char **ret, const char *file, int lineno, const char *func, const char *fmt, va_list ap),
|
||||
{
|
||||
int res;
|
||||
|
||||
+1
-1
@@ -163,7 +163,7 @@ enum jb_return_code jb_getinfo(jitterbuf *jb, jb_info *stats);
|
||||
/*! \brief set jitterbuf conf */
|
||||
enum jb_return_code jb_setconf(jitterbuf *jb, jb_conf *conf);
|
||||
|
||||
typedef void (*jb_output_function_t)(const char *fmt, ...);
|
||||
typedef void __attribute__((format (printf, 1, 2))) (*jb_output_function_t)(const char *fmt, ...);
|
||||
void jb_setoutput(jb_output_function_t err, jb_output_function_t warn, jb_output_function_t dbg);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
+21
-21
@@ -1374,7 +1374,7 @@ static void quit_handler(int num, int nice, int safeshutdown, int restart)
|
||||
close(ast_consock);
|
||||
if (!ast_opt_remote)
|
||||
unlink(ast_config_AST_PID);
|
||||
printf(term_quit());
|
||||
printf("%s", term_quit());
|
||||
if (restart) {
|
||||
if (option_verbose || ast_opt_console)
|
||||
ast_verbose("Preparing for Asterisk restart...\n");
|
||||
@@ -1459,7 +1459,7 @@ static int ast_all_zeros(char *s)
|
||||
|
||||
static void consolehandler(char *s)
|
||||
{
|
||||
printf(term_end());
|
||||
printf("%s", term_end());
|
||||
fflush(stdout);
|
||||
|
||||
/* Called when readline data is available */
|
||||
@@ -1907,7 +1907,7 @@ static int ast_el_read_char(EditLine *el, char *cp)
|
||||
for (tries = 0; tries < 30 * reconnects_per_second; tries++) {
|
||||
if (ast_tryconnect()) {
|
||||
fprintf(stderr, "Reconnect succeeded after %.3f seconds\n", 1.0 / reconnects_per_second * tries);
|
||||
printf(term_quit());
|
||||
printf("%s", term_quit());
|
||||
WELCOME_MESSAGE;
|
||||
if (!ast_opt_mute)
|
||||
fdprint(ast_consock, "logger mute silent");
|
||||
@@ -3087,7 +3087,7 @@ int main(int argc, char *argv[])
|
||||
#endif
|
||||
|
||||
ast_term_init();
|
||||
printf(term_end());
|
||||
printf("%s", term_end());
|
||||
fflush(stdout);
|
||||
|
||||
if (ast_opt_console && !option_verbose)
|
||||
@@ -3112,18 +3112,18 @@ int main(int argc, char *argv[])
|
||||
quit_handler(0, 0, 0, 0);
|
||||
exit(0);
|
||||
}
|
||||
printf(term_quit());
|
||||
printf("%s", term_quit());
|
||||
ast_remotecontrol(NULL);
|
||||
quit_handler(0, 0, 0, 0);
|
||||
exit(0);
|
||||
} else {
|
||||
ast_log(LOG_ERROR, "Asterisk already running on %s. Use 'asterisk -r' to connect.\n", ast_config_AST_SOCKET);
|
||||
printf(term_quit());
|
||||
printf("%s", term_quit());
|
||||
exit(1);
|
||||
}
|
||||
} else if (ast_opt_remote || ast_opt_exec) {
|
||||
ast_log(LOG_ERROR, "Unable to connect to remote asterisk (does %s exist?)\n", ast_config_AST_SOCKET);
|
||||
printf(term_quit());
|
||||
printf("%s", term_quit());
|
||||
exit(1);
|
||||
}
|
||||
/* Blindly write pid file since we couldn't connect */
|
||||
@@ -3181,7 +3181,7 @@ int main(int argc, char *argv[])
|
||||
initstate((unsigned int) getpid() * 65536 + (unsigned int) time(NULL), randompool, sizeof(randompool));
|
||||
|
||||
if (init_logger()) { /* Start logging subsystem */
|
||||
printf(term_quit());
|
||||
printf("%s", term_quit());
|
||||
exit(1);
|
||||
}
|
||||
|
||||
@@ -3192,12 +3192,12 @@ int main(int argc, char *argv[])
|
||||
ast_autoservice_init();
|
||||
|
||||
if (load_modules(1)) { /* Load modules, pre-load only */
|
||||
printf(term_quit());
|
||||
printf("%s", term_quit());
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (dnsmgr_init()) { /* Initialize the DNS manager */
|
||||
printf(term_quit());
|
||||
printf("%s", term_quit());
|
||||
exit(1);
|
||||
}
|
||||
|
||||
@@ -3206,17 +3206,17 @@ int main(int argc, char *argv[])
|
||||
ast_channels_init();
|
||||
|
||||
if (init_manager()) {
|
||||
printf(term_quit());
|
||||
printf("%s", term_quit());
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (ast_cdr_engine_init()) {
|
||||
printf(term_quit());
|
||||
printf("%s", term_quit());
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (ast_device_state_engine_init()) {
|
||||
printf(term_quit());
|
||||
printf("%s", term_quit());
|
||||
exit(1);
|
||||
}
|
||||
|
||||
@@ -3225,39 +3225,39 @@ int main(int argc, char *argv[])
|
||||
ast_udptl_init();
|
||||
|
||||
if (ast_image_init()) {
|
||||
printf(term_quit());
|
||||
printf("%s", term_quit());
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (ast_file_init()) {
|
||||
printf(term_quit());
|
||||
printf("%s", term_quit());
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (load_pbx()) {
|
||||
printf(term_quit());
|
||||
printf("%s", term_quit());
|
||||
exit(1);
|
||||
}
|
||||
|
||||
ast_features_init();
|
||||
|
||||
if (init_framer()) {
|
||||
printf(term_quit());
|
||||
printf("%s", term_quit());
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (astdb_init()) {
|
||||
printf(term_quit());
|
||||
printf("%s", term_quit());
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (ast_enum_init()) {
|
||||
printf(term_quit());
|
||||
printf("%s", term_quit());
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (load_modules(0)) {
|
||||
printf(term_quit());
|
||||
printf("%s", term_quit());
|
||||
exit(1);
|
||||
}
|
||||
|
||||
@@ -3268,7 +3268,7 @@ int main(int argc, char *argv[])
|
||||
if (ast_opt_console && !option_verbose)
|
||||
ast_verbose(" ]\n");
|
||||
if (option_verbose || ast_opt_console)
|
||||
ast_verbose(term_color(tmp, "Asterisk Ready.\n", COLOR_BRWHITE, COLOR_BLACK, sizeof(tmp)));
|
||||
ast_verbose("%s", term_color(tmp, "Asterisk Ready.\n", COLOR_BRWHITE, COLOR_BLACK, sizeof(tmp)));
|
||||
if (ast_opt_no_fork)
|
||||
consolethread = pthread_self();
|
||||
|
||||
|
||||
+1
-1
@@ -878,7 +878,7 @@ static char *handle_commandcomplete(struct ast_cli_entry *e, int cmd, struct ast
|
||||
return CLI_SHOWUSAGE;
|
||||
buf = __ast_cli_generator(a->argv[2], a->argv[3], atoi(a->argv[4]), 0);
|
||||
if (buf) {
|
||||
ast_cli(a->fd, buf);
|
||||
ast_cli(a->fd, "%s", buf);
|
||||
ast_free(buf);
|
||||
} else
|
||||
ast_cli(a->fd, "NULL\n");
|
||||
|
||||
+8
-8
@@ -2845,7 +2845,7 @@ static char *handle_feature_show(struct ast_cli_entry *e, int cmd, struct ast_cl
|
||||
{
|
||||
int i;
|
||||
struct ast_call_feature *feature;
|
||||
char format[] = "%-25s %-7s %-7s\n";
|
||||
#define HFS_FORMAT "%-25s %-7s %-7s\n"
|
||||
|
||||
switch (cmd) {
|
||||
|
||||
@@ -2859,25 +2859,25 @@ static char *handle_feature_show(struct ast_cli_entry *e, int cmd, struct ast_cl
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ast_cli(a->fd, format, "Builtin Feature", "Default", "Current");
|
||||
ast_cli(a->fd, format, "---------------", "-------", "-------");
|
||||
ast_cli(a->fd, HFS_FORMAT, "Builtin Feature", "Default", "Current");
|
||||
ast_cli(a->fd, HFS_FORMAT, "---------------", "-------", "-------");
|
||||
|
||||
ast_cli(a->fd, format, "Pickup", "*8", ast_pickup_ext()); /* default hardcoded above, so we'll hardcode it here */
|
||||
ast_cli(a->fd, HFS_FORMAT, "Pickup", "*8", ast_pickup_ext()); /* default hardcoded above, so we'll hardcode it here */
|
||||
|
||||
ast_rwlock_rdlock(&features_lock);
|
||||
for (i = 0; i < FEATURES_COUNT; i++)
|
||||
ast_cli(a->fd, format, builtin_features[i].fname, builtin_features[i].default_exten, builtin_features[i].exten);
|
||||
ast_cli(a->fd, HFS_FORMAT, builtin_features[i].fname, builtin_features[i].default_exten, builtin_features[i].exten);
|
||||
ast_rwlock_unlock(&features_lock);
|
||||
|
||||
ast_cli(a->fd, "\n");
|
||||
ast_cli(a->fd, format, "Dynamic Feature", "Default", "Current");
|
||||
ast_cli(a->fd, format, "---------------", "-------", "-------");
|
||||
ast_cli(a->fd, HFS_FORMAT, "Dynamic Feature", "Default", "Current");
|
||||
ast_cli(a->fd, HFS_FORMAT, "---------------", "-------", "-------");
|
||||
if (AST_LIST_EMPTY(&feature_list))
|
||||
ast_cli(a->fd, "(none)\n");
|
||||
else {
|
||||
AST_LIST_LOCK(&feature_list);
|
||||
AST_LIST_TRAVERSE(&feature_list, feature, feature_entry)
|
||||
ast_cli(a->fd, format, feature->sname, "no def", feature->exten);
|
||||
ast_cli(a->fd, HFS_FORMAT, feature->sname, "no def", feature->exten);
|
||||
AST_LIST_UNLOCK(&feature_list);
|
||||
}
|
||||
ast_cli(a->fd, "\nCall parking\n");
|
||||
|
||||
+1
-1
@@ -560,7 +560,7 @@ static enum jb_return_code _jb_get(jitterbuf *jb, jb_frame *frameout, long now,
|
||||
|
||||
/* if a hard clamp was requested, use it */
|
||||
if ((jb->info.conf.max_jitterbuf) && ((jb->info.target - jb->info.min) > jb->info.conf.max_jitterbuf)) {
|
||||
jb_dbg("clamping target from %d to %d\n", (jb->info.target - jb->info.min), jb->info.conf.max_jitterbuf);
|
||||
jb_dbg("clamping target from %ld to %ld\n", (jb->info.target - jb->info.min), jb->info.conf.max_jitterbuf);
|
||||
jb->info.target = jb->info.min + jb->info.conf.max_jitterbuf;
|
||||
}
|
||||
|
||||
|
||||
+9
-9
@@ -644,7 +644,7 @@ static char *handle_showmancmds(struct ast_cli_entry *e, int cmd, struct ast_cli
|
||||
{
|
||||
struct manager_action *cur;
|
||||
struct ast_str *authority;
|
||||
static const char *format = " %-15.15s %-15.15s %-55.55s\n";
|
||||
#define HSMC_FORMAT " %-15.15s %-15.15s %-55.55s\n"
|
||||
switch (cmd) {
|
||||
case CLI_INIT:
|
||||
e->command = "manager show commands";
|
||||
@@ -656,12 +656,12 @@ static char *handle_showmancmds(struct ast_cli_entry *e, int cmd, struct ast_cli
|
||||
return NULL;
|
||||
}
|
||||
authority = ast_str_alloca(80);
|
||||
ast_cli(a->fd, format, "Action", "Privilege", "Synopsis");
|
||||
ast_cli(a->fd, format, "------", "---------", "--------");
|
||||
ast_cli(a->fd, HSMC_FORMAT, "Action", "Privilege", "Synopsis");
|
||||
ast_cli(a->fd, HSMC_FORMAT, "------", "---------", "--------");
|
||||
|
||||
AST_RWLIST_RDLOCK(&actions);
|
||||
AST_RWLIST_TRAVERSE(&actions, cur, list)
|
||||
ast_cli(a->fd, format, cur->action, authority_to_str(cur->authority, &authority), cur->synopsis);
|
||||
ast_cli(a->fd, HSMC_FORMAT, cur->action, authority_to_str(cur->authority, &authority), cur->synopsis);
|
||||
AST_RWLIST_UNLOCK(&actions);
|
||||
|
||||
return CLI_SUCCESS;
|
||||
@@ -672,8 +672,8 @@ static char *handle_showmanconn(struct ast_cli_entry *e, int cmd, struct ast_cli
|
||||
{
|
||||
struct mansession *s;
|
||||
time_t now = time(NULL);
|
||||
static const char *format = " %-15.15s %-15.15s %-10.10s %-10.10s %-8.8s %-8.8s %-5.5s %-5.5s\n";
|
||||
static const char *format2 = " %-15.15s %-15.15s %-10d %-10d %-8d %-8d %-5.5d %-5.5d\n";
|
||||
#define HSMCONN_FORMAT1 " %-15.15s %-15.15s %-10.10s %-10.10s %-8.8s %-8.8s %-5.5s %-5.5s\n"
|
||||
#define HSMCONN_FORMAT2 " %-15.15s %-15.15s %-10d %-10d %-8d %-8d %-5.5d %-5.5d\n"
|
||||
int count = 0;
|
||||
switch (cmd) {
|
||||
case CLI_INIT:
|
||||
@@ -687,11 +687,11 @@ static char *handle_showmanconn(struct ast_cli_entry *e, int cmd, struct ast_cli
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ast_cli(a->fd, format, "Username", "IP Address", "Start", "Elapsed", "FileDes", "HttpCnt", "Read", "Write");
|
||||
ast_cli(a->fd, HSMCONN_FORMAT1, "Username", "IP Address", "Start", "Elapsed", "FileDes", "HttpCnt", "Read", "Write");
|
||||
|
||||
AST_LIST_LOCK(&sessions);
|
||||
AST_LIST_TRAVERSE(&sessions, s, list) {
|
||||
ast_cli(a->fd, format2, s->username, ast_inet_ntoa(s->sin.sin_addr), (int)(s->sessionstart), (int)(now - s->sessionstart), s->fd, s->inuse, s->readperm, s->writeperm);
|
||||
ast_cli(a->fd, HSMCONN_FORMAT2, s->username, ast_inet_ntoa(s->sin.sin_addr), (int)(s->sessionstart), (int)(now - s->sessionstart), s->fd, s->inuse, s->readperm, s->writeperm);
|
||||
count++;
|
||||
}
|
||||
AST_LIST_UNLOCK(&sessions);
|
||||
@@ -3589,7 +3589,7 @@ static struct ast_str *generic_http_callback(enum output_format format,
|
||||
if (format == FORMAT_XML || format == FORMAT_HTML)
|
||||
xml_translate(&out, buf, params, format);
|
||||
else
|
||||
ast_str_append(&out, 0, buf);
|
||||
ast_str_append(&out, 0, "%s", buf);
|
||||
munmap(buf, l);
|
||||
}
|
||||
} else if (format == FORMAT_XML || format == FORMAT_HTML) {
|
||||
|
||||
+1
-1
@@ -592,7 +592,7 @@ static char *handle_cli_core_show_translation(struct ast_cli_entry *e, int cmd,
|
||||
}
|
||||
}
|
||||
ast_str_append(&out, -1, "\n");
|
||||
ast_cli(a->fd, out->str);
|
||||
ast_cli(a->fd, "%s", out->str);
|
||||
}
|
||||
AST_RWLIST_UNLOCK(&translators);
|
||||
return CLI_SUCCESS;
|
||||
|
||||
@@ -1349,6 +1349,7 @@ ast_string_field __ast_string_field_alloc_space(struct ast_string_field_mgr *mgr
|
||||
return result;
|
||||
}
|
||||
|
||||
__attribute((format (printf, 4, 0)))
|
||||
void __ast_string_field_ptr_build_va(struct ast_string_field_mgr *mgr,
|
||||
struct ast_string_field_pool **pool_head,
|
||||
const ast_string_field *ptr, const char *format, va_list ap1, va_list ap2)
|
||||
@@ -1380,6 +1381,7 @@ void __ast_string_field_ptr_build_va(struct ast_string_field_mgr *mgr,
|
||||
mgr->used += needed;
|
||||
}
|
||||
|
||||
__attribute((format (printf, 4, 5)))
|
||||
void __ast_string_field_ptr_build(struct ast_string_field_mgr *mgr,
|
||||
struct ast_string_field_pool **pool_head,
|
||||
const ast_string_field *ptr, const char *format, ...)
|
||||
@@ -1470,6 +1472,8 @@ int ast_get_time_t(const char *src, time_t *dst, time_t _default, int *consumed)
|
||||
* ast_str_set_va(...)
|
||||
* ast_str_append_va(...)
|
||||
*/
|
||||
|
||||
__attribute__((format (printf, 4, 0)))
|
||||
int __ast_str_helper(struct ast_str **buf, size_t max_len,
|
||||
int append, const char *fmt, va_list ap)
|
||||
{
|
||||
|
||||
+1
-1
@@ -2721,7 +2721,7 @@ static char *handle_cli_agi_show(struct ast_cli_entry *e, int cmd, struct ast_cl
|
||||
if (a->argc > e->args) {
|
||||
command = find_command(a->argv + e->args, 1);
|
||||
if (command) {
|
||||
ast_cli(a->fd, command->usage);
|
||||
ast_cli(a->fd, "%s", command->usage);
|
||||
ast_cli(a->fd, " Runs Dead : %s\n", command->dead ? "Yes" : "No");
|
||||
} else {
|
||||
if (find_command(a->argv + e->args, -1)) {
|
||||
|
||||
@@ -766,10 +766,10 @@ static struct ast_variable **realtime_ldap_base_ap(unsigned int *entries_count_p
|
||||
ast_str_append(&filter, 0, "(&");
|
||||
|
||||
if (table_config && table_config->additional_filter)
|
||||
ast_str_append(&filter, 0, table_config->additional_filter);
|
||||
ast_str_append(&filter, 0, "%s", table_config->additional_filter);
|
||||
if (table_config != base_table_config && base_table_config &&
|
||||
base_table_config->additional_filter) {
|
||||
ast_str_append(&filter, 0, base_table_config->additional_filter);
|
||||
ast_str_append(&filter, 0, "%s", base_table_config->additional_filter);
|
||||
}
|
||||
|
||||
/* Create the first part of the query using the first parameter/value pairs we just extracted */
|
||||
@@ -1171,11 +1171,11 @@ static int update_ldap(const char *basedn, const char *table_name, const char *a
|
||||
/* Create the filter with the table additional filter and the parameter/value pairs we were given */
|
||||
ast_str_append(&filter, 0, "(&");
|
||||
if (table_config && table_config->additional_filter) {
|
||||
ast_str_append(&filter, 0, table_config->additional_filter);
|
||||
ast_str_append(&filter, 0, "%s", table_config->additional_filter);
|
||||
}
|
||||
if (table_config != base_table_config && base_table_config
|
||||
&& base_table_config->additional_filter) {
|
||||
ast_str_append(&filter, 0, base_table_config->additional_filter);
|
||||
ast_str_append(&filter, 0, "%s", base_table_config->additional_filter);
|
||||
}
|
||||
append_var_and_value_to_filter(&filter, table_config, attribute, lookup);
|
||||
ast_str_append(&filter, 0, ")");
|
||||
|
||||
@@ -202,7 +202,7 @@ static char *handle_cli_indication_show(struct ast_cli_entry *e, int cmd, struct
|
||||
if (tz->nrringcadence)
|
||||
j--;
|
||||
ast_copy_string(buf + j, "\n", sizeof(buf) - j);
|
||||
ast_cli(a->fd, buf);
|
||||
ast_cli(a->fd, "%s", buf);
|
||||
for (ts = tz->tones; ts; ts = ts->next)
|
||||
ast_cli(a->fd, "%-7.7s %-15.15s %s\n", tz->country, ts->name, ts->data);
|
||||
break;
|
||||
|
||||
+1
-1
@@ -914,7 +914,7 @@ static int pp_each_user_exec(struct ast_channel *chan, const char *cmd, char *da
|
||||
if (!ast_strlen_zero(args.exclude_mac) && !strcasecmp(user->macaddress, args.exclude_mac))
|
||||
continue;
|
||||
pbx_substitute_variables_varshead(user->headp, args.string, expand_buf, sizeof(expand_buf));
|
||||
ast_build_string(&buf, &len, expand_buf);
|
||||
ast_build_string(&buf, &len, "%s", expand_buf);
|
||||
}
|
||||
AST_RWLIST_UNLOCK(&users);
|
||||
|
||||
|
||||
+4
-4
@@ -42,7 +42,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
|
||||
|
||||
static char *cli_realtime_load(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
|
||||
{
|
||||
char *header_format = "%30s %-30s\n";
|
||||
#define CRL_HEADER_FORMAT "%30s %-30s\n"
|
||||
struct ast_variable *var=NULL;
|
||||
|
||||
switch (cmd) {
|
||||
@@ -64,10 +64,10 @@ static char *cli_realtime_load(struct ast_cli_entry *e, int cmd, struct ast_cli_
|
||||
var = ast_load_realtime_all(a->argv[2], a->argv[3], a->argv[4], NULL);
|
||||
|
||||
if (var) {
|
||||
ast_cli(a->fd, header_format, "Column Name", "Column Value");
|
||||
ast_cli(a->fd, header_format, "--------------------", "--------------------");
|
||||
ast_cli(a->fd, CRL_HEADER_FORMAT, "Column Name", "Column Value");
|
||||
ast_cli(a->fd, CRL_HEADER_FORMAT, "--------------------", "--------------------");
|
||||
while (var) {
|
||||
ast_cli(a->fd, header_format, var->name, var->value);
|
||||
ast_cli(a->fd, CRL_HEADER_FORMAT, var->name, var->value);
|
||||
var = var->next;
|
||||
}
|
||||
} else {
|
||||
|
||||
+5
-3
@@ -141,7 +141,8 @@ static void del_chan(char *name)
|
||||
AST_LIST_TRAVERSE_SAFE_END;
|
||||
}
|
||||
|
||||
static void fdprintf(int fd, char *fmt, ...)
|
||||
|
||||
static void __attribute__((format (printf, 2, 3))) fdprintf(int fd, char *fmt, ...)
|
||||
{
|
||||
char stuff[4096];
|
||||
va_list ap;
|
||||
@@ -406,7 +407,8 @@ static struct message *wait_for_response(int timeout)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static int manager_action(char *action, char *fmt, ...)
|
||||
|
||||
static int __attribute__((format (printf, 2, 3))) manager_action(char *action, char *fmt, ...)
|
||||
{
|
||||
struct ast_mansession *s;
|
||||
char tmp[4096];
|
||||
@@ -465,7 +467,7 @@ static int hide_doing(void)
|
||||
static void try_status(void)
|
||||
{
|
||||
struct message *m;
|
||||
manager_action("Status", "");
|
||||
manager_action("Status", "%s", "");
|
||||
m = wait_for_response(10000);
|
||||
if (!m) {
|
||||
show_message("Status Failed", "Timeout waiting for response");
|
||||
|
||||
+1
-1
@@ -40,7 +40,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
|
||||
* ast_str_set_va(...)
|
||||
* ast_str_append_va(...)
|
||||
*/
|
||||
int __ast_str_helper(struct ast_str **buf, size_t max_len,
|
||||
int __attribute__((format (printf, 4, 0))) __ast_str_helper(struct ast_str **buf, size_t max_len,
|
||||
int append, const char *fmt, va_list ap)
|
||||
{
|
||||
int res, need;
|
||||
|
||||
+3
-1
@@ -1078,6 +1078,7 @@ char * attribute_malloc _ast_strndup(const char *str, size_t len, const char *fi
|
||||
_ast_asprintf((ret), __FILE__, __LINE__, __PRETTY_FUNCTION__, fmt, __VA_ARGS__)
|
||||
|
||||
AST_INLINE_API(
|
||||
__attribute__((format (printf, 5, 6)))
|
||||
int _ast_asprintf(char **ret, const char *file, int lineno, const char *func, const char *fmt, ...),
|
||||
{
|
||||
int res;
|
||||
@@ -1104,6 +1105,7 @@ int _ast_asprintf(char **ret, const char *file, int lineno, const char *func, co
|
||||
_ast_vasprintf((ret), __FILE__, __LINE__, __PRETTY_FUNCTION__, (fmt), (ap))
|
||||
|
||||
AST_INLINE_API(
|
||||
__attribute__((format (printf, 5, 0)))
|
||||
int _ast_vasprintf(char **ret, const char *file, int lineno, const char *func, const char *fmt, va_list ap),
|
||||
{
|
||||
int res;
|
||||
@@ -2733,7 +2735,7 @@ static void ast_log(int level, const char *file, int line, const char *function,
|
||||
va_end(vars);
|
||||
}
|
||||
|
||||
static void ast_verbose(const char *fmt, ...)
|
||||
static void __attribute__((format (printf, 1, 2))) ast_verbose(const char *fmt, ...)
|
||||
{
|
||||
va_list vars;
|
||||
va_start(vars,fmt);
|
||||
|
||||
+5
-6
@@ -910,7 +910,7 @@ int workloop( FILE *theinfile, FILE *theoutfile,
|
||||
return TRUE; /* Input file done with, no errors. */
|
||||
}
|
||||
|
||||
int chat( const char *format, ...)
|
||||
int __attribute__((format (printf,1,2))) chat( const char *format, ...)
|
||||
{
|
||||
va_list ap;
|
||||
int result = 0;
|
||||
@@ -924,8 +924,7 @@ int chat( const char *format, ...)
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
int inform( const char *format, ...)
|
||||
int __attribute__((format (printf,1,2))) inform( const char *format, ...)
|
||||
{
|
||||
va_list ap;
|
||||
int result = 0;
|
||||
@@ -939,7 +938,7 @@ int inform( const char *format, ...)
|
||||
return result;
|
||||
}
|
||||
|
||||
int error( const char *format, ...)
|
||||
int __attribute__((format (printf,1,2))) error( const char *format, ...)
|
||||
{
|
||||
va_list ap;
|
||||
int result;
|
||||
@@ -950,7 +949,7 @@ int error( const char *format, ...)
|
||||
return result;
|
||||
}
|
||||
|
||||
void fatalerror( const char *format, ...)
|
||||
void __attribute__((format (printf,1,2))) fatalerror( const char *format, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
@@ -966,7 +965,7 @@ void fatalperror( const char *string)
|
||||
myexit( 1);
|
||||
}
|
||||
|
||||
int say( const char *format, ...)
|
||||
int __attribute__((format (printf,1,2))) say( const char *format, ...)
|
||||
{
|
||||
va_list ap;
|
||||
int result;
|
||||
|
||||
Reference in New Issue
Block a user