1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-22 22:04:08 +03:00

s3-smb Use FILE_ATTRIBUTE_ARCHIVE intead of aARCH

This means we use just one constant for this file attribute.

Andrew Bartlett
This commit is contained in:
Andrew Bartlett 2011-04-29 12:00:57 +10:00
parent 0eca33bbf6
commit 0520da2bbe
14 changed files with 29 additions and 32 deletions

View 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);
}
{

View 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"));

View 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

View 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)

View 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");

View 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;

View 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);
}

View 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;

View 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"));

View 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);
}
}

View 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,

View 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;
}

View 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;
}

View 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;