libsmb: use K format for parsing unsigned long long
authorRalph Boehme <slow@samba.org>
Sun, 29 Oct 2023 13:59:22 +0000 (14:59 +0100)
committerRalph Boehme <slow@samba.org>
Tue, 31 Oct 2023 04:38:42 +0000 (04:38 +0000)
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: David Mulder <dmulder@samba.org>
source3/libsmb/pylibsmb.c

index 00f7e010cf76a0170bd101d079cf72419ea6f993..5330cffbf50569b7d2643495408274f2ad81f8bb 100644 (file)
@@ -1886,17 +1886,15 @@ static NTSTATUS list_posix_helper(struct file_info *finfo,
 {
        PyObject *result = (PyObject *)state;
        PyObject *file = NULL;
-       PyObject *size = NULL;
        int ret;
 
-       size = PyLong_FromUnsignedLongLong(finfo->size);
        /*
         * Build a dictionary representing the file info.
         */
-       file = Py_BuildValue("{s:s,s:i,s:O,s:l,s:i,s:i,s:i,s:s,s:s}",
+       file = Py_BuildValue("{s:s,s:i,s:K,s:l,s:i,s:i,s:i,s:s,s:s}",
                             "name", finfo->name,
                             "attrib", (int)finfo->attr,
-                            "size", size,
+                            "size", finfo->size,
                             "mtime",
                             convert_timespec_to_time_t(finfo->mtime_ts),
                             "perms", finfo->st_ex_mode,
@@ -1906,9 +1904,6 @@ static NTSTATUS list_posix_helper(struct file_info *finfo,
                             dom_sid_string(finfo, &finfo->owner_sid),
                             "group_sid",
                             dom_sid_string(finfo, &finfo->group_sid));
-
-       Py_CLEAR(size);
-
        if (file == NULL) {
                return NT_STATUS_NO_MEMORY;
        }