From 336f8ec57a1f33997967b9a5d1e10ec2358ee3d6 Mon Sep 17 00:00:00 2001 From: Jan Luebbe Date: Wed, 12 Aug 2009 15:18:52 +0200 Subject: [PATCH] allocate a token for new subscribers --- openbsc/src/gsm_04_11.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/openbsc/src/gsm_04_11.c b/openbsc/src/gsm_04_11.c index 05e55d4dc..1dc68d0c3 100644 --- a/openbsc/src/gsm_04_11.c +++ b/openbsc/src/gsm_04_11.c @@ -954,6 +954,8 @@ static int subscr_sig_cb(unsigned int subsys, unsigned int signal, struct gsm_lchan *lchan; struct gsm_sms *sms; + u_int32_t token; + switch (signal) { case S_SUBSCR_ATTACHED: /* A subscriber has attached. Check if there are @@ -968,6 +970,18 @@ static int subscr_sig_cb(unsigned int subsys, unsigned int signal, /* Establish a SAPI3 RLL connection for SMS */ rll_establish(lchan, UM_SAPI_SMS, rll_ind_cb, sms); break; + case S_SUBSCR_FIRST_CONTACT: + /* A new subscriber has just been created in the DB */ + subscr = signal_data; + if (subscr->net->auth_policy == GSM_AUTH_POLICY_TOKEN) { + if (db_subscriber_alloc_token(subscr, &token)) { + /* error: probably use already has a token */ + break; + } else { + /* FIXME: send sms with token here */ + } + } + break; default: break; }