[gvfs] smb: Catch invalid argument type when setting mtime



commit b6c397c60b3c66cb792975071a1edd9193848edb
Author: Benjamin Otte <otte redhat com>
Date:   Mon Jan 24 03:01:25 2011 +0100

    smb: Catch invalid argument type when setting mtime

 daemon/gvfsbackendsmb.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
---
diff --git a/daemon/gvfsbackendsmb.c b/daemon/gvfsbackendsmb.c
index 91c290e..a2bc097 100644
--- a/daemon/gvfsbackendsmb.c
+++ b/daemon/gvfsbackendsmb.c
@@ -1715,6 +1715,15 @@ do_set_attribute (GVfsBackend *backend,
 
   if (strcmp (attribute, G_FILE_ATTRIBUTE_TIME_MODIFIED) == 0)
     {
+      if (type != G_FILE_ATTRIBUTE_TYPE_UINT64) 
+        {
+          g_vfs_job_failed (G_VFS_JOB (job),
+                            G_IO_ERROR,
+                            G_IO_ERROR_INVALID_ARGUMENT,
+                            "%s",
+                            _("Invalid attribute type (uint64 expected)"));
+        }
+
       smbc_utimes = smbc_getFunctionUtimes (op_backend->smb_context);
       tbuf[1].tv_sec = (*(guint64 *)value_p);  /* mtime */
       tbuf[1].tv_usec = 0;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]