https://github.com/dcnick3/aurora-test
https://github.com/dcnick3/aurora-test
Last synced: over 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/dcnick3/aurora-test
- Owner: DCNick3
- Created: 2022-04-04T19:20:40.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2022-04-05T07:17:03.000Z (over 4 years ago)
- Last Synced: 2025-01-28T03:29:54.232Z (over 1 year ago)
- Language: C++
- Size: 5.86 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## overview
I decided to use C++ with CMake build system for the task
First of all, I've written C++ wrappers for Linux C functions I needed to get uid & gid by usernames along with file permissions.
In there I used [TartanLlama/expected](https://github.com/TartanLlama/expected) library which is an implementation of https://wg21.link/P0323R11 proposal to handle errors nicely.
This piece of code is located in `unix.cpp` file
The algorithm itself is located in `main.cpp` file. It uses `std::filesystem::recursive_directory_iterator` to traverse the directory tree and functions from `unix.cpp` to get the info necessary for deciding whether the user can write the file or not.
Finally, I use [CLIUtils/CLI11](https://github.com/CLIUtils/CLI11) to parse the command line arguments and provide a nice help message
## how to build & run
Build should as easy as this one-liner:
```
rm -rf cmake-build-debug/ && mkdir -p cmake-build-debug/ && cd cmake-build-debug/ && cmake .. && cmake --build .; cd ..
```
Cmake will download the required libraries and build the program
After this it can be ran as
```
sudo ./cmake-build-debug/mycheckperm -u username -g groupname -p /home/myname/testdir/
```