summaryrefslogtreecommitdiffstats
path: root/source3/smbd/reply.c
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2014-09-08 12:41:19 +0200
committerDavid Disseldorp <ddiss@samba.org>2014-09-09 13:03:58 +0200
commitaf23d5efc0a95bfac4f0d1d38f3f9bfdd33efa2e (patch)
treedd01295d002653856b30acd30d1bc50e39df60af /source3/smbd/reply.c
parentdec0243c8595359df6448caf5d242b3d2062deb6 (diff)
downloadsamba-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>
Diffstat (limited to 'source3/smbd/reply.c')
-rw-r--r--source3/smbd/reply.c46
1 files changed, 46 insertions, 0 deletions
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.
****************************************************************************/