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; int ofd, status = 0;
char* zoneIdentifierStr = NULL; 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) { if (zoneIdentifierStr == NULL) {
status = -1; status = -1;
goto cleanup; 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 // 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) { if ((ofd = open(fileStreamPath, O_WRONLY | O_CREAT, USHRT_MAX)) == -1) {
@ -2194,7 +2194,7 @@ add_mark_of_web(const char* filename)
goto cleanup; goto cleanup;
} }
if (atomicio(vwrite, ofd, zoneIdentifierStr, zoneIndentifierLen) != zoneIndentifierLen) { if (atomicio(vwrite, ofd, zoneIdentifierStr, zoneIdentifierLen) != zoneIdentifierLen) {
status = -1; status = -1;
} }

7
scp.c
View File

@ -2081,10 +2081,9 @@ sink(int argc, char **argv, const char *src)
omode = mode; omode = mode;
mode |= S_IWUSR; mode |= S_IWUSR;
#ifdef WINDOWS #ifdef WINDOWS
if (add_mark_of_web(np) == -1) { // only attempt mark of the web for pull case (from remote to local)
if (verbose_mode) { if (!iamremote && add_mark_of_web(np) == -1) {
note_err("%s: add_mark_of_web failed\n", np); 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. // In windows, we would like to inherit the parent folder permissions by setting mode to USHRT_MAX.