[Pkg-samba-maint] [samba] 04/135: s3-lib: smbclient shows no error if deleting a directory with del failed
Ivo De Decker
ivodd at moszumanska.debian.org
Sat Jan 11 21:30:22 UTC 2014
This is an automated email from the git hooks/post-receive script.
ivodd pushed a commit to branch master
in repository samba.
commit b0ce9bc6899220d921a7f520e4f92e99a7945fa8
Author: Jeremy Allison <jra at samba.org>
Date: Tue Nov 12 15:32:42 2013 -0800
s3-lib: smbclient shows no error if deleting a directory with del failed
BUG: https://bugzilla.samba.org/show_bug.cgi?id=10260
Move dir_check_ftype() to util.c
Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>
(cherry picked from commit fc611dd6e849537aa4817504275cdbf48f6f1e79)
---
source3/include/proto.h | 1 +
source3/lib/util.c | 42 ++++++++++++++++++++++++++++++++++++++++++
source3/smbd/dir.c | 26 --------------------------
source3/smbd/proto.h | 1 -
4 files changed, 43 insertions(+), 27 deletions(-)
diff --git a/source3/include/proto.h b/source3/include/proto.h
index acf013b..ddf3fab 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -480,6 +480,7 @@ bool map_open_params_to_ntcreate(const char *smb_base_fname,
uint32 *pcreate_options,
uint32_t *pprivate_flags);
struct security_unix_token *copy_unix_token(TALLOC_CTX *ctx, const struct security_unix_token *tok);
+bool dir_check_ftype(uint32_t mode, uint32_t dirtype);
void init_modules(void);
/* The following definitions come from lib/util_builtin.c */
diff --git a/source3/lib/util.c b/source3/lib/util.c
index 5168092..551beab 100644
--- a/source3/lib/util.c
+++ b/source3/lib/util.c
@@ -2393,3 +2393,45 @@ struct security_unix_token *copy_unix_token(TALLOC_CTX *ctx, const struct securi
}
return cpy;
}
+
+/****************************************************************************
+ Check that a file matches a particular file type.
+****************************************************************************/
+
+bool dir_check_ftype(uint32_t mode, uint32_t dirtype)
+{
+ uint32_t mask;
+
+ /* Check the "may have" search bits. */
+ if (((mode & ~dirtype) &
+ (FILE_ATTRIBUTE_HIDDEN |
+ FILE_ATTRIBUTE_SYSTEM |
+ FILE_ATTRIBUTE_DIRECTORY)) != 0) {
+ return false;
+ }
+
+ /* 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|
+ FILE_ATTRIBUTE_ARCHIVE|
+ FILE_ATTRIBUTE_READONLY|
+ FILE_ATTRIBUTE_HIDDEN|
+ FILE_ATTRIBUTE_SYSTEM)); /* & 0x37 */
+ if(mask) {
+ 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;
+ }
+ }
+
+ return true;
+}
diff --git a/source3/smbd/dir.c b/source3/smbd/dir.c
index 6b7cce2..8fa320b 100644
--- a/source3/smbd/dir.c
+++ b/source3/smbd/dir.c
@@ -962,32 +962,6 @@ struct dptr_struct *dptr_fetch_lanman2(struct smbd_server_connection *sconn,
return(dptr);
}
-/****************************************************************************
- Check that a file matches a particular file type.
-****************************************************************************/
-
-bool dir_check_ftype(uint32_t mode, uint32_t dirtype)
-{
- uint32_t mask;
-
- /* Check the "may have" search bits. */
- if (((mode & ~dirtype) & (FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_DIRECTORY)) != 0)
- return False;
-
- /* 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|FILE_ATTRIBUTE_ARCHIVE|FILE_ATTRIBUTE_READONLY|FILE_ATTRIBUTE_HIDDEN|FILE_ATTRIBUTE_SYSTEM)); /* & 0x37 */
- if(mask) {
- 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;
- }
-
- return True;
-}
-
static bool mangle_mask_match(connection_struct *conn,
const char *filename,
const char *mask)
diff --git a/source3/smbd/proto.h b/source3/smbd/proto.h
index 91ef3ed..1e0d06d 100644
--- a/source3/smbd/proto.h
+++ b/source3/smbd/proto.h
@@ -218,7 +218,6 @@ struct dptr_struct *dptr_fetch(struct smbd_server_connection *sconn,
char *buf,int *num);
struct dptr_struct *dptr_fetch_lanman2(struct smbd_server_connection *sconn,
int dptr_num);
-bool dir_check_ftype(uint32_t mode, uint32_t dirtype);
bool get_dir_entry(TALLOC_CTX *ctx,
struct dptr_struct *dirptr,
const char *mask,
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-samba/samba.git
More information about the Pkg-samba-maint
mailing list