~n-muench/ubuntu/precise/open-vm-tools/open-vm-tools.raring-precise.backport

« back to all changes in this revision

Viewing changes to lib/hgfsServer/hgfsServerLinux.c

  • Committer: Package Import Robot
  • Author(s): Nate Muench
  • Date: 2012-01-23 16:09:45 UTC
  • mfrom: (1.4.6) (2.4.26 sid)
  • Revision ID: package-import@ubuntu.com-20120123160945-b6s0r1vkcovucpf3
Tags: 2011.12.20-562307-0ubuntu1
* Merge latest upstream git tag. Fixes building on Precise
  (LP: #898289, LP: #905612)

* Items merged from Debian unstable:
  - debian/control:
    + open-vm-tools recommends open-vm-dkms. (LP: #598933)
    + open-vm-tools now suggests open-vm-toolbox. (LP: #604998)
  (From 2011.08.21-471295-1 release)
  - Updating maintainer and uploaders fields.
  - Removing vcs fields.
  - Removing references to Daniel's old email address.
  - Updating years in copyright file.
  - Updating to standards version 3.9.2.
  - Updating to debhelper version 8.
  - Switching to source format 3.0 (quilt).
  - Removing manual chrpath setting.
  - Removing exclusion from plugins from debhelper shlibs.
  - Rediffing kvers.patch.
  (From 2011.09.23-491607-1 release)
  - Marking binary architecture-dependend packages as linux and kfreebsd
  only.
  - Removing liburiparser-dev from build-depends as upstream dropped
  unity support.
  - Building with libproc-dev on amd64 again.
  - Dropping disabling of dnet support.
  (From 2011.09.23-491607-2 release)
  - Adding doxygen to build-depends for api documentation.
  - Adding libcunit1-dev to build-depends for test suites.
  - Minimizing rules file.
  - Adding open-vm-tools-dev package, containing only the api
    documentation for now.
  (From 2011.09.23-491607-3 release)
  - Sorting overrides in rules alphabetically.
  - Compacting copyright file.
  - Adding udev rule to set timeout for vmware scsi devices
  (From 2011.12.20-562307-1 release)
  - Adding patch to correct typo in upstreams dkms configuration

* Remaining Changes:
  - Remove Stable part of version numbering.
  - debian folder:
    + Re-added open-vm-dkms.postinst & open-vm-dkms.prerm.
      * Allows dkms modules to compile upon installation.
  - debian/control:
    + Re-add open-vm-source and make into a transitional package
      for open-vm-toolbox.
    + Return dependancies that were moved to open-vm-tools back to
      open-vm-toolbox.
  - debian/rules and debian/open-vm-toolbox.lintian-overrides:
    + Make vmware-user-suid-wrapper suid-root
  - debian/rules:
    + Added CFLAGS field with -Wno-deprecated-declarations
      * Will suppress issues with glib 2.31 or later.
    + Add line to copy vmware-xdg-detect-de into place.
    + Install vmware-user.desktop through toolbox package.
  - debian/open-vm-tools.init:
    + Re-add 'modprobe [-r] vmblock'.
    + Add 'modprobe [-r] vmxnet'.
      * Incase it's not loaded during boot.
    + Remove and re-add pcnet32 module
      * Will be done before (remove) and after (readd) vmxnet module
        is added.
      * If vmxnet doesn't exist (aka modules fail to build), pcnet32 can be
        still used for network connectivity.
      * Workaround until a better fix can be done.
  - Re-add gnome-session to debian/local/xautostart.conf
  - Manpages removed (from debian/manpages):
    + vmmemctl.9
    + vmxnet3.9
    + Remove references to manpages that have been removed.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1096
1096
 
1097
1097
   /* Set the rest of the Windows specific attributes if necessary. */
1098
1098
   if (needToSetAttribute) {
1099
 
      HgfsSetHiddenXAttr(openInfo->utf8Name, openInfo->attr & HGFS_ATTR_HIDDEN,
 
1099
      HgfsSetHiddenXAttr(openInfo->utf8Name,
 
1100
                         (openInfo->attr & HGFS_ATTR_HIDDEN) != 0,
1100
1101
                         fileStat.st_mode);
1101
1102
   }
1102
1103
 
1965
1966
    * Linux: Glibc 2.3+ has st_Xtim.  Glibc 2.1/2.2 has st_Xtime/__unusedX on
1966
1967
    *        same place (see below).  We do not support Glibc 2.0 or older.
1967
1968
    */
1968
 
#   if (__GLIBC__ == 2) && (__GLIBC_MINOR__ < 3)
 
1969
#   if (__GLIBC__ == 2) && (__GLIBC_MINOR__ < 3) && !defined(__UCLIBC__)
1969
1970
   /*
1970
1971
    * stat structure is same between glibc 2.3 and older glibcs, just
1971
1972
    * these __unused fields are always zero. If we'll use __unused*
2431
2432
    * Linux: Glibc 2.3+ has st_Xtim.  Glibc 2.1/2.2 has st_Xtime/__unusedX on
2432
2433
    *        same place (see below).  We do not support Glibc 2.0 or older.
2433
2434
    */
2434
 
#   if (__GLIBC__ == 2) && (__GLIBC_MINOR__ < 3)
 
2435
#   if (__GLIBC__ == 2) && (__GLIBC_MINOR__ < 3) && !defined(__UCLIBC__)
2435
2436
   /*
2436
2437
    * stat structure is same between glibc 2.3 and older glibcs, just
2437
2438
    * these __unused fields are always zero. If we'll use __unused*
2848
2849
       char *localName;
2849
2850
       size_t localNameSize;
2850
2851
       if (HgfsHandle2FileName(file, session, &localName, &localNameSize)) {
2851
 
          status = HgfsSetHiddenXAttr(localName, attr->flags & HGFS_ATTR_HIDDEN,
 
2852
          status = HgfsSetHiddenXAttr(localName,
 
2853
                                      (attr->flags & HGFS_ATTR_HIDDEN) != 0,
2852
2854
                                      newPermissions);
2853
2855
          free(localName);
2854
2856
       }
3036
3038
   }
3037
3039
 
3038
3040
   if (attr->mask & HGFS_ATTR_VALID_FLAGS) {
3039
 
      status = HgfsSetHiddenXAttr(localName, attr->flags & HGFS_ATTR_HIDDEN,
 
3041
      status = HgfsSetHiddenXAttr(localName,
 
3042
                                  (attr->flags & HGFS_ATTR_HIDDEN) != 0,
3040
3043
                                  newPermissions);
3041
3044
   }
3042
3045
 
4336
4339
 * ChangeInvisibleFlag --
4337
4340
 *
4338
4341
 *    Changes value of the invisible bit in a flags variable to a value defined
4339
 
 *    by setFlag parameter.
 
4342
 *    by setHidden parameter.
4340
4343
 *
4341
4344
 * Results:
4342
4345
 *    TRUE flag has been changed, FALSE otherwise.
4348
4351
 */
4349
4352
 
4350
4353
static Bool
4351
 
ChangeInvisibleFlag(uint16 *flags,           // IN: variable that contains flags
4352
 
                    Bool setFlag)            // IN: new value for the invisible flag
 
4354
ChangeInvisibleFlag(uint16 *flags,           // IN/OUT: variable that contains flags
 
4355
                    Bool setHidden)          // IN: new value for the invisible flag
4353
4356
{
4354
4357
   Bool changed = FALSE;
4355
4358
   /*
4358
4361
    * and then convert back to big endian before saving
4359
4362
    */
4360
4363
   uint16 finderFlags = CFSwapInt16BigToHost(*flags);
4361
 
   Bool isInvisible = (finderFlags & kIsInvisible) != 0;
4362
 
   if (setFlag != isInvisible) {
4363
 
      if (setFlag) {
 
4364
   Bool isHidden = (finderFlags & kIsInvisible) != 0;
 
4365
   if (setHidden) {
 
4366
      if (!isHidden) {
4364
4367
         finderFlags |= kIsInvisible;
4365
 
      } else {
4366
 
         finderFlags &= ~kIsInvisible;
 
4368
         changed = TRUE;
4367
4369
      }
 
4370
   } else if (isHidden) {
 
4371
      finderFlags &= ~kIsInvisible;
 
4372
      changed = TRUE;
 
4373
   }
 
4374
 
 
4375
   if (changed) {
4368
4376
      *flags = CFSwapInt16HostToBig(finderFlags);
4369
 
      changed = TRUE;
4370
4377
   }
4371
4378
   return changed;
4372
4379
}
4390
4397
 
4391
4398
static HgfsInternalStatus
4392
4399
HgfsSetHiddenXAttr(char const *fileName,       // IN: path to the file
4393
 
                   Bool value,                 // IN: new value to the invisible attribute
 
4400
                   Bool setHidden,             // IN: new value to the invisible attribute
4394
4401
                   mode_t permissions)         // IN: permissions of the file
4395
4402
{
4396
4403
   HgfsInternalStatus err;
4408
4415
      switch (attrBuf.objType) {
4409
4416
      case VREG: {
4410
4417
         FileInfo *info = (FileInfo*) attrBuf.finderInfo;
4411
 
         changed = ChangeInvisibleFlag(&info->finderFlags, value);
 
4418
         changed = ChangeInvisibleFlag(&info->finderFlags, setHidden);
4412
4419
         break;
4413
4420
      }
4414
4421
      case VDIR: {
4415
4422
         FolderInfo *info = (FolderInfo*) attrBuf.finderInfo;
4416
 
         changed = ChangeInvisibleFlag(&info->finderFlags, value);
 
4423
         changed = ChangeInvisibleFlag(&info->finderFlags, setHidden);
4417
4424
         break;
4418
4425
      }
4419
4426
      default: