summaryrefslogtreecommitdiffstats
path: root/openbsc/src/libmsc/gsm_04_08.c
diff options
context:
space:
mode:
authorNeels Hofmeyr <nhofmeyr@sysmocom.de>2016-05-30 15:06:55 +0200
committerNeels Hofmeyr <nhofmeyr@sysmocom.de>2016-11-12 16:05:05 +0100
commit3f7958f08b05d251ecbc88ac2988650308e23f3b (patch)
tree34f825d23f02673878cdc9c8b05cf43beabd49ea /openbsc/src/libmsc/gsm_04_08.c
parentc8f00fa50d8b2d79160611625c651543f382d125 (diff)
move subscr auth check to gsm_subscriber.c
add subscr_authorized(), subscr_authorized_imsi() Change-Id: If2ef06b1229351127c61477ca14653d6ae4cb6bb
Diffstat (limited to 'openbsc/src/libmsc/gsm_04_08.c')
-rw-r--r--openbsc/src/libmsc/gsm_04_08.c37
1 files changed, 3 insertions, 34 deletions
diff --git a/openbsc/src/libmsc/gsm_04_08.c b/openbsc/src/libmsc/gsm_04_08.c
index 2068f7d2f..8c9328703 100644
--- a/openbsc/src/libmsc/gsm_04_08.c
+++ b/openbsc/src/libmsc/gsm_04_08.c
@@ -29,8 +29,6 @@
#include <errno.h>
#include <time.h>
#include <netinet/in.h>
-#include <regex.h>
-#include <sys/types.h>
#include <openssl/rand.h>
#include "bscconfig.h"
@@ -298,19 +296,8 @@ int gsm48_secure_channel(struct gsm_subscriber_connection *conn, int key_seq,
return -EINVAL; /* not reached */
}
-static bool subscr_regexp_check(const struct gsm_network *net, const char *imsi)
-{
- if (!net->authorized_reg_str)
- return false;
-
- if (regexec(&net->authorized_regexp, imsi, 0, NULL, 0) != REG_NOMATCH)
- return true;
-
- return false;
-}
-
static bool authorize_subscriber(struct gsm_loc_updating_operation *loc,
- struct gsm_subscriber *subscriber)
+ struct gsm_subscriber *subscriber)
{
if (!subscriber) {
LOGP(DMM, LOGL_DEBUG, "authorize_subscriber() on NULL subscriber\n");
@@ -331,25 +318,7 @@ static bool authorize_subscriber(struct gsm_loc_updating_operation *loc,
return false;
}
- switch (subscriber->group->net->auth_policy) {
- case GSM_AUTH_POLICY_CLOSED:
- return subscriber->authorized;
- case GSM_AUTH_POLICY_REGEXP:
- if (subscriber->authorized)
- return true;
- if (subscr_regexp_check(subscriber->group->net,
- subscriber->imsi))
- subscriber->authorized = 1;
- return subscriber->authorized;
- case GSM_AUTH_POLICY_TOKEN:
- if (subscriber->authorized)
- return subscriber->authorized;
- return (subscriber->flags & GSM_SUBSCRIBER_FIRST_CONTACT);
- case GSM_AUTH_POLICY_ACCEPT_ALL:
- return true;
- default:
- return false;
- }
+ return subscr_authorized(subscriber);
}
static void release_loc_updating_req(struct gsm_subscriber_connection *conn, int release)
@@ -597,7 +566,7 @@ static struct gsm_subscriber *subscr_create(const struct gsm_network *net,
if (!net->auto_create_subscr)
return NULL;
- if (!subscr_regexp_check(net, imsi))
+ if (!subscr_authorized_imsi(net, imsi))
return NULL;
return subscr_create_subscriber(net->subscr_group, imsi);