s3: lib: Add new utility function cp_smb_filename_nostream().
[amitay/samba.git] / source3 / lib / filename_util.c
index 3983aaa0eca857e928d452e4e10b6c0be5873e26..8a16bacddbea52edb899ec14d88abf79b003a948 100644 (file)
@@ -71,6 +71,22 @@ struct smb_filename *synthetic_smb_fname(TALLOC_CTX *mem_ctx,
        return cp_smb_filename(mem_ctx, &smb_fname_loc);
 }
 
+/**
+ * Utility function used by VFS calls that must *NOT* operate
+ * on a stream filename, only the base_name.
+ */
+struct smb_filename *cp_smb_filename_nostream(TALLOC_CTX *mem_ctx,
+                                       const struct smb_filename *smb_fname_in)
+{
+       struct smb_filename *smb_fname = cp_smb_filename(mem_ctx,
+                                                       smb_fname_in);
+       if (smb_fname == NULL) {
+               return NULL;
+       }
+       TALLOC_FREE(smb_fname->stream_name);
+       return smb_fname;
+}
+
 /**
  * There are a few legitimate users of this.
  */