unix::passwd
Index
Types
type grent;
type pwent;
Errors
type invalid;
Functions
fn getgid(uint) (grent | void);
fn getgroup(str) (grent | void);
fn getuid(uint) (pwent | void);
fn getuser(str) (pwent | void);
fn grent_finish(*grent) void;
fn nextgr(io::handle) (grent | io::EOF | io::error | invalid);
fn nextpw(io::handle) (pwent | io::EOF | io::error | invalid);
fn pwent_finish(*pwent) void;
Types
type grent
type grent = struct {
name: str,
password: str,
gid: uint,
userlist: []str,
};
A Unix-like group file entry.
type pwent
type pwent = struct {
username: str,
password: str,
uid: uint,
gid: uint,
comment: str,
homedir: str,
shell: str,
};
A Unix-like password database entry.
Errors
type invalid
type invalid = !void;
An invalid entry was encountered during parsing.
Functions
fn getgid
fn getgid(gid: uint) (grent | void);
Looks up a group by ID in a Unix-like group file. It expects a such file at
/etc/group. Aborts if that file doesn't exist or is not properly formatted.
See nextgr for low-level parsing API.
fn getgroup
fn getgroup(name: str) (grent | void);
Looks up a group by name in a Unix-like group file. It expects a such file at
/etc/group. Aborts if that file doesn't exist or is not properly formatted.
See nextgr for low-level parsing API.
fn getuid
fn getuid(uid: uint) (pwent | void);
Looks up a user by ID in a Unix-like password file. It expects a password
database file at /etc/passwd. Aborts if that file doesn't exist or is not
properly formatted. The return value must be freed with pwent_finish.
See nextpw for low-level parsing API.
fn getuser
fn getuser(username: str) (pwent | void);
Looks up a user by name in a Unix-like password file. It expects a password
database file at /etc/passwd. Aborts if that file doesn't exist or is not
properly formatted. The return value must be freed with pwent_finish.
See nextpw for low-level parsing API.
fn grent_finish
fn grent_finish(ent: *grent) void;
Frees resources associated with grent.
fn nextgr
fn nextgr(in: io::handle) (grent | io::EOF | io::error | invalid);
Reads a Unix-like group entry from an io::handle. The caller must free
the return value using grent_finish.
fn nextpw
fn nextpw(file: io::handle) (pwent | io::EOF | io::error | invalid);
Reads a Unix-like password entry from an io::handle. The caller must free
the return value using pwent_finish.
fn pwent_finish
fn pwent_finish(ent: *pwent) void;
Frees resources associated with a pwent.