mirror of
https://github.com/samba-team/samba.git
synced 2025-08-04 08:22:08 +03:00
pydsdb: Mark all SamDB and Schema methods that are in pydsdb as
private, to discourage them being called directly.
This commit is contained in:
@ -462,46 +462,46 @@ static PyObject *py_dsdb_write_prefixes_from_schema_to_ldb(PyObject *self, PyObj
|
|||||||
|
|
||||||
|
|
||||||
static PyMethodDef py_dsdb_methods[] = {
|
static PyMethodDef py_dsdb_methods[] = {
|
||||||
{ "samdb_server_site_name", (PyCFunction)py_samdb_server_site_name,
|
{ "_samdb_server_site_name", (PyCFunction)py_samdb_server_site_name,
|
||||||
METH_VARARGS, "Get the server site name as a string"},
|
METH_VARARGS, "Get the server site name as a string"},
|
||||||
{ "dsdb_convert_schema_to_openldap",
|
{ "_dsdb_convert_schema_to_openldap",
|
||||||
(PyCFunction)py_dsdb_convert_schema_to_openldap, METH_VARARGS,
|
(PyCFunction)py_dsdb_convert_schema_to_openldap, METH_VARARGS,
|
||||||
"dsdb_convert_schema_to_openldap(ldb, target_str, mapping) -> str\n"
|
"dsdb_convert_schema_to_openldap(ldb, target_str, mapping) -> str\n"
|
||||||
"Create an OpenLDAP schema from a schema." },
|
"Create an OpenLDAP schema from a schema." },
|
||||||
{ "samdb_set_domain_sid", (PyCFunction)py_samdb_set_domain_sid,
|
{ "_samdb_set_domain_sid", (PyCFunction)py_samdb_set_domain_sid,
|
||||||
METH_VARARGS,
|
METH_VARARGS,
|
||||||
"samdb_set_domain_sid(samdb, sid)\n"
|
"samdb_set_domain_sid(samdb, sid)\n"
|
||||||
"Set SID of domain to use." },
|
"Set SID of domain to use." },
|
||||||
{ "samdb_get_domain_sid", (PyCFunction)py_samdb_get_domain_sid,
|
{ "_samdb_get_domain_sid", (PyCFunction)py_samdb_get_domain_sid,
|
||||||
METH_VARARGS,
|
METH_VARARGS,
|
||||||
"samdb_get_domain_sid(samdb)\n"
|
"samdb_get_domain_sid(samdb)\n"
|
||||||
"Get SID of domain in use." },
|
"Get SID of domain in use." },
|
||||||
{ "samdb_ntds_invocation_id", (PyCFunction)py_samdb_ntds_invocation_id,
|
{ "_samdb_ntds_invocation_id", (PyCFunction)py_samdb_ntds_invocation_id,
|
||||||
METH_VARARGS, "get the NTDS invocation ID GUID as a string"},
|
METH_VARARGS, "get the NTDS invocation ID GUID as a string"},
|
||||||
{ "samdb_set_ntds_settings_dn", (PyCFunction)py_samdb_set_ntds_settings_dn,
|
{ "_samdb_set_ntds_settings_dn", (PyCFunction)py_samdb_set_ntds_settings_dn,
|
||||||
METH_VARARGS,
|
METH_VARARGS,
|
||||||
"samdb_set_ntds_settings_dn(samdb, ntds_settings_dn)\n"
|
"samdb_set_ntds_settings_dn(samdb, ntds_settings_dn)\n"
|
||||||
"Set NTDS Settings DN for this LDB (allows it to be set before the DB fully exists)." },
|
"Set NTDS Settings DN for this LDB (allows it to be set before the DB fully exists)." },
|
||||||
{ "dsdb_get_oid_from_attid", (PyCFunction)py_dsdb_get_oid_from_attid,
|
{ "_dsdb_get_oid_from_attid", (PyCFunction)py_dsdb_get_oid_from_attid,
|
||||||
METH_VARARGS, NULL },
|
METH_VARARGS, NULL },
|
||||||
{ "dsdb_set_ntds_invocation_id",
|
{ "_dsdb_set_ntds_invocation_id",
|
||||||
(PyCFunction)py_dsdb_set_ntds_invocation_id, METH_VARARGS,
|
(PyCFunction)py_dsdb_set_ntds_invocation_id, METH_VARARGS,
|
||||||
NULL },
|
NULL },
|
||||||
{ "samdb_ntds_objectGUID", (PyCFunction)py_samdb_ntds_objectGUID,
|
{ "_samdb_ntds_objectGUID", (PyCFunction)py_samdb_ntds_objectGUID,
|
||||||
METH_VARARGS, "get the NTDS objectGUID as a string"},
|
METH_VARARGS, "get the NTDS objectGUID as a string"},
|
||||||
{ "dsdb_set_global_schema", (PyCFunction)py_dsdb_set_global_schema,
|
{ "_dsdb_set_global_schema", (PyCFunction)py_dsdb_set_global_schema,
|
||||||
METH_VARARGS, NULL },
|
METH_VARARGS, NULL },
|
||||||
{ "dsdb_load_partition_usn", (PyCFunction)py_dsdb_load_partition_usn,
|
{ "_dsdb_load_partition_usn", (PyCFunction)py_dsdb_load_partition_usn,
|
||||||
METH_VARARGS,
|
METH_VARARGS,
|
||||||
"get uSNHighest and uSNUrgent from the partition @REPLCHANGED"},
|
"get uSNHighest and uSNUrgent from the partition @REPLCHANGED"},
|
||||||
{ "dsdb_set_am_rodc",
|
{ "_dsdb_set_am_rodc",
|
||||||
(PyCFunction)py_dsdb_set_am_rodc, METH_VARARGS,
|
(PyCFunction)py_dsdb_set_am_rodc, METH_VARARGS,
|
||||||
NULL },
|
NULL },
|
||||||
{ "dsdb_set_schema_from_ldif", (PyCFunction)py_dsdb_set_schema_from_ldif, METH_VARARGS,
|
{ "_dsdb_set_schema_from_ldif", (PyCFunction)py_dsdb_set_schema_from_ldif, METH_VARARGS,
|
||||||
NULL },
|
NULL },
|
||||||
{ "dsdb_set_schema_from_ldb", (PyCFunction)py_dsdb_set_schema_from_ldb, METH_VARARGS,
|
{ "_dsdb_set_schema_from_ldb", (PyCFunction)py_dsdb_set_schema_from_ldb, METH_VARARGS,
|
||||||
NULL },
|
NULL },
|
||||||
{ "dsdb_write_prefixes_from_schema_to_ldb", (PyCFunction)py_dsdb_write_prefixes_from_schema_to_ldb, METH_VARARGS,
|
{ "_dsdb_write_prefixes_from_schema_to_ldb", (PyCFunction)py_dsdb_write_prefixes_from_schema_to_ldb, METH_VARARGS,
|
||||||
NULL },
|
NULL },
|
||||||
{ NULL }
|
{ NULL }
|
||||||
};
|
};
|
||||||
|
@ -42,7 +42,6 @@ else:
|
|||||||
|
|
||||||
|
|
||||||
import ldb
|
import ldb
|
||||||
import _glue
|
|
||||||
from samba._ldb import Ldb as _Ldb
|
from samba._ldb import Ldb as _Ldb
|
||||||
|
|
||||||
class Ldb(_Ldb):
|
class Ldb(_Ldb):
|
||||||
@ -264,7 +263,7 @@ class Ldb(_Ldb):
|
|||||||
|
|
||||||
def substitute_var(text, values):
|
def substitute_var(text, values):
|
||||||
"""Substitute strings of the form ${NAME} in str, replacing
|
"""Substitute strings of the form ${NAME} in str, replacing
|
||||||
with substitutions from subobj.
|
with substitutions from values.
|
||||||
|
|
||||||
:param text: Text in which to subsitute.
|
:param text: Text in which to subsitute.
|
||||||
:param values: Dictionary with keys and values.
|
:param values: Dictionary with keys and values.
|
||||||
@ -355,6 +354,7 @@ def ensure_external_module(modulename, location):
|
|||||||
sys.modules[modulename] = __import__(
|
sys.modules[modulename] = __import__(
|
||||||
"samba.external.%s" % modulename, fromlist=["samba.external"])
|
"samba.external.%s" % modulename, fromlist=["samba.external"])
|
||||||
|
|
||||||
|
import _glue
|
||||||
version = _glue.version
|
version = _glue.version
|
||||||
interface_ips = _glue.interface_ips
|
interface_ips = _glue.interface_ips
|
||||||
set_debug_level = _glue.set_debug_level
|
set_debug_level = _glue.set_debug_level
|
||||||
|
@ -48,9 +48,9 @@ class SamDB(samba.Ldb):
|
|||||||
options=options)
|
options=options)
|
||||||
|
|
||||||
if global_schema:
|
if global_schema:
|
||||||
dsdb.dsdb_set_global_schema(self)
|
dsdb._dsdb_set_global_schema(self)
|
||||||
|
|
||||||
dsdb.dsdb_set_am_rodc(self, am_rodc)
|
dsdb._dsdb_set_am_rodc(self, am_rodc)
|
||||||
|
|
||||||
def connect(self, url=None, flags=0, options=None):
|
def connect(self, url=None, flags=0, options=None):
|
||||||
if self.lp is not None:
|
if self.lp is not None:
|
||||||
@ -422,27 +422,27 @@ accountExpires: %u
|
|||||||
|
|
||||||
:param sid: The new domain sid to use.
|
:param sid: The new domain sid to use.
|
||||||
"""
|
"""
|
||||||
dsdb.samdb_set_domain_sid(self, sid)
|
dsdb._samdb_set_domain_sid(self, sid)
|
||||||
|
|
||||||
def get_domain_sid(self):
|
def get_domain_sid(self):
|
||||||
"""Read the domain SID used by this LDB.
|
"""Read the domain SID used by this LDB.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
dsdb.samdb_get_domain_sid(self)
|
dsdb._samdb_get_domain_sid(self)
|
||||||
|
|
||||||
def set_invocation_id(self, invocation_id):
|
def set_invocation_id(self, invocation_id):
|
||||||
"""Set the invocation id for this SamDB handle.
|
"""Set the invocation id for this SamDB handle.
|
||||||
|
|
||||||
:param invocation_id: GUID of the invocation id.
|
:param invocation_id: GUID of the invocation id.
|
||||||
"""
|
"""
|
||||||
dsdb.dsdb_set_ntds_invocation_id(self, invocation_id)
|
dsdb._dsdb_set_ntds_invocation_id(self, invocation_id)
|
||||||
|
|
||||||
def get_oid_from_attid(self, attid):
|
def get_oid_from_attid(self, attid):
|
||||||
return dsdb.dsdb_get_oid_from_attid(self, attid)
|
return dsdb._dsdb_get_oid_from_attid(self, attid)
|
||||||
|
|
||||||
def get_invocation_id(self):
|
def get_invocation_id(self):
|
||||||
"Get the invocation_id id"
|
"Get the invocation_id id"
|
||||||
return dsdb.samdb_ntds_invocation_id(self)
|
return dsdb._samdb_ntds_invocation_id(self)
|
||||||
|
|
||||||
def set_ntds_settings_dn(self, ntds_settings_dn):
|
def set_ntds_settings_dn(self, ntds_settings_dn):
|
||||||
"""Set the NTDS Settings DN, as would be returned on the dsServiceName rootDSE attribute
|
"""Set the NTDS Settings DN, as would be returned on the dsServiceName rootDSE attribute
|
||||||
@ -451,7 +451,7 @@ accountExpires: %u
|
|||||||
|
|
||||||
:param ntds_settings_dn: The new DN to use
|
:param ntds_settings_dn: The new DN to use
|
||||||
"""
|
"""
|
||||||
dsdb.samdb_set_ntds_settings_dn(self, ntds_settings_dn)
|
dsdb._samdb_set_ntds_settings_dn(self, ntds_settings_dn)
|
||||||
|
|
||||||
invocation_id = property(get_invocation_id, set_invocation_id)
|
invocation_id = property(get_invocation_id, set_invocation_id)
|
||||||
|
|
||||||
@ -459,20 +459,20 @@ accountExpires: %u
|
|||||||
|
|
||||||
def get_ntds_GUID(self):
|
def get_ntds_GUID(self):
|
||||||
"Get the NTDS objectGUID"
|
"Get the NTDS objectGUID"
|
||||||
return dsdb.samdb_ntds_objectGUID(self)
|
return dsdb._samdb_ntds_objectGUID(self)
|
||||||
|
|
||||||
def server_site_name(self):
|
def server_site_name(self):
|
||||||
"Get the server site name"
|
"Get the server site name"
|
||||||
return dsdb.samdb_server_site_name(self)
|
return dsdb._samdb_server_site_name(self)
|
||||||
|
|
||||||
def load_partition_usn(self, base_dn):
|
def load_partition_usn(self, base_dn):
|
||||||
return dsdb.dsdb_load_partition_usn(self, base_dn)
|
return dsdb._dsdb_load_partition_usn(self, base_dn)
|
||||||
|
|
||||||
def set_schema(self, schema):
|
def set_schema(self, schema):
|
||||||
self.set_schema_from_ldb(schema.ldb)
|
self.set_schema_from_ldb(schema.ldb)
|
||||||
|
|
||||||
def set_schema_from_ldb(self, ldb):
|
def set_schema_from_ldb(self, ldb):
|
||||||
dsdb.dsdb_set_schema_from_ldb(self, ldb)
|
dsdb._dsdb_set_schema_from_ldb(self, ldb)
|
||||||
|
|
||||||
def write_prefixes_from_schema(self):
|
def write_prefixes_from_schema(self):
|
||||||
dsdb.dsdb_write_prefixes_from_schema_to_ldb(self)
|
dsdb._dsdb_write_prefixes_from_schema_to_ldb(self)
|
||||||
|
@ -109,7 +109,7 @@ class Schema(object):
|
|||||||
self.set_from_ldif(prefixmap_ldif, self.schema_data)
|
self.set_from_ldif(prefixmap_ldif, self.schema_data)
|
||||||
|
|
||||||
def set_from_ldif(self, pf, df):
|
def set_from_ldif(self, pf, df):
|
||||||
dsdb.dsdb_set_schema_from_ldif(self.ldb, pf, df)
|
dsdb._dsdb_set_schema_from_ldif(self.ldb, pf, df)
|
||||||
|
|
||||||
def write_to_tmp_ldb(self, schemadb_path):
|
def write_to_tmp_ldb(self, schemadb_path):
|
||||||
self.ldb.connect(url=schemadb_path)
|
self.ldb.connect(url=schemadb_path)
|
||||||
@ -140,7 +140,7 @@ dn: @INDEXLIST
|
|||||||
return get_dnsyntax_attributes(self.schemadn, self.ldb)
|
return get_dnsyntax_attributes(self.schemadn, self.ldb)
|
||||||
|
|
||||||
def convert_to_openldap(self, target, mapping):
|
def convert_to_openldap(self, target, mapping):
|
||||||
return dsdb.dsdb_convert_schema_to_openldap(self.ldb, target, mapping)
|
return dsdb._dsdb_convert_schema_to_openldap(self.ldb, target, mapping)
|
||||||
|
|
||||||
|
|
||||||
# Return a hash with the forward attribute as a key and the back as the value
|
# Return a hash with the forward attribute as a key and the back as the value
|
||||||
|
Reference in New Issue
Block a user