summaryrefslogtreecommitdiffstats
path: root/src/syslog.rs
diff options
context:
space:
mode:
authorTomasz Kramkowski <tomasz@kramkow.ski>2023-01-30 13:33:22 +0000
committerTomasz Kramkowski <tomasz@kramkow.ski>2023-01-30 18:41:42 +0000
commit6b89e0dcb0d3a513d548fb38c08d4b66a353f364 (patch)
tree57904b88909ba15bbca650d2116a1d91e7699086 /src/syslog.rs
parentdaf57f99f22cd105bf274cb856ae8e198388748e (diff)
downloadpam_usercg_rust-6b89e0dcb0d3a513d548fb38c08d4b66a353f364.tar.gz
pam_usercg_rust-6b89e0dcb0d3a513d548fb38c08d4b66a353f364.tar.xz
pam_usercg_rust-6b89e0dcb0d3a513d548fb38c08d4b66a353f364.zip
Basic pam_syslog error reporting
Diffstat (limited to 'src/syslog.rs')
-rw-r--r--src/syslog.rs48
1 files changed, 48 insertions, 0 deletions
diff --git a/src/syslog.rs b/src/syslog.rs
new file mode 100644
index 0000000..65c8283
--- /dev/null
+++ b/src/syslog.rs
@@ -0,0 +1,48 @@
+use std::ffi::c_int;
+
+#[rustfmt::skip]
+pub enum Level {
+ Emergency = 0,
+ Alert = 1,
+ Critical = 2,
+ Error = 3,
+ Warning = 4,
+ Notice = 5,
+ Info = 6,
+ Debug = 7,
+}
+
+#[rustfmt::skip]
+pub enum Facility {
+ Kernel = 0 << 3,
+ User = 1 << 3,
+ Mail = 2 << 3,
+ Daemon = 3 << 3,
+ Auth = 4 << 3,
+ Syslog = 5 << 3,
+ Lpr = 6 << 3,
+ News = 7 << 3,
+ Uucp = 8 << 3,
+ Cron = 9 << 3,
+ AuthPriv = 10 << 3,
+ Ftp = 11 << 3,
+ Local0 = 12 << 3,
+ Local1 = 13 << 3,
+ Local2 = 14 << 3,
+ Local3 = 15 << 3,
+ Local4 = 16 << 3,
+ Local5 = 17 << 3,
+ Local6 = 18 << 3,
+ Local7 = 19 << 3,
+}
+
+pub struct Priority {
+ pub level: Level,
+ pub facility: Facility,
+}
+
+impl Into<c_int> for Priority {
+ fn into(self) -> c_int {
+ self.level as c_int | self.facility as c_int
+ }
+}