diff options
author | Uri Lublin <uril@redhat.com> | 2013-11-05 18:35:27 +0200 |
---|---|---|
committer | Uri Lublin <uril@redhat.com> | 2013-11-13 10:39:37 +0200 |
commit | 71193f658131d31b28b6d9afdd385111bc32377b (patch) | |
tree | a5e35d33a31a3e3c7baa968696478522020d31c4 /vdagent | |
parent | 750a8bab405588d91c41f84c458d9cda0f7189bf (diff) |
file_xfer: create file with user privileges
Diffstat (limited to 'vdagent')
-rw-r--r-- | vdagent/file_xfer.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/vdagent/file_xfer.cpp b/vdagent/file_xfer.cpp index 66b489a..2a6480a 100644 --- a/vdagent/file_xfer.cpp +++ b/vdagent/file_xfer.cpp @@ -21,6 +21,7 @@ #include <inttypes.h> #include <stdio.h> #include "file_xfer.h" +#include "as_user.h" FileXfer::~FileXfer() { @@ -44,6 +45,7 @@ void FileXfer::handle_start(VDAgentFileXferStartMessage* start, FileXferTask* task; uint64_t file_size; HANDLE handle; + AsUser as_user; status->id = start->id; status->result = VD_AGENT_FILE_XFER_STATUS_ERROR; @@ -53,6 +55,11 @@ void FileXfer::handle_start(VDAgentFileXferStartMessage* start, return; } vd_printf("%u %s (%" PRIu64 ")", start->id, file_name, file_size); + if (!as_user.begin()) { + vd_printf("as_user failed"); + return; + } + if (FAILED(SHGetFolderPathA(NULL, CSIDL_COMMON_DESKTOPDIRECTORY | CSIDL_FLAG_CREATE, NULL, SHGFP_TYPE_CURRENT, file_path))) { vd_printf("failed getting desktop path"); |