← Back to team overview

ubuntu-touch-coreapps-reviewers team mailing list archive

[Merge] lp:~carlos-mazieri/ubuntu-filemanager-app/samba-improvements-04 into lp:ubuntu-filemanager-app

 

Carlos Jose Mazieri has proposed merging lp:~carlos-mazieri/ubuntu-filemanager-app/samba-improvements-04 into lp:ubuntu-filemanager-app with lp:~carlos-mazieri/ubuntu-filemanager-app/samba-improvements-03 as a prerequisite.

Commit message:
fixed SmbUtil::changePermissions()
improved SmbUtil::checkValidShareName()

Requested reviews:
  Ubuntu File Manager Developers (ubuntu-filemanager-dev)

For more details, see:
https://code.launchpad.net/~carlos-mazieri/ubuntu-filemanager-app/samba-improvements-04/+merge/273336

fixed SmbUtil::changePermissions()
improved SmbUtil::checkValidShareName()
-- 
Your team Ubuntu File Manager Developers is requested to review the proposed merge of lp:~carlos-mazieri/ubuntu-filemanager-app/samba-improvements-04 into lp:ubuntu-filemanager-app.
=== modified file 'src/plugin/folderlistmodel/smb/qsambaclient/src/smbutil.cpp'
--- src/plugin/folderlistmodel/smb/qsambaclient/src/smbutil.cpp	2015-10-04 15:50:08 +0000
+++ src/plugin/folderlistmodel/smb/qsambaclient/src/smbutil.cpp	2015-10-04 15:50:08 +0000
@@ -342,7 +342,7 @@
     Smb::FileHandler fd = 0;
     ::memset(st, 0, sizeof(struct stat));
     if ((fd=openDir(context, smb_path)) )
-        {
+    {
         ret = guessDirType(context,fd);
         closeHandle(context, fd);
         if (ret == StatDir)
@@ -356,7 +356,7 @@
         }
     }
     else if (errno != EACCES && errno != ECONNREFUSED) // perhaps is a file
-            {
+    {
         errno = 0;
         ret = getStat(context, smb_path,st);
     }
@@ -366,21 +366,21 @@
         SHOW_ERRNO(smb_path);
         switch(errno)
         {
-           case EACCES:
-                //force shares to have Directory attribute
+        case EACCES:
+            //force shares to have Directory attribute
                 if (slashes == URL_SLASHES_NUMBER_FOR_SHARES)
-                {
-                     st->st_mode |= S_IFDIR;
-                }
-                ret = StatNoAccess; //authentication should have failed
-                break;
-           case ENOENT:
-           case ENODEV:
-           case ECONNREFUSED:
-                ret = StatDoesNotExist; //item does not exist
-                break;
-           default:
-                break;
+            {
+                st->st_mode |= S_IFDIR;
+            }
+            ret = StatNoAccess; //authentication should have failed
+            break;
+        case ENOENT:
+        case ENODEV:
+        case ECONNREFUSED:
+            ret = StatDoesNotExist; //item does not exist
+            break;
+        default:
+            break;
         }
     }
     deleteContext(context);
@@ -636,6 +636,10 @@
     {
       return false;
     }
+    if (::strcmp(shareName, "ADMIN$") == 0)
+    {
+      return false;
+    }
 
     return true;
 }
@@ -727,7 +731,7 @@
 
 bool SmbUtil::changePermissions(Smb::Context context, const QString& smb_path, mode_t mode)
 {
-    int ret = ::smbc_getFunctionChmod(context)(context, smb_path.toLocal8Bit().constBegin(), mode);
+    int ret = ::smbc_getFunctionChmod(context)(context, smb_path.toLocal8Bit().constData(), mode);
     if (ret < 0)
     {
         SHOW_ERRNO(smb_path);