diff options
author | Stefan Metzmacher <metze@samba.org> | 2016-01-28 13:44:33 +0100 |
---|---|---|
committer | Karolin Seeger <kseeger@samba.org> | 2016-02-05 10:03:18 +0100 |
commit | 04b2073eeba3553682890e5849bacc05fc213405 (patch) | |
tree | 610addb01cec4659bab11b0d34e715885f330e12 /python | |
parent | fe875f39dc5a536fb88bae0a1b199484d2f45e6f (diff) | |
download | samba-04b2073eeba3553682890e5849bacc05fc213405.tar.gz |
python:samba: add a generic string_to_byte_array() helper function
We should avoid implementing this again and again.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=11699
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
(cherry picked from commit 65127d16744763d0865ca9ce4d039866785e3fc7)
Diffstat (limited to 'python')
-rw-r--r-- | python/samba/__init__.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/python/samba/__init__.py b/python/samba/__init__.py index b04e83cd115..59b6ebf5e61 100644 --- a/python/samba/__init__.py +++ b/python/samba/__init__.py @@ -362,6 +362,14 @@ def dn_from_dns_name(dnsdomain): def current_unix_time(): return int(time.time()) +def string_to_byte_array(string): + blob = [0] * len(string) + + for i in range(len(string)): + blob[i] = ord(string[i]) + + return blob + import _glue version = _glue.version interface_ips = _glue.interface_ips |