s3: libsmb: Add return args to clistr_is_previous_version_path().
authorJeremy Allison <jra@samba.org>
Fri, 19 Aug 2016 00:15:01 +0000 (17:15 -0700)
committerStefan Metzmacher <metze@samba.org>
Sun, 28 Aug 2016 16:12:11 +0000 (18:12 +0200)
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@samba.org>
Reviewed-by: Uri Simchoni <uri@samba.org>
(cherry picked from commit 14fd6dca4ef33ee85a2f8578f1ad608d6056da1f)

source3/libsmb/clifile.c
source3/libsmb/clilist.c
source3/libsmb/clistr.c
source3/libsmb/proto.h

index 0964b3a0883d31d8568871ca520ee647250a8c5c..75ec3a252ac40cca84e5f8842c0a09b34deadd75 100644 (file)
@@ -197,7 +197,7 @@ struct tevent_req *cli_setpathinfo_send(TALLOC_CTX *mem_ctx,
                return tevent_req_post(req, ev);
        }
 
-       if (clistr_is_previous_version_path(path) &&
+       if (clistr_is_previous_version_path(path, NULL, NULL, NULL) &&
                        !INFO_LEVEL_IS_UNIX(level)) {
                additional_flags2 = FLAGS2_REPARSE_PATH;
        }
@@ -1155,7 +1155,7 @@ struct tevent_req *cli_rename_send(TALLOC_CTX *mem_ctx,
                return tevent_req_post(req, ev);
        }
 
-       if (clistr_is_previous_version_path(fname_src)) {
+       if (clistr_is_previous_version_path(fname_src, NULL, NULL, NULL)) {
                additional_flags2 = FLAGS2_REPARSE_PATH;
        }
 
@@ -1290,7 +1290,7 @@ static struct tevent_req *cli_ntrename_internal_send(TALLOC_CTX *mem_ctx,
                return tevent_req_post(req, ev);
        }
 
-       if (clistr_is_previous_version_path(fname_src)) {
+       if (clistr_is_previous_version_path(fname_src, NULL, NULL, NULL)) {
                additional_flags2 = FLAGS2_REPARSE_PATH;
        }
 
@@ -1495,7 +1495,7 @@ struct tevent_req *cli_unlink_send(TALLOC_CTX *mem_ctx,
                return tevent_req_post(req, ev);
        }
 
-       if (clistr_is_previous_version_path(fname)) {
+       if (clistr_is_previous_version_path(fname, NULL, NULL, NULL)) {
                additional_flags2 = FLAGS2_REPARSE_PATH;
        }
 
@@ -1610,7 +1610,7 @@ struct tevent_req *cli_mkdir_send(TALLOC_CTX *mem_ctx,
                return tevent_req_post(req, ev);
        }
 
-       if (clistr_is_previous_version_path(dname)) {
+       if (clistr_is_previous_version_path(dname, NULL, NULL, NULL)) {
                additional_flags2 = FLAGS2_REPARSE_PATH;
        }
 
@@ -1725,7 +1725,7 @@ struct tevent_req *cli_rmdir_send(TALLOC_CTX *mem_ctx,
                return tevent_req_post(req, ev);
        }
 
-       if (clistr_is_previous_version_path(dname)) {
+       if (clistr_is_previous_version_path(dname, NULL, NULL, NULL)) {
                additional_flags2 = FLAGS2_REPARSE_PATH;
        }
 
@@ -1978,7 +1978,7 @@ static struct tevent_req *cli_ntcreate1_send(TALLOC_CTX *mem_ctx,
                                   fname, strlen(fname)+1,
                                   &converted_len);
 
-       if (clistr_is_previous_version_path(fname)) {
+       if (clistr_is_previous_version_path(fname, NULL, NULL, NULL)) {
                additional_flags2 = FLAGS2_REPARSE_PATH;
        }
 
@@ -2282,7 +2282,7 @@ struct tevent_req *cli_nttrans_create_send(TALLOC_CTX *mem_ctx,
                return tevent_req_post(req, ev);
        }
 
-       if (clistr_is_previous_version_path(fname)) {
+       if (clistr_is_previous_version_path(fname, NULL, NULL, NULL)) {
                additional_flags2 = FLAGS2_REPARSE_PATH;
        }
 
@@ -2508,7 +2508,7 @@ struct tevent_req *cli_openx_create(TALLOC_CTX *mem_ctx,
                return tevent_req_post(req, ev);
        }
 
-       if (clistr_is_previous_version_path(fname)) {
+       if (clistr_is_previous_version_path(fname, NULL, NULL, NULL)) {
                additional_flags2 = FLAGS2_REPARSE_PATH;
        }
 
@@ -3765,7 +3765,7 @@ struct tevent_req *cli_getatr_send(TALLOC_CTX *mem_ctx,
                return tevent_req_post(req, ev);
        }
 
-       if (clistr_is_previous_version_path(fname)) {
+       if (clistr_is_previous_version_path(fname, NULL, NULL, NULL)) {
                additional_flags2 = FLAGS2_REPARSE_PATH;
        }
 
@@ -4057,7 +4057,7 @@ struct tevent_req *cli_setatr_send(TALLOC_CTX *mem_ctx,
                return tevent_req_post(req, ev);
        }
 
-       if (clistr_is_previous_version_path(fname)) {
+       if (clistr_is_previous_version_path(fname, NULL, NULL, NULL)) {
                additional_flags2 = FLAGS2_REPARSE_PATH;
        }
 
@@ -4178,7 +4178,7 @@ struct tevent_req *cli_chkpath_send(TALLOC_CTX *mem_ctx,
                return tevent_req_post(req, ev);
        }
 
-       if (clistr_is_previous_version_path(fname)) {
+       if (clistr_is_previous_version_path(fname, NULL, NULL, NULL)) {
                additional_flags2 = FLAGS2_REPARSE_PATH;
        }
 
@@ -4489,7 +4489,7 @@ struct tevent_req *cli_ctemp_send(TALLOC_CTX *mem_ctx,
                return tevent_req_post(req, ev);
        }
 
-       if (clistr_is_previous_version_path(path)) {
+       if (clistr_is_previous_version_path(path, NULL, NULL, NULL)) {
                additional_flags2 = FLAGS2_REPARSE_PATH;
        }
 
@@ -5651,7 +5651,7 @@ struct tevent_req *cli_qpathinfo_send(TALLOC_CTX *mem_ctx,
                return tevent_req_post(req, ev);
        }
 
-       if (clistr_is_previous_version_path(fname) &&
+       if (clistr_is_previous_version_path(fname, NULL, NULL, NULL) &&
                        !INFO_LEVEL_IS_UNIX(level)) {
                additional_flags2 = FLAGS2_REPARSE_PATH;
        }
index d6116f0711236a322cfe84818369bb6777e5ba7a..41f585120b92793b5f605ba76edfb78c764d6055 100644 (file)
@@ -600,7 +600,7 @@ static struct tevent_req *cli_list_trans_send(TALLOC_CTX *mem_ctx,
                return tevent_req_post(req, ev);
        }
 
-       if (clistr_is_previous_version_path(state->mask)) {
+       if (clistr_is_previous_version_path(state->mask, NULL, NULL, NULL)) {
                additional_flags2 = FLAGS2_REPARSE_PATH;
        }
 
@@ -792,7 +792,7 @@ static void cli_list_trans_done(struct tevent_req *subreq)
        }
        param_len = talloc_get_size(state->param);
 
-       if (clistr_is_previous_version_path(state->mask)) {
+       if (clistr_is_previous_version_path(state->mask, NULL, NULL, NULL)) {
                additional_flags2 = FLAGS2_REPARSE_PATH;
        }
 
index c3611be72ccffc0981e48b13d5628142bfe81c49..154b9a18b55b54acfcbfea4002cf4ff7f1c79b56 100644 (file)
@@ -38,7 +38,10 @@ size_t clistr_pull_talloc(TALLOC_CTX *ctx,
                                  flags);
 }
 
-bool clistr_is_previous_version_path(const char *path)
+bool clistr_is_previous_version_path(const char *path,
+               const char **startp,
+               const char **endp,
+               time_t *ptime)
 {
        char *q;
        time_t timestamp;
@@ -63,5 +66,17 @@ bool clistr_is_previous_version_path(const char *path)
        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;
 }
index f9bb9856874a8065bfad91163fb09eb983c46ca6..c0e1b749fa54361c7a63c860dd9dd8f2c929e230 100644 (file)
@@ -868,7 +868,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);
+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  */