mirror of
https://github.com/samba-team/samba.git
synced 2024-12-23 17:34:34 +03:00
s3:lib. Add split_stream_filename() Not yet used.
Will replace internals of synthetic_smb_fname_split(). Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Uri Simchoni <uri@samba.org>
This commit is contained in:
parent
b96511f81b
commit
59f6a73c93
@ -1152,6 +1152,10 @@ bool is_ntfs_stream_smb_fname(const struct smb_filename *smb_fname);
|
||||
bool is_ntfs_default_stream_smb_fname(const struct smb_filename *smb_fname);
|
||||
bool is_invalid_windows_ea_name(const char *name);
|
||||
bool ea_list_has_invalid_name(struct ea_list *ea_list);
|
||||
bool split_stream_filename(TALLOC_CTX *ctx,
|
||||
const char *filename_in,
|
||||
char **filename_out,
|
||||
char **streamname_out);
|
||||
|
||||
/* The following definitions come from lib/dummyroot.c */
|
||||
|
||||
|
@ -280,3 +280,45 @@ bool ea_list_has_invalid_name(struct ea_list *ea_list)
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
Split an incoming name into tallocd filename and stream components.
|
||||
Returns true on success, false on out of memory.
|
||||
****************************************************************************/
|
||||
|
||||
bool split_stream_filename(TALLOC_CTX *ctx,
|
||||
const char *filename_in,
|
||||
char **filename_out,
|
||||
char **streamname_out)
|
||||
{
|
||||
const char *stream_name = NULL;
|
||||
char *stream_out = NULL;
|
||||
char *file_out = NULL;
|
||||
|
||||
stream_name = strchr_m(filename_in, ':');
|
||||
|
||||
if (stream_name) {
|
||||
stream_out = talloc_strdup(ctx, stream_name);
|
||||
if (stream_out == NULL) {
|
||||
return false;
|
||||
}
|
||||
file_out = talloc_strndup(ctx,
|
||||
filename_in,
|
||||
PTR_DIFF(stream_name, filename_in));
|
||||
} else {
|
||||
file_out = talloc_strdup(ctx, filename_in);
|
||||
}
|
||||
|
||||
if (file_out == NULL) {
|
||||
TALLOC_FREE(stream_out);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (filename_out) {
|
||||
*filename_out = file_out;
|
||||
}
|
||||
if (streamname_out) {
|
||||
*streamname_out = stream_out;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user