diff options
author | Stefan Metzmacher <metze@samba.org> | 2016-01-28 13:44:33 +0100 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2016-02-03 08:33:11 +0100 |
commit | 65127d16744763d0865ca9ce4d039866785e3fc7 (patch) | |
tree | c846f10134716b3f7a7a47b71979210dc1bbe8e6 /python/samba/__init__.py | |
parent | 943e69ca8fd4491004eafbf29ed2ca748b0b7480 (diff) | |
download | samba-65127d16744763d0865ca9ce4d039866785e3fc7.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>
Diffstat (limited to 'python/samba/__init__.py')
-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 |