mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-12 15:45:18 +00:00
remove some useless checks of the result of ast_strdupa
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@8378 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -2784,12 +2784,10 @@ static int create_addr(const char *peername, struct sockaddr_in *sin, struct cre
|
||||
char *key = NULL;
|
||||
|
||||
family = ast_strdupa(peer->dbsecret);
|
||||
if (family) {
|
||||
key = strchr(family, '/');
|
||||
if (key)
|
||||
*key++ = '\0';
|
||||
}
|
||||
if (!family || !key || ast_db_get(family, key, cai->secret, sizeof(cai->secret))) {
|
||||
key = strchr(family, '/');
|
||||
if (key)
|
||||
*key++ = '\0';
|
||||
if (!key || ast_db_get(family, key, cai->secret, sizeof(cai->secret))) {
|
||||
ast_log(LOG_WARNING, "Unable to retrieve database password for family/key '%s'!\n", peer->dbsecret);
|
||||
if (ast_test_flag(peer, IAX_TEMPONLY))
|
||||
destroy_peer(peer);
|
||||
@@ -3906,9 +3904,8 @@ static int decrypt_frame(int callno, struct ast_iax2_full_hdr *fh, struct ast_fr
|
||||
unsigned char digest[16];
|
||||
char *tmppw, *stringp;
|
||||
|
||||
tmppw = ast_strdupa(iaxs[callno]->secret);
|
||||
stringp = tmppw;
|
||||
while((tmppw = strsep(&stringp, ";"))) {
|
||||
stringp = ast_strdupa(iaxs[callno]->secret);
|
||||
while ((tmppw = strsep(&stringp, ";"))) {
|
||||
MD5Init(&md5);
|
||||
MD5Update(&md5, (unsigned char *)iaxs[callno]->challenge, strlen(iaxs[callno]->challenge));
|
||||
MD5Update(&md5, (unsigned char *)tmppw, strlen(tmppw));
|
||||
@@ -4855,14 +4852,10 @@ static int check_access(int callno, struct sockaddr_in *sin, struct iax_ies *ies
|
||||
if (!ast_strlen_zero(user->dbsecret)) {
|
||||
char *family, *key=NULL;
|
||||
family = ast_strdupa(user->dbsecret);
|
||||
if (family) {
|
||||
key = strchr(family, '/');
|
||||
if (key) {
|
||||
*key = '\0';
|
||||
key++;
|
||||
}
|
||||
}
|
||||
if (!family || !key || ast_db_get(family, key, iaxs[callno]->secret, sizeof(iaxs[callno]->secret))) {
|
||||
key = strchr(family, '/');
|
||||
if (key)
|
||||
*key++ = '\0';
|
||||
if (!key || ast_db_get(family, key, iaxs[callno]->secret, sizeof(iaxs[callno]->secret))) {
|
||||
ast_log(LOG_WARNING, "Unable to retrieve database password for family/key '%s'!\n", user->dbsecret);
|
||||
if (ast_test_flag(user, IAX_TEMPONLY)) {
|
||||
destroy_user(user);
|
||||
@@ -4968,9 +4961,8 @@ static int authenticate_verify(struct chan_iax2_pvt *p, struct iax_ies *ies)
|
||||
unsigned char digest[16];
|
||||
char *tmppw, *stringp;
|
||||
|
||||
tmppw = ast_strdupa(p->secret);
|
||||
stringp = tmppw;
|
||||
while((tmppw = strsep(&stringp, ";"))) {
|
||||
stringp = ast_strdupa(p->secret);
|
||||
while ((tmppw = strsep(&stringp, ";"))) {
|
||||
MD5Init(&md5);
|
||||
MD5Update(&md5, (unsigned char *)p->challenge, strlen(p->challenge));
|
||||
MD5Update(&md5, (unsigned char *)tmppw, strlen(tmppw));
|
||||
@@ -5098,9 +5090,8 @@ static int register_verify(int callno, struct sockaddr_in *sin, struct iax_ies *
|
||||
unsigned char digest[16];
|
||||
char *tmppw, *stringp;
|
||||
|
||||
tmppw = ast_strdupa(p->secret);
|
||||
stringp = tmppw;
|
||||
while((tmppw = strsep(&stringp, ";"))) {
|
||||
stringp = ast_strdupa(p->secret);
|
||||
while ((tmppw = strsep(&stringp, ";"))) {
|
||||
MD5Init(&md5);
|
||||
MD5Update(&md5, (unsigned char *)iaxs[callno]->challenge, strlen(iaxs[callno]->challenge));
|
||||
MD5Update(&md5, (unsigned char *)tmppw, strlen(tmppw));
|
||||
@@ -8034,10 +8025,6 @@ static int peer_set_srcaddr(struct iax2_peer *peer, const char *srcaddr)
|
||||
char *portstr;
|
||||
|
||||
tmp = ast_strdupa(srcaddr);
|
||||
if (!tmp) {
|
||||
ast_log(LOG_WARNING, "Out of memory!\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
addr = strsep(&tmp, ":");
|
||||
portstr = tmp;
|
||||
@@ -8335,7 +8322,7 @@ static struct iax2_user *build_user(const char *name, struct ast_variable *v, in
|
||||
user->ha = ast_append_ha(v->name, v->value, user->ha);
|
||||
} else if (!strcasecmp(v->name, "setvar")) {
|
||||
varname = ast_strdupa(v->value);
|
||||
if (varname && (varval = strchr(varname,'='))) {
|
||||
if ((varval = strchr(varname,'='))) {
|
||||
*varval = '\0';
|
||||
varval++;
|
||||
if((tmpvar = ast_variable_new(varname, varval))) {
|
||||
@@ -9174,10 +9161,7 @@ static char *function_iaxpeer(struct ast_channel *chan, char *cmd, char *data, c
|
||||
char *peername, *colname;
|
||||
char iabuf[INET_ADDRSTRLEN];
|
||||
|
||||
if (!(peername = ast_strdupa(data))) {
|
||||
ast_log(LOG_ERROR, "Memory Error!\n");
|
||||
return ret;
|
||||
}
|
||||
peername = ast_strdupa(data);
|
||||
|
||||
/* if our channel, return the IP address of the endpoint of current channel */
|
||||
if (!strcmp(peername,"CURRENTCHANNEL")) {
|
||||
|
Reference in New Issue
Block a user