2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License as published by
4 * the Free Software Foundation; either version 2 of the License, or
5 * (at your option) any later version.
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
10 * General Public License for more details.
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the Free Software
14 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 * Based in part on code from sash, Copyright (c) 1999 by David I. Bell
17 * Permission has been granted to redistribute this code under the GPL.
26 #include "pwd_grp/pwd.h"
27 #include "pwd_grp/grp.h"
29 #ifdef TLG_FEATURE_MD5_PASSWORDS
32 #ifdef TLG_FEATURE_SHA1_PASSWORDS
37 #include <config/autoconf.h>
39 /* Some useful definitions */
40 #define FALSE ((int) 1)
41 #define TRUE ((int) 0)
44 #define NOLOGIN_FILE "/etc/nologin"
45 #ifndef CONFIG_USER_FLATFSD_FLATFSD
46 #define PASSWD_FILE "/etc/passwd"
47 #define GROUP_FILE "/etc/group"
49 #define PASSWD_FILE "/etc/config/passwd"
50 #define GROUP_FILE "/etc/config/group"
52 #define _PATH_LOGIN "/bin/login"
53 #define CRYPT_EP_SIZE 13 /* Maximum encrypted password size */
66 int (*main) (int argc, char **argv);
67 enum Location location;
73 extern const struct Applet applets[];
75 /* Automagically pull in all the applet function prototypes and
76 * applet usage strings. These are all of the form:
77 * extern int foo_main(int argc, char **argv);
78 * extern const char foo_usage[];
79 * These are all autogenerated from the set of currently defined applets.
85 extern const char *applet_name;
88 /* Utility routines */
89 extern const char *applet_name;
90 extern void usage(const char *usage) __attribute__ ((noreturn));
91 extern void error_msg(const char *s,
93 ...) __attribute__ ((format(printf, 1, 2)));
94 extern void error_msg_and_die(const char *s,
95 ...) __attribute__ ((noreturn,
96 format(printf, 1, 2)));
97 extern void perror_msg(const char *s,
98 ...) __attribute__ ((format(printf, 1, 2)));
99 extern void perror_msg_and_die(const char *s,
100 ...) __attribute__ ((noreturn,
101 format(printf, 1, 2)));
103 extern char *pw_encrypt(const char *clear, const char *salt);
104 extern void addenv(const char *string, const char *value);
105 extern void *xmalloc(size_t size);
106 extern char *xstrdup(const char *s);
107 extern void initenv();
108 extern void checkutmp(int picky);
109 extern void updwtmp(const char *filename, const struct utmp *ut);
110 extern void set_env(int argc, char *const *argv);
111 extern void setutmp(const char *name, const char *line);
112 extern void setup_env(struct passwd *info);
113 extern void shell(char *file, char *arg);
114 extern struct spwd *pwd_to_spwd(const struct passwd *pw);
115 extern int update_passwd(const struct passwd *pw, char *crypt_pw);
116 extern int obscure(const char *old, const char *new,
118 const struct passwd *pwdp);
121 extern struct utmp utent;
124 #define STRFCPY(A,B) \
125 (strncpy((A), (B), sizeof(A) - 1), (A)[sizeof(A) - 1] = '\0')
131 # define difftime(x, y) ((y) - (x))
132 #endif /* __UC_LIBC__ */
134 #endif /* _INTERNAL_H_ */