]> asedeno.scripts.mit.edu Git - PuTTY.git/blobdiff - windows/winsftp.c
Log when -restrict-acl is in use.
[PuTTY.git] / windows / winsftp.c
index 0776cba94bdc19f544814d26dd7e985611fcae42..437ef439d0c23651cb2f7bee8ad8be79350b1359 100644 (file)
@@ -8,6 +8,7 @@
 #include "psftp.h"
 #include "ssh.h"
 #include "int64.h"
+#include "winsecur.h"
 
 char *get_ttymode(void *frontend, const char *mode) { return NULL; }
 
@@ -102,8 +103,12 @@ RFile *open_existing_file(const char *name, uint64 *size,
     ret = snew(RFile);
     ret->h = h;
 
-    if (size)
-        size->lo=GetFileSize(h, &(size->hi));
+    if (size) {
+        DWORD lo, hi;
+        lo = GetFileSize(h, &hi);
+        size->lo = lo;
+        size->hi = hi;
+    }
 
     if (mtime || atime) {
        FILETIME actime, wrtime;
@@ -170,8 +175,12 @@ WFile *open_existing_wfile(const char *name, uint64 *size)
     ret = snew(WFile);
     ret->h = h;
 
-    if (size)
-       size->lo=GetFileSize(h, &(size->hi));
+    if (size) {
+        DWORD lo, hi;
+        lo = GetFileSize(h, &hi);
+        size->lo = lo;
+        size->hi = hi;
+    }
 
     return ret;
 }
@@ -221,7 +230,10 @@ int seek_file(WFile *f, uint64 offset, int whence)
        return -1;
     }
 
-    SetFilePointer(f->h, offset.lo, &(offset.hi), movemethod);
+    {
+        LONG lo = offset.lo, hi = offset.hi;
+        SetFilePointer(f->h, lo, &hi, movemethod);
+    }
     
     if (GetLastError() != NO_ERROR)
        return -1;
@@ -232,9 +244,11 @@ int seek_file(WFile *f, uint64 offset, int whence)
 uint64 get_file_posn(WFile *f)
 {
     uint64 ret;
+    LONG lo, hi = 0;
 
-    ret.hi = 0L;
-    ret.lo = SetFilePointer(f->h, 0L, &(ret.hi), FILE_CURRENT);
+    lo = SetFilePointer(f->h, 0L, &hi, FILE_CURRENT);
+    ret.lo = lo;
+    ret.hi = hi;
 
     return ret;
 }
@@ -733,6 +747,13 @@ char *ssh_sftp_get_cmdline(const char *prompt, int no_fds_ok)
     return ctx->line;
 }
 
+void platform_psftp_pre_conn_setup(void)
+{
+    if (restricted_acl) {
+       logevent(NULL, "Running with restricted process ACL");
+    }
+}
+
 /* ----------------------------------------------------------------------
  * Main program. Parse arguments etc.
  */
@@ -740,6 +761,8 @@ int main(int argc, char *argv[])
 {
     int ret;
 
+    dll_hijacking_protection();
+
     ret = psftp_main(argc, argv);
 
     return ret;