Running into a problem with PyArg_ParseTuple ...

Richard Sharpe realrichardsharpe at gmail.com
Sun Mar 25 11:31:42 MDT 2012


Hi folks,

I have tried to modify py_smb_getacl thusly:

-static PyObject *py_smb_getacl(pytalloc_Object *self, PyObject *args, PyObject
+static PyObject *py_smb_getacl(pytalloc_Object *self, PyObject *args)
 {
        NTSTATUS status;
        union smb_open io;
        union smb_fileinfo fio;
        struct smb_private_data *spdata;
        const char *filename;
+       int sinfo = 0;
        int fnum;

-       if (!PyArg_ParseTuple(args, "s:get_acl", &filename)) {
+       if (!PyArg_ParseTuple(args, "sl:get_acl", &filename, &sinfo)) {
                return NULL;
        }

+       printf("filename = \"%s\", sinfo = 0x%X\n", filename, sinfo);
+
        ZERO_STRUCT(io);

        spdata = self->ptr;

However, it always crashes on the printf and filename is out of
bounds. finfo has the correct value, though (7, which is the sum of
SECINFO_OWNER, SECINFO_GROUP and SECINFO_DACL).

Can anyone suggest what I have done wrong? All the examples on
extending Python suggest that what I have done should be OK.
-- 
Regards,
Richard Sharpe
(何以解憂?唯有杜康。--曹操)


More information about the samba-technical mailing list