pw_util.3 (b5ff185e19f6013ca565b2a15bc2d6abce933f46) pw_util.3 (34e9190d82ac021bae00937cc1a663920aa19309)
1.\" Copyright (c) 2012 Baptiste Daroussin <bapt@FreeBSD.org>
2.\" All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\" notice, this list of conditions and the following disclaimer.

--- 10 unchanged lines hidden (view full) ---

19.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23.\" SUCH DAMAGE.
24.\"
25.\" $FreeBSD$
26.\"
1.\" Copyright (c) 2012 Baptiste Daroussin <bapt@FreeBSD.org>
2.\" All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\" notice, this list of conditions and the following disclaimer.

--- 10 unchanged lines hidden (view full) ---

19.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23.\" SUCH DAMAGE.
24.\"
25.\" $FreeBSD$
26.\"
27.Dd July 02, 2015
27.Dd July 26, 2018
28.Dt PW_UTIL 3
29.Os
30.Sh NAME
31.Nm pw_copy ,
32.Nm pw_dup ,
33.Nm pw_edit ,
34.Nm pw_equal ,
35.Nm pw_fini ,

--- 18 unchanged lines hidden (view full) ---

54.Ft int
55.Fn pw_edit "int nosetuid"
56.Ft int
57.Fn pw_equal "const struct passwd *pw1" "const struct passwd *pw2"
58.Ft void
59.Fn pw_fini "void"
60.Ft int
61.Fn pw_init "const char *dir" const char *master"
28.Dt PW_UTIL 3
29.Os
30.Sh NAME
31.Nm pw_copy ,
32.Nm pw_dup ,
33.Nm pw_edit ,
34.Nm pw_equal ,
35.Nm pw_fini ,

--- 18 unchanged lines hidden (view full) ---

54.Ft int
55.Fn pw_edit "int nosetuid"
56.Ft int
57.Fn pw_equal "const struct passwd *pw1" "const struct passwd *pw2"
58.Ft void
59.Fn pw_fini "void"
60.Ft int
61.Fn pw_init "const char *dir" const char *master"
62.Ft void
63.Fn pw_initpwd "struct passwd *pw"
62.Ft "char *"
63.Fn pw_make "const struct passwd *pw"
64.Ft "char *"
65.Fn pw_make_v7 "const struct passwd *pw"
66.Ft int
67.Fn pw_mkdb "const char *user"
68.Ft int
69.Fn pw_lock "void"

--- 104 unchanged lines hidden (view full) ---

174.Fn pw_edit
175if any,
176and closes the lock created by
177.Fn pw_lock
178if any.
179.Pp
180The
181.Fn pw_init
64.Ft "char *"
65.Fn pw_make "const struct passwd *pw"
66.Ft "char *"
67.Fn pw_make_v7 "const struct passwd *pw"
68.Ft int
69.Fn pw_mkdb "const char *user"
70.Ft int
71.Fn pw_lock "void"

--- 104 unchanged lines hidden (view full) ---

176.Fn pw_edit
177if any,
178and closes the lock created by
179.Fn pw_lock
180if any.
181.Pp
182The
183.Fn pw_init
182initialize the static variable representing the path a password file.
184initializes the static variable representing the path to a password file.
183.Fa dir
184is the directory where the password file is located.
185If set to
186.Dv NULL ,
187it will default to
188.Pa /etc .
189.Fa master
190is the name of the password file.
191If set to
192.Dv NULL?
193it will default to
194.Pa master.passwd
195.Pp
196The
185.Fa dir
186is the directory where the password file is located.
187If set to
188.Dv NULL ,
189it will default to
190.Pa /etc .
191.Fa master
192is the name of the password file.
193If set to
194.Dv NULL?
195it will default to
196.Pa master.passwd
197.Pp
198The
199.Fn pw_initpwd
200function initializes the
201.Vt passwd
202struct to canonical values.
203The entire structure is zeroed, then
204.Va pw_uid
205and
206.Va pw_gid
207are set to -1, and all string pointers are set to point at
208an internally-defined zero-length string.
209.Pp
210The
197.Fn pw_make
198function creates a properly formatted
199.Bx
200.Xr passwd 5
201line from a
202.Vt struct passwd ,
203and returns a pointer to the resulting string.
204The string is allocated with

--- 83 unchanged lines hidden ---
211.Fn pw_make
212function creates a properly formatted
213.Bx
214.Xr passwd 5
215line from a
216.Vt struct passwd ,
217and returns a pointer to the resulting string.
218The string is allocated with

--- 83 unchanged lines hidden ---