[Spice-devel] [vdagent-win v2 PATCH 2/6] file_xfer: create file with user privileges
Uri Lublin
uril at redhat.com
Wed Nov 13 01:22:29 PST 2013
---
vdagent/file_xfer.cpp | 7 +++++++
1 file changed, 7 insertions(+)
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