485
485
*-----------------------------------------------------------------------------
487
* HgfsServerPolicy_ProcessCPName --
489
* Get the local path for a share name by looking at the requested
490
* name, finding the matching share (if any) and returning the share's
491
* local path local path and permissions.
494
* An HgfsNameStatus value indicating the result is returned.
496
* The local path for the shareName is also returned if a match is found.
501
*-----------------------------------------------------------------------------
505
HgfsServerPolicy_ProcessCPName(char const *nameIn, // IN: name in CPName form
506
size_t nameInLen, // IN: length of the name
507
Bool *readAccess, // OUT: Read permissions
508
Bool *writeAccess, // OUT: Write permissions
509
char const **shareBaseDir) // OUT: Shared directory
511
HgfsSharedFolder *myShare;
514
ASSERT(shareBaseDir);
516
myShare = HgfsServerPolicyGetShare(&myState, nameIn, nameInLen);
518
LOG(4, ("%s: No matching share name\n", __FUNCTION__));
519
return HGFS_NAME_STATUS_DOES_NOT_EXIST;
522
*readAccess = myShare->readAccess;
523
*writeAccess = myShare->writeAccess;
524
*shareBaseDir = myShare->path;
525
return HGFS_NAME_STATUS_COMPLETE;
530
*-----------------------------------------------------------------------------
487
532
* HgfsServerPolicy_GetShareOptions --
489
534
* Get the HGFS share config options by looking at the requested name,
609
654
return HGFS_NAME_STATUS_COMPLETE;
659
*-----------------------------------------------------------------------------
661
* HgfsServerPolicy_CheckMode --
663
* Checks if the requested mode may be granted depending on read/write permissions.
666
* TRUE if the requested mode can be granted, FALSE otherwise.
671
*-----------------------------------------------------------------------------
675
HgfsServerPolicy_CheckMode(HgfsOpenMode mode, // IN: mode to check
676
Bool writePermissions, // IN: callers write permissions
677
Bool readPermissions) // IN: callers read permissions
680
* See if access is allowed in the requested mode.
682
* XXX Yeah, this is retarded. We should be using bits instead of
683
* an enum for HgfsOpenMode. Add it to the todo list. [bac]
685
switch (HGFS_OPEN_MODE_ACCMODE(mode)) {
686
case HGFS_OPEN_MODE_READ_ONLY:
687
if (!readPermissions) {
688
LOG(4, ("HgfsServerPolicyCheckMode: Read access denied\n"));
693
case HGFS_OPEN_MODE_WRITE_ONLY:
694
if (!writePermissions) {
695
LOG(4, ("HgfsServerPolicyCheckMode: Write access denied\n"));
700
case HGFS_OPEN_MODE_READ_WRITE:
701
if (!readPermissions || !writePermissions) {
702
LOG(4, ("HgfsServerPolicyCheckMode: Read/write access denied\n"));
708
LOG(0, ("HgfsServerPolicyCheckMode: Invalid mode\n"));