[PATCH] s4:libcli/raw: Add option to set per packet case sensitive flag
Jelmer Vernooij
jelmer at samba.org
Wed Nov 20 04:30:18 MST 2013
Quick note on the python bindings here:
On Wed, Nov 20, 2013 at 12:09:33PM +0100, Samuel Cabrero wrote:
> index fb981c7..a24dbd8 100644
> --- a/source4/libcli/pysmb.c
> +++ b/source4/libcli/pysmb.c
> @@ -528,6 +528,31 @@ static PyObject *py_close_file(pytalloc_Object *self, PyObject *args, PyObject *
> Py_RETURN_NONE;
> }
>
> +/*
> + * Set the case sensitive flag on the packets
> + */
> +static PyObject *py_smb_case_sensitive(pytalloc_Object *self, PyObject *args)
> +{
> + NTSTATUS status;
> + char s;
> + bool sensitive;
> + struct smb_private_data *spdata;
> +
> + if (!PyArg_ParseTuple(args, "b:case_sensitive", &s)) {
> + return NULL;
> + }
> + sensitive = s ? true : false;
> +
> + spdata = self->ptr;
> + status = smbcli_set_case_sensitive(spdata->tree, sensitive);
> +
> + if (NT_STATUS_IS_OK(status)) {
> + Py_RETURN_TRUE;
> + }
> +
> + Py_RETURN_FALSE;
> +}
Please raise exceptions for NTSTATUS and return None. Returning true/false loses information
(i.e. what kind of error occurred) and makes it easy to ignore errors.
Jelmer
More information about the samba-technical
mailing list