mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-18 15:49:56 +00:00
formatting cleanup (bug #4750)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@6167 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
17
acl.c
17
acl.c
@@ -91,12 +91,10 @@ static void ast_copy_ha(struct ast_ha *from, struct ast_ha *to)
|
||||
static struct ast_ha *ast_duplicate_ha(struct ast_ha *original)
|
||||
{
|
||||
struct ast_ha *new_ha = malloc(sizeof(struct ast_ha));
|
||||
|
||||
/* Copy from original to new object */
|
||||
ast_copy_ha(original, new_ha);
|
||||
|
||||
return(new_ha);
|
||||
|
||||
return new_ha;
|
||||
}
|
||||
|
||||
/* Create duplicate HA link list */
|
||||
@@ -118,7 +116,7 @@ struct ast_ha *ast_duplicate_ha_list(struct ast_ha *original)
|
||||
start = start->next; /* Go to next object */
|
||||
prev = link; /* Save pointer to this object */
|
||||
}
|
||||
return (ret); /* Return start of list */
|
||||
return ret; /* Return start of list */
|
||||
}
|
||||
|
||||
struct ast_ha *ast_append_ha(char *sense, char *stuff, struct ast_ha *path)
|
||||
@@ -138,9 +136,9 @@ struct ast_ha *ast_append_ha(char *sense, char *stuff, struct ast_ha *path)
|
||||
if (ha) {
|
||||
ast_copy_string(tmp, stuff, sizeof(tmp));
|
||||
nm = strchr(tmp, '/');
|
||||
if (!nm)
|
||||
if (!nm) {
|
||||
nm = "255.255.255.255";
|
||||
else {
|
||||
} else {
|
||||
*nm = '\0';
|
||||
nm++;
|
||||
}
|
||||
@@ -170,11 +168,12 @@ struct ast_ha *ast_append_ha(char *sense, char *stuff, struct ast_ha *path)
|
||||
ha->sense = AST_SENSE_DENY;
|
||||
}
|
||||
ha->next = NULL;
|
||||
if (prev)
|
||||
if (prev) {
|
||||
prev->next = ha;
|
||||
else
|
||||
} else {
|
||||
ret = ha;
|
||||
}
|
||||
}
|
||||
ast_log(LOG_DEBUG, "%s/%s appended to acl for peer\n", stuff, nm);
|
||||
return ret;
|
||||
}
|
||||
@@ -193,7 +192,7 @@ int ast_apply_ha(struct ast_ha *ha, struct sockaddr_in *sin)
|
||||
ast_inet_ntoa(iabuf2, sizeof(iabuf2), ha->netaddr));
|
||||
/* For each rule, if this address and the netmask = the net address
|
||||
apply the current rule */
|
||||
if ((sin->sin_addr.s_addr & ha->netmask.s_addr) == (ha->netaddr.s_addr))
|
||||
if ((sin->sin_addr.s_addr & ha->netmask.s_addr) == ha->netaddr.s_addr)
|
||||
res = ha->sense;
|
||||
ha = ha->next;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user