Changeset f9f7321e in rtems


Ignore:
Timestamp:
Dec 22, 2015, 6:56:57 AM (4 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
c653559
Parents:
173c44eb
git-author:
Sebastian Huber <sebastian.huber@…> (12/22/15 06:56:57)
git-committer:
Sebastian Huber <sebastian.huber@…> (01/05/16 13:29:09)
Message:

Filesystem: Remove superfluous permission checks

The permission is check by the upper layer.

Files:
4 edited

Legend:

Unmodified
Added
Removed
  • cpukit/libfs/src/imfs/imfs_chown.c

    r173c44eb rf9f7321e  
    3131)
    3232{
    33   IMFS_jnode_t  *jnode;
    34 #if defined(RTEMS_POSIX_API)
    35   uid_t          st_uid;
    36 #endif
     33  IMFS_jnode_t *jnode;
    3734
    3835  jnode = (IMFS_jnode_t *) loc->node_access;
    39 
    40   /*
    41    *  Verify I am the owner of the node or the super user.
    42    */
    43 
    44 #if defined(RTEMS_POSIX_API)
    45   st_uid = geteuid();
    46 
    47   if ( ( st_uid != jnode->st_uid ) && ( st_uid != 0 ) )
    48     rtems_set_errno_and_return_minus_one( EPERM );
    49 #endif
    5036
    5137  jnode->st_uid = owner;
  • cpukit/libfs/src/rfs/rtems-rfs-rtems.c

    r173c44eb rf9f7321e  
    275275  rtems_rfs_ino          ino = rtems_rfs_rtems_get_pathloc_ino (pathloc);
    276276  rtems_rfs_inode_handle inode;
    277 #if defined (RTEMS_POSIX_API)
    278   uid_t                  uid;
    279 #endif
    280277  int                    rc;
    281278
     
    289286    return rtems_rfs_rtems_error ("chown: opening inode", rc);
    290287  }
    291 
    292   /*
    293    *  Verify I am the owner of the node or the super user.
    294    */
    295 
    296 #if defined (RTEMS_POSIX_API)
    297   uid = geteuid();
    298 
    299   if ((uid != rtems_rfs_inode_get_uid (&inode)) && (uid != 0))
    300   {
    301     rtems_rfs_inode_close (fs, &inode);
    302     return rtems_rfs_rtems_error ("chown: not able", EPERM);
    303   }
    304 #endif
    305288
    306289  rtems_rfs_inode_set_uid_gid (&inode, owner, group);
  • testsuites/fstests/fspermission/test.c

    r173c44eb rf9f7321e  
    442442  rtems_test_assert(group_id==statbuf.st_gid);
    443443
     444  status = seteuid(user_id - 1);
     445  rtems_test_assert(status == 0);
     446
     447  errno = 0;
     448  status = chown(file01, user_id, group_id);
     449  rtems_test_assert(status == -1);
     450  rtems_test_assert(errno == EPERM);
     451
     452  status = seteuid(user_id);
     453  rtems_test_assert(status == 0);
     454
     455  status = chown(file01, user_id, group_id);
     456  rtems_test_assert(status == 0);
     457
     458  status = seteuid(0);
     459  rtems_test_assert(status == 0);
     460
     461  status = chown(file01, user_id, group_id);
     462  rtems_test_assert(status == 0);
     463
    444464  status=mkdir(directory01,mode);
    445465  rtems_test_assert(status==0);
  • testsuites/psxtests/psximfs02/init.c

    r173c44eb rf9f7321e  
    161161  rtems_test_assert( status == 0 );
    162162
    163 #if defined(RTEMS_POSIX_API)
    164163  puts( "Attempt chmod on /node -- expect EPERM" );
    165164  status = chmod( "/node", S_IRUSR );
     
    171170  rtems_test_assert( status == -1 );
    172171  rtems_test_assert( errno == EPERM );
    173 #else
    174   puts( "Attempt chmod on /node -- EPERM only when POSIX enabled" );
    175   puts( "Attempt chown on /node -- EPERM only when POSIX enabled" );
    176 #endif
    177172
    178173  puts( "Changing euid back to 0 [root]" );
Note: See TracChangeset for help on using the changeset viewer.