s3-pysmbd: Add hook for get_nt_acl()
authorAndrew Bartlett <abartlet@samba.org>
Thu, 2 Aug 2012 05:16:13 +0000 (15:16 +1000)
committerAndrew Bartlett <abartlet@samba.org>
Thu, 2 Aug 2012 11:27:54 +0000 (13:27 +0200)
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Thu Aug  2 13:27:55 CEST 2012 on sn-devel-104

source3/smbd/pysmbd.c

index 1dd3d62e194cf978cb438808172e1b186fd94e4c..9a44d259ab02cb3141363c46cf4ea8c81656fbfc 100644 (file)
@@ -305,6 +305,29 @@ static PyObject *py_smbd_set_nt_acl(PyObject *self, PyObject *args)
        Py_RETURN_NONE;
 }
 
+/*
+  set a simple ACL on a file, as a test
+ */
+static PyObject *py_smbd_get_nt_acl(PyObject *self, PyObject *args)
+{
+       char *fname;
+       int security_info_sent;
+       PyObject *py_sd;
+       struct security_descriptor *sd;
+       TALLOC_CTX *tmp_ctx = talloc_new(NULL);
+
+       if (!PyArg_ParseTuple(args, "si", &fname, &security_info_sent))
+               return NULL;
+       
+       sd = get_nt_acl_no_snum(tmp_ctx, fname);
+
+       py_sd = py_return_ndr_struct("samba.dcerpc.security", "security_descriptor", sd, sd);
+
+       talloc_free(tmp_ctx);
+
+       return py_sd;
+}
+
 static PyMethodDef py_smbd_methods[] = {
        { "have_posix_acls",
                (PyCFunction)py_smbd_have_posix_acls, METH_VARARGS,
@@ -315,6 +338,9 @@ static PyMethodDef py_smbd_methods[] = {
        { "set_nt_acl",
                (PyCFunction)py_smbd_set_nt_acl, METH_VARARGS,
                NULL },
+       { "get_nt_acl",
+               (PyCFunction)py_smbd_get_nt_acl, METH_VARARGS,
+               NULL },
        { NULL }
 };