s3-smb Use FILE_ATTRIBUTE_ARCHIVE intead of aARCH
authorAndrew Bartlett <abartlet@samba.org>
Fri, 29 Apr 2011 02:00:57 +0000 (12:00 +1000)
committerAndrew Bartlett <abartlet@samba.org>
Fri, 29 Apr 2011 06:38:13 +0000 (16:38 +1000)
This means we use just one constant for this file attribute.

Andrew Bartlett

14 files changed:
source3/client/client.c
source3/client/clitar.c
source3/include/smb.h
source3/include/smb_macros.h
source3/lib/util.c
source3/libsmb/libsmb_dir.c
source3/modules/onefs_open.c
source3/smbd/dir.c
source3/smbd/dosmode.c
source3/smbd/fileio.c
source3/smbd/nttrans.c
source3/smbd/open.c
source3/smbd/reply.c
source3/torture/torture.c

index dadaf443943836be2bac707226c8d0da5b0ec062..4c90716c48b8ebfb7ca72f94dac7fc2f61e14e1e 100644 (file)
@@ -520,7 +520,7 @@ static bool do_this_one(struct file_info *finfo)
                return false;
        }
 
-       if ((archive_level==1 || archive_level==2) && !(finfo->mode & aARCH)) {
+       if ((archive_level==1 || archive_level==2) && !(finfo->mode & FILE_ATTRIBUTE_ARCHIVE)) {
                DEBUG(3,("archive %s failed\n", finfo->name));
                return false;
        }
@@ -1147,8 +1147,8 @@ static int do_get(const char *rname, const char *lname_in, bool reget)
                close(handle);
        }
 
