1*df57947fSPedro F. Giffuni /*- 2*df57947fSPedro F. Giffuni * SPDX-License-Identifier: BSD-4-Clause 3*df57947fSPedro F. Giffuni * 49b50d902SRodney W. Grimes * Copyright (c) 1988, 1993, 1994 59b50d902SRodney W. Grimes * The Regents of the University of California. All rights reserved. 6f1d05925SDag-Erling Smørgrav * Copyright (c) 2002 Networks Associates Technology, Inc. 7f1d05925SDag-Erling Smørgrav * All rights reserved. 8f1d05925SDag-Erling Smørgrav * 9f1d05925SDag-Erling Smørgrav * Portions of this software were developed for the FreeBSD Project by 10f1d05925SDag-Erling Smørgrav * ThinkSec AS and NAI Labs, the Security Research Division of Network 11f1d05925SDag-Erling Smørgrav * Associates, Inc. under DARPA/SPAWAR contract N66001-01-C-8035 12f1d05925SDag-Erling Smørgrav * ("CBOSS"), as part of the DARPA CHATS research program. 139b50d902SRodney W. Grimes * 149b50d902SRodney W. Grimes * Redistribution and use in source and binary forms, with or without 159b50d902SRodney W. Grimes * modification, are permitted provided that the following conditions 169b50d902SRodney W. Grimes * are met: 179b50d902SRodney W. Grimes * 1. Redistributions of source code must retain the above copyright 189b50d902SRodney W. Grimes * notice, this list of conditions and the following disclaimer. 199b50d902SRodney W. Grimes * 2. Redistributions in binary form must reproduce the above copyright 209b50d902SRodney W. Grimes * notice, this list of conditions and the following disclaimer in the 219b50d902SRodney W. Grimes * documentation and/or other materials provided with the distribution. 229b50d902SRodney W. Grimes * 3. All advertising materials mentioning features or use of this software 239b50d902SRodney W. Grimes * must display the following acknowledgement: 249b50d902SRodney W. Grimes * This product includes software developed by the University of 259b50d902SRodney W. Grimes * California, Berkeley and its contributors. 269b50d902SRodney W. Grimes * 4. Neither the name of the University nor the names of its contributors 279b50d902SRodney W. Grimes * may be used to endorse or promote products derived from this software 289b50d902SRodney W. Grimes * without specific prior written permission. 299b50d902SRodney W. Grimes * 309b50d902SRodney W. Grimes * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 319b50d902SRodney W. Grimes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 329b50d902SRodney W. Grimes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 339b50d902SRodney W. Grimes * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 349b50d902SRodney W. Grimes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 359b50d902SRodney W. Grimes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 369b50d902SRodney W. Grimes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 379b50d902SRodney W. Grimes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 389b50d902SRodney W. Grimes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 399b50d902SRodney W. Grimes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 409b50d902SRodney W. Grimes * SUCH DAMAGE. 419b50d902SRodney W. Grimes */ 429b50d902SRodney W. Grimes 439b50d902SRodney W. Grimes struct passwd; 449b50d902SRodney W. Grimes 459b50d902SRodney W. Grimes typedef struct _entry { 465ea73378SMark Murray const char *prompt; 475ea73378SMark Murray int (*func)(char *, struct passwd *, struct _entry *); 48f1d05925SDag-Erling Smørgrav int restricted; 49f1d05925SDag-Erling Smørgrav size_t len; 50ac75fa88SEd Schouten const char *except, *save; 519b50d902SRodney W. Grimes } ENTRY; 529b50d902SRodney W. Grimes 539b50d902SRodney W. Grimes /* Field numbers. */ 549b50d902SRodney W. Grimes #define E_BPHONE 8 559b50d902SRodney W. Grimes #define E_HPHONE 9 569b50d902SRodney W. Grimes #define E_LOCATE 10 579b50d902SRodney W. Grimes #define E_NAME 7 5819ae8d1eSPeter Hawkins #define E_OTHER 11 59e29c2a4fSMark Murray #define E_SHELL 13 609b50d902SRodney W. Grimes 619b50d902SRodney W. Grimes extern ENTRY list[]; 62f1d05925SDag-Erling Smørgrav extern int master_mode; 639b50d902SRodney W. Grimes 64f1bb2cd2SWarner Losh int atot(char *, time_t *); 65f1d05925SDag-Erling Smørgrav struct passwd *edit(const char *, struct passwd *); 66612956f6SPhilippe Charnier int ok_shell(char *); 67612956f6SPhilippe Charnier char *dup_shell(char *); 68f1bb2cd2SWarner Losh int p_change(char *, struct passwd *, ENTRY *); 69f1bb2cd2SWarner Losh int p_class(char *, struct passwd *, ENTRY *); 70f1bb2cd2SWarner Losh int p_expire(char *, struct passwd *, ENTRY *); 71f1bb2cd2SWarner Losh int p_gecos(char *, struct passwd *, ENTRY *); 72f1bb2cd2SWarner Losh int p_gid(char *, struct passwd *, ENTRY *); 73f1bb2cd2SWarner Losh int p_hdir(char *, struct passwd *, ENTRY *); 74f1bb2cd2SWarner Losh int p_login(char *, struct passwd *, ENTRY *); 75f1bb2cd2SWarner Losh int p_passwd(char *, struct passwd *, ENTRY *); 76f1bb2cd2SWarner Losh int p_shell(char *, struct passwd *, ENTRY *); 77f1bb2cd2SWarner Losh int p_uid(char *, struct passwd *, ENTRY *); 78f1bb2cd2SWarner Losh char *ttoa(time_t); 79