summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2021-02-07 22:50:05 +0000
committerGitHub <noreply@github.com>2021-02-07 22:50:05 +0000
commit3b8180c430fe838e4fd71b83e5f92db6386e5c57 (patch)
treeafbfdbb338a941bb610c1ea7a0b8b1eda7056afe
parente7c702160b3a2d4ed3377ddf1fa2b6986401c396 (diff)
parent8dc757bb545a7a3f1339ae69abcb649e38700cca (diff)
downloadnix-3b8180c430fe838e4fd71b83e5f92db6386e5c57.zip
Merge #1338
1338: Add a passwd field to Group r=asomers a=blinsay Adds a `passwd` field to unistd::Group. The `gr_passwd` field exists on `libc::group` and wasn't exposed. I didn't see tests for `from(libc:group)` for either `User` or `Password`. Let me know if there are other tests I should add! Co-authored-by: Ben Linsay <blinsay@gmail.com>
-rw-r--r--CHANGELOG.md2
-rw-r--r--src/unistd.rs3
2 files changed, 5 insertions, 0 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 99972478..a109b7f1 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,6 +5,8 @@ This project adheres to [Semantic Versioning](http://semver.org/).
## [Unreleased] - ReleaseDate
### Added
+
+- Added a `passwd` field to `Group` (#[1338](https://github.com/nix-rust/nix/pull/1338))
- Added `mremap` (#[1306](https://github.com/nix-rust/nix/pull/1306))
- Added `personality` (#[1331](https://github.com/nix-rust/nix/pull/1331))
- Added limited Fuchsia support (#[1285](https://github.com/nix-rust/nix/pull/1285))
diff --git a/src/unistd.rs b/src/unistd.rs
index dd335596..7a4517e6 100644
--- a/src/unistd.rs
+++ b/src/unistd.rs
@@ -2671,6 +2671,8 @@ impl User {
pub struct Group {
/// Group name
pub name: String,
+ /// Group password
+ pub passwd: CString,
/// Group ID
pub gid: Gid,
/// List of Group members
@@ -2683,6 +2685,7 @@ impl From<&libc::group> for Group {
unsafe {
Group {
name: CStr::from_ptr((*gr).gr_name).to_string_lossy().into_owned(),
+ passwd: CString::new(CStr::from_ptr((*gr).gr_passwd).to_bytes()).unwrap(),
gid: Gid::from_raw((*gr).gr_gid),
mem: Group::members((*gr).gr_mem)
}