annotate src/constants.rs @ 103:dfcd96a74ac4 default tip

write a truly prodigious amount of documentation adds a bunch of links to the OpenPAM man pages and the XSSO spec as well as just a bunch of prose and stuff.
author Paul Fisher <paul@pfish.zone>
date Wed, 25 Jun 2025 00:59:24 -0400
parents efe2f5f8b5b2
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
60
05cc2c27334f The Big Refactor: clean up docs and exports.
Paul Fisher <paul@pfish.zone>
parents: 59
diff changeset
1 //! Constants and enum values from the PAM library.
05cc2c27334f The Big Refactor: clean up docs and exports.
Paul Fisher <paul@pfish.zone>
parents: 59
diff changeset
2
87
05291b601f0a Well and truly separate the Linux extensions.
Paul Fisher <paul@pfish.zone>
parents: 86
diff changeset
3 // We have a lot of dumb casts that we just gotta do because of differences
05291b601f0a Well and truly separate the Linux extensions.
Paul Fisher <paul@pfish.zone>
parents: 86
diff changeset
4 // between Linux-PAM and OpenPAM header files.
05291b601f0a Well and truly separate the Linux extensions.
Paul Fisher <paul@pfish.zone>
parents: 86
diff changeset
5 #![allow(clippy::unnecessary_cast)]
05291b601f0a Well and truly separate the Linux extensions.
Paul Fisher <paul@pfish.zone>
parents: 86
diff changeset
6
80
5aa1a010f1e8 Start using PAM headers; improve owned/borrowed distinction.
Paul Fisher <paul@pfish.zone>
parents: 77
diff changeset
7 #[cfg(feature = "link")]
5aa1a010f1e8 Start using PAM headers; improve owned/borrowed distinction.
Paul Fisher <paul@pfish.zone>
parents: 77
diff changeset
8 use crate::libpam::pam_ffi;
103
dfcd96a74ac4 write a truly prodigious amount of documentation
Paul Fisher <paul@pfish.zone>
parents: 97
diff changeset
9 use crate::{_linklist, _man7, _manbsd, _xsso};
56
daa2cde64601 Big big refactor. Probably should have been multiple changes.
Paul Fisher <paul@pfish.zone>
parents: 55
diff changeset
10 use bitflags::bitflags;
80
5aa1a010f1e8 Start using PAM headers; improve owned/borrowed distinction.
Paul Fisher <paul@pfish.zone>
parents: 77
diff changeset
11 use libc::c_int;
5aa1a010f1e8 Start using PAM headers; improve owned/borrowed distinction.
Paul Fisher <paul@pfish.zone>
parents: 77
diff changeset
12 use num_enum::{IntoPrimitive, TryFromPrimitive};
90
f6186e41399b Miscellaneous fixes and cleanup:
Paul Fisher <paul@pfish.zone>
parents: 87
diff changeset
13 use std::error::Error;
84
a638a45e5f1f do some real irritating i32/u32 juggling to make bindgen happy
Paul Fisher <paul@pfish.zone>
parents: 80
diff changeset
14 use std::ffi::c_uint;
90
f6186e41399b Miscellaneous fixes and cleanup:
Paul Fisher <paul@pfish.zone>
parents: 87
diff changeset
15 use std::fmt;
f6186e41399b Miscellaneous fixes and cleanup:
Paul Fisher <paul@pfish.zone>
parents: 87
diff changeset
16 use std::fmt::{Display, Formatter};
71
58f9d2a4df38 Reorganize everything again???
Paul Fisher <paul@pfish.zone>
parents: 70
diff changeset
17 use std::result::Result as StdResult;
15
27730595f1ea Adding pam-http module
Anthony Nowell <anthony@algorithmia.com>
parents:
diff changeset
18
80
5aa1a010f1e8 Start using PAM headers; improve owned/borrowed distinction.
Paul Fisher <paul@pfish.zone>
parents: 77
diff changeset
19 /// Arbitrary values for PAM constants when not linking against system PAM.
5aa1a010f1e8 Start using PAM headers; improve owned/borrowed distinction.
Paul Fisher <paul@pfish.zone>
parents: 77
diff changeset
20 ///
5aa1a010f1e8 Start using PAM headers; improve owned/borrowed distinction.
Paul Fisher <paul@pfish.zone>
parents: 77
diff changeset
21 /// **The values of these constants are deliberately selected _not_ to match
5aa1a010f1e8 Start using PAM headers; improve owned/borrowed distinction.
Paul Fisher <paul@pfish.zone>
parents: 77
diff changeset
22 /// any PAM implementations. Applications should always use the symbolic value
5aa1a010f1e8 Start using PAM headers; improve owned/borrowed distinction.
Paul Fisher <paul@pfish.zone>
parents: 77
diff changeset
23 /// and not a magic number.**
5aa1a010f1e8 Start using PAM headers; improve owned/borrowed distinction.
Paul Fisher <paul@pfish.zone>
parents: 77
diff changeset
24 #[cfg(not(feature = "link"))]
85
5e14bb093851 fix more openpam compat stuff
Paul Fisher <paul@pfish.zone>
parents: 84
diff changeset
25 mod pam_ffi {
92
5ddbcada30f2 Add the ability to log against a PAM handle.
Paul Fisher <paul@pfish.zone>
parents: 90
diff changeset
26 use std::ffi::c_uint;
5ddbcada30f2 Add the ability to log against a PAM handle.
Paul Fisher <paul@pfish.zone>
parents: 90
diff changeset
27
80
5aa1a010f1e8 Start using PAM headers; improve owned/borrowed distinction.
Paul Fisher <paul@pfish.zone>
parents: 77
diff changeset
28 macro_rules! define {
5aa1a010f1e8 Start using PAM headers; improve owned/borrowed distinction.
Paul Fisher <paul@pfish.zone>
parents: 77
diff changeset
29 ($(#[$attr:meta])* $($name:ident = $value:expr),+) => {
5aa1a010f1e8 Start using PAM headers; improve owned/borrowed distinction.
Paul Fisher <paul@pfish.zone>
parents: 77
diff changeset
30 define!(
5aa1a010f1e8 Start using PAM headers; improve owned/borrowed distinction.
Paul Fisher <paul@pfish.zone>
parents: 77
diff changeset
31 @meta { $(#[$attr])* }
84
a638a45e5f1f do some real irritating i32/u32 juggling to make bindgen happy
Paul Fisher <paul@pfish.zone>
parents: 80
diff changeset
32 $(pub const $name: u32 = $value;)+
80
5aa1a010f1e8 Start using PAM headers; improve owned/borrowed distinction.
Paul Fisher <paul@pfish.zone>
parents: 77
diff changeset
33 );
5aa1a010f1e8 Start using PAM headers; improve owned/borrowed distinction.
Paul Fisher <paul@pfish.zone>
parents: 77
diff changeset
34 };
5aa1a010f1e8 Start using PAM headers; improve owned/borrowed distinction.
Paul Fisher <paul@pfish.zone>
parents: 77
diff changeset
35 (@meta $m:tt $($i:item)+) => { define!(@expand $($m $i)+); };
5aa1a010f1e8 Start using PAM headers; improve owned/borrowed distinction.
Paul Fisher <paul@pfish.zone>
parents: 77
diff changeset
36 (@expand $({ $(#[$m:meta])* } $i:item)+) => {$($(#[$m])* $i)+};
5aa1a010f1e8 Start using PAM headers; improve owned/borrowed distinction.
Paul Fisher <paul@pfish.zone>
parents: 77
diff changeset
37 }
84
a638a45e5f1f do some real irritating i32/u32 juggling to make bindgen happy
Paul Fisher <paul@pfish.zone>
parents: 80
diff changeset
38 const fn bit(n: u8) -> u32 {
80
5aa1a010f1e8 Start using PAM headers; improve owned/borrowed distinction.
Paul Fisher <paul@pfish.zone>
parents: 77
diff changeset
39 1 << n
5aa1a010f1e8 Start using PAM headers; improve owned/borrowed distinction.
Paul Fisher <paul@pfish.zone>
parents: 77
diff changeset
40 }
5aa1a010f1e8 Start using PAM headers; improve owned/borrowed distinction.
Paul Fisher <paul@pfish.zone>
parents: 77
diff changeset
41 define!(
5aa1a010f1e8 Start using PAM headers; improve owned/borrowed distinction.
Paul Fisher <paul@pfish.zone>
parents: 77
diff changeset
42 PAM_SILENT = bit(13),
5aa1a010f1e8 Start using PAM headers; improve owned/borrowed distinction.
Paul Fisher <paul@pfish.zone>
parents: 77
diff changeset
43 PAM_DISALLOW_NULL_AUTHTOK = bit(14),
5aa1a010f1e8 Start using PAM headers; improve owned/borrowed distinction.
Paul Fisher <paul@pfish.zone>
parents: 77
diff changeset
44 PAM_ESTABLISH_CRED = bit(15),
5aa1a010f1e8 Start using PAM headers; improve owned/borrowed distinction.
Paul Fisher <paul@pfish.zone>
parents: 77
diff changeset
45 PAM_DELETE_CRED = bit(16),
5aa1a010f1e8 Start using PAM headers; improve owned/borrowed distinction.
Paul Fisher <paul@pfish.zone>
parents: 77
diff changeset
46 PAM_REINITIALIZE_CRED = bit(17),
5aa1a010f1e8 Start using PAM headers; improve owned/borrowed distinction.
Paul Fisher <paul@pfish.zone>
parents: 77
diff changeset
47 PAM_REFRESH_CRED = bit(18),
5aa1a010f1e8 Start using PAM headers; improve owned/borrowed distinction.
Paul Fisher <paul@pfish.zone>
parents: 77
diff changeset
48 PAM_CHANGE_EXPIRED_AUTHTOK = bit(19),
5aa1a010f1e8 Start using PAM headers; improve owned/borrowed distinction.
Paul Fisher <paul@pfish.zone>
parents: 77
diff changeset
49 PAM_PRELIM_CHECK = bit(20),
5aa1a010f1e8 Start using PAM headers; improve owned/borrowed distinction.
Paul Fisher <paul@pfish.zone>
parents: 77
diff changeset
50 PAM_UPDATE_AUTHTOK = bit(21)
5aa1a010f1e8 Start using PAM headers; improve owned/borrowed distinction.
Paul Fisher <paul@pfish.zone>
parents: 77
diff changeset
51 );
5aa1a010f1e8 Start using PAM headers; improve owned/borrowed distinction.
Paul Fisher <paul@pfish.zone>
parents: 77
diff changeset
52
5aa1a010f1e8 Start using PAM headers; improve owned/borrowed distinction.
Paul Fisher <paul@pfish.zone>
parents: 77
diff changeset
53 define!(
5aa1a010f1e8 Start using PAM headers; improve owned/borrowed distinction.
Paul Fisher <paul@pfish.zone>
parents: 77
diff changeset
54 PAM_ABORT = 513,
5aa1a010f1e8 Start using PAM headers; improve owned/borrowed distinction.
Paul Fisher <paul@pfish.zone>
parents: 77
diff changeset
55 PAM_ACCT_EXPIRED = 514,
5aa1a010f1e8 Start using PAM headers; improve owned/borrowed distinction.
Paul Fisher <paul@pfish.zone>
parents: 77
diff changeset
56 PAM_AUTHINFO_UNAVAIL = 515,
5aa1a010f1e8 Start using PAM headers; improve owned/borrowed distinction.
Paul Fisher <paul@pfish.zone>
parents: 77
diff changeset
57 PAM_AUTHTOK_DISABLE_AGING = 516,
5aa1a010f1e8 Start using PAM headers; improve owned/borrowed distinction.
Paul Fisher <paul@pfish.zone>
parents: 77
diff changeset
58 PAM_AUTHTOK_ERR = 517,
5aa1a010f1e8 Start using PAM headers; improve owned/borrowed distinction.
Paul Fisher <paul@pfish.zone>
parents: 77
diff changeset
59 PAM_AUTHTOK_EXPIRED = 518,
5aa1a010f1e8 Start using PAM headers; improve owned/borrowed distinction.
Paul Fisher <paul@pfish.zone>
parents: 77
diff changeset
60 PAM_AUTHTOK_LOCK_BUSY = 519,
5aa1a010f1e8 Start using PAM headers; improve owned/borrowed distinction.
Paul Fisher <paul@pfish.zone>
parents: 77
diff changeset
61 PAM_AUTHTOK_RECOVERY_ERR = 520,
5aa1a010f1e8 Start using PAM headers; improve owned/borrowed distinction.
Paul Fisher <paul@pfish.zone>
parents: 77
diff changeset
62 PAM_AUTH_ERR = 521,
5aa1a010f1e8 Start using PAM headers; improve owned/borrowed distinction.
Paul Fisher <paul@pfish.zone>
parents: 77
diff changeset
63 PAM_BAD_ITEM = 522,
5aa1a010f1e8 Start using PAM headers; improve owned/borrowed distinction.
Paul Fisher <paul@pfish.zone>
parents: 77
diff changeset
64 PAM_BUF_ERR = 533,
5aa1a010f1e8 Start using PAM headers; improve owned/borrowed distinction.
Paul Fisher <paul@pfish.zone>
parents: 77
diff changeset
65 PAM_CONV_AGAIN = 534,
5aa1a010f1e8 Start using PAM headers; improve owned/borrowed distinction.
Paul Fisher <paul@pfish.zone>
parents: 77
diff changeset
66 PAM_CONV_ERR = 535,
5aa1a010f1e8 Start using PAM headers; improve owned/borrowed distinction.
Paul Fisher <paul@pfish.zone>
parents: 77
diff changeset
67 PAM_CRED_ERR = 536,
5aa1a010f1e8 Start using PAM headers; improve owned/borrowed distinction.
Paul Fisher <paul@pfish.zone>
parents: 77
diff changeset
68 PAM_CRED_EXPIRED = 537,
5aa1a010f1e8 Start using PAM headers; improve owned/borrowed distinction.
Paul Fisher <paul@pfish.zone>
parents: 77
diff changeset
69 PAM_CRED_INSUFFICIENT = 538,
5aa1a010f1e8 Start using PAM headers; improve owned/borrowed distinction.
Paul Fisher <paul@pfish.zone>
parents: 77
diff changeset
70 PAM_CRED_UNAVAIL = 539,
5aa1a010f1e8 Start using PAM headers; improve owned/borrowed distinction.
Paul Fisher <paul@pfish.zone>
parents: 77
diff changeset
71 PAM_IGNORE = 540,
5aa1a010f1e8 Start using PAM headers; improve owned/borrowed distinction.
Paul Fisher <paul@pfish.zone>
parents: 77
diff changeset
72 PAM_INCOMPLETE = 541,
5aa1a010f1e8 Start using PAM headers; improve owned/borrowed distinction.
Paul Fisher <paul@pfish.zone>
parents: 77
diff changeset
73 PAM_MAXTRIES = 542,
5aa1a010f1e8 Start using PAM headers; improve owned/borrowed distinction.
Paul Fisher <paul@pfish.zone>
parents: 77
diff changeset
74 PAM_MODULE_UNKNOWN = 543,
5aa1a010f1e8 Start using PAM headers; improve owned/borrowed distinction.
Paul Fisher <paul@pfish.zone>
parents: 77
diff changeset
75 PAM_NEW_AUTHTOK_REQD = 544,
5aa1a010f1e8 Start using PAM headers; improve owned/borrowed distinction.
Paul Fisher <paul@pfish.zone>
parents: 77
diff changeset
76 PAM_NO_MODULE_DATA = 545,
5aa1a010f1e8 Start using PAM headers; improve owned/borrowed distinction.
Paul Fisher <paul@pfish.zone>
parents: 77
diff changeset
77 PAM_OPEN_ERR = 546,
5aa1a010f1e8 Start using PAM headers; improve owned/borrowed distinction.
Paul Fisher <paul@pfish.zone>
parents: 77
diff changeset
78 PAM_PERM_DENIED = 547,
5aa1a010f1e8 Start using PAM headers; improve owned/borrowed distinction.
Paul Fisher <paul@pfish.zone>
parents: 77
diff changeset
79 PAM_SERVICE_ERR = 548,
5aa1a010f1e8 Start using PAM headers; improve owned/borrowed distinction.
Paul Fisher <paul@pfish.zone>
parents: 77
diff changeset
80 PAM_SESSION_ERR = 549,
5aa1a010f1e8 Start using PAM headers; improve owned/borrowed distinction.
Paul Fisher <paul@pfish.zone>
parents: 77
diff changeset
81 PAM_SYMBOL_ERR = 550,
5aa1a010f1e8 Start using PAM headers; improve owned/borrowed distinction.
Paul Fisher <paul@pfish.zone>
parents: 77
diff changeset
82 PAM_SYSTEM_ERR = 551,
5aa1a010f1e8 Start using PAM headers; improve owned/borrowed distinction.
Paul Fisher <paul@pfish.zone>
parents: 77
diff changeset
83 PAM_TRY_AGAIN = 552,
5aa1a010f1e8 Start using PAM headers; improve owned/borrowed distinction.
Paul Fisher <paul@pfish.zone>
parents: 77
diff changeset
84 PAM_USER_UNKNOWN = 553
5aa1a010f1e8 Start using PAM headers; improve owned/borrowed distinction.
Paul Fisher <paul@pfish.zone>
parents: 77
diff changeset
85 );
90
f6186e41399b Miscellaneous fixes and cleanup:
Paul Fisher <paul@pfish.zone>
parents: 87
diff changeset
86
92
5ddbcada30f2 Add the ability to log against a PAM handle.
Paul Fisher <paul@pfish.zone>
parents: 90
diff changeset
87 /// Dummy implementation of strerror so that it always returns None.
5ddbcada30f2 Add the ability to log against a PAM handle.
Paul Fisher <paul@pfish.zone>
parents: 90
diff changeset
88 pub fn strerror(val: c_uint) -> Option<&'static str> {
5ddbcada30f2 Add the ability to log against a PAM handle.
Paul Fisher <paul@pfish.zone>
parents: 90
diff changeset
89 _ = val;
90
f6186e41399b Miscellaneous fixes and cleanup:
Paul Fisher <paul@pfish.zone>
parents: 87
diff changeset
90 None
f6186e41399b Miscellaneous fixes and cleanup:
Paul Fisher <paul@pfish.zone>
parents: 87
diff changeset
91 }
80
5aa1a010f1e8 Start using PAM headers; improve owned/borrowed distinction.
Paul Fisher <paul@pfish.zone>
parents: 77
diff changeset
92 }
5aa1a010f1e8 Start using PAM headers; improve owned/borrowed distinction.
Paul Fisher <paul@pfish.zone>
parents: 77
diff changeset
93
56
daa2cde64601 Big big refactor. Probably should have been multiple changes.
Paul Fisher <paul@pfish.zone>
parents: 55
diff changeset
94 bitflags! {
60
05cc2c27334f The Big Refactor: clean up docs and exports.
Paul Fisher <paul@pfish.zone>
parents: 59
diff changeset
95 /// The available PAM flags.
05cc2c27334f The Big Refactor: clean up docs and exports.
Paul Fisher <paul@pfish.zone>
parents: 59
diff changeset
96 ///
64
bbe84835d6db More organization; add lots of docs.
Paul Fisher <paul@pfish.zone>
parents: 63
diff changeset
97 /// See `/usr/include/security/_pam_types.h` and
bbe84835d6db More organization; add lots of docs.
Paul Fisher <paul@pfish.zone>
parents: 63
diff changeset
98 /// See `/usr/include/security/pam_modules.h` for more details.
97
efe2f5f8b5b2 Implement "stateless" application-side PAM calls.
Paul Fisher <paul@pfish.zone>
parents: 92
diff changeset
99 #[derive(Debug, Default, PartialEq)]
56
daa2cde64601 Big big refactor. Probably should have been multiple changes.
Paul Fisher <paul@pfish.zone>
parents: 55
diff changeset
100 #[repr(transparent)]
84
a638a45e5f1f do some real irritating i32/u32 juggling to make bindgen happy
Paul Fisher <paul@pfish.zone>
parents: 80
diff changeset
101 pub struct Flags: c_uint {
64
bbe84835d6db More organization; add lots of docs.
Paul Fisher <paul@pfish.zone>
parents: 63
diff changeset
102 /// The module should not generate any messages.
85
5e14bb093851 fix more openpam compat stuff
Paul Fisher <paul@pfish.zone>
parents: 84
diff changeset
103 const SILENT = pam_ffi::PAM_SILENT as u32;
64
bbe84835d6db More organization; add lots of docs.
Paul Fisher <paul@pfish.zone>
parents: 63
diff changeset
104
bbe84835d6db More organization; add lots of docs.
Paul Fisher <paul@pfish.zone>
parents: 63
diff changeset
105 /// The module should return [ErrorCode::AuthError]
bbe84835d6db More organization; add lots of docs.
Paul Fisher <paul@pfish.zone>
parents: 63
diff changeset
106 /// if the user has an empty authentication token
bbe84835d6db More organization; add lots of docs.
Paul Fisher <paul@pfish.zone>
parents: 63
diff changeset
107 /// rather than immediately accepting them.
85
5e14bb093851 fix more openpam compat stuff
Paul Fisher <paul@pfish.zone>
parents: 84
diff changeset
108 const DISALLOW_NULL_AUTHTOK = pam_ffi::PAM_DISALLOW_NULL_AUTHTOK as u32;
64
bbe84835d6db More organization; add lots of docs.
Paul Fisher <paul@pfish.zone>
parents: 63
diff changeset
109
bbe84835d6db More organization; add lots of docs.
Paul Fisher <paul@pfish.zone>
parents: 63
diff changeset
110 // Flag used for `set_credentials`.
bbe84835d6db More organization; add lots of docs.
Paul Fisher <paul@pfish.zone>
parents: 63
diff changeset
111
60
05cc2c27334f The Big Refactor: clean up docs and exports.
Paul Fisher <paul@pfish.zone>
parents: 59
diff changeset
112 /// Set user credentials for an authentication service.
85
5e14bb093851 fix more openpam compat stuff
Paul Fisher <paul@pfish.zone>
parents: 84
diff changeset
113 const ESTABLISH_CREDENTIALS = pam_ffi::PAM_ESTABLISH_CRED as u32;
60
05cc2c27334f The Big Refactor: clean up docs and exports.
Paul Fisher <paul@pfish.zone>
parents: 59
diff changeset
114 /// Delete user credentials associated with
05cc2c27334f The Big Refactor: clean up docs and exports.
Paul Fisher <paul@pfish.zone>
parents: 59
diff changeset
115 /// an authentication service.
85
5e14bb093851 fix more openpam compat stuff
Paul Fisher <paul@pfish.zone>
parents: 84
diff changeset
116 const DELETE_CREDENTIALS = pam_ffi::PAM_DELETE_CRED as u32;
60
05cc2c27334f The Big Refactor: clean up docs and exports.
Paul Fisher <paul@pfish.zone>
parents: 59
diff changeset
117 /// Reinitialize user credentials.
85
5e14bb093851 fix more openpam compat stuff
Paul Fisher <paul@pfish.zone>
parents: 84
diff changeset
118 const REINITIALIZE_CREDENTIALS = pam_ffi::PAM_REINITIALIZE_CRED as u32;
60
05cc2c27334f The Big Refactor: clean up docs and exports.
Paul Fisher <paul@pfish.zone>
parents: 59
diff changeset
119 /// Extend the lifetime of user credentials.
85
5e14bb093851 fix more openpam compat stuff
Paul Fisher <paul@pfish.zone>
parents: 84
diff changeset
120 const REFRESH_CREDENTIALS = pam_ffi::PAM_REFRESH_CRED as u32;
64
bbe84835d6db More organization; add lots of docs.
Paul Fisher <paul@pfish.zone>
parents: 63
diff changeset
121
bbe84835d6db More organization; add lots of docs.
Paul Fisher <paul@pfish.zone>
parents: 63
diff changeset
122 // Flags used for password changing.
bbe84835d6db More organization; add lots of docs.
Paul Fisher <paul@pfish.zone>
parents: 63
diff changeset
123
60
05cc2c27334f The Big Refactor: clean up docs and exports.
Paul Fisher <paul@pfish.zone>
parents: 59
diff changeset
124 /// The password service should only update those passwords
05cc2c27334f The Big Refactor: clean up docs and exports.
Paul Fisher <paul@pfish.zone>
parents: 59
diff changeset
125 /// that have aged. If this flag is _not_ passed,
05cc2c27334f The Big Refactor: clean up docs and exports.
Paul Fisher <paul@pfish.zone>
parents: 59
diff changeset
126 /// the password service should update all passwords.
64
bbe84835d6db More organization; add lots of docs.
Paul Fisher <paul@pfish.zone>
parents: 63
diff changeset
127 ///
bbe84835d6db More organization; add lots of docs.
Paul Fisher <paul@pfish.zone>
parents: 63
diff changeset
128 /// This flag is only used by `change_authtok`.
86
23162cd399aa fix THE REST OF THE CONSTANTS
Paul Fisher <paul@pfish.zone>
parents: 85
diff changeset
129 const CHANGE_EXPIRED_AUTHTOK = pam_ffi::PAM_CHANGE_EXPIRED_AUTHTOK as u32;
64
bbe84835d6db More organization; add lots of docs.
Paul Fisher <paul@pfish.zone>
parents: 63
diff changeset
130 /// This is a preliminary check for password changing.
bbe84835d6db More organization; add lots of docs.
Paul Fisher <paul@pfish.zone>
parents: 63
diff changeset
131 /// The password should not be changed.
bbe84835d6db More organization; add lots of docs.
Paul Fisher <paul@pfish.zone>
parents: 63
diff changeset
132 ///
bbe84835d6db More organization; add lots of docs.
Paul Fisher <paul@pfish.zone>
parents: 63
diff changeset
133 /// This is only used between PAM and a module.
bbe84835d6db More organization; add lots of docs.
Paul Fisher <paul@pfish.zone>
parents: 63
diff changeset
134 /// Applications may not use this flag.
bbe84835d6db More organization; add lots of docs.
Paul Fisher <paul@pfish.zone>
parents: 63
diff changeset
135 ///
bbe84835d6db More organization; add lots of docs.
Paul Fisher <paul@pfish.zone>
parents: 63
diff changeset
136 /// This flag is only used by `change_authtok`.
86
23162cd399aa fix THE REST OF THE CONSTANTS
Paul Fisher <paul@pfish.zone>
parents: 85
diff changeset
137 const PRELIMINARY_CHECK = pam_ffi::PAM_PRELIM_CHECK as u32;
64
bbe84835d6db More organization; add lots of docs.
Paul Fisher <paul@pfish.zone>
parents: 63
diff changeset
138 /// The password should actuallyPR be updated.
bbe84835d6db More organization; add lots of docs.
Paul Fisher <paul@pfish.zone>
parents: 63
diff changeset
139 /// This and [Self::PRELIMINARY_CHECK] are mutually exclusive.
bbe84835d6db More organization; add lots of docs.
Paul Fisher <paul@pfish.zone>
parents: 63
diff changeset
140 ///
bbe84835d6db More organization; add lots of docs.
Paul Fisher <paul@pfish.zone>
parents: 63
diff changeset
141 /// This is only used between PAM and a module.
bbe84835d6db More organization; add lots of docs.
Paul Fisher <paul@pfish.zone>
parents: 63
diff changeset
142 /// Applications may not use this flag.
bbe84835d6db More organization; add lots of docs.
Paul Fisher <paul@pfish.zone>
parents: 63
diff changeset
143 ///
bbe84835d6db More organization; add lots of docs.
Paul Fisher <paul@pfish.zone>
parents: 63
diff changeset
144 /// This flag is only used by `change_authtok`.
86
23162cd399aa fix THE REST OF THE CONSTANTS
Paul Fisher <paul@pfish.zone>
parents: 85
diff changeset
145 const UPDATE_AUTHTOK = pam_ffi::PAM_UPDATE_AUTHTOK as u32;
56
daa2cde64601 Big big refactor. Probably should have been multiple changes.
Paul Fisher <paul@pfish.zone>
parents: 55
diff changeset
146 }
daa2cde64601 Big big refactor. Probably should have been multiple changes.
Paul Fisher <paul@pfish.zone>
parents: 55
diff changeset
147 }
15
27730595f1ea Adding pam-http module
Anthony Nowell <anthony@algorithmia.com>
parents:
diff changeset
148
103
dfcd96a74ac4 write a truly prodigious amount of documentation
Paul Fisher <paul@pfish.zone>
parents: 97
diff changeset
149 /// The PAM error return codes.
dfcd96a74ac4 write a truly prodigious amount of documentation
Paul Fisher <paul@pfish.zone>
parents: 97
diff changeset
150 ///
dfcd96a74ac4 write a truly prodigious amount of documentation
Paul Fisher <paul@pfish.zone>
parents: 97
diff changeset
151 /// These are returned by most PAM functions if an error of some kind occurs.
dfcd96a74ac4 write a truly prodigious amount of documentation
Paul Fisher <paul@pfish.zone>
parents: 97
diff changeset
152 ///
dfcd96a74ac4 write a truly prodigious amount of documentation
Paul Fisher <paul@pfish.zone>
parents: 97
diff changeset
153 /// Instead of being an error code, success is represented by an Ok [`Result`].
60
05cc2c27334f The Big Refactor: clean up docs and exports.
Paul Fisher <paul@pfish.zone>
parents: 59
diff changeset
154 ///
103
dfcd96a74ac4 write a truly prodigious amount of documentation
Paul Fisher <paul@pfish.zone>
parents: 97
diff changeset
155 /// # References
dfcd96a74ac4 write a truly prodigious amount of documentation
Paul Fisher <paul@pfish.zone>
parents: 97
diff changeset
156 ///
dfcd96a74ac4 write a truly prodigious amount of documentation
Paul Fisher <paul@pfish.zone>
parents: 97
diff changeset
157 #[doc = _linklist!(pam: man7, manbsd)]
dfcd96a74ac4 write a truly prodigious amount of documentation
Paul Fisher <paul@pfish.zone>
parents: 97
diff changeset
158 /// - [X/SSO error code specification][xsso]
dfcd96a74ac4 write a truly prodigious amount of documentation
Paul Fisher <paul@pfish.zone>
parents: 97
diff changeset
159 ///
dfcd96a74ac4 write a truly prodigious amount of documentation
Paul Fisher <paul@pfish.zone>
parents: 97
diff changeset
160 #[doc = _man7!(3 pam "RETURN_VALUES")]
dfcd96a74ac4 write a truly prodigious amount of documentation
Paul Fisher <paul@pfish.zone>
parents: 97
diff changeset
161 #[doc = _manbsd!(3 pam "RETURN%20VALUES")]
dfcd96a74ac4 write a truly prodigious amount of documentation
Paul Fisher <paul@pfish.zone>
parents: 97
diff changeset
162 #[doc = _xsso!("chap5.htm#tagcjh_06_02")]
15
27730595f1ea Adding pam-http module
Anthony Nowell <anthony@algorithmia.com>
parents:
diff changeset
163 #[allow(non_camel_case_types, dead_code)]
90
f6186e41399b Miscellaneous fixes and cleanup:
Paul Fisher <paul@pfish.zone>
parents: 87
diff changeset
164 #[derive(Copy, Clone, Debug, PartialEq, TryFromPrimitive, IntoPrimitive)]
56
daa2cde64601 Big big refactor. Probably should have been multiple changes.
Paul Fisher <paul@pfish.zone>
parents: 55
diff changeset
165 #[non_exhaustive] // C might give us anything!
84
a638a45e5f1f do some real irritating i32/u32 juggling to make bindgen happy
Paul Fisher <paul@pfish.zone>
parents: 80
diff changeset
166 #[repr(u32)]
56
daa2cde64601 Big big refactor. Probably should have been multiple changes.
Paul Fisher <paul@pfish.zone>
parents: 55
diff changeset
167 pub enum ErrorCode {
80
5aa1a010f1e8 Start using PAM headers; improve owned/borrowed distinction.
Paul Fisher <paul@pfish.zone>
parents: 77
diff changeset
168 OpenError = pam_ffi::PAM_OPEN_ERR,
5aa1a010f1e8 Start using PAM headers; improve owned/borrowed distinction.
Paul Fisher <paul@pfish.zone>
parents: 77
diff changeset
169 SymbolError = pam_ffi::PAM_SYMBOL_ERR,
5aa1a010f1e8 Start using PAM headers; improve owned/borrowed distinction.
Paul Fisher <paul@pfish.zone>
parents: 77
diff changeset
170 ServiceError = pam_ffi::PAM_SERVICE_ERR,
5aa1a010f1e8 Start using PAM headers; improve owned/borrowed distinction.
Paul Fisher <paul@pfish.zone>
parents: 77
diff changeset
171 SystemError = pam_ffi::PAM_SYSTEM_ERR,
5aa1a010f1e8 Start using PAM headers; improve owned/borrowed distinction.
Paul Fisher <paul@pfish.zone>
parents: 77
diff changeset
172 BufferError = pam_ffi::PAM_BUF_ERR,
5aa1a010f1e8 Start using PAM headers; improve owned/borrowed distinction.
Paul Fisher <paul@pfish.zone>
parents: 77
diff changeset
173 PermissionDenied = pam_ffi::PAM_PERM_DENIED,
5aa1a010f1e8 Start using PAM headers; improve owned/borrowed distinction.
Paul Fisher <paul@pfish.zone>
parents: 77
diff changeset
174 AuthenticationError = pam_ffi::PAM_AUTH_ERR,
5aa1a010f1e8 Start using PAM headers; improve owned/borrowed distinction.
Paul Fisher <paul@pfish.zone>
parents: 77
diff changeset
175 CredentialsInsufficient = pam_ffi::PAM_CRED_INSUFFICIENT,
5aa1a010f1e8 Start using PAM headers; improve owned/borrowed distinction.
Paul Fisher <paul@pfish.zone>
parents: 77
diff changeset
176 AuthInfoUnavailable = pam_ffi::PAM_AUTHINFO_UNAVAIL,
5aa1a010f1e8 Start using PAM headers; improve owned/borrowed distinction.
Paul Fisher <paul@pfish.zone>
parents: 77
diff changeset
177 UserUnknown = pam_ffi::PAM_USER_UNKNOWN,
5aa1a010f1e8 Start using PAM headers; improve owned/borrowed distinction.
Paul Fisher <paul@pfish.zone>
parents: 77
diff changeset
178 MaxTries = pam_ffi::PAM_MAXTRIES,
5aa1a010f1e8 Start using PAM headers; improve owned/borrowed distinction.
Paul Fisher <paul@pfish.zone>
parents: 77
diff changeset
179 NewAuthTokRequired = pam_ffi::PAM_NEW_AUTHTOK_REQD,
5aa1a010f1e8 Start using PAM headers; improve owned/borrowed distinction.
Paul Fisher <paul@pfish.zone>
parents: 77
diff changeset
180 AccountExpired = pam_ffi::PAM_ACCT_EXPIRED,
5aa1a010f1e8 Start using PAM headers; improve owned/borrowed distinction.
Paul Fisher <paul@pfish.zone>
parents: 77
diff changeset
181 SessionError = pam_ffi::PAM_SESSION_ERR,
5aa1a010f1e8 Start using PAM headers; improve owned/borrowed distinction.
Paul Fisher <paul@pfish.zone>
parents: 77
diff changeset
182 CredentialsUnavailable = pam_ffi::PAM_CRED_UNAVAIL,
5aa1a010f1e8 Start using PAM headers; improve owned/borrowed distinction.
Paul Fisher <paul@pfish.zone>
parents: 77
diff changeset
183 CredentialsExpired = pam_ffi::PAM_CRED_EXPIRED,
5aa1a010f1e8 Start using PAM headers; improve owned/borrowed distinction.
Paul Fisher <paul@pfish.zone>
parents: 77
diff changeset
184 CredentialsError = pam_ffi::PAM_CRED_ERR,
5aa1a010f1e8 Start using PAM headers; improve owned/borrowed distinction.
Paul Fisher <paul@pfish.zone>
parents: 77
diff changeset
185 NoModuleData = pam_ffi::PAM_NO_MODULE_DATA,
5aa1a010f1e8 Start using PAM headers; improve owned/borrowed distinction.
Paul Fisher <paul@pfish.zone>
parents: 77
diff changeset
186 ConversationError = pam_ffi::PAM_CONV_ERR,
5aa1a010f1e8 Start using PAM headers; improve owned/borrowed distinction.
Paul Fisher <paul@pfish.zone>
parents: 77
diff changeset
187 AuthTokError = pam_ffi::PAM_AUTHTOK_ERR,
5aa1a010f1e8 Start using PAM headers; improve owned/borrowed distinction.
Paul Fisher <paul@pfish.zone>
parents: 77
diff changeset
188 AuthTokRecoveryError = pam_ffi::PAM_AUTHTOK_RECOVERY_ERR,
5aa1a010f1e8 Start using PAM headers; improve owned/borrowed distinction.
Paul Fisher <paul@pfish.zone>
parents: 77
diff changeset
189 AuthTokLockBusy = pam_ffi::PAM_AUTHTOK_LOCK_BUSY,
5aa1a010f1e8 Start using PAM headers; improve owned/borrowed distinction.
Paul Fisher <paul@pfish.zone>
parents: 77
diff changeset
190 AuthTokDisableAging = pam_ffi::PAM_AUTHTOK_DISABLE_AGING,
5aa1a010f1e8 Start using PAM headers; improve owned/borrowed distinction.
Paul Fisher <paul@pfish.zone>
parents: 77
diff changeset
191 TryAgain = pam_ffi::PAM_TRY_AGAIN,
5aa1a010f1e8 Start using PAM headers; improve owned/borrowed distinction.
Paul Fisher <paul@pfish.zone>
parents: 77
diff changeset
192 Ignore = pam_ffi::PAM_IGNORE,
5aa1a010f1e8 Start using PAM headers; improve owned/borrowed distinction.
Paul Fisher <paul@pfish.zone>
parents: 77
diff changeset
193 Abort = pam_ffi::PAM_ABORT,
5aa1a010f1e8 Start using PAM headers; improve owned/borrowed distinction.
Paul Fisher <paul@pfish.zone>
parents: 77
diff changeset
194 AuthTokExpired = pam_ffi::PAM_AUTHTOK_EXPIRED,
5aa1a010f1e8 Start using PAM headers; improve owned/borrowed distinction.
Paul Fisher <paul@pfish.zone>
parents: 77
diff changeset
195 ModuleUnknown = pam_ffi::PAM_MODULE_UNKNOWN,
5aa1a010f1e8 Start using PAM headers; improve owned/borrowed distinction.
Paul Fisher <paul@pfish.zone>
parents: 77
diff changeset
196 BadItem = pam_ffi::PAM_BAD_ITEM,
87
05291b601f0a Well and truly separate the Linux extensions.
Paul Fisher <paul@pfish.zone>
parents: 86
diff changeset
197 #[cfg(feature = "linux-pam-extensions")]
80
5aa1a010f1e8 Start using PAM headers; improve owned/borrowed distinction.
Paul Fisher <paul@pfish.zone>
parents: 77
diff changeset
198 ConversationAgain = pam_ffi::PAM_CONV_AGAIN,
87
05291b601f0a Well and truly separate the Linux extensions.
Paul Fisher <paul@pfish.zone>
parents: 86
diff changeset
199 #[cfg(feature = "linux-pam-extensions")]
80
5aa1a010f1e8 Start using PAM headers; improve owned/borrowed distinction.
Paul Fisher <paul@pfish.zone>
parents: 77
diff changeset
200 Incomplete = pam_ffi::PAM_INCOMPLETE,
15
27730595f1ea Adding pam-http module
Anthony Nowell <anthony@algorithmia.com>
parents:
diff changeset
201 }
56
daa2cde64601 Big big refactor. Probably should have been multiple changes.
Paul Fisher <paul@pfish.zone>
parents: 55
diff changeset
202
60
05cc2c27334f The Big Refactor: clean up docs and exports.
Paul Fisher <paul@pfish.zone>
parents: 59
diff changeset
203 /// A PAM-specific Result type with an [ErrorCode] error.
71
58f9d2a4df38 Reorganize everything again???
Paul Fisher <paul@pfish.zone>
parents: 70
diff changeset
204 pub type Result<T> = StdResult<T, ErrorCode>;
60
05cc2c27334f The Big Refactor: clean up docs and exports.
Paul Fisher <paul@pfish.zone>
parents: 59
diff changeset
205
90
f6186e41399b Miscellaneous fixes and cleanup:
Paul Fisher <paul@pfish.zone>
parents: 87
diff changeset
206 impl Display for ErrorCode {
f6186e41399b Miscellaneous fixes and cleanup:
Paul Fisher <paul@pfish.zone>
parents: 87
diff changeset
207 fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
f6186e41399b Miscellaneous fixes and cleanup:
Paul Fisher <paul@pfish.zone>
parents: 87
diff changeset
208 match pam_ffi::strerror((*self).into()) {
f6186e41399b Miscellaneous fixes and cleanup:
Paul Fisher <paul@pfish.zone>
parents: 87
diff changeset
209 Some(err) => f.write_str(err),
f6186e41399b Miscellaneous fixes and cleanup:
Paul Fisher <paul@pfish.zone>
parents: 87
diff changeset
210 None => self.fmt_internal(f),
f6186e41399b Miscellaneous fixes and cleanup:
Paul Fisher <paul@pfish.zone>
parents: 87
diff changeset
211 }
f6186e41399b Miscellaneous fixes and cleanup:
Paul Fisher <paul@pfish.zone>
parents: 87
diff changeset
212 }
f6186e41399b Miscellaneous fixes and cleanup:
Paul Fisher <paul@pfish.zone>
parents: 87
diff changeset
213 }
f6186e41399b Miscellaneous fixes and cleanup:
Paul Fisher <paul@pfish.zone>
parents: 87
diff changeset
214
f6186e41399b Miscellaneous fixes and cleanup:
Paul Fisher <paul@pfish.zone>
parents: 87
diff changeset
215 impl Error for ErrorCode {}
f6186e41399b Miscellaneous fixes and cleanup:
Paul Fisher <paul@pfish.zone>
parents: 87
diff changeset
216
56
daa2cde64601 Big big refactor. Probably should have been multiple changes.
Paul Fisher <paul@pfish.zone>
parents: 55
diff changeset
217 impl ErrorCode {
60
05cc2c27334f The Big Refactor: clean up docs and exports.
Paul Fisher <paul@pfish.zone>
parents: 59
diff changeset
218 /// Converts this [Result] into a C-compatible result code.
05cc2c27334f The Big Refactor: clean up docs and exports.
Paul Fisher <paul@pfish.zone>
parents: 59
diff changeset
219 pub fn result_to_c<T>(value: Result<T>) -> c_int {
56
daa2cde64601 Big big refactor. Probably should have been multiple changes.
Paul Fisher <paul@pfish.zone>
parents: 55
diff changeset
220 match value {
daa2cde64601 Big big refactor. Probably should have been multiple changes.
Paul Fisher <paul@pfish.zone>
parents: 55
diff changeset
221 Ok(_) => 0, // PAM_SUCCESS
84
a638a45e5f1f do some real irritating i32/u32 juggling to make bindgen happy
Paul Fisher <paul@pfish.zone>
parents: 80
diff changeset
222 Err(otherwise) => u32::from(otherwise) as i32,
56
daa2cde64601 Big big refactor. Probably should have been multiple changes.
Paul Fisher <paul@pfish.zone>
parents: 55
diff changeset
223 }
daa2cde64601 Big big refactor. Probably should have been multiple changes.
Paul Fisher <paul@pfish.zone>
parents: 55
diff changeset
224 }
daa2cde64601 Big big refactor. Probably should have been multiple changes.
Paul Fisher <paul@pfish.zone>
parents: 55
diff changeset
225
60
05cc2c27334f The Big Refactor: clean up docs and exports.
Paul Fisher <paul@pfish.zone>
parents: 59
diff changeset
226 /// Converts a C result code into a [Result], with success as Ok.
59
3f4a77aa88be Fix string copyting and improve error situation.
Paul Fisher <paul@pfish.zone>
parents: 56
diff changeset
227 /// Invalid values are returned as a [Self::SystemError].
60
05cc2c27334f The Big Refactor: clean up docs and exports.
Paul Fisher <paul@pfish.zone>
parents: 59
diff changeset
228 pub fn result_from(value: c_int) -> Result<()> {
56
daa2cde64601 Big big refactor. Probably should have been multiple changes.
Paul Fisher <paul@pfish.zone>
parents: 55
diff changeset
229 match value {
daa2cde64601 Big big refactor. Probably should have been multiple changes.
Paul Fisher <paul@pfish.zone>
parents: 55
diff changeset
230 0 => Ok(()),
84
a638a45e5f1f do some real irritating i32/u32 juggling to make bindgen happy
Paul Fisher <paul@pfish.zone>
parents: 80
diff changeset
231 value => Err((value as u32).try_into().unwrap_or(Self::SystemError)),
56
daa2cde64601 Big big refactor. Probably should have been multiple changes.
Paul Fisher <paul@pfish.zone>
parents: 55
diff changeset
232 }
daa2cde64601 Big big refactor. Probably should have been multiple changes.
Paul Fisher <paul@pfish.zone>
parents: 55
diff changeset
233 }
90
f6186e41399b Miscellaneous fixes and cleanup:
Paul Fisher <paul@pfish.zone>
parents: 87
diff changeset
234
f6186e41399b Miscellaneous fixes and cleanup:
Paul Fisher <paul@pfish.zone>
parents: 87
diff changeset
235 /// A basic Display implementation for if we don't link against PAM.
f6186e41399b Miscellaneous fixes and cleanup:
Paul Fisher <paul@pfish.zone>
parents: 87
diff changeset
236 fn fmt_internal(self, f: &mut Formatter<'_>) -> fmt::Result {
f6186e41399b Miscellaneous fixes and cleanup:
Paul Fisher <paul@pfish.zone>
parents: 87
diff changeset
237 write!(f, "PAM error: {self:?} ({n})", n = self as c_uint)
f6186e41399b Miscellaneous fixes and cleanup:
Paul Fisher <paul@pfish.zone>
parents: 87
diff changeset
238 }
56
daa2cde64601 Big big refactor. Probably should have been multiple changes.
Paul Fisher <paul@pfish.zone>
parents: 55
diff changeset
239 }
daa2cde64601 Big big refactor. Probably should have been multiple changes.
Paul Fisher <paul@pfish.zone>
parents: 55
diff changeset
240
59
3f4a77aa88be Fix string copyting and improve error situation.
Paul Fisher <paul@pfish.zone>
parents: 56
diff changeset
241 #[cfg(test)]
3f4a77aa88be Fix string copyting and improve error situation.
Paul Fisher <paul@pfish.zone>
parents: 56
diff changeset
242 mod tests {
3f4a77aa88be Fix string copyting and improve error situation.
Paul Fisher <paul@pfish.zone>
parents: 56
diff changeset
243 use super::*;
3f4a77aa88be Fix string copyting and improve error situation.
Paul Fisher <paul@pfish.zone>
parents: 56
diff changeset
244
3f4a77aa88be Fix string copyting and improve error situation.
Paul Fisher <paul@pfish.zone>
parents: 56
diff changeset
245 #[test]
3f4a77aa88be Fix string copyting and improve error situation.
Paul Fisher <paul@pfish.zone>
parents: 56
diff changeset
246 fn test_enums() {
3f4a77aa88be Fix string copyting and improve error situation.
Paul Fisher <paul@pfish.zone>
parents: 56
diff changeset
247 assert_eq!(Ok(()), ErrorCode::result_from(0));
80
5aa1a010f1e8 Start using PAM headers; improve owned/borrowed distinction.
Paul Fisher <paul@pfish.zone>
parents: 77
diff changeset
248 assert_eq!(
84
a638a45e5f1f do some real irritating i32/u32 juggling to make bindgen happy
Paul Fisher <paul@pfish.zone>
parents: 80
diff changeset
249 pam_ffi::PAM_BAD_ITEM as i32,
80
5aa1a010f1e8 Start using PAM headers; improve owned/borrowed distinction.
Paul Fisher <paul@pfish.zone>
parents: 77
diff changeset
250 ErrorCode::result_to_c::<()>(Err(ErrorCode::BadItem))
5aa1a010f1e8 Start using PAM headers; improve owned/borrowed distinction.
Paul Fisher <paul@pfish.zone>
parents: 77
diff changeset
251 );
5aa1a010f1e8 Start using PAM headers; improve owned/borrowed distinction.
Paul Fisher <paul@pfish.zone>
parents: 77
diff changeset
252 assert_eq!(
5aa1a010f1e8 Start using PAM headers; improve owned/borrowed distinction.
Paul Fisher <paul@pfish.zone>
parents: 77
diff changeset
253 Err(ErrorCode::Abort),
84
a638a45e5f1f do some real irritating i32/u32 juggling to make bindgen happy
Paul Fisher <paul@pfish.zone>
parents: 80
diff changeset
254 ErrorCode::result_from(pam_ffi::PAM_ABORT as i32)
80
5aa1a010f1e8 Start using PAM headers; improve owned/borrowed distinction.
Paul Fisher <paul@pfish.zone>
parents: 77
diff changeset
255 );
59
3f4a77aa88be Fix string copyting and improve error situation.
Paul Fisher <paul@pfish.zone>
parents: 56
diff changeset
256 assert_eq!(Err(ErrorCode::SystemError), ErrorCode::result_from(423));
3f4a77aa88be Fix string copyting and improve error situation.
Paul Fisher <paul@pfish.zone>
parents: 56
diff changeset
257 }
3f4a77aa88be Fix string copyting and improve error situation.
Paul Fisher <paul@pfish.zone>
parents: 56
diff changeset
258 }