]> git.saurik.com Git - apple/system_cmds.git/blob - chpass.tproj/chpass.h
system_cmds-541.tar.gz
[apple/system_cmds.git] / chpass.tproj / chpass.h
1 /*
2 * Copyright (c) 1999-2006 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
11 * file.
12 *
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23 /*
24 * Copyright (c) 1988, 1993, 1994
25 * The Regents of the University of California. All rights reserved.
26 * Copyright (c) 2002 Networks Associates Technology, Inc.
27 * All rights reserved.
28 *
29 * Portions of this software were developed for the FreeBSD Project by
30 * ThinkSec AS and NAI Labs, the Security Research Division of Network
31 * Associates, Inc. under DARPA/SPAWAR contract N66001-01-C-8035
32 * ("CBOSS"), as part of the DARPA CHATS research program.
33 *
34 * Redistribution and use in source and binary forms, with or without
35 * modification, are permitted provided that the following conditions
36 * are met:
37 * 1. Redistributions of source code must retain the above copyright
38 * notice, this list of conditions and the following disclaimer.
39 * 2. Redistributions in binary form must reproduce the above copyright
40 * notice, this list of conditions and the following disclaimer in the
41 * documentation and/or other materials provided with the distribution.
42 * 3. All advertising materials mentioning features or use of this software
43 * must display the following acknowledgement:
44 * This product includes software developed by the University of
45 * California, Berkeley and its contributors.
46 * 4. Neither the name of the University nor the names of its contributors
47 * may be used to endorse or promote products derived from this software
48 * without specific prior written permission.
49 *
50 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
51 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
52 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
53 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
54 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
55 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
56 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
57 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
58 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
59 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
60 * SUCH DAMAGE.
61 *
62 * @(#)chpass.h 8.4 (Berkeley) 4/2/94
63 * $FreeBSD: src/usr.bin/chpass/chpass.h,v 1.7 2004/01/18 21:46:39 charnier Exp $
64 */
65
66 #ifdef OPEN_DIRECTORY
67 #include "open_directory.h"
68
69 extern char* progname;
70 extern CFStringRef DSPath;
71 #endif /* OPEN_DIRECTORY */
72
73 struct passwd;
74
75 typedef struct _entry {
76 const char *prompt;
77 #ifdef OPEN_DIRECTORY
78 void (*display)();
79 #endif
80 int (*func)(char *, struct passwd *, struct _entry *);
81 int restricted;
82 size_t len;
83 #if OPEN_DIRECTORY
84 char *except;
85 const CFStringRef *attrName;
86 #else /* OPEN_DIRECTORY */
87 char *except, *save;
88 #endif /* OPEN_DIRECTORY */
89 } ENTRY;
90
91 /* Field numbers. */
92 #define E_BPHONE 8
93 #define E_HPHONE 9
94 #define E_LOCATE 10
95 #define E_NAME 7
96 #define E_OTHER 11
97 #define E_SHELL 13
98
99 extern ENTRY list[];
100 extern int master_mode;
101
102 #ifdef OPEN_DIRECTORY
103 /* edit.c */
104 void display_time(CFDictionaryRef, CFStringRef, const char*, FILE *);
105 void display_string(CFDictionaryRef, CFStringRef, const char*, FILE *);
106 CFDictionaryRef edit(const char *tfn, CFDictionaryRef pw);
107
108 /* util.c */
109 int cfprintf(FILE* file, const char* format, ...);
110 int editfile(const char* tfn);
111 #endif /* OPEN_DIRECTORY */
112
113 int atot(char *, time_t *);
114 #ifndef OPEN_DIRECTORY
115 struct passwd *edit(const char *, struct passwd *);
116 #endif /* OPEN_DIRECTORY */
117 int ok_shell(char *);
118 char *dup_shell(char *);
119 int p_change(char *, struct passwd *, ENTRY *);
120 int p_class(char *, struct passwd *, ENTRY *);
121 int p_expire(char *, struct passwd *, ENTRY *);
122 int p_gecos(char *, struct passwd *, ENTRY *);
123 int p_gid(char *, struct passwd *, ENTRY *);
124 int p_hdir(char *, struct passwd *, ENTRY *);
125 int p_login(char *, struct passwd *, ENTRY *);
126 int p_passwd(char *, struct passwd *, ENTRY *);
127 int p_shell(char *, struct passwd *, ENTRY *);
128 int p_uid(char *, struct passwd *, ENTRY *);
129 #ifdef OPEN_DIRECTORY
130 int p_uuid(char *, struct passwd *, ENTRY *);
131 #endif /* OPEN_DIRECTORY */
132 char *ttoa(time_t);