aboutsummaryrefslogtreecommitdiffstats
path: root/channels/h323
diff options
context:
space:
mode:
authorjeremy <jeremy@f38db490-d61c-443f-a65b-d21fe96a405b>2003-03-31 20:26:08 +0000
committerjeremy <jeremy@f38db490-d61c-443f-a65b-d21fe96a405b>2003-03-31 20:26:08 +0000
commit9b5b1083a7d461ed0300e8d72d5c56889195bde5 (patch)
tree209842d9bf36e09e85f5591ba370026e6ba73f72 /channels/h323
parentd89316c17a7370daf22f6cffb3fb8b38de5571c4 (diff)
do user authentication right
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@733 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels/h323')
-rwxr-xr-xchannels/h323/chan_h323.c10
-rwxr-xr-xchannels/h323/chan_h323.h7
2 files changed, 11 insertions, 6 deletions
diff --git a/channels/h323/chan_h323.c b/channels/h323/chan_h323.c
index 7ba351502..6e293309f 100755
--- a/channels/h323/chan_h323.c
+++ b/channels/h323/chan_h323.c
@@ -256,6 +256,8 @@ static struct oh323_user *build_user(char *name, struct ast_variable *v)
free(user);
return NULL;
}
+ /* Let us know we need to use ip authentication */
+ user->host = 1;
} else if (!strcasecmp(v->name, "amaflags")) {
format = ast_cdr_amaflags2int(v->value);
if (format < 0) {
@@ -957,9 +959,11 @@ int setup_incoming_call(call_details_t cd)
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);
} else {
- 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);
- return 0;
+ if (user->host) {
+ 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 of '%s'\n", user->name, cd.sourceIp);
+ return 0;
+ }
}
if (user->incominglimit > 0) {
if (user->inUse >= user->incominglimit) {
diff --git a/channels/h323/chan_h323.h b/channels/h323/chan_h323.h
index ec718f9a1..d30a42e5d 100755
--- a/channels/h323/chan_h323.h
+++ b/channels/h323/chan_h323.h
@@ -37,14 +37,15 @@ struct oh323_user {
char callerid[80];
char accountcode[20];
int amaflags;
- int noFastStart;
- int noH245Tunneling;
- int noSilenceSuppression;
+ int noFastStart;
+ int noH245Tunneling;
+ int noSilenceSuppression;
int inUse;
int incominglimit;
int bridge;
int nat;
int dtmfmode;
+ int host;
struct ast_ha *ha;
struct sockaddr_in addr;
struct oh323_user *next;