lib: Add synthetic_smb_fname
authorVolker Lendecke <vl@samba.org>
Thu, 11 Apr 2013 15:01:22 +0000 (17:01 +0200)
committerJeremy Allison <jra@samba.org>
Wed, 17 Apr 2013 21:49:57 +0000 (14:49 -0700)
The interface of create_synthetic_smb_fname is just silly

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/include/proto.h
source3/lib/filename_util.c

index 6bc151e88866b046254d2cd79edfb904ec4fb69e..5b9decdc1ca860684b3929200d13dfb6542a5629 100644 (file)
@@ -1605,6 +1605,10 @@ NTSTATUS create_synthetic_smb_fname_split(TALLOC_CTX *ctx,
                                          const char *fname,
                                          const SMB_STRUCT_STAT *psbuf,
                                          struct smb_filename **smb_fname_out);
+struct smb_filename *synthetic_smb_fname(TALLOC_CTX *mem_ctx,
+                                        const char *base_name,
+                                        const char *stream_name,
+                                        const SMB_STRUCT_STAT *psbuf);
 const char *smb_fname_str_dbg(const struct smb_filename *smb_fname);
 const char *fsp_str_dbg(const struct files_struct *fsp);
 const char *fsp_fnum_dbg(const struct files_struct *fsp);
index 99cc114c184bf3fcc2d577506c4d0f9841569d1c..2503e77764c23fd13cad757bc413050cd2e990a6 100644 (file)
@@ -75,6 +75,25 @@ NTSTATUS create_synthetic_smb_fname(TALLOC_CTX *ctx, const char *base_name,
        return copy_smb_filename(ctx, &smb_fname_loc, smb_fname_out);
 }
 
+struct smb_filename *synthetic_smb_fname(TALLOC_CTX *mem_ctx,
+                                        const char *base_name,
+                                        const char *stream_name,
+                                        const SMB_STRUCT_STAT *psbuf)
+{
+       struct smb_filename smb_fname_loc = { 0, };
+
+       /* Setup the base_name/stream_name. */
+       smb_fname_loc.base_name = discard_const_p(char, base_name);
+       smb_fname_loc.stream_name = discard_const_p(char, stream_name);
+
+       /* Copy the psbuf if one was given. */
+       if (psbuf)
+               smb_fname_loc.st = *psbuf;
+
+       /* Let copy_smb_filename() do the heavy lifting. */
+       return cp_smb_filename(mem_ctx, &smb_fname_loc);
+}
+
 /**
  * XXX: This is temporary and there should be no callers of this once
  * smb_filename is plumbed through all path based operations.