limit scp mark of the web attempt to pull case and change logging to debug3 (#652)

This commit is contained in:
Tess Gauthier 2023-01-09 15:02:24 -05:00 committed by GitHub
parent ba5a84ba35
commit 2bf8005da1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 8 deletions

View File

@ -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;
}

7
scp.c
View File

@ -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.