diff options
author | Volker Lendecke <vl@samba.org> | 2014-09-08 12:41:19 +0200 |
---|---|---|
committer | David Disseldorp <ddiss@samba.org> | 2014-09-09 13:03:58 +0200 |
commit | af23d5efc0a95bfac4f0d1d38f3f9bfdd33efa2e (patch) | |
tree | dd01295d002653856b30acd30d1bc50e39df60af | |
parent | dec0243c8595359df6448caf5d242b3d2062deb6 (diff) | |
download | samba-af23d5efc0a95bfac4f0d1d38f3f9bfdd33efa2e.tar.gz samba-af23d5efc0a95bfac4f0d1d38f3f9bfdd33efa2e.tar.xz samba-af23d5efc0a95bfac4f0d1d38f3f9bfdd33efa2e.zip |
smbd: Move make_dir_struct() to reply.c
This routine has nothing to do with dptr handling, it is SMB1 marshalling
called only from reply_search().
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: David Disseldorp <ddiss@samba.org>
-rw-r--r-- | source3/smbd/dir.c | 46 | ||||
-rw-r--r-- | source3/smbd/proto.h | 8 | ||||
-rw-r--r-- | source3/smbd/reply.c | 46 |
3 files changed, 46 insertions, 54 deletions
diff --git a/source3/smbd/dir.c b/source3/smbd/dir.c index 55d774278b..6c811fe984 100644 --- a/source3/smbd/dir.c +++ b/source3/smbd/dir.c @@ -87,52 +87,6 @@ static void DirCacheAdd(struct smb_Dir *dirp, const char *name, long offset); #define INVALID_DPTR_KEY (-3) /**************************************************************************** - Make a dir struct. -****************************************************************************/ - -bool make_dir_struct(TALLOC_CTX *ctx, - char *buf, - const char *mask, - const char *fname, - off_t size, - uint32 mode, - time_t date, - bool uc) -{ - char *p; - char *mask2 = talloc_strdup(ctx, mask); - - if (!mask2) { - return False; - } - - if ((mode & FILE_ATTRIBUTE_DIRECTORY) != 0) { - size = 0; - } - - memset(buf+1,' ',11); - if ((p = strchr_m(mask2,'.')) != NULL) { - *p = 0; - push_ascii(buf+1,mask2,8, 0); - push_ascii(buf+9,p+1,3, 0); - *p = '.'; - } else { - push_ascii(buf+1,mask2,11, 0); - } - - memset(buf+21,'\0',DIR_STRUCT_SIZE-21); - SCVAL(buf,21,mode); - srv_put_dos_date(buf,22,date); - SSVAL(buf,26,size & 0xFFFF); - SSVAL(buf,28,(size >> 16)&0xFFFF); - /* We only uppercase if FLAGS2_LONG_PATH_COMPONENTS is zero in the input buf. - Strange, but verified on W2K3. Needed for OS/2. JRA. */ - push_ascii(buf+30,fname,12, uc ? STR_UPPER : 0); - DEBUG(8,("put name [%s] from [%s] into dir struct\n",buf+30, fname)); - return True; -} - -/**************************************************************************** Initialise the dir bitmap. ****************************************************************************/ diff --git a/source3/smbd/proto.h b/source3/smbd/proto.h index 692f582815..f2b5888491 100644 --- a/source3/smbd/proto.h +++ b/source3/smbd/proto.h @@ -179,14 +179,6 @@ uint64_t get_dfree_info(connection_struct *conn, /* The following definitions come from smbd/dir.c */ -bool make_dir_struct(TALLOC_CTX *ctx, - char *buf, - const char *mask, - const char *fname, - off_t size, - uint32 mode, - time_t date, - bool uc); bool init_dptrs(struct smbd_server_connection *sconn); const char *dptr_path(struct smbd_server_connection *sconn, int key); const char *dptr_wcard(struct smbd_server_connection *sconn, int key); diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c index 2cc174fce4..2422ad3629 100644 --- a/source3/smbd/reply.c +++ b/source3/smbd/reply.c @@ -1524,6 +1524,52 @@ static NTSTATUS split_fname_dir_mask(TALLOC_CTX *ctx, const char *fname_in, } /**************************************************************************** + Make a dir struct. +****************************************************************************/ + +static bool make_dir_struct(TALLOC_CTX *ctx, + char *buf, + const char *mask, + const char *fname, + off_t size, + uint32 mode, + time_t date, + bool uc) +{ + char *p; + char *mask2 = talloc_strdup(ctx, mask); + + if (!mask2) { + return False; + } + + if ((mode & FILE_ATTRIBUTE_DIRECTORY) != 0) { + size = 0; + } + + memset(buf+1,' ',11); + if ((p = strchr_m(mask2,'.')) != NULL) { + *p = 0; + push_ascii(buf+1,mask2,8, 0); + push_ascii(buf+9,p+1,3, 0); + *p = '.'; + } else { + push_ascii(buf+1,mask2,11, 0); + } + + memset(buf+21,'\0',DIR_STRUCT_SIZE-21); + SCVAL(buf,21,mode); + srv_put_dos_date(buf,22,date); + SSVAL(buf,26,size & 0xFFFF); + SSVAL(buf,28,(size >> 16)&0xFFFF); + /* We only uppercase if FLAGS2_LONG_PATH_COMPONENTS is zero in the input buf. + Strange, but verified on W2K3. Needed for OS/2. JRA. */ + push_ascii(buf+30,fname,12, uc ? STR_UPPER : 0); + DEBUG(8,("put name [%s] from [%s] into dir struct\n",buf+30, fname)); + return True; +} + +/**************************************************************************** Reply to a search. Can be called from SMBsearch, SMBffirst or SMBfunique. ****************************************************************************/ |