/usr/share/pyshared/rgw.py is in python-ceph 0.41-1ubuntu2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | """librgw Python ctypes wrapper
Copyright 2011, New Dream Network
"""
from ctypes import CDLL, c_char_p, c_void_p,\
byref, c_int
import ctypes
class Rgw(object):
"""librgw python wrapper"""
def __init__(self):
self.lib = CDLL('librgw.so.1')
self.rgw = c_void_p(0)
ret = self.lib.librgw_create(byref(self.rgw), 0)
if (ret != 0):
raise Exception("librgw_create failed with error %d" % ret)
def __del__(self):
self.lib.librgw_shutdown(self.rgw)
def acl_bin2xml(self, blob):
blob_buf = ctypes.create_string_buffer(blob[:])
xml = c_char_p(0)
ret = self.lib.librgw_acl_bin2xml(self.rgw, byref(blob_buf), len(blob), byref(xml))
if (ret != 0):
raise Exception("acl_bin2xml failed with error %d" % ret)
rets = ctypes.string_at(xml)
self.lib.librgw_free_xml(self.rgw, xml)
return rets
def acl_xml2bin(self, xml):
blen = c_int(0)
blob = c_void_p(0)
ret = self.lib.librgw_acl_xml2bin(self.rgw, c_char_p(xml),
byref(blob), byref(blen))
if (ret != 0):
raise Exception("acl_bin2xml failed with error %d" % ret)
rets = ctypes.string_at(blob, blen)
self.lib.librgw_free_bin(self.rgw, blob)
return rets
|