[Pkg-samba-maint] [samba] 08/17: s3: libsmb: Add return args to clistr_is_previous_version_path().

Mathieu Parent sathieu at moszumanska.debian.org
Thu Mar 30 22:15:34 UTC 2017


This is an automated email from the git hooks/post-receive script.

sathieu pushed a commit to branch jessie
in repository samba.

commit c5fb8bee91a516574b209f4767f04fa20aec6690
Author: Jeremy Allison <jra at samba.org>
Date:   Thu Aug 18 17:15:01 2016 -0700

    s3: libsmb: Add return args to clistr_is_previous_version_path().
    
    Not yet used - we will use these to construct the SMB2 TWrp blob.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=12166
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Uri Simchoni <uri at samba.org>
    (back-ported from commit 14fd6dca4ef33ee85a2f8578f1ad608d6056da1f)
---
 source3/libsmb/clistr.c | 43 +++++++++++++++++++++++++++++++++++++++++++
 source3/libsmb/proto.h  |  4 ++++
 2 files changed, 47 insertions(+)

diff --git a/source3/libsmb/clistr.c b/source3/libsmb/clistr.c
index f1264f6..154b9a1 100644
--- a/source3/libsmb/clistr.c
+++ b/source3/libsmb/clistr.c
@@ -37,3 +37,46 @@ size_t clistr_pull_talloc(TALLOC_CTX *ctx,
 				  src_len,
 				  flags);
 }
+
+bool clistr_is_previous_version_path(const char *path,
+		const char **startp,
+		const char **endp,
+		time_t *ptime)
+{
+	char *q;
+	time_t timestamp;
+	struct tm tm;
+	const char *p = strstr_m(path, "@GMT-");
+
+	if (p == NULL) {
+		return false;
+	}
+	if (p > path && (p[-1] != '\\')) {
+		return false;
+	}
+	q = strptime(p, GMT_FORMAT, &tm);
+	if (q == NULL) {
+		return false;
+	}
+	tm.tm_isdst = -1;
+	timestamp = timegm(&tm);
+	if (timestamp == (time_t)-1) {
+		return false;
+	}
+	if (q[0] != '\0' && q[0] != '\\') {
+		return false;
+	}
+	if (startp) {
+		*startp = p;
+	}
+	if (endp) {
+		if (q[0] == '\\') {
+			q++;
+		}
+		*endp = q;
+	}
+	if (ptime) {
+		*ptime = timestamp;
+	}
+	return true;
+}
diff --git a/source3/libsmb/proto.h b/source3/libsmb/proto.h
index a4b3c74..db5e874 100644
--- a/source3/libsmb/proto.h
+++ b/source3/libsmb/proto.h
@@ -843,6 +843,10 @@ size_t clistr_pull_talloc(TALLOC_CTX *ctx,
 			  const void *src,
 			  int src_len,
 			  int flags);
+bool clistr_is_previous_version_path(const char *path,
+			const char **startp,
+			const char **endp,
+			time_t *ptime);
 
 /* The following definitions come from libsmb/clitrans.c  */
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-samba/samba.git




More information about the Pkg-samba-maint mailing list