1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00

lib: Add synthetic_smb_fname_split

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
Volker Lendecke 2013-04-12 11:06:45 +02:00 committed by Jeremy Allison
parent 133cde3093
commit 8087e701cc
2 changed files with 32 additions and 0 deletions

View File

@ -1609,6 +1609,9 @@ struct smb_filename *synthetic_smb_fname(TALLOC_CTX *mem_ctx,
const char *base_name, const char *base_name,
const char *stream_name, const char *stream_name,
const SMB_STRUCT_STAT *psbuf); 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 *smb_fname_str_dbg(const struct smb_filename *smb_fname);
const char *fsp_str_dbg(const struct files_struct *fsp); const char *fsp_str_dbg(const struct files_struct *fsp);
const char *fsp_fnum_dbg(const struct files_struct *fsp); const char *fsp_fnum_dbg(const struct files_struct *fsp);

View File

@ -117,6 +117,35 @@ NTSTATUS create_synthetic_smb_fname_split(TALLOC_CTX *ctx,
return status; 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() * Return a string using the talloc_tos()
*/ */