sms: Always go through the database and the smsqueue to send messages
This is also fixing a memory and subscriber leak. Make sure to
always release the gsm_sms structure.
diff --git a/openbsc/src/vty_interface_layer3.c b/openbsc/src/vty_interface_layer3.c
index 7df0d7b..c01d9c6 100644
--- a/openbsc/src/vty_interface_layer3.c
+++ b/openbsc/src/vty_interface_layer3.c
@@ -171,16 +171,15 @@
sms = sms_from_text(receiver, str);
sms->protocol_id = tp_pid;
- if(!receiver->lac){
- /* subscriber currently not attached, store in database */
- if (db_sms_store(sms) != 0) {
- LOGP(DSMS, LOGL_ERROR, "Failed to store SMS in Database\n");
- return CMD_WARNING;
- }
- } else {
- gsm411_send_sms_subscr(receiver, sms);
+ /* store in database for the queue */
+ if (db_sms_store(sms) != 0) {
+ LOGP(DSMS, LOGL_ERROR, "Failed to store SMS in Database\n");
+ sms_free(sms);
+ return CMD_WARNING;
}
+ sms_free(sms);
+ sms_queue_trigger(receiver->net->sms_queue);
return CMD_SUCCESS;
}