~n-muench/ubuntu/oneiric/open-vm-tools/open-vm-tools.fix-836277

« back to all changes in this revision

Viewing changes to lib/hgfsServerPolicyGuest/hgfsServerPolicyGuest.c

  • Committer: Bazaar Package Importer
  • Author(s): Devid Antonio Filoni
  • Date: 2008-08-15 21:21:40 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20080815212140-05fhxj8wroosysmj
Tags: 2008.08.08-109361-1ubuntu1
* Merge from Debian unstable (LP: #258393), remaining Ubuntu change:
  - add ubuntu_toolchain_FTBFS.dpatch patch, fix FTBFS
* Update ubuntu_toolchain_FTBFS.dpatch patch for the new version.

Show diffs side-by-side

added added

removed removed

Lines of Context:
129
129
{
130
130
   HgfsSharedFolder *rootShare;
131
131
 
132
 
   /* 
133
 
    * We do not recognize this callback, so make sure our caller doesn't pass 
 
132
   /*
 
133
    * We do not recognize this callback, so make sure our caller doesn't pass
134
134
    * it in.
135
135
    */
136
136
   ASSERT(!invalidateObjects);
220
220
   ASSERT(state);
221
221
   ASSERT(nameIn);
222
222
 
223
 
   /* 
224
 
    * First try to find a share that matches the given name exactly. 
 
223
   /*
 
224
    * First try to find a share that matches the given name exactly.
225
225
    * This is to handle the case where 2 share names differ in case only.
226
226
    */
227
227
 
236
236
      }
237
237
   }
238
238
 
239
 
   /* 
 
239
   /*
240
240
    * There was no match. As a fall back try a case insensitive match.
241
241
    * This is because some Windows applications uppercase or lowercase the
242
 
    * entire path before sending the request. 
 
242
    * entire path before sending the request.
243
243
    */
244
 
   
 
244
 
245
245
   for (l = state->shares.next; l != &state->shares; l = l->next) {
246
246
      HgfsSharedFolder *share;
247
247
      char *tempName;
248
248
 
249
249
      /*
250
 
       * Null terminate the input name before a case insensitive comparison. 
 
250
       * Null terminate the input name before a case insensitive comparison.
251
251
       * This is just to protect against bad implementations of strnicmp.
252
252
       */
253
253
 
273
273
 
274
274
      free(tempName);
275
275
   }
276
 
   
 
276
 
277
277
   return NULL;
278
278
}
279
279
 
413
413
 * Results:
414
414
 *    An HgfsNameStatus value indicating the result is returned.
415
415
 *
416
 
 *    The local path for the shareName is also returned if a match is found and 
 
416
 *    The local path for the shareName is also returned if a match is found and
417
417
 *    access is permitted.
418
418
 *
419
419
 * Side effects:
427
427
                              size_t nameInLen,          // IN: Length of nameIn
428
428
                              HgfsOpenMode mode,         // IN: Requested access mode
429
429
                              size_t *sharePathLen,      // OUT: Length of share path
430
 
                              char const **sharePath,    // OUT: Share path
431
 
                              HgfsSharedFolder **share)  // OUT: Share
 
430
                              char const **sharePath)    // OUT: Share path
432
431
{
433
432
   HgfsSharedFolder *myShare;
434
433
 
478
477
 
479
478
   *sharePathLen = myShare->pathLen;
480
479
   *sharePath = myShare->path;
481
 
   if (share) {
482
 
      *share = myShare;
 
480
   return HGFS_NAME_STATUS_COMPLETE;
 
481
}
 
482
 
 
483
 
 
484
/*
 
485
 *-----------------------------------------------------------------------------
 
486
 *
 
487
 * HgfsServerPolicy_GetShareOptions --
 
488
 *
 
489
 *    Get the HGFS share config options by looking at the requested name,
 
490
 *    finding the matching share (if any).
 
491
 *
 
492
 * Results:
 
493
 *    HGFS_NAME_STATUS_COMPLETE on success, and HGFS_NAME_STATUS_DOES_NOT_EXIST
 
494
 *    if no matching share.
 
495
 *
 
496
 * Side effects:
 
497
 *    None
 
498
 *
 
499
 *-----------------------------------------------------------------------------
 
500
 */
 
501
 
 
502
HgfsNameStatus
 
503
HgfsServerPolicy_GetShareOptions(char const *nameIn,         // IN: Share name
 
504
                      size_t nameInLen,                      // IN: Length of share name
 
505
                      HgfsShareOptions *configOptions)       // OUT: Share config options
 
506
{
 
507
   HgfsSharedFolder *share;
 
508
 
 
509
   ASSERT(nameIn);
 
510
   ASSERT(configOptions);
 
511
 
 
512
   share = HgfsServerPolicyGetShare(&myState, nameIn, nameInLen);
 
513
   if (!share) {
 
514
      LOG(4, ("HgfsServerPolicy_GetShareOptions: No matching share name.\n"));
 
515
      return HGFS_NAME_STATUS_DOES_NOT_EXIST;
483
516
   }
 
517
   *configOptions = share->configOptions;
484
518
   return HGFS_NAME_STATUS_COMPLETE;
485
519
}
486
520
 
488
522
/*
489
523
 *-----------------------------------------------------------------------------
490
524
 *
 
525
 * HgfsServerPolicy_IsShareOptionSet --
 
526
 *
 
527
 *    Check if the specified config option is set.
 
528
 *
 
529
 * Results:
 
530
 *    TRUE if set.
 
531
 *    FALSE otherwise.
 
532
 *
 
533
 * Side effects:
 
534
 *    None
 
535
 *
 
536
 *-----------------------------------------------------------------------------
 
537
 */
 
538
 
 
539
Bool
 
540
HgfsServerPolicy_IsShareOptionSet(HgfsShareOptions configOptions, // IN: config options
 
541
                                  uint32 option)                  // IN: option to check
 
542
{
 
543
   return (configOptions & option) == option;
 
544
}
 
545
 
 
546
 
 
547
/*
 
548
 *-----------------------------------------------------------------------------
 
549
 *
491
550
 * HgfsServerPolicy_GetShareMode --
492
551
 *
493
552
 *    Get the access mode for a share by looking at the requested
494
 
 *    name, finding the matching share (if any), and returning 
 
553
 *    name, finding the matching share (if any), and returning
495
554
 *    the share's access mode.
496
555
 *
497
556
 * Results:
498
 
 *    An HgfsNameStatus value indicating the result is returned.    
 
557
 *    An HgfsNameStatus value indicating the result is returned.
499
558
 *
500
559
 *    The access mode for the shareName is also returned if a match is found.
501
560
 *