[PATCH] smppbox
Victor Luchitz <[email protected]>
| Newsgroups | gmane.comp.mobile.kannel.devel |
|---|---|
| Message-ID | <[email protected]> |
Hello! After a day of trying to get smppbox to work properly on my machine, I've come up with a patch that: 1) fixes compilation on freeebsd, one has to rerun the bootstrap script afterwards 2) fixes smppbox incorrectly setting the UDH ESM class bit and assertion failure in octstr_cat due to msg2->sms.udhdata being empty. The bug only happened in case the original message was not split into several parts. Seeing you've already fixed the catenated_sms_counter bit, I'm not including it into the patch. Thank you and keep up the great work! -- Best regards, Victor Luchitz
smppbox.diff
(application/octet-stream, 1.8 KB)
Index: configure.in
===================================================================
--- configure.in (revision 7)
+++ configure.in (working copy)
@@ -82,7 +82,9 @@
;;
*-*-openbsd* | *-*-freebsd*)
CFLAGS="$CFLAGS -pthread"
- AC_CHECK_LIB(c_r, pthread_exit, [LIBS="$LIBS -lc_r -lkse"; pthread="yes"])
+ AC_CHECK_LIB(pthread, pthread_exit, [LIBS="$LIBS -lpthread"; pthread="yes"],
+ [AC_CHECK_LIB(c_r, pthread_exit, [LIBS="$LIBS -lc_r"; pthread="yes"])]
+ )
;;
esac
Index: gw/smppbox.c
===================================================================
--- gw/smppbox.c (revision 7)
+++ gw/smppbox.c (working copy)
@@ -744,7 +744,7 @@
list = sms_split(msg, header, footer, suffix, split_chars, catenate,
msg_sequence, max_msgs, sms_max_length);
msg_count = gwlist_len(list);
-
+
debug("SMPP", 0, "message length %ld, sending %ld messages",
octstr_len(msg->sms.msgdata), msg_count);
@@ -760,8 +760,13 @@
pdu2->u.deliver_sm.destination_addr = octstr_duplicate(pdu->u.deliver_sm.destination_addr);
pdu2->u.deliver_sm.service_type = octstr_duplicate(pdu->u.deliver_sm.service_type);
if (msg_count > 0) {
- pdu2->u.deliver_sm.esm_class = pdu->u.deliver_sm.esm_class | ESM_CLASS_DELIVER_UDH_INDICATOR;
- pdu2->u.deliver_sm.short_message = octstr_cat(msg2->sms.udhdata, msg2->sms.msgdata);
+ if (octstr_len(msg2->sms.udhdata) > 0) {
+ pdu2->u.deliver_sm.esm_class = pdu->u.deliver_sm.esm_class | ESM_CLASS_DELIVER_UDH_INDICATOR;
+ pdu2->u.deliver_sm.short_message = octstr_cat(msg2->sms.udhdata, msg2->sms.msgdata);
+ }
+ else {
+ pdu2->u.deliver_sm.short_message = octstr_duplicate(msg2->sms.msgdata);
+ }
}
else {
pdu2->u.deliver_sm.short_message = octstr_duplicate(msg2->sms.msgdata);