mirror of
https://gitlab.rtems.org/rtems/rtos/rtems.git
synced 2025-11-16 12:34:45 +00:00
2003-11-25 Jennifer Averett <jennifer@OARcorp.com>
PR 519/filesystem * include/rtems/libio_.h, src/eval.c, src/rmdir.c, src/unlink.c: Check write permissions in parent directory for file or directory delete
This commit is contained in:
@@ -1,3 +1,10 @@
|
|||||||
|
2003-11-25 Jennifer Averett <jennifer@OARcorp.com>
|
||||||
|
|
||||||
|
PR 519/filesystem
|
||||||
|
* include/rtems/libio_.h, src/eval.c, src/rmdir.c, src/unlink.c:
|
||||||
|
Check write permissions in parent directory for file or
|
||||||
|
directory delete
|
||||||
|
|
||||||
2003-10-22 Joel Sherrill <joel@OARcorp.com>
|
2003-10-22 Joel Sherrill <joel@OARcorp.com>
|
||||||
|
|
||||||
PR 511/filesystem
|
PR 511/filesystem
|
||||||
|
|||||||
@@ -227,6 +227,11 @@ int rtems_filesystem_evaluate_path(
|
|||||||
int follow_link
|
int follow_link
|
||||||
);
|
);
|
||||||
|
|
||||||
|
int rtems_filesystem_evaluate_parent(
|
||||||
|
int flags,
|
||||||
|
rtems_filesystem_location_info_t *pathloc
|
||||||
|
);
|
||||||
|
|
||||||
void rtems_filesystem_initialize();
|
void rtems_filesystem_initialize();
|
||||||
|
|
||||||
int init_fs_mount_table();
|
int init_fs_mount_table();
|
||||||
|
|||||||
@@ -97,3 +97,27 @@ int rtems_filesystem_evaluate_path(
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int rtems_filesystem_evaluate_parent(
|
||||||
|
int flags,
|
||||||
|
rtems_filesystem_location_info_t *pathloc
|
||||||
|
)
|
||||||
|
{
|
||||||
|
rtems_filesystem_location_info_t parent;
|
||||||
|
int result;
|
||||||
|
|
||||||
|
if ( !pathloc )
|
||||||
|
rtems_set_errno_and_return_minus_one( EIO ); /* should never happen */
|
||||||
|
|
||||||
|
if ( !pathloc->ops->evalpath_h )
|
||||||
|
rtems_set_errno_and_return_minus_one( ENOTSUP );
|
||||||
|
|
||||||
|
parent = *pathloc;
|
||||||
|
result = (*pathloc->ops->evalpath_h)( "..", flags, &parent );
|
||||||
|
if (result != 0){
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
rtems_filesystem_freenode( &parent );
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -39,6 +39,12 @@ int rmdir(
|
|||||||
if ( result != 0 )
|
if ( result != 0 )
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
result = rtems_filesystem_evaluate_parent(RTEMS_LIBIO_PERMS_WRITE, &loc );
|
||||||
|
if (result != 0){
|
||||||
|
rtems_filesystem_freenode( &loc );
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Verify you can remove this node as a directory.
|
* Verify you can remove this node as a directory.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -35,6 +35,12 @@ int unlink(
|
|||||||
if ( result != 0 )
|
if ( result != 0 )
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
result = rtems_filesystem_evaluate_parent(RTEMS_LIBIO_PERMS_WRITE, &loc );
|
||||||
|
if (result != 0){
|
||||||
|
rtems_filesystem_freenode( &loc );
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
if ( !loc.ops->node_type_h ) {
|
if ( !loc.ops->node_type_h ) {
|
||||||
rtems_filesystem_freenode( &loc );
|
rtems_filesystem_freenode( &loc );
|
||||||
rtems_set_errno_and_return_minus_one( ENOTSUP );
|
rtems_set_errno_and_return_minus_one( ENOTSUP );
|
||||||
|
|||||||
Reference in New Issue
Block a user