mirror of
https://github.com/samba-team/samba.git
synced 2025-03-09 08:58:35 +03:00
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)
This commit is contained in:
parent
fe875f39dc
commit
04b2073eeb
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user