diff options
author | Andrew Tridgell <tridge@samba.org> | 2010-02-25 18:35:01 +1100 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2010-02-26 13:59:17 +1100 |
commit | 1e66ec832e1e4b1c6c71c96259328a64552de57c (patch) | |
tree | ca59e58bb0b1d70c6a5ccd33de2afb2053b71f94 /source4/scripting | |
parent | 8f763e046cf80863fa089724118a4efb4c7e450e (diff) | |
download | samba-1e66ec832e1e4b1c6c71c96259328a64552de57c.tar.gz samba-1e66ec832e1e4b1c6c71c96259328a64552de57c.tar.bz2 samba-1e66ec832e1e4b1c6c71c96259328a64552de57c.zip |
pyglue: added py_samdb_server_site_name()
Diffstat (limited to 'source4/scripting')
-rw-r--r-- | source4/scripting/python/pyglue.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/source4/scripting/python/pyglue.c b/source4/scripting/python/pyglue.c index 03a39d498e..c9e8f1414e 100644 --- a/source4/scripting/python/pyglue.c +++ b/source4/scripting/python/pyglue.c @@ -522,6 +522,33 @@ static PyObject *py_samdb_ntds_invocation_id(PyObject *self, PyObject *args) } +static PyObject *py_samdb_server_site_name(PyObject *self, PyObject *args) +{ + PyObject *py_ldb, *result; + struct ldb_context *ldb; + const char *site; + TALLOC_CTX *mem_ctx = talloc_new(NULL); + + if (!PyArg_ParseTuple(args, "O", &py_ldb)) { + talloc_free(mem_ctx); + return NULL; + } + + PyErr_LDB_OR_RAISE(py_ldb, ldb); + + site = samdb_server_site_name(ldb, mem_ctx); + if (site == NULL) { + PyErr_SetStringError("Failed to find server site"); + talloc_free(mem_ctx); + return NULL; + } + + result = PyString_FromString(site); + talloc_free(mem_ctx); + return result; +} + + /* return the list of interface IPs we have configured takes an loadparm context, returns a list of IPs in string form @@ -623,6 +650,8 @@ static PyMethodDef py_misc_methods[] = { "get uSNHighest and uSNUrgent from the partition @REPLCHANGED"}, { "samdb_ntds_invocation_id", (PyCFunction)py_samdb_ntds_invocation_id, METH_VARARGS, "get the NTDS invocation ID GUID as a string"}, + { "samdb_server_site_name", (PyCFunction)py_samdb_server_site_name, METH_VARARGS, + "get the server site name as a string"}, { "interface_ips", (PyCFunction)py_interface_ips, METH_VARARGS, "get interface IP address list"}, { NULL } |