mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-19 11:42:27 +00:00
do user authentication right
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@733 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -256,6 +256,8 @@ static struct oh323_user *build_user(char *name, struct ast_variable *v)
|
|||||||
free(user);
|
free(user);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
/* Let us know we need to use ip authentication */
|
||||||
|
user->host = 1;
|
||||||
} else if (!strcasecmp(v->name, "amaflags")) {
|
} else if (!strcasecmp(v->name, "amaflags")) {
|
||||||
format = ast_cdr_amaflags2int(v->value);
|
format = ast_cdr_amaflags2int(v->value);
|
||||||
if (format < 0) {
|
if (format < 0) {
|
||||||
@@ -957,10 +959,12 @@ int setup_incoming_call(call_details_t cd)
|
|||||||
strncpy(p->context, default_context, sizeof(p->context)-1);
|
strncpy(p->context, default_context, sizeof(p->context)-1);
|
||||||
ast_log(LOG_DEBUG, "Sending %s to context [%s]\n", cd.call_source_aliases, p->context);
|
ast_log(LOG_DEBUG, "Sending %s to context [%s]\n", cd.call_source_aliases, p->context);
|
||||||
} else {
|
} else {
|
||||||
|
if (user->host) {
|
||||||
if (strcasecmp(cd.sourceIp, inet_ntoa(user->addr.sin_addr))){
|
if (strcasecmp(cd.sourceIp, inet_ntoa(user->addr.sin_addr))){
|
||||||
ast_log(LOG_ERROR, "Call from user '%s' rejected due to non-matching IP address: '%s'\n", user->name, cd.sourceIp);
|
ast_log(LOG_ERROR, "Call from user '%s' rejected due to non-matching IP address of '%s'\n", user->name, cd.sourceIp);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (user->incominglimit > 0) {
|
if (user->incominglimit > 0) {
|
||||||
if (user->inUse >= user->incominglimit) {
|
if (user->inUse >= user->incominglimit) {
|
||||||
ast_log(LOG_ERROR, "Call from user '%s' rejected due to usage limit of %d\n", user->name, user->incominglimit);
|
ast_log(LOG_ERROR, "Call from user '%s' rejected due to usage limit of %d\n", user->name, user->incominglimit);
|
||||||
|
@@ -45,6 +45,7 @@ struct oh323_user {
|
|||||||
int bridge;
|
int bridge;
|
||||||
int nat;
|
int nat;
|
||||||
int dtmfmode;
|
int dtmfmode;
|
||||||
|
int host;
|
||||||
struct ast_ha *ha;
|
struct ast_ha *ha;
|
||||||
struct sockaddr_in addr;
|
struct sockaddr_in addr;
|
||||||
struct oh323_user *next;
|
struct oh323_user *next;
|
||||||
|
Reference in New Issue
Block a user