[Spice-devel] [vdagent-win PATCH 2/6] file_xfer: create file with user privileges
Uri Lublin
uril at redhat.com
Thu Nov 7 14:02:52 PST 2013
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");
--
1.8.3.1
More information about the Spice-devel
mailing list