Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SCP File Modes #663

Merged
merged 1 commit into from
Mar 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions src/wolfscp.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ static int ScpPushDir(void *fs, ScpSendCtx* ctx, const char* path, void* heap);
static int ScpPopDir(void *fs, ScpSendCtx* ctx, void* heap);
#endif

#define WOLFSSH_MODE_MASK 0777

const char scpError[] = "scp error: %s, %d";
const char scpState[] = "scp state: %s";

Expand Down Expand Up @@ -315,7 +317,8 @@ static int SendScpFileHeader(WOLFSSH* ssh)
#ifndef WSCPFILEHDR
WMEMSET(buf, 0, sizeof(buf));
WSNPRINTF(buf, sizeof(buf), "C%04o %u %s\n",
ssh->scpFileMode, ssh->scpFileSz, ssh->scpFileName);
ssh->scpFileMode & WOLFSSH_MODE_MASK,
ssh->scpFileSz, ssh->scpFileName);
filehdr = buf;
#else
filehdr = WSCPFILEHDR(ssh);
Expand Down Expand Up @@ -350,8 +353,9 @@ static int SendScpEnterDirectory(WOLFSSH* ssh)

WMEMSET(buf, 0, sizeof(buf));

WSNPRINTF(buf, sizeof(buf), "D%04o 0 %s\n", ssh->scpFileMode,
ssh->scpFileName);
WSNPRINTF(buf, sizeof(buf), "D%04o 0 %s\n",
ssh->scpFileMode & WOLFSSH_MODE_MASK,
ssh->scpFileName);

bufSz = (int)WSTRLEN(buf);

Expand Down
Loading