mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-06 04:30:28 +00:00
more ast_copy_string conversions
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@6073 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
4
acl.c
4
acl.c
@@ -146,7 +146,7 @@ struct ast_ha *ast_append_ha(char *sense, char *stuff, struct ast_ha *path)
|
|||||||
path = path->next;
|
path = path->next;
|
||||||
}
|
}
|
||||||
if (ha) {
|
if (ha) {
|
||||||
strncpy(tmp, stuff, sizeof(tmp) - 1);
|
ast_copy_string(tmp, stuff, sizeof(tmp));
|
||||||
nm = strchr(tmp, '/');
|
nm = strchr(tmp, '/');
|
||||||
if (!nm)
|
if (!nm)
|
||||||
nm = "255.255.255.255";
|
nm = "255.255.255.255";
|
||||||
@@ -248,7 +248,7 @@ int ast_lookup_iface(char *iface, struct in_addr *address)
|
|||||||
struct my_ifreq ifreq;
|
struct my_ifreq ifreq;
|
||||||
|
|
||||||
memset(&ifreq, 0, sizeof(ifreq));
|
memset(&ifreq, 0, sizeof(ifreq));
|
||||||
strncpy(ifreq.ifrn_name,iface,sizeof(ifreq.ifrn_name) - 1);
|
ast_copy_string(ifreq.ifrn_name,iface,sizeof(ifreq.ifrn_name));
|
||||||
|
|
||||||
mysock = socket(PF_INET,SOCK_DGRAM,IPPROTO_IP);
|
mysock = socket(PF_INET,SOCK_DGRAM,IPPROTO_IP);
|
||||||
res = ioctl(mysock,SIOCGIFADDR,&ifreq);
|
res = ioctl(mysock,SIOCGIFADDR,&ifreq);
|
||||||
|
8
astmm.c
8
astmm.c
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* Asterisk -- A telephony toolkit for Linux.
|
* Asterisk -- A telephony toolkit for Linux.
|
||||||
*
|
*
|
||||||
* Channel Variables
|
* Memory Management
|
||||||
*
|
*
|
||||||
* Copyright (C) 2002-2005, Mark Spencer
|
* Copyright (C) 2002-2005, Mark Spencer
|
||||||
*
|
*
|
||||||
@@ -73,9 +73,9 @@ static inline void *__ast_alloc_region(size_t size, int which, const char *file,
|
|||||||
reg = malloc(size + sizeof(struct ast_region));
|
reg = malloc(size + sizeof(struct ast_region));
|
||||||
ast_mutex_lock(®lock);
|
ast_mutex_lock(®lock);
|
||||||
if (reg) {
|
if (reg) {
|
||||||
strncpy(reg->file, file, sizeof(reg->file) - 1);
|
ast_copy_string(reg->file, file, sizeof(reg->file));
|
||||||
reg->file[sizeof(reg->file) - 1] = '\0';
|
reg->file[sizeof(reg->file) - 1] = '\0';
|
||||||
strncpy(reg->func, func, sizeof(reg->func) - 1);
|
ast_copy_string(reg->func, func, sizeof(reg->func));
|
||||||
reg->func[sizeof(reg->func) - 1] = '\0';
|
reg->func[sizeof(reg->func) - 1] = '\0';
|
||||||
reg->lineno = lineno;
|
reg->lineno = lineno;
|
||||||
reg->len = size;
|
reg->len = size;
|
||||||
@@ -305,7 +305,7 @@ static int handle_show_memory_summary(int fd, int argc, char *argv[])
|
|||||||
if (!cur) {
|
if (!cur) {
|
||||||
cur = alloca(sizeof(struct file_summary));
|
cur = alloca(sizeof(struct file_summary));
|
||||||
memset(cur, 0, sizeof(struct file_summary));
|
memset(cur, 0, sizeof(struct file_summary));
|
||||||
strncpy(cur->fn, fn ? reg->func : reg->file, sizeof(cur->fn) - 1);
|
ast_copy_string(cur->fn, fn ? reg->func : reg->file, sizeof(cur->fn));
|
||||||
cur->next = list;
|
cur->next = list;
|
||||||
list = cur;
|
list = cur;
|
||||||
}
|
}
|
||||||
|
14
callerid.c
14
callerid.c
@@ -364,7 +364,7 @@ int callerid_feed(struct callerid_state *cid, unsigned char *ubuf, int len, int
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* SDMF */
|
/* SDMF */
|
||||||
strncpy(cid->number, cid->rawdata + 8, sizeof(cid->number)-1);
|
ast_copy_string(cid->number, cid->rawdata + 8, sizeof(cid->number));
|
||||||
}
|
}
|
||||||
/* Update flags */
|
/* Update flags */
|
||||||
cid->flags = 0;
|
cid->flags = 0;
|
||||||
@@ -646,7 +646,7 @@ int ast_callerid_parse(char *instr, char **name, char **location)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
strncpy(tmp, instr, sizeof(tmp)-1);
|
ast_copy_string(tmp, instr, sizeof(tmp));
|
||||||
ast_shrink_phone_number(tmp);
|
ast_shrink_phone_number(tmp);
|
||||||
if (ast_isphonenumber(tmp)) {
|
if (ast_isphonenumber(tmp)) {
|
||||||
/* Assume it's just a location */
|
/* Assume it's just a location */
|
||||||
@@ -691,11 +691,11 @@ char *ast_callerid_merge(char *buf, int bufsiz, const char *name, const char *nu
|
|||||||
if (name && num)
|
if (name && num)
|
||||||
snprintf(buf, bufsiz, "\"%s\" <%s>", name, num);
|
snprintf(buf, bufsiz, "\"%s\" <%s>", name, num);
|
||||||
else if (name)
|
else if (name)
|
||||||
strncpy(buf, name, bufsiz - 1);
|
ast_copy_string(buf, name, bufsiz);
|
||||||
else if (num)
|
else if (num)
|
||||||
strncpy(buf, num, bufsiz - 1);
|
ast_copy_string(buf, num, bufsiz);
|
||||||
else
|
else
|
||||||
strncpy(buf, unknown, bufsiz - 1);
|
ast_copy_string(buf, unknown, bufsiz);
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
int ast_callerid_split(const char *buf, char *name, int namelen, char *num, int numlen)
|
int ast_callerid_split(const char *buf, char *name, int namelen, char *num, int numlen)
|
||||||
@@ -710,12 +710,12 @@ int ast_callerid_split(const char *buf, char *name, int namelen, char *num, int
|
|||||||
}
|
}
|
||||||
ast_callerid_parse(tmp, &n, &l);
|
ast_callerid_parse(tmp, &n, &l);
|
||||||
if (n)
|
if (n)
|
||||||
strncpy(name, n, namelen - 1);
|
ast_copy_string(name, n, namelen);
|
||||||
else
|
else
|
||||||
name[0] = '\0';
|
name[0] = '\0';
|
||||||
if (l) {
|
if (l) {
|
||||||
ast_shrink_phone_number(l);
|
ast_shrink_phone_number(l);
|
||||||
strncpy(num, l, numlen - 1);
|
ast_copy_string(num, l, numlen);
|
||||||
} else
|
} else
|
||||||
num[0] = '\0';
|
num[0] = '\0';
|
||||||
return 0;
|
return 0;
|
||||||
|
6
cli.c
6
cli.c
@@ -587,7 +587,7 @@ static int handle_debuglevel(int fd, int argc, char *argv[])
|
|||||||
option_debug = newlevel;
|
option_debug = newlevel;
|
||||||
if (argc == 4) {
|
if (argc == 4) {
|
||||||
filename = argv[3];
|
filename = argv[3];
|
||||||
strncpy(debug_filename, filename, sizeof(debug_filename) - 1);
|
ast_copy_string(debug_filename, filename, sizeof(debug_filename));
|
||||||
} else {
|
} else {
|
||||||
debug_filename[0] = '\0';
|
debug_filename[0] = '\0';
|
||||||
}
|
}
|
||||||
@@ -686,7 +686,7 @@ static int handle_showchan(int fd, int argc, char *argv[])
|
|||||||
sec = elapsed_seconds % 60;
|
sec = elapsed_seconds % 60;
|
||||||
snprintf(cdrtime, sizeof(cdrtime), "%dh%dm%ds", hour, min, sec);
|
snprintf(cdrtime, sizeof(cdrtime), "%dh%dm%ds", hour, min, sec);
|
||||||
} else
|
} else
|
||||||
strncpy(cdrtime, "N/A", sizeof(cdrtime) -1);
|
strcpy(cdrtime, "N/A");
|
||||||
ast_cli(fd,
|
ast_cli(fd,
|
||||||
" -- General --\n"
|
" -- General --\n"
|
||||||
" Name: %s\n"
|
" Name: %s\n"
|
||||||
@@ -784,7 +784,7 @@ static char *complete_fn(char *line, char *word, int pos, int state)
|
|||||||
if (pos != 1)
|
if (pos != 1)
|
||||||
return NULL;
|
return NULL;
|
||||||
if (word[0] == '/')
|
if (word[0] == '/')
|
||||||
strncpy(filename, word, sizeof(filename)-1);
|
ast_copy_string(filename, word, sizeof(filename));
|
||||||
else
|
else
|
||||||
snprintf(filename, sizeof(filename), "%s/%s", (char *)ast_config_AST_MODULE_DIR, word);
|
snprintf(filename, sizeof(filename), "%s/%s", (char *)ast_config_AST_MODULE_DIR, word);
|
||||||
c = (char*)filename_completion_function(filename, state);
|
c = (char*)filename_completion_function(filename, state);
|
||||||
|
10
config.c
10
config.c
@@ -192,7 +192,7 @@ struct ast_category *ast_category_new(const char *name)
|
|||||||
category = malloc(sizeof(struct ast_category));
|
category = malloc(sizeof(struct ast_category));
|
||||||
if (category) {
|
if (category) {
|
||||||
memset(category, 0, sizeof(struct ast_category));
|
memset(category, 0, sizeof(struct ast_category));
|
||||||
strncpy(category->name, name, sizeof(category->name) - 1);
|
ast_copy_string(category->name, name, sizeof(category->name));
|
||||||
}
|
}
|
||||||
|
|
||||||
return category;
|
return category;
|
||||||
@@ -295,7 +295,7 @@ struct ast_variable *ast_category_detach_variables(struct ast_category *cat)
|
|||||||
|
|
||||||
void ast_category_rename(struct ast_category *cat, const char *name)
|
void ast_category_rename(struct ast_category *cat, const char *name)
|
||||||
{
|
{
|
||||||
strncpy(cat->name, name, sizeof(cat->name) - 1);
|
ast_copy_string(cat->name, name, sizeof(cat->name));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void inherit_category(struct ast_category *new, const struct ast_category *base)
|
static void inherit_category(struct ast_category *new, const struct ast_category *base)
|
||||||
@@ -531,7 +531,7 @@ static struct ast_config *config_text_file_load(const char *database, const char
|
|||||||
cat = ast_config_get_current_category(cfg);
|
cat = ast_config_get_current_category(cfg);
|
||||||
|
|
||||||
if (filename[0] == '/') {
|
if (filename[0] == '/') {
|
||||||
strncpy(fn, filename, sizeof(fn)-1);
|
ast_copy_string(fn, filename, sizeof(fn));
|
||||||
} else {
|
} else {
|
||||||
snprintf(fn, sizeof(fn), "%s/%s", (char *)ast_config_AST_CONFIG_DIR, filename);
|
snprintf(fn, sizeof(fn), "%s/%s", (char *)ast_config_AST_CONFIG_DIR, filename);
|
||||||
}
|
}
|
||||||
@@ -556,7 +556,7 @@ static struct ast_config *config_text_file_load(const char *database, const char
|
|||||||
/* loop over expanded files */
|
/* loop over expanded files */
|
||||||
int i;
|
int i;
|
||||||
for (i=0; i<globbuf.gl_pathc; i++) {
|
for (i=0; i<globbuf.gl_pathc; i++) {
|
||||||
strncpy(fn, globbuf.gl_pathv[i], sizeof(fn)-1);
|
ast_copy_string(fn, globbuf.gl_pathv[i], sizeof(fn));
|
||||||
#endif
|
#endif
|
||||||
if ((option_verbose > 1) && !option_debug) {
|
if ((option_verbose > 1) && !option_debug) {
|
||||||
ast_verbose( VERBOSE_PREFIX_2 "Parsing '%s': ", fn);
|
ast_verbose( VERBOSE_PREFIX_2 "Parsing '%s': ", fn);
|
||||||
@@ -668,7 +668,7 @@ int config_text_file_save(const char *configfile, const struct ast_config *cfg,
|
|||||||
snprintf(fn, sizeof(fn), "%s/%s", ast_config_AST_CONFIG_DIR, configfile);
|
snprintf(fn, sizeof(fn), "%s/%s", ast_config_AST_CONFIG_DIR, configfile);
|
||||||
}
|
}
|
||||||
time(&t);
|
time(&t);
|
||||||
strncpy(date, ctime(&t), sizeof(date) - 1);
|
ast_copy_string(date, ctime(&t), sizeof(date));
|
||||||
if ((f = fopen(fn, "w"))) {
|
if ((f = fopen(fn, "w"))) {
|
||||||
if ((option_verbose > 1) && !option_debug)
|
if ((option_verbose > 1) && !option_debug)
|
||||||
ast_verbose( VERBOSE_PREFIX_2 "Saving '%s': ", fn);
|
ast_verbose( VERBOSE_PREFIX_2 "Saving '%s': ", fn);
|
||||||
|
20
enum.c
20
enum.c
@@ -148,23 +148,23 @@ static int parse_naptr(unsigned char *dst, int dstsize, char *tech, int techsize
|
|||||||
|
|
||||||
if ((!strncasecmp(services, "e2u+sip", 7)) ||
|
if ((!strncasecmp(services, "e2u+sip", 7)) ||
|
||||||
(!strncasecmp(services, "sip+e2u", 7))) {
|
(!strncasecmp(services, "sip+e2u", 7))) {
|
||||||
strncpy(tech, "sip", techsize -1);
|
ast_copy_string(tech, "sip", techsize);
|
||||||
} else if ((!strncasecmp(services, "e2u+h323", 8)) ||
|
} else if ((!strncasecmp(services, "e2u+h323", 8)) ||
|
||||||
(!strncasecmp(services, "h323+e2u", 8))) {
|
(!strncasecmp(services, "h323+e2u", 8))) {
|
||||||
strncpy(tech, "h323", techsize -1);
|
ast_copy_string(tech, "h323", techsize);
|
||||||
} else if ((!strncasecmp(services, "e2u+x-iax2", 10)) ||
|
} else if ((!strncasecmp(services, "e2u+x-iax2", 10)) ||
|
||||||
(!strncasecmp(services, "e2u+iax2", 8)) ||
|
(!strncasecmp(services, "e2u+iax2", 8)) ||
|
||||||
(!strncasecmp(services, "iax2+e2u", 8))) {
|
(!strncasecmp(services, "iax2+e2u", 8))) {
|
||||||
strncpy(tech, "iax2", techsize -1);
|
ast_copy_string(tech, "iax2", techsize);
|
||||||
} else if ((!strncasecmp(services, "e2u+x-iax", 9)) ||
|
} else if ((!strncasecmp(services, "e2u+x-iax", 9)) ||
|
||||||
(!strncasecmp(services, "e2u+iax", 7)) ||
|
(!strncasecmp(services, "e2u+iax", 7)) ||
|
||||||
(!strncasecmp(services, "iax+e2u", 7))) {
|
(!strncasecmp(services, "iax+e2u", 7))) {
|
||||||
strncpy(tech, "iax", techsize -1);
|
ast_copy_string(tech, "iax", techsize);
|
||||||
} else if ((!strncasecmp(services, "e2u+tel", 7)) ||
|
} else if ((!strncasecmp(services, "e2u+tel", 7)) ||
|
||||||
(!strncasecmp(services, "tel+e2u", 7))) {
|
(!strncasecmp(services, "tel+e2u", 7))) {
|
||||||
strncpy(tech, "tel", techsize -1);
|
ast_copy_string(tech, "tel", techsize);
|
||||||
} else if (!strncasecmp(services, "e2u+voice:", 10)) {
|
} else if (!strncasecmp(services, "e2u+voice:", 10)) {
|
||||||
strncpy(tech, services+10, techsize -1);
|
ast_copy_string(tech, services+10, techsize);
|
||||||
} else {
|
} else {
|
||||||
ast_log(LOG_DEBUG,
|
ast_log(LOG_DEBUG,
|
||||||
"Services must be e2u+${tech}, ${tech}+e2u, or e2u+voice: where $tech is from (sip, h323, tel, iax, iax2). \n");
|
"Services must be e2u+${tech}, ${tech}+e2u, or e2u+voice: where $tech is from (sip, h323, tel, iax, iax2). \n");
|
||||||
@@ -172,7 +172,7 @@ static int parse_naptr(unsigned char *dst, int dstsize, char *tech, int techsize
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* DEDBUGGING STUB
|
/* DEDBUGGING STUB
|
||||||
strncpy(regexp, "!^\\+43(.*)$!\\1@bla.fasel!", sizeof(regexp) - 1);
|
ast_copy_string(regexp, "!^\\+43(.*)$!\\1@bla.fasel!", sizeof(regexp) - 1);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
regexp_len = strlen(regexp);
|
regexp_len = strlen(regexp);
|
||||||
@@ -244,7 +244,7 @@ static int parse_naptr(unsigned char *dst, int dstsize, char *tech, int techsize
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
*d = 0;
|
*d = 0;
|
||||||
strncpy(dst, temp, dstsize - 1);
|
ast_copy_string(dst, temp, dstsize);
|
||||||
dst[dstsize - 1] = '\0';
|
dst[dstsize - 1] = '\0';
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -286,7 +286,7 @@ static int txt_callback(void *context, u_char *answer, int len, u_char *fullansw
|
|||||||
len +=1;
|
len +=1;
|
||||||
|
|
||||||
/* finally, copy the answer into c->txt */
|
/* finally, copy the answer into c->txt */
|
||||||
strncpy(c->txt, answer, len < c->txtlen ? len-1 : (c->txtlen)-1);
|
ast_copy_string(c->txt, answer, len < c->txtlen ? len : (c->txtlen));
|
||||||
|
|
||||||
/* just to be safe, let's make sure c->txt is null terminated */
|
/* just to be safe, let's make sure c->txt is null terminated */
|
||||||
c->txt[(c->txtlen)-1] = '\0';
|
c->txt[(c->txtlen)-1] = '\0';
|
||||||
@@ -439,7 +439,7 @@ static struct enum_search *enum_newtoplev(char *s)
|
|||||||
tmp = malloc(sizeof(struct enum_search));
|
tmp = malloc(sizeof(struct enum_search));
|
||||||
if (tmp) {
|
if (tmp) {
|
||||||
memset(tmp, 0, sizeof(struct enum_search));
|
memset(tmp, 0, sizeof(struct enum_search));
|
||||||
strncpy(tmp->toplev, s, sizeof(tmp->toplev) - 1);
|
ast_copy_string(tmp->toplev, s, sizeof(tmp->toplev));
|
||||||
}
|
}
|
||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
|
6
frame.c
6
frame.c
@@ -739,7 +739,7 @@ void ast_frame_dump(char *name, struct ast_frame *f, char *prefix)
|
|||||||
case AST_FRAME_TEXT:
|
case AST_FRAME_TEXT:
|
||||||
strcpy(ftype, "Text");
|
strcpy(ftype, "Text");
|
||||||
strcpy(subclass, "N/A");
|
strcpy(subclass, "N/A");
|
||||||
strncpy(moreinfo, f->data, sizeof(moreinfo) - 1);
|
ast_copy_string(moreinfo, f->data, sizeof(moreinfo));
|
||||||
break;
|
break;
|
||||||
case AST_FRAME_IMAGE:
|
case AST_FRAME_IMAGE:
|
||||||
strcpy(ftype, "Image");
|
strcpy(ftype, "Image");
|
||||||
@@ -750,7 +750,7 @@ void ast_frame_dump(char *name, struct ast_frame *f, char *prefix)
|
|||||||
switch(f->subclass) {
|
switch(f->subclass) {
|
||||||
case AST_HTML_URL:
|
case AST_HTML_URL:
|
||||||
strcpy(subclass, "URL");
|
strcpy(subclass, "URL");
|
||||||
strncpy(moreinfo, f->data, sizeof(moreinfo) - 1);
|
ast_copy_string(moreinfo, f->data, sizeof(moreinfo));
|
||||||
break;
|
break;
|
||||||
case AST_HTML_DATA:
|
case AST_HTML_DATA:
|
||||||
strcpy(subclass, "Data");
|
strcpy(subclass, "Data");
|
||||||
@@ -769,7 +769,7 @@ void ast_frame_dump(char *name, struct ast_frame *f, char *prefix)
|
|||||||
break;
|
break;
|
||||||
case AST_HTML_LINKURL:
|
case AST_HTML_LINKURL:
|
||||||
strcpy(subclass, "Link URL");
|
strcpy(subclass, "Link URL");
|
||||||
strncpy(moreinfo, f->data, sizeof(moreinfo) - 1);
|
ast_copy_string(moreinfo, f->data, sizeof(moreinfo));
|
||||||
break;
|
break;
|
||||||
case AST_HTML_UNLINK:
|
case AST_HTML_UNLINK:
|
||||||
strcpy(subclass, "Unlink");
|
strcpy(subclass, "Unlink");
|
||||||
|
10
logger.c
10
logger.c
@@ -245,7 +245,7 @@ static struct logchannel *make_logchannel(char *channel, char *components, int l
|
|||||||
if(!ast_strlen_zero(hostname)) {
|
if(!ast_strlen_zero(hostname)) {
|
||||||
snprintf(chan->filename, sizeof(chan->filename) - 1,"%s.%s", channel, hostname);
|
snprintf(chan->filename, sizeof(chan->filename) - 1,"%s.%s", channel, hostname);
|
||||||
} else {
|
} else {
|
||||||
strncpy(chan->filename, channel, sizeof(chan->filename) - 1);
|
ast_copy_string(chan->filename, channel, sizeof(chan->filename));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -297,7 +297,7 @@ static void init_logger_chain(void)
|
|||||||
if ((s = ast_variable_retrieve(cfg, "general", "appendhostname"))) {
|
if ((s = ast_variable_retrieve(cfg, "general", "appendhostname"))) {
|
||||||
if(ast_true(s)) {
|
if(ast_true(s)) {
|
||||||
if(gethostname(hostname, sizeof(hostname)-1)) {
|
if(gethostname(hostname, sizeof(hostname)-1)) {
|
||||||
strncpy(hostname, "unknown", sizeof(hostname)-1);
|
ast_copy_string(hostname, "unknown", sizeof(hostname));
|
||||||
ast_log(LOG_WARNING, "What box has no hostname???\n");
|
ast_log(LOG_WARNING, "What box has no hostname???\n");
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
@@ -305,9 +305,9 @@ static void init_logger_chain(void)
|
|||||||
} else
|
} else
|
||||||
hostname[0] = '\0';
|
hostname[0] = '\0';
|
||||||
if ((s = ast_variable_retrieve(cfg, "general", "dateformat"))) {
|
if ((s = ast_variable_retrieve(cfg, "general", "dateformat"))) {
|
||||||
strncpy(dateformat, s, sizeof(dateformat) - 1);
|
ast_copy_string(dateformat, s, sizeof(dateformat));
|
||||||
} else
|
} else
|
||||||
strncpy(dateformat, "%b %e %T", sizeof(dateformat) - 1);
|
ast_copy_string(dateformat, "%b %e %T", sizeof(dateformat));
|
||||||
if ((s = ast_variable_retrieve(cfg, "general", "queue_log"))) {
|
if ((s = ast_variable_retrieve(cfg, "general", "queue_log"))) {
|
||||||
logfiles.queue_log = ast_true(s);
|
logfiles.queue_log = ast_true(s);
|
||||||
}
|
}
|
||||||
@@ -417,7 +417,7 @@ int reload_logger(int rotate)
|
|||||||
fclose(f->fileptr); /* Close file */
|
fclose(f->fileptr); /* Close file */
|
||||||
f->fileptr = NULL;
|
f->fileptr = NULL;
|
||||||
if(rotate) {
|
if(rotate) {
|
||||||
strncpy(old, f->filename, sizeof(old) - 1);
|
ast_copy_string(old, f->filename, sizeof(old));
|
||||||
|
|
||||||
for(x=0;;x++) {
|
for(x=0;;x++) {
|
||||||
snprintf(new, sizeof(new), "%s.%d", f->filename, x);
|
snprintf(new, sizeof(new), "%s.%d", f->filename, x);
|
||||||
|
30
manager.c
30
manager.c
@@ -135,7 +135,7 @@ static char *authority_to_str(int authority, char *res, int reslen)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (ast_strlen_zero(res)) {
|
if (ast_strlen_zero(res)) {
|
||||||
strncpy(res, "<none>", reslen);
|
ast_copy_string(res, "<none>", reslen);
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
@@ -480,7 +480,7 @@ static int authenticate(struct mansession *s, struct message *m)
|
|||||||
cat = ast_category_browse(cfg, cat);
|
cat = ast_category_browse(cfg, cat);
|
||||||
}
|
}
|
||||||
if (cat) {
|
if (cat) {
|
||||||
strncpy(s->username, cat, sizeof(s->username) - 1);
|
ast_copy_string(s->username, cat, sizeof(s->username));
|
||||||
s->readperm = get_perm(ast_variable_retrieve(cfg, cat, "read"));
|
s->readperm = get_perm(ast_variable_retrieve(cfg, cat, "read"));
|
||||||
s->writeperm = get_perm(ast_variable_retrieve(cfg, cat, "write"));
|
s->writeperm = get_perm(ast_variable_retrieve(cfg, cat, "write"));
|
||||||
ast_config_destroy(cfg);
|
ast_config_destroy(cfg);
|
||||||
@@ -953,7 +953,7 @@ static int action_originate(struct mansession *s, struct message *m)
|
|||||||
astman_send_error(s, m, "Invalid timeout\n");
|
astman_send_error(s, m, "Invalid timeout\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
strncpy(tmp, name, sizeof(tmp) - 1);
|
ast_copy_string(tmp, name, sizeof(tmp));
|
||||||
tech = tmp;
|
tech = tmp;
|
||||||
data = strchr(tmp, '/');
|
data = strchr(tmp, '/');
|
||||||
if (!data) {
|
if (!data) {
|
||||||
@@ -962,7 +962,7 @@ static int action_originate(struct mansession *s, struct message *m)
|
|||||||
}
|
}
|
||||||
*data = '\0';
|
*data = '\0';
|
||||||
data++;
|
data++;
|
||||||
strncpy(tmp2, callerid, sizeof(tmp2) - 1);
|
ast_copy_string(tmp2, callerid, sizeof(tmp2));
|
||||||
ast_callerid_parse(tmp2, &n, &l);
|
ast_callerid_parse(tmp2, &n, &l);
|
||||||
if (n) {
|
if (n) {
|
||||||
if (ast_strlen_zero(n))
|
if (ast_strlen_zero(n))
|
||||||
@@ -981,18 +981,18 @@ static int action_originate(struct mansession *s, struct message *m)
|
|||||||
memset(fast, 0, sizeof(struct fast_originate_helper));
|
memset(fast, 0, sizeof(struct fast_originate_helper));
|
||||||
if (id && !ast_strlen_zero(id))
|
if (id && !ast_strlen_zero(id))
|
||||||
snprintf(fast->idtext, sizeof(fast->idtext), "ActionID: %s\r\n", id);
|
snprintf(fast->idtext, sizeof(fast->idtext), "ActionID: %s\r\n", id);
|
||||||
strncpy(fast->tech, tech, sizeof(fast->tech) - 1);
|
ast_copy_string(fast->tech, tech, sizeof(fast->tech));
|
||||||
strncpy(fast->data, data, sizeof(fast->data) - 1);
|
ast_copy_string(fast->data, data, sizeof(fast->data));
|
||||||
strncpy(fast->app, app, sizeof(fast->app) - 1);
|
ast_copy_string(fast->app, app, sizeof(fast->app));
|
||||||
strncpy(fast->appdata, appdata, sizeof(fast->appdata) - 1);
|
ast_copy_string(fast->appdata, appdata, sizeof(fast->appdata));
|
||||||
if (l)
|
if (l)
|
||||||
strncpy(fast->cid_num, l, sizeof(fast->cid_num) - 1);
|
ast_copy_string(fast->cid_num, l, sizeof(fast->cid_num));
|
||||||
if (n)
|
if (n)
|
||||||
strncpy(fast->cid_name, n, sizeof(fast->cid_name) - 1);
|
ast_copy_string(fast->cid_name, n, sizeof(fast->cid_name));
|
||||||
strncpy(fast->variable, variable, sizeof(fast->variable) - 1);
|
ast_copy_string(fast->variable, variable, sizeof(fast->variable));
|
||||||
strncpy(fast->account, account, sizeof(fast->account) - 1);
|
ast_copy_string(fast->account, account, sizeof(fast->account));
|
||||||
strncpy(fast->context, context, sizeof(fast->context) - 1);
|
ast_copy_string(fast->context, context, sizeof(fast->context));
|
||||||
strncpy(fast->exten, exten, sizeof(fast->exten) - 1);
|
ast_copy_string(fast->exten, exten, sizeof(fast->exten));
|
||||||
fast->timeout = to;
|
fast->timeout = to;
|
||||||
fast->priority = pi;
|
fast->priority = pi;
|
||||||
pthread_attr_init(&attr);
|
pthread_attr_init(&attr);
|
||||||
@@ -1173,7 +1173,7 @@ static int process_message(struct mansession *s, struct message *m)
|
|||||||
char idText[256] = "";
|
char idText[256] = "";
|
||||||
char iabuf[INET_ADDRSTRLEN];
|
char iabuf[INET_ADDRSTRLEN];
|
||||||
|
|
||||||
strncpy(action, astman_get_header(m, "Action"), sizeof(action) - 1);
|
ast_copy_string(action, astman_get_header(m, "Action"), sizeof(action));
|
||||||
ast_log( LOG_DEBUG, "Manager received command '%s'\n", action );
|
ast_log( LOG_DEBUG, "Manager received command '%s'\n", action );
|
||||||
|
|
||||||
if (ast_strlen_zero(action)) {
|
if (ast_strlen_zero(action)) {
|
||||||
|
10
privacy.c
10
privacy.c
@@ -1,11 +1,11 @@
|
|||||||
/*
|
/*
|
||||||
* Asterisk -- A telephony toolkit for Linux.
|
* Asterisk -- A telephony toolkit for Linux.
|
||||||
*
|
*
|
||||||
* Channel Management
|
* Privacy Routines
|
||||||
*
|
*
|
||||||
* Copyright (C) 1999, Mark Spencer
|
* Copyright (C) 1999 - 2005, Mark Spencer
|
||||||
*
|
*
|
||||||
* Mark Spencer <markster@linux-support.net>
|
* Mark Spencer <markster@digium.com>
|
||||||
*
|
*
|
||||||
* This program is free software, distributed under the terms of
|
* This program is free software, distributed under the terms of
|
||||||
* the GNU General Public License
|
* the GNU General Public License
|
||||||
@@ -44,7 +44,7 @@ int ast_privacy_check(char *dest, char *cid)
|
|||||||
int res;
|
int res;
|
||||||
char key[256], result[256];
|
char key[256], result[256];
|
||||||
if (cid)
|
if (cid)
|
||||||
strncpy(tmp, cid, sizeof(tmp) - 1);
|
ast_copy_string(tmp, cid, sizeof(tmp));
|
||||||
ast_callerid_parse(tmp, &n, &l);
|
ast_callerid_parse(tmp, &n, &l);
|
||||||
if (l) {
|
if (l) {
|
||||||
ast_shrink_phone_number(l);
|
ast_shrink_phone_number(l);
|
||||||
@@ -80,7 +80,7 @@ int ast_privacy_set(char *dest, char *cid, int status)
|
|||||||
int res;
|
int res;
|
||||||
char key[256];
|
char key[256];
|
||||||
if (cid)
|
if (cid)
|
||||||
strncpy(tmp, cid, sizeof(tmp) - 1);
|
ast_copy_string(tmp, cid, sizeof(tmp));
|
||||||
ast_callerid_parse(tmp, &n, &l);
|
ast_callerid_parse(tmp, &n, &l);
|
||||||
if (l) {
|
if (l) {
|
||||||
ast_shrink_phone_number(l);
|
ast_shrink_phone_number(l);
|
||||||
|
2
srv.c
2
srv.c
@@ -65,7 +65,7 @@ static int parse_srv(unsigned char *host, int hostlen, int *portno, unsigned cha
|
|||||||
if (option_verbose > 3)
|
if (option_verbose > 3)
|
||||||
ast_verbose( VERBOSE_PREFIX_3 "parse_srv: SRV mapped to host %s, port %d\n", repl, ntohs(srv->portnum));
|
ast_verbose( VERBOSE_PREFIX_3 "parse_srv: SRV mapped to host %s, port %d\n", repl, ntohs(srv->portnum));
|
||||||
if (host) {
|
if (host) {
|
||||||
strncpy(host, repl, hostlen - 1);
|
ast_copy_string(host, repl, hostlen);
|
||||||
host[hostlen-1] = '\0';
|
host[hostlen-1] = '\0';
|
||||||
}
|
}
|
||||||
if (portno)
|
if (portno)
|
||||||
|
14
term.c
14
term.c
@@ -1,11 +1,11 @@
|
|||||||
/*
|
/*
|
||||||
* Asterisk -- A telephony toolkit for Linux.
|
* Asterisk -- A telephony toolkit for Linux.
|
||||||
*
|
*
|
||||||
* Channel Management
|
* Terminal Routines
|
||||||
*
|
*
|
||||||
* Copyright (C) 1999, Mark Spencer
|
* Copyright (C) 1999 - 2005, Mark Spencer
|
||||||
*
|
*
|
||||||
* Mark Spencer <markster@linux-support.net>
|
* Mark Spencer <markster@digium.com>
|
||||||
*
|
*
|
||||||
* This program is free software, distributed under the terms of
|
* This program is free software, distributed under the terms of
|
||||||
* the GNU General Public License
|
* the GNU General Public License
|
||||||
@@ -140,16 +140,16 @@ char *term_color(char *outbuf, const char *inbuf, int fgcolor, int bgcolor, int
|
|||||||
int attr=0;
|
int attr=0;
|
||||||
char tmp[40];
|
char tmp[40];
|
||||||
if (!vt100compat) {
|
if (!vt100compat) {
|
||||||
strncpy(outbuf, inbuf, maxout -1);
|
ast_copy_string(outbuf, inbuf, maxout);
|
||||||
return outbuf;
|
return outbuf;
|
||||||
}
|
}
|
||||||
if (!fgcolor && !bgcolor) {
|
if (!fgcolor && !bgcolor) {
|
||||||
strncpy(outbuf, inbuf, maxout - 1);
|
ast_copy_string(outbuf, inbuf, maxout);
|
||||||
return outbuf;
|
return outbuf;
|
||||||
}
|
}
|
||||||
if ((fgcolor & 128) && (bgcolor & 128)) {
|
if ((fgcolor & 128) && (bgcolor & 128)) {
|
||||||
/* Can't both be highlighted */
|
/* Can't both be highlighted */
|
||||||
strncpy(outbuf, inbuf, maxout - 1);
|
ast_copy_string(outbuf, inbuf, maxout);
|
||||||
return outbuf;
|
return outbuf;
|
||||||
}
|
}
|
||||||
if (!bgcolor)
|
if (!bgcolor)
|
||||||
@@ -241,7 +241,7 @@ char *term_strip(char *outbuf, char *inbuf, int maxout)
|
|||||||
char *term_prompt(char *outbuf, const char *inbuf, int maxout)
|
char *term_prompt(char *outbuf, const char *inbuf, int maxout)
|
||||||
{
|
{
|
||||||
if (!vt100compat) {
|
if (!vt100compat) {
|
||||||
strncpy(outbuf, inbuf, maxout -1);
|
ast_copy_string(outbuf, inbuf, maxout);
|
||||||
return outbuf;
|
return outbuf;
|
||||||
}
|
}
|
||||||
snprintf(outbuf, maxout, "%c[%d;%d;%dm%c%c[%d;%d;%dm%s",
|
snprintf(outbuf, maxout, "%c[%d;%d;%dm%c%c[%d;%d;%dm%s",
|
||||||
|
Reference in New Issue
Block a user