[pkg-fso-commits] [SCM] FSO frameworkd Debian packaging branch, master, updated. milestone5.1

Daniel Willmann daniel at totalueberwachung.de
Sat Jun 6 12:21:46 UTC 2009


The following commit has been merged in the master branch:
commit ceef20a8780e2abc96d4f68e49ffb11fd208a0e7
Author: Daniel Willmann <daniel at totalueberwachung.de>
Date:   Fri Feb 13 23:23:56 2009 +0100

    ogsmd: Fix binary SMS with null bytes
    
    Since binary SMS are very likely to contain null bytes we use a
    bytearray in the properties to convey the data. This still doesn't fix
    the problem if we receive UCS2 messages which include null bytes (which
    is possible, but less likely). Fixes FSO #345.

diff --git a/framework/subsystems/ogsmd/gsm/sms.py b/framework/subsystems/ogsmd/gsm/sms.py
index 3d27b52..b91e248 100644
--- a/framework/subsystems/ogsmd/gsm/sms.py
+++ b/framework/subsystems/ogsmd/gsm/sms.py
@@ -262,7 +262,9 @@ class SMS(object):
                 self.error.append("Userdata corrupt")
                 self.ud = ""
         else:
-            self.ud = userdata
+            # Binary message
+            self.data = [ ord(x) for x in userdata ]
+            self.ud = "This is a binary message"
 
     def _getDCS( self ):
         # TODO throw exceptions on invalid combinations
@@ -355,6 +357,10 @@ class SMS(object):
         map["type"] = self.type
         map["pid"] = self.pid
         map["alphabet"] = SMS_ALPHABET_TO_ENCODING.revlookup(self.dcs_alphabet)
+
+        if map["alphabet"] == "binary":
+            map["data"] = self.data
+
         if len(self.error) > 0:
             map["error"] = self.error
 
@@ -383,6 +389,8 @@ class SMS(object):
                 self.pid = v
             if k == "alphabet":
                 self.dcs_alphabet = SMS_ALPHABET_TO_ENCODING[v]
+            if k == "data":
+                    self.data = v
 
     properties = property( _getProperties, _setProperties )
 
@@ -439,7 +447,8 @@ class SMS(object):
                     self.dcs_alphabet = "utf_16_be"
                     pduud = self.ud.encode( self.dcs_alphabet )
             else:
-                pduud = self.ud
+                # Binary message
+                pduud = "".join([ chr(x) for x in self.data ])
 
         if self.type == "sms-deliver" or self.type == "sms-submit":
             pdubytes.append( self.dcs )

-- 
FSO frameworkd Debian packaging



More information about the pkg-fso-commits mailing list