Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/n0la/lua-openbsd
Lua library that binds to OpenBSD specific functions
https://github.com/n0la/lua-openbsd
Last synced: 3 months ago
JSON representation
Lua library that binds to OpenBSD specific functions
- Host: GitHub
- URL: https://github.com/n0la/lua-openbsd
- Owner: n0la
- License: mit
- Created: 2016-01-19T21:37:19.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2023-06-16T08:59:53.000Z (over 1 year ago)
- Last Synced: 2024-02-14T03:28:34.871Z (9 months ago)
- Language: C
- Size: 14.6 KB
- Stars: 12
- Watchers: 6
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: COPYING
Awesome Lists containing this project
- awesome-pledge - lua-openbsd - *Lua library that binds to OpenBSD specific functions* (Libraries)
README
# OpenBSD Lua Library
Implements:
* pledge()
* arc4random()
* arc4random_uniform()
* unveil()
* auth_userokay()Works and has been tested on Lua 5.1, 5.2, 5.3 and 5.4.
Note that pledge() pre 6.3 takes an optional set of paths as the second
argument.```lua
-- OK
o.pledge('rpath stdio')
-- Error
o.pledge('rpath stdio', 'stdio')
```## Build
Don't forget to set the `MODLUA_VERSION` variable to the Lua version you are
using.```
$ mkdir build && cd build
$ cmake .. -DMODLUA_VERSION=5.4
$ make
$ make install
```## Usage
```lua
#!/usr/bin/env lua51o = require('openbsd')
ret, error_string = o.pledge('rpath stdio')
if ret == -1 then
error(error_string)
end
```Or:
```
#!/usr/bin/env lua54o = require('openbsd')
for i = 1, 10 do
print(o.arc4random_uniform(20))
end
```## Author
Written by Florian Stinglmayr
Copyright (c) 2016, All Rights Reserved