allocate a token for new subscribers

This commit is contained in:
Jan Luebbe 2009-08-12 15:18:52 +02:00 committed by Harald Welte (local)
parent 06513f26a1
commit 336f8ec57a
1 changed files with 14 additions and 0 deletions

View File

@ -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;
}