{
struct ast_ha *ha = malloc(sizeof(struct ast_ha));
char *nm;
{
struct ast_ha *ha = malloc(sizeof(struct ast_ha));
char *nm;
struct ast_ha *prev = NULL;
struct ast_ha *ret;
ret = path;
struct ast_ha *prev = NULL;
struct ast_ha *ret;
ret = path;
path = path->next;
}
if (ha) {
path = path->next;
}
if (ha) {
- char *stringp=NULL;
- stringp=stuff;
- strsep(&stringp, "/");
- nm = strsep(&stringp, "/");
+ strncpy(tmp, stuff, sizeof(tmp) - 1);
+ nm = strchr(tmp, '/');
if (!nm)
nm = "255.255.255.255";
if (!nm)
nm = "255.255.255.255";
- if (!inet_aton(stuff, &ha->netaddr)) {
+ else {
+ *nm = '\0';
+ nm++;
+ }
+ if (!inet_aton(tmp, &ha->netaddr)) {
ast_log(LOG_WARNING, "%s not a valid IP\n", stuff);
free(ha);
ast_log(LOG_WARNING, "%s not a valid IP\n", stuff);
free(ha);
}
if (!inet_aton(nm, &ha->netmask)) {
ast_log(LOG_WARNING, "%s not a valid netmask\n", nm);
free(ha);
}
if (!inet_aton(nm, &ha->netmask)) {
ast_log(LOG_WARNING, "%s not a valid netmask\n", nm);
free(ha);
}
ha->netaddr.s_addr &= ha->netmask.s_addr;
if (!strncasecmp(sense, "p", 1)) {
}
ha->netaddr.s_addr &= ha->netmask.s_addr;
if (!strncasecmp(sense, "p", 1)) {
{
struct sip_user *user;
int format;
{
struct sip_user *user;
int format;
+ struct ast_ha *oldha = NULL;
user = (struct sip_user *)malloc(sizeof(struct sip_user));
if (user) {
memset(user, 0, sizeof(struct sip_user));
strncpy(user->name, name, sizeof(user->name)-1);
user = (struct sip_user *)malloc(sizeof(struct sip_user));
if (user) {
memset(user, 0, sizeof(struct sip_user));
strncpy(user->name, name, sizeof(user->name)-1);
+ oldha = user->ha;
+ user->ha = NULL;
/* set the usage flag to a sane staring value*/
user->inUse = 0;
user->outUse = 0;
/* set the usage flag to a sane staring value*/
user->inUse = 0;
user->outUse = 0;
else if (strlen(user->md5secret))
strncpy(user->methods, "md5", sizeof(user->methods) - 1);
}
else if (strlen(user->md5secret))
strncpy(user->methods, "md5", sizeof(user->methods) - 1);
}
+ if (oldha)
+ ast_free_ha(oldha);
{
struct sip_peer *peer;
struct sip_peer *prev;
{
struct sip_peer *peer;
struct sip_peer *prev;
+ struct ast_ha *oldha = NULL;
int maskfound=0;
int format;
int found=0;
int maskfound=0;
int format;
int found=0;
peer->addr.sin_port = htons(DEFAULT_SIP_PORT);
peer->expiry = expiry;
}
peer->addr.sin_port = htons(DEFAULT_SIP_PORT);
peer->expiry = expiry;
}
+ oldha = peer->ha;
+ peer->ha = NULL;
peer->capability = capability;
/* Assume can reinvite */
peer->canreinvite = REINVITE_INVITE;
peer->capability = capability;
/* Assume can reinvite */
peer->canreinvite = REINVITE_INVITE;
reg_source_db(peer);
peer->delme = 0;
}
reg_source_db(peer);
peer->delme = 0;
}
+ if (oldha)
+ ast_free_ha(oldha);