From: Ralph Boehme Date: Thu, 30 Apr 2020 12:13:44 +0000 (+0200) Subject: smbd: refactor canonicalize_snapshot_path() X-Git-Tag: ldb-2.2.0~695 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=69458cc22a5c00fbfc300769fbbb894cc7ac172d;p=thirdparty%2Fsamba.git smbd: refactor canonicalize_snapshot_path() This prepares for adding additional code after calling rearrange_snapshot_path(). Signed-off-by: Ralph Boehme Reviewed-by: Jeremy Allison --- diff --git a/source3/smbd/filename.c b/source3/smbd/filename.c index 9de550a730e..6cfc1855993 100644 --- a/source3/smbd/filename.c +++ b/source3/smbd/filename.c @@ -369,6 +369,7 @@ static NTSTATUS canonicalize_snapshot_path(struct smb_filename *smb_fname) char *startp = strchr_m(smb_fname->base_name, '@'); char *endp = NULL; struct tm tm; + NTSTATUS status; if (startp == NULL) { /* No @ */ @@ -392,13 +393,7 @@ static NTSTATUS canonicalize_snapshot_path(struct smb_filename *smb_fname) return NT_STATUS_OK; } - if ( endp[0] == '\0') { - return rearrange_snapshot_path(smb_fname, - startp, - endp); - } - - if (endp[0] != '/') { + if (endp[0] != '\0' && endp[0] != '/') { /* * It is not a complete path component, i.e. the path * component continues after the gmt-token. @@ -406,9 +401,12 @@ static NTSTATUS canonicalize_snapshot_path(struct smb_filename *smb_fname) return NT_STATUS_OK; } - return rearrange_snapshot_path(smb_fname, - startp, - endp); + status = rearrange_snapshot_path(smb_fname, startp, endp); + if (!NT_STATUS_IS_OK(status)) { + return status; + } + + return NT_STATUS_OK; } /*