From 2bf8005da1052ecc8f2b9dc95d20ef25a456626b Mon Sep 17 00:00:00 2001 From: Tess Gauthier Date: Mon, 9 Jan 2023 15:02:24 -0500 Subject: [PATCH] limit scp mark of the web attempt to pull case and change logging to debug3 (#652) --- contrib/win32/win32compat/misc.c | 8 ++++---- scp.c | 7 +++---- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/contrib/win32/win32compat/misc.c b/contrib/win32/win32compat/misc.c index e8de0604c..deb65cd71 100644 --- a/contrib/win32/win32compat/misc.c +++ b/contrib/win32/win32compat/misc.c @@ -2177,16 +2177,16 @@ add_mark_of_web(const char* filename) int ofd, status = 0; char* zoneIdentifierStr = NULL; - size_t zoneIndentifierLen = strlen("[ZoneTransfer]\nZoneId=") + 1 + 1; + size_t zoneIdentifierLen = strlen("[ZoneTransfer]\nZoneId=") + 1 + 1; - zoneIdentifierStr = malloc(zoneIndentifierLen * sizeof(char)); + zoneIdentifierStr = malloc(zoneIdentifierLen * sizeof(char)); if (zoneIdentifierStr == NULL) { status = -1; goto cleanup; } - sprintf_s(zoneIdentifierStr, zoneIndentifierLen, "[ZoneTransfer]\nZoneId=%d", motw_zone_id); + sprintf_s(zoneIdentifierStr, zoneIdentifierLen, "[ZoneTransfer]\nZoneId=%d", motw_zone_id); // create zone identifer file stream and then write the Mark of the Web to it if ((ofd = open(fileStreamPath, O_WRONLY | O_CREAT, USHRT_MAX)) == -1) { @@ -2194,7 +2194,7 @@ add_mark_of_web(const char* filename) goto cleanup; } - if (atomicio(vwrite, ofd, zoneIdentifierStr, zoneIndentifierLen) != zoneIndentifierLen) { + if (atomicio(vwrite, ofd, zoneIdentifierStr, zoneIdentifierLen) != zoneIdentifierLen) { status = -1; } diff --git a/scp.c b/scp.c index f163cd295..0688cd075 100644 --- a/scp.c +++ b/scp.c @@ -2081,10 +2081,9 @@ sink(int argc, char **argv, const char *src) omode = mode; mode |= S_IWUSR; #ifdef WINDOWS - if (add_mark_of_web(np) == -1) { - if (verbose_mode) { - note_err("%s: add_mark_of_web failed\n", np); - } + // only attempt mark of the web for pull case (from remote to local) + if (!iamremote && add_mark_of_web(np) == -1) { + debug3_f("%s: add_mark_of_web failed\n", np); } // In windows, we would like to inherit the parent folder permissions by setting mode to USHRT_MAX.