summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <holger@moiji-mobile.com>2014-04-30 18:59:11 +0200
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2014-04-30 20:51:28 +0200
commitf242e7afef5353c16e15e84437d54fcb26a24cb3 (patch)
tree7f7727bfbbef2a269e2efc4b0002c72d94b1da23
parentedfdc9829cc2cc6f05a9cd9015e22210e442a259 (diff)
db: Fix fall-out with the subscriber removal in the subscriber deletion code
The sender_id is gone so the code that attempted to delete SMS didn't work anymore. Delete the SMS based on src_addr or the dest_addr. Fixes: ====================================================================== ERROR: testSubscriberAddRemove (__main__.TestCtrlNITB) ---------------------------------------------------------------------- Traceback (most recent call last): File "tests/ctrl_test_runner.py", line 379, in testSubscriberAddRemove r = self.do_set('subscriber-delete-v1', '2620345') File "tests/ctrl_test_runner.py", line 114, in do_set return self.recv_msgs()[id] KeyError: 1002
-rw-r--r--openbsc/src/libmsc/db.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/openbsc/src/libmsc/db.c b/openbsc/src/libmsc/db.c
index 1580acd91..90c66c88f 100644
--- a/openbsc/src/libmsc/db.c
+++ b/openbsc/src/libmsc/db.c
@@ -1042,8 +1042,8 @@ int db_subscriber_delete(struct gsm_subscriber *subscr)
dbi_result_free(result);
result = dbi_conn_queryf(conn,
- "DELETE FROM SMS WHERE sender_id=%llu OR receiver_id=%llu",
- subscr->id, subscr->id);
+ "DELETE FROM SMS WHERE src_addr=%s OR dest_addr=%s",
+ subscr->extension, subscr->extension);
if (!result) {
LOGP(DDB, LOGL_ERROR,
"Failed to delete SMS for %llu\n", subscr->id);