xref: /minix3/usr.bin/chpass/chpass.h (revision 84d9c625bfea59e274550651111ae9edfdc40fbd)
1*84d9c625SLionel Sambuc /*	$NetBSD: chpass.h,v 1.13 2011/08/29 14:08:39 joerg Exp $	*/
25c007436SBen Gras 
35c007436SBen Gras /*
45c007436SBen Gras  * Copyright (c) 1988, 1993, 1994
55c007436SBen Gras  *	The Regents of the University of California.  All rights reserved.
65c007436SBen Gras  *
75c007436SBen Gras  * Redistribution and use in source and binary forms, with or without
85c007436SBen Gras  * modification, are permitted provided that the following conditions
95c007436SBen Gras  * are met:
105c007436SBen Gras  * 1. Redistributions of source code must retain the above copyright
115c007436SBen Gras  *    notice, this list of conditions and the following disclaimer.
125c007436SBen Gras  * 2. Redistributions in binary form must reproduce the above copyright
135c007436SBen Gras  *    notice, this list of conditions and the following disclaimer in the
145c007436SBen Gras  *    documentation and/or other materials provided with the distribution.
155c007436SBen Gras  * 3. Neither the name of the University nor the names of its contributors
165c007436SBen Gras  *    may be used to endorse or promote products derived from this software
175c007436SBen Gras  *    without specific prior written permission.
185c007436SBen Gras  *
195c007436SBen Gras  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
205c007436SBen Gras  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
215c007436SBen Gras  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
225c007436SBen Gras  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
235c007436SBen Gras  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
245c007436SBen Gras  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
255c007436SBen Gras  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
265c007436SBen Gras  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
275c007436SBen Gras  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
285c007436SBen Gras  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
295c007436SBen Gras  * SUCH DAMAGE.
305c007436SBen Gras  *
315c007436SBen Gras  *	@(#)chpass.h	8.4 (Berkeley) 4/2/94
325c007436SBen Gras  */
335c007436SBen Gras 
345c007436SBen Gras struct passwd;
355c007436SBen Gras 
365c007436SBen Gras typedef struct _entry {
375c007436SBen Gras 	const char *prompt;
385c007436SBen Gras 	int (*func)(const char *, struct passwd *, struct _entry *), restricted, len;
395c007436SBen Gras 	const char *except, *save;
405c007436SBen Gras } ENTRY;
415c007436SBen Gras 
425c007436SBen Gras extern	int use_yp;
435c007436SBen Gras 
445c007436SBen Gras /* Field numbers. */
455c007436SBen Gras #define	E_BPHONE	8
465c007436SBen Gras #define	E_HPHONE	9
475c007436SBen Gras #define	E_LOCATE	10
485c007436SBen Gras #define	E_NAME		7
495c007436SBen Gras #define	E_SHELL		12
505c007436SBen Gras 
515c007436SBen Gras extern ENTRY list[];
525c007436SBen Gras extern uid_t uid;
535c007436SBen Gras 
545c007436SBen Gras int	 atot(const char *, time_t *);
555c007436SBen Gras void	 display(char *, int, struct passwd *);
565c007436SBen Gras void	 edit(char *, struct passwd *);
575c007436SBen Gras const char *
585c007436SBen Gras 	 ok_shell(const char *);
595c007436SBen Gras int	 p_change(const char *, struct passwd *, ENTRY *);
605c007436SBen Gras int	 p_class(const char *, struct passwd *, ENTRY *);
615c007436SBen Gras int	 p_expire(const char *, struct passwd *, ENTRY *);
625c007436SBen Gras int	 p_gecos(const char *, struct passwd *, ENTRY *);
635c007436SBen Gras int	 p_gid(const char *, struct passwd *, ENTRY *);
645c007436SBen Gras int	 p_hdir(const char *, struct passwd *, ENTRY *);
655c007436SBen Gras int	 p_login(const char *, struct passwd *, ENTRY *);
665c007436SBen Gras int	 p_passwd(const char *, struct passwd *, ENTRY *);
675c007436SBen Gras int	 p_shell(const char *, struct passwd *, ENTRY *);
685c007436SBen Gras int	 p_uid(const char *, struct passwd *, ENTRY *);
695c007436SBen Gras char    *ttoa(char *, size_t, time_t);
705c007436SBen Gras int	 verify(char *, struct passwd *);
715c007436SBen Gras 
725c007436SBen Gras #ifdef YP
735c007436SBen Gras int	check_yppasswdd(void);
745c007436SBen Gras int	pw_yp(struct passwd *, uid_t);
75*84d9c625SLionel Sambuc __dead void	yppw_error(const char *name, int, int);
765c007436SBen Gras void	yppw_prompt(void);
775c007436SBen Gras struct passwd *ypgetpwnam(const char *);
785c007436SBen Gras struct passwd *ypgetpwuid(uid_t);
795c007436SBen Gras #endif
805c007436SBen Gras 
815c007436SBen Gras extern	void (*Pw_error)(const char *name, int, int);
82