sms db: don't attempt to query pending SMS for unset MSISDN

When the subscriber has no MSISDN, we might construct an invalid SQL statement
such as

  ... AND dest_addr= AND ...

Instead, don't even query for empty MSISDNs.

Related: OS#2706
Change-Id: I7d6169d774b2da04b3051957e364fe620feed51e
This commit is contained in:
Neels Hofmeyr 2017-12-05 12:34:44 +01:00 committed by Neels Hofmeyr
parent a55dda703f
commit f6704f1a50
1 changed files with 4 additions and 0 deletions

View File

@ -840,6 +840,10 @@ struct gsm_sms *db_sms_get_unsent_for_subscr(struct vlr_subscr *vsub,
if (!vsub->lu_complete)
return NULL;
/* A subscriber having no phone number cannot possibly receive SMS. */
if (*vsub->msisdn == '\0')
return NULL;
result = dbi_conn_queryf(conn,
"SELECT * FROM SMS"
" WHERE sent IS NULL"