libmsc/db.c: get rid of hard-coded SMS expiry threshold

The initial idea of the SMS expiry threshold was to avoid storing
SMS messages with too long validity time (e.g. 63 weeks).
Unfortunately, neither this feature was properly documented, nor
the expiry threshold is configurable. Moreover, it has been
implemented in a wrong way, so instead of deleting the oldest
expired message, it would delete the youngest one or nothing:

  SELECT ... FROM SMS ORDER BY created LIMIT 1;

while it should be sorted by 'valid_until' in ascending order:

  SELECT .. FROM SMS ORDER BY valid_until LIMIT 1;

Thus, if the oldest message is expired, it gets deleted. If the
oldest message is not expired yet, there is nothing to delete.

Change-Id: I0ce6b1ab50986dc69a2be4ea62b6a24c7f3f8f0a
diff --git a/tests/db_sms/db_sms_test.ok b/tests/db_sms/db_sms_test.ok
index c61b1f4..486dcc3 100644
--- a/tests/db_sms/db_sms_test.ok
+++ b/tests/db_sms/db_sms_test.ok
@@ -68,8 +68,7 @@
 DDB NOTICE verify_sms('Truncated TP-UD (255 octets, 8-bit encoding)'): TP-User-Data mismatch
 DDB NOTICE test_db_sms_get('Same MSISDN #1'): failure, as expected
 DDB NOTICE test_db_sms_get('Same MSISDN #2'): failure, as expected
-DDB NOTICE test_db_sms_get('Expired SMS'): unexpected result
-DDB NOTICE verify_sms('Expired SMS'): match
+DDB NOTICE test_db_sms_get('Expired SMS'): failure, as expected
 DDB NOTICE test_db_sms_get('Empty TP-UD'): success, as expected
 DDB NOTICE verify_sms('Empty TP-UD'): match
 full talloc report on 'null_context' (total      0 bytes in   1 blocks)