mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2024-12-23 18:14:56 +01:00
Add new pw_make_v7 to make a passwd line (in v7 format) out of a struct passwd
while here, fix missing parentheses of the return statement of pw_make. Approved by: des (mentor)
This commit is contained in:
parent
19c262fe87
commit
a9e4a4780a
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=229572
@ -144,6 +144,7 @@ int pw_equal(const struct passwd *_pw1, const struct passwd *_pw2);
|
||||
void pw_fini(void);
|
||||
int pw_init(const char *_dir, const char *_master);
|
||||
char *pw_make(const struct passwd *_pw);
|
||||
char *pw_make_v7(const struct passwd *_pw);
|
||||
int pw_mkdb(const char *_user);
|
||||
int pw_lock(void);
|
||||
struct passwd *pw_scan(const char *_line, int _flags);
|
||||
|
@ -406,7 +406,21 @@ pw_make(const struct passwd *pw)
|
||||
pw->pw_passwd, (uintmax_t)pw->pw_uid, (uintmax_t)pw->pw_gid,
|
||||
pw->pw_class, (uintmax_t)pw->pw_change, (uintmax_t)pw->pw_expire,
|
||||
pw->pw_gecos, pw->pw_dir, pw->pw_shell);
|
||||
return line;
|
||||
return (line);
|
||||
}
|
||||
|
||||
/*
|
||||
* Make a passwd line (in v7 format) out of a struct passwd
|
||||
*/
|
||||
char *
|
||||
pw_make_v7(const struct passwd *pw)
|
||||
{
|
||||
char *line;
|
||||
|
||||
asprintf(&line, "%s:*:%ju:%ju:%s:%s:%s", pw->pw_name,
|
||||
(uintmax_t)pw->pw_uid, (uintmax_t)pw->pw_gid,
|
||||
pw->pw_gecos, pw->pw_dir, pw->pw_shell);
|
||||
return (line);
|
||||
}
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user