summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2013-04-12 11:06:45 +0200
committerJeremy Allison <jra@samba.org>2013-04-17 14:49:58 -0700
commit8087e701ccddc5ea8835292605007cced674a43b (patch)
tree2d297c1c6992c9b687be6a219b9ac803922ca400 /source3
parent133cde309381d9e127c8d78167b486dd7cbb0920 (diff)
downloadsamba-8087e701ccddc5ea8835292605007cced674a43b.tar.gz
samba-8087e701ccddc5ea8835292605007cced674a43b.tar.bz2
samba-8087e701ccddc5ea8835292605007cced674a43b.zip
lib: Add synthetic_smb_fname_split
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'source3')
-rw-r--r--source3/include/proto.h3
-rw-r--r--source3/lib/filename_util.c29
2 files changed, 32 insertions, 0 deletions
diff --git a/source3/include/proto.h b/source3/include/proto.h
index 5b9decdc1c..f481e9977d 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -1609,6 +1609,9 @@ 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 *synthetic_smb_fname_split(TALLOC_CTX *ctx,
+ const char *fname,
+ 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);
diff --git a/source3/lib/filename_util.c b/source3/lib/filename_util.c
index a92c11e304..2fe611c6d4 100644
--- a/source3/lib/filename_util.c
+++ b/source3/lib/filename_util.c
@@ -117,6 +117,35 @@ NTSTATUS create_synthetic_smb_fname_split(TALLOC_CTX *ctx,
return status;
}
+struct smb_filename *synthetic_smb_fname_split(TALLOC_CTX *ctx,
+ const char *fname,
+ const SMB_STRUCT_STAT *psbuf)
+{
+ const char *stream_name = NULL;
+ char *base_name = NULL;
+ struct smb_filename *ret;
+
+ if (!lp_posix_pathnames()) {
+ stream_name = strchr_m(fname, ':');
+ }
+
+ /* Setup the base_name/stream_name. */
+ if (stream_name) {
+ base_name = talloc_strndup(ctx, fname,
+ PTR_DIFF(stream_name, fname));
+ } else {
+ base_name = talloc_strdup(ctx, fname);
+ }
+
+ if (!base_name) {
+ return NULL;
+ }
+
+ ret = synthetic_smb_fname(ctx, base_name, stream_name, psbuf);
+ TALLOC_FREE(base_name);
+ return ret;
+}
+
/**
* Return a string using the talloc_tos()
*/