r23784: use the GPLv3 boilerplate as recommended by the FSF and the license text
[tprouty/samba.git] / source3 / python / py_smb.c
index c3d59d4fb8c064c662e95797559685ba08048007..5f913682d119bfb700eb176d0a41ebd5f1e86b17 100644 (file)
@@ -5,7 +5,7 @@
    
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
+   the Free Software Foundation; either version 3 of the License, or
    (at your option) any later version.
    
    This program is distributed in the hope that it will be useful,
@@ -14,8 +14,7 @@
    GNU General Public License for more details.
    
    You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
 #include "python/py_smb.h"
@@ -43,7 +42,7 @@ static PyObject *py_smb_connect(PyObject *self, PyObject *args, PyObject *kw)
        if (!PyArg_ParseTupleAndKeywords(args, kw, "s", kwlist, &server))
                return NULL;
 
-       if (!(cli = cli_initialise(NULL)))
+       if (!(cli = cli_initialise()))
                return NULL;
 
        ZERO_STRUCT(ip);
@@ -99,7 +98,7 @@ static PyObject *py_smb_session_setup(PyObject *self, PyObject *args,
        static char *kwlist[] = { "creds", NULL };
        PyObject *creds;
        char *username, *domain, *password, *errstr;
-       BOOL result;
+       NTSTATUS result;
 
        if (!PyArg_ParseTupleAndKeywords(args, kw, "|O", kwlist, &creds))
                return NULL;
@@ -118,7 +117,7 @@ static PyObject *py_smb_session_setup(PyObject *self, PyObject *args,
                return NULL;
        }
 
-       return Py_BuildValue("i", result);
+       return Py_BuildValue("i", NT_STATUS_IS_OK(result));
 }
 
 static PyObject *py_smb_tconx(PyObject *self, PyObject *args, PyObject *kw)
@@ -154,7 +153,7 @@ static PyObject *py_smb_nt_create_andx(PyObject *self, PyObject *args,
        char *filename;
        uint32 desired_access, file_attributes = 0, 
                share_access = FILE_SHARE_READ | FILE_SHARE_WRITE,
-               create_disposition = FILE_EXISTS_OPEN, create_options = 0;
+               create_disposition = OPENX_FILE_EXISTS_OPEN, create_options = 0;
        int result;
 
        /* Parse parameters */
@@ -212,7 +211,7 @@ static PyObject *py_smb_read(PyObject *self, PyObject *args, PyObject *kw)
        static char *kwlist[] = { "fnum", "offset", "size", NULL };
        int fnum, offset=0, size=0;
        ssize_t result;
-       size_t fsize;
+       SMB_OFF_T fsize;
        char *data;
        PyObject *ret;
 
@@ -235,7 +234,7 @@ static PyObject *py_smb_read(PyObject *self, PyObject *args, PyObject *kw)
        if (size < 1 || size > fsize - offset)
                size = fsize - offset;
 
-       if (!(data = (char *) malloc((size_t) size))) {
+       if (!(data = SMB_XMALLOC_ARRAY(char, size))) {
                PyErr_SetString(PyExc_RuntimeError, "malloc failed");
                return NULL;
        }