generic-poky/meta/recipes-connectivity/gsm/files/024_sms-text-in-bracket.patch

73 lines
2.3 KiB
Diff
Raw Normal View History

http://bugzilla.openmoko.org/cgi-bin/bugzilla/show_bug.cgi?id=834
From: Kristian Mueller <kristian@mput.de>
Subject: [PATCH] libgsmd-tool does not allow sms with more than one word
libgsmd-tool only allows for command strings without spaces.
SMS messages with more than one word will be parsed as multible commands.
The patch introduces SMS message text in bracket and fixes a NULL pointer
reference on mailformed "ss" commands.
Signed-off-by: Jim Huang <jserv@openmoko.org>
recipes: add Upstream-Status for multiple recipes hostap: add upstream status for hostap-fw-load.patch lrzsz: add upstream status for lrzsz's patches bluez: add upstream status for bluez's patches bluez-dtl1-workaround: add upstream status for COPYING.patch libgsmd: add upstream status for gsm's patches. gypsy: add upstream status for gypsy's patch libpcap: add upstream status for libpcap's patches ppp: add upstream status for ppp's patches libtelepathy: add upstream status for libtelepathy's patches telepathy-python: add upstream status for telepahty-python's patches wireless-tools: add upstream status for wireless-tools's patches wpa-supplicant: add upstream status for wpa-supplicant zeroconf: add upstream status for zeroconf's patch glibc: add upstream status for glibc's patches dpkg: add upstream status for dpkg's patches makedevs: add upstream status for makedevs's patch opkg: add upstream status for opkg's patches opkg-utils: add upstream status for opkg-utils's patch minicom: add upstream status for minicom patches rpcbind: add upstream status for rpcbind's patch which: add upstream status for which's patch clutter-gst: add upstream status for clutter-gst's patches flac: add upstream status for flac's patches gst-ffmpeg: add upstream status for gst-ffmpeg's patch liba52: add upstream status for liba52's patch libid3tag: add upstream status for libid3tag libmusicbrainz: add upstream status for libmusicbrainz's patch pulseaudio: add upstream status for pulseaudio patches db: add upstream status for db's patch neon: add upstream status for neon's patch taglib: add upstream status for taglib's patches libetpan: add upstream status for libetpan's patch libopensync: add upstream status for libopensync's patches libopensync-plugin-evolution2: add upstream status for its patch libopensync-plugin-syncml: add upstream status for its patch libsyncml: add upstream status for libsyncml's patch empathy: add upstream status for empathy's patch wv: add upstream status for wv's patch xournal: add upstream status for xournal's patch (From OE-Core rev: 0f9f0518ac46c2f2beb0224e881ff136f1603d33) Signed-off-by: Dongxiao Xu <dongxiao.xu@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-05-10 04:55:32 +00:00
Upstream-Status: Inappropriate [not used]
---
src/util/shell.c | 32 ++++++++++++++++++++++++++------
1 file changed, 26 insertions(+), 6 deletions(-)
Index: gsm/src/util/shell.c
===================================================================
--- gsm.orig/src/util/shell.c 2007-08-31 16:15:30.000000000 +0800
+++ gsm/src/util/shell.c 2007-09-17 23:35:31.000000000 +0800
@@ -389,7 +389,7 @@
"\tsd\tSMS Delete (sd=index,delflg)\n"
"\tsl\tSMS List (sl=stat)\n"
"\tsr\tSMS Read (sr=index)\n"
- "\tss\tSMS Send (ss=number,text)\n"
+ "\tss\tSMS Send (ss=number,text|[\"text\"])\n"
"\tsw\tSMS Write (sw=stat,number,text)\n"
"\tsm\tSMS Storage stats\n"
"\tsM\tSMS Set preferred storage (sM=mem1,mem2,mem3)\n"
@@ -612,16 +612,36 @@
lgsm_sms_read(lgsmh, atoi(ptr+1));
} else if ( !strncmp(buf, "ss", 2)) {
- printf("Send SMS\n");
struct lgsm_sms sms;
ptr = strchr(buf, '=');
fcomma = strchr(buf, ',');
- strncpy(sms.addr, ptr+1, fcomma-ptr-1);
- sms.addr[fcomma-ptr-1] = '\0';
- packing_7bit_character(fcomma+1, &sms);
+ if (!ptr || !fcomma) {
+ printf("Wrong command format\n");
+ } else {
+ strncpy(sms.addr, ptr+1, fcomma-ptr-1);
+ sms.addr[fcomma-ptr-1] = '\0';
+
+ /* todo define \" to allow " in text */
+ if (fcomma[1] == '"' &&
+ !strchr(fcomma+2, '"')) {
+ /* read until closing '"' */
+ rc = fscanf(stdin, "%[^\"]\"",
+ fcomma+strlen(fcomma));
+ if (rc == EOF) {
+ printf("EOF\n");
+ return -1;
+ }
+ /* remove brackets */
+ fcomma++;
+ fcomma[strlen(fcomma)] = '\0';
+ }
+
+ printf("Send SMS\n");
+ packing_7bit_character(fcomma+1, &sms);
- lgsm_sms_send(lgsmh, &sms);
+ lgsm_sms_send(lgsmh, &sms);
+ }
} else if ( !strncmp(buf, "sw", 2)) {
printf("Write SMS\n");
struct lgsm_sms_write sms_write;