s3:pylibsmb: Minor refactor to py_cli_list() variables
authorTim Beale <timbeale@catalyst.net.nz>
Wed, 12 Dec 2018 00:47:46 +0000 (13:47 +1300)
committerTim Beale <timbeale@samba.org>
Mon, 7 Jan 2019 00:23:08 +0000 (01:23 +0100)
Add a define for the file attribute mask (we'll reuse it in a subsequent
patch), and make the variable type explicit.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13676

Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
source3/libsmb/pylibsmb.c

index 08de5d0f531e9e52527410bced23943d8496f591..44389454d6f2200fa2cc3d75d0a3362c0af27d1d 100644 (file)
@@ -30,6 +30,9 @@
 #include "trans2.h"
 #include "libsmb/clirap.h"
 
+#define LIST_ATTRIBUTE_MASK \
+       (FILE_ATTRIBUTE_DIRECTORY|FILE_ATTRIBUTE_SYSTEM|FILE_ATTRIBUTE_HIDDEN)
+
 static PyTypeObject *get_pytype(const char *module, const char *type)
 {
        PyObject *mod;
@@ -1151,7 +1154,7 @@ static NTSTATUS do_listing(struct py_cli_state *self,
                           void *priv)
 {
        char *mask = NULL;
-       unsigned info_level = SMB_FIND_FILE_BOTH_DIRECTORY_INFO;
+       unsigned int info_level = SMB_FIND_FILE_BOTH_DIRECTORY_INFO;
        struct file_info *finfos = NULL;
        size_t i;
        size_t num_finfos = 0;
@@ -1208,10 +1211,7 @@ static PyObject *py_cli_list(struct py_cli_state *self,
 {
        char *base_dir;
        char *user_mask = NULL;
-       unsigned attribute =
-               FILE_ATTRIBUTE_DIRECTORY |
-               FILE_ATTRIBUTE_SYSTEM |
-               FILE_ATTRIBUTE_HIDDEN;
+       unsigned int attribute = LIST_ATTRIBUTE_MASK;
        NTSTATUS status;
        PyObject *result;
        const char *kwlist[] = { "directory", "mask", "attribs", NULL };