-       if (archive_level >= 2 && (attr & aARCH)) {
-               cli_setatr(cli, rname, attr & ~(uint16)aARCH, 0);
+       if (archive_level >= 2 && (attr & FILE_ATTRIBUTE_ARCHIVE)) {
+               cli_setatr(cli, rname, attr & ~(uint16)FILE_ATTRIBUTE_ARCHIVE, 0);
        }
 
        {
index ebda5af5e3490c06ab527251eace84c91a2a7b8b..289e57801b2cdd93f4e46fb8b360ee7d6bd8afeb 100644 (file)
@@ -686,7 +686,7 @@ static NTSTATUS do_atar(const char *rname_in, char *lname,
 
        DEBUG(3,("file %s attrib 0x%X\n",finfo.name,finfo.mode));
 
-       if (tar_inc && !(finfo.mode & aARCH)) {
+       if (tar_inc && !(finfo.mode & FILE_ATTRIBUTE_ARCHIVE)) {
                DEBUG(4, ("skipping %s - archive bit not set\n", finfo.name));
                shallitime=0;
        } else if (!tar_system && (finfo.mode & FILE_ATTRIBUTE_SYSTEM)) {
@@ -784,7 +784,7 @@ static NTSTATUS do_atar(const char *rname_in, char *lname,
 
                /* if shallitime is true then we didn't skip */
                if (tar_reset && !dry_run)
-                       (void) do_setrattr(finfo.name, aARCH, ATTRRESET);
+                       (void) do_setrattr(finfo.name, FILE_ATTRIBUTE_ARCHIVE, ATTRRESET);
 
                clock_gettime_mono(&tp_end);
                this_time = (tp_end.tv_sec - tp_start.tv_sec)*1000 + (tp_end.tv_nsec - tp_start.tv_nsec)/1000000;
@@ -1414,7 +1414,7 @@ int cmd_setmode(void)
                                        attra[direct]|=FILE_ATTRIBUTE_SYSTEM;
                                        break;
                                case 'a':
-                                       attra[direct]|=aARCH;
+                                       attra[direct]|=FILE_ATTRIBUTE_ARCHIVE;
                                        break;
                                default:
                                        DEBUG(0, ("setmode <filename> <perm=[+|-]rsha>\n"));
index 12b089442baae11ddc8cad253743d057b0209b4f..8885ef2d14a095b5222df9b28dc4bb5173bfb322 100644 (file)
@@ -85,9 +85,6 @@ enum smb_read_errors {
 
 #define DIR_STRUCT_SIZE 43
 
-/* these define the attribute byte as seen by DOS */
-#define aARCH (1L<<5)          /* 0x20 */
-
 /* deny modes */
 #define DENY_DOS 0
 #define DENY_ALL 1
index 1a6ef3b318ef109454a12a70239db0c0fde6df08..79aa4c54068100f48c000a327ec793ed47d4f19e 100644 (file)
@@ -30,7 +30,7 @@
 /* for readability... */
 #define IS_DOS_READONLY(test_mode) (((test_mode) & FILE_ATTRIBUTE_READONLY) != 0)
 #define IS_DOS_DIR(test_mode)      (((test_mode) & FILE_ATTRIBUTE_DIRECTORY) != 0)
-#define IS_DOS_ARCHIVE(test_mode)  (((test_mode) & aARCH) != 0)
+#define IS_DOS_ARCHIVE(test_mode)  (((test_mode) & FILE_ATTRIBUTE_ARCHIVE) != 0)
 #define IS_DOS_SYSTEM(test_mode)   (((test_mode) & FILE_ATTRIBUTE_SYSTEM) != 0)
 #define IS_DOS_HIDDEN(test_mode)   (((test_mode) & FILE_ATTRIBUTE_HIDDEN) != 0)
 
index bec279e3bd7ac9eeecaa8d8c763bce0844490b6f..f592a0f778e40b8348c9286ff486ca43fe8cc552 100644 (file)
@@ -306,7 +306,7 @@ char *attrib_string(uint16 mode)
 
        if (mode & FILE_ATTRIBUTE_VOLUME) fstrcat(attrstr,"V");
        if (mode & FILE_ATTRIBUTE_DIRECTORY) fstrcat(attrstr,"D");
-       if (mode & aARCH) fstrcat(attrstr,"A");
+       if (mode & FILE_ATTRIBUTE_ARCHIVE) fstrcat(attrstr,"A");
        if (mode & FILE_ATTRIBUTE_HIDDEN) fstrcat(attrstr,"H");
        if (mode & FILE_ATTRIBUTE_SYSTEM) fstrcat(attrstr,"S");
        if (mode & FILE_ATTRIBUTE_READONLY) fstrcat(attrstr,"R");
index f07ddf199aeafdd4dbb1109badf911db7645201b..3d50107f60ec1c85d5ed9f4ea39d3fc9f735d911 100644 (file)
@@ -1612,7 +1612,7 @@ SMBC_chmod_ctx(SMBCCTX *context,
        mode = 0;
 
        if (!(newmode & (S_IWUSR | S_IWGRP | S_IWOTH))) mode |= FILE_ATTRIBUTE_READONLY;
-       if ((newmode & S_IXUSR) && lp_map_archive(-1)) mode |= aARCH;
+       if ((newmode & S_IXUSR) && lp_map_archive(-1)) mode |= FILE_ATTRIBUTE_ARCHIVE;
        if ((newmode & S_IXGRP) && lp_map_system(-1)) mode |= FILE_ATTRIBUTE_SYSTEM;
        if ((newmode & S_IXOTH) && lp_map_hidden(-1)) mode |= FILE_ATTRIBUTE_HIDDEN;
 
index 9cd831ce2ddd40eb58bf881ca8e3740b8909a7c9..6ab47d739bacd5e72f632931428b07b2e4509000 100644 (file)
@@ -498,9 +498,9 @@ NTSTATUS onefs_open_file_ntcreate(connection_struct *conn,
                unx_mode = (mode_t)(new_dos_attributes & ~FILE_FLAG_POSIX_SEMANTICS);
                new_dos_attributes = 0;
        } else {
-               /* We add aARCH to this as this mode is only used if the file is
+               /* We add FILE_ATTRIBUTE_ARCHIVE to this as this mode is only used if the file is
                 * created new. */
-               unx_mode = unix_mode(conn, new_dos_attributes | aARCH,
+               unx_mode = unix_mode(conn, new_dos_attributes | FILE_ATTRIBUTE_ARCHIVE,
                                     smb_fname, parent_dir);
        }
 
@@ -587,7 +587,7 @@ NTSTATUS onefs_open_file_ntcreate(connection_struct *conn,
 
        /* Setup dos_attributes to be set by ifs_createfile */
        if (lp_store_dos_attributes(SNUM(conn))) {
-               createfile_attributes = (new_dos_attributes | aARCH) &
+               createfile_attributes = (new_dos_attributes | FILE_ATTRIBUTE_ARCHIVE) &
                    ~(FILE_ATTRIBUTE_NONINDEXED | FILE_ATTRIBUTE_COMPRESSED);
        }
 
index 83b6225aad5dcc4fab006e1fd523c643ed695f6a..9969693e7b861e063c2e5c160d797d1bdb141d50 100644 (file)
@@ -878,9 +878,9 @@ bool dir_check_ftype(connection_struct *conn, uint32 mode, uint32 dirtype)
        /* Check the "must have" bits, which are the may have bits shifted eight */
        /* If must have bit is set, the file/dir can not be returned in search unless the matching
                file attribute is set */
-       mask = ((dirtype >> 8) & (FILE_ATTRIBUTE_DIRECTORY|aARCH|FILE_ATTRIBUTE_READONLY|FILE_ATTRIBUTE_HIDDEN|FILE_ATTRIBUTE_SYSTEM)); /* & 0x37 */
+       mask = ((dirtype >> 8) & (FILE_ATTRIBUTE_DIRECTORY|FILE_ATTRIBUTE_ARCHIVE|FILE_ATTRIBUTE_READONLY|FILE_ATTRIBUTE_HIDDEN|FILE_ATTRIBUTE_SYSTEM)); /* & 0x37 */
        if(mask) {
-               if((mask & (mode & (FILE_ATTRIBUTE_DIRECTORY|aARCH|FILE_ATTRIBUTE_READONLY|FILE_ATTRIBUTE_HIDDEN|FILE_ATTRIBUTE_SYSTEM))) == mask)   /* check if matching attribute present */
+               if((mask & (mode & (FILE_ATTRIBUTE_DIRECTORY|FILE_ATTRIBUTE_ARCHIVE|FILE_ATTRIBUTE_READONLY|FILE_ATTRIBUTE_HIDDEN|FILE_ATTRIBUTE_SYSTEM))) == mask)   /* check if matching attribute present */
                        return True;
                else
                        return False;
index 260909ec190f13677768bb7f1912e153c20568e9..823d44d0aaf08f64190fcf5f178e29be584d74c5 100644 (file)
@@ -183,7 +183,7 @@ static uint32 dos_mode_from_sbuf(connection_struct *conn,
        } /* Else never set the readonly bit. */
 
        if (MAP_ARCHIVE(conn) && ((smb_fname->st.st_ex_mode & S_IXUSR) != 0))
-               result |= aARCH;
+               result |= FILE_ATTRIBUTE_ARCHIVE;
 
        if (MAP_SYSTEM(conn) && ((smb_fname->st.st_ex_mode & S_IXGRP) != 0))
                result |= FILE_ATTRIBUTE_SYSTEM;
@@ -202,7 +202,7 @@ static uint32 dos_mode_from_sbuf(connection_struct *conn,
        if (result & FILE_ATTRIBUTE_READONLY ) DEBUG(8, ("r"));
        if (result & FILE_ATTRIBUTE_SYSTEM) DEBUG(8, ("s"));
        if (result & FILE_ATTRIBUTE_DIRECTORY   ) DEBUG(8, ("d"));
-       if (result & aARCH  ) DEBUG(8, ("a"));
+       if (result & FILE_ATTRIBUTE_ARCHIVE  ) DEBUG(8, ("a"));
 
        DEBUG(8,("\n"));
        return result;
@@ -329,7 +329,7 @@ static bool get_ea_dos_attribute(connection_struct *conn,
        if (dosattr & FILE_ATTRIBUTE_READONLY ) DEBUG(8, ("r"));
        if (dosattr & FILE_ATTRIBUTE_SYSTEM) DEBUG(8, ("s"));
        if (dosattr & FILE_ATTRIBUTE_DIRECTORY   ) DEBUG(8, ("d"));
-       if (dosattr & aARCH  ) DEBUG(8, ("a"));
+       if (dosattr & FILE_ATTRIBUTE_ARCHIVE  ) DEBUG(8, ("a"));
 
        DEBUG(8,("\n"));
 
@@ -490,7 +490,7 @@ uint32 dos_mode_msdfs(connection_struct *conn,
        if (result & FILE_ATTRIBUTE_READONLY ) DEBUG(8, ("r"));
        if (result & FILE_ATTRIBUTE_SYSTEM) DEBUG(8, ("s"));
        if (result & FILE_ATTRIBUTE_DIRECTORY   ) DEBUG(8, ("d"));
-       if (result & aARCH  ) DEBUG(8, ("a"));
+       if (result & FILE_ATTRIBUTE_ARCHIVE  ) DEBUG(8, ("a"));
        if (result & FILE_ATTRIBUTE_SPARSE ) DEBUG(8, ("[sparse]"));
 
        DEBUG(8,("\n"));
@@ -507,7 +507,7 @@ int dos_attributes_to_stat_dos_flags(uint32_t dosmode)
 {
        uint32_t dos_stat_flags = 0;
 
-       if (dosmode & aARCH)
+       if (dosmode & FILE_ATTRIBUTE_ARCHIVE)
                dos_stat_flags |= UF_DOS_ARCHIVE;
        if (dosmode & FILE_ATTRIBUTE_HIDDEN)
                dos_stat_flags |= UF_DOS_HIDDEN;
@@ -540,7 +540,7 @@ static bool get_stat_dos_flags(connection_struct *conn,
                  smb_fname_str_dbg(smb_fname)));
 
        if (smb_fname->st.st_ex_flags & UF_DOS_ARCHIVE)
-               *dosmode |= aARCH;
+               *dosmode |= FILE_ATTRIBUTE_ARCHIVE;
        if (smb_fname->st.st_ex_flags & UF_DOS_HIDDEN)
                *dosmode |= FILE_ATTRIBUTE_HIDDEN;
        if (smb_fname->st.st_ex_flags & UF_DOS_RO)
@@ -675,7 +675,7 @@ uint32 dos_mode(connection_struct *conn, struct smb_filename *smb_fname)
        if (result & FILE_ATTRIBUTE_READONLY ) DEBUG(8, ("r"));
        if (result & FILE_ATTRIBUTE_SYSTEM) DEBUG(8, ("s"));
        if (result & FILE_ATTRIBUTE_DIRECTORY   ) DEBUG(8, ("d"));
-       if (result & aARCH  ) DEBUG(8, ("a"));
+       if (result & FILE_ATTRIBUTE_ARCHIVE  ) DEBUG(8, ("a"));
        if (result & FILE_ATTRIBUTE_SPARSE ) DEBUG(8, ("[sparse]"));
 
        DEBUG(8,("\n"));
index 16d8853b54cefb705fce09b826e94599c49564f7..ea607d3d5d3c8f3e14fda674ea0ecb13a0501b79 100644 (file)
@@ -322,7 +322,7 @@ ssize_t write_file(struct smb_request *req,
                                int dosmode = dos_mode(fsp->conn, fsp->fsp_name);
                                if (!IS_DOS_ARCHIVE(dosmode)) {
                                        file_set_dosmode(fsp->conn, fsp->fsp_name,
-                                                dosmode | aARCH, NULL, false);
+                                                dosmode | FILE_ATTRIBUTE_ARCHIVE, NULL, false);
                                }
                        }
 
index 858e19aeb323a2846efb3468354e02ba13474c0d..f4bd969300e1980d7abd5f833dd37df7fb667357 100644 (file)
@@ -1450,7 +1450,7 @@ static NTSTATUS copy_internals(TALLOC_CTX *ctx,
 
        status = close_file(NULL, fsp2, NORMAL_CLOSE);
 
-       /* Grrr. We have to do this as open_file_ntcreate adds aARCH when it
+       /* Grrr. We have to do this as open_file_ntcreate adds FILE_ATTRIBUTE_ARCHIVE when it
           creates the file. This isn't the correct thing to do in the copy
           case. JRA */
        if (!parent_dirname(talloc_tos(), smb_fname_dst->base_name, &parent,
index d1ac91c9c58a77e0262a8e1c6adfc23cf705366b..076ae1ff694874b0314743f4fa4e9f83e8cac139 100644 (file)
@@ -1622,9 +1622,9 @@ static NTSTATUS open_file_ntcreate(connection_struct *conn,
                unx_mode = (mode_t)(new_dos_attributes & ~FILE_FLAG_POSIX_SEMANTICS);
                new_dos_attributes = 0;
        } else {
-               /* We add aARCH to this as this mode is only used if the file is
+               /* We add FILE_ATTRIBUTE_ARCHIVE to this as this mode is only used if the file is
                 * created new. */
-               unx_mode = unix_mode(conn, new_dos_attributes | aARCH,
+               unx_mode = unix_mode(conn, new_dos_attributes | FILE_ATTRIBUTE_ARCHIVE,
                                     smb_fname, parent_dir);
        }
 
@@ -2361,7 +2361,7 @@ static NTSTATUS open_file_ntcreate(connection_struct *conn,
                    lp_store_dos_attributes(SNUM(conn))) {
                        if (!posix_open) {
                                if (file_set_dosmode(conn, smb_fname,
-                                           new_dos_attributes | aARCH,
+                                           new_dos_attributes | FILE_ATTRIBUTE_ARCHIVE,
                                            parent_dir, true) == 0) {
                                        unx_mode = smb_fname->st.st_ex_mode;
                                }
index cabf92d7afbd700006bb146fda9e9ccecfb3a426..db40539620b43f4534607f9524443668f1597114 100644 (file)
@@ -2449,10 +2449,10 @@ static NTSTATUS do_unlink(connection_struct *conn,
        fattr = dos_mode(conn, smb_fname);
 
        if (dirtype & FILE_ATTRIBUTE_NORMAL) {
-               dirtype = FILE_ATTRIBUTE_DIRECTORY|aARCH|FILE_ATTRIBUTE_READONLY;
+               dirtype = FILE_ATTRIBUTE_DIRECTORY|FILE_ATTRIBUTE_ARCHIVE|FILE_ATTRIBUTE_READONLY;
        }
 
-       dirtype &= (FILE_ATTRIBUTE_DIRECTORY|aARCH|FILE_ATTRIBUTE_READONLY|FILE_ATTRIBUTE_HIDDEN|FILE_ATTRIBUTE_SYSTEM);
+       dirtype &= (FILE_ATTRIBUTE_DIRECTORY|FILE_ATTRIBUTE_ARCHIVE|FILE_ATTRIBUTE_READONLY|FILE_ATTRIBUTE_HIDDEN|FILE_ATTRIBUTE_SYSTEM);
        if (!dirtype) {
                return NT_STATUS_NO_SUCH_FILE;
        }
index 090f838105180dbad1d2366a07c34be3ca4fd323..b887e2965beba6050b3997db5392a83fa4df2575 100644 (file)
@@ -5720,7 +5720,7 @@ static bool run_dirtest1(int dummy)
                correct = False;
 
        num_seen = 0;
-       cli_list_old(cli, "\\LISTDIR\\*", (aARCH<<8)|FILE_ATTRIBUTE_DIRECTORY, list_fn, &num_seen);
+       cli_list_old(cli, "\\LISTDIR\\*", (FILE_ATTRIBUTE_ARCHIVE<<8)|FILE_ATTRIBUTE_DIRECTORY, list_fn, &num_seen);
        printf("num_seen = %d\n", num_seen );
        if (num_seen != 1000)
                correct = False;