diff options
| author | Eric Andersen <andersen@codepoet.org> | 2002-06-23 04:24:25 +0000 |
|---|---|---|
| committer | Eric Andersen <andersen@codepoet.org> | 2002-06-23 04:24:25 +0000 |
| commit | 27f64e1f4eb4354844f6553e37501deffde8373e (patch) | |
| tree | 632fbb26b13ad67f6efa335c33a22551b2707930 /include | |
| parent | 0fbff134f400ea51540cfd6ef5eeaeab60f9a5de (diff) | |
| download | busybox-w32-27f64e1f4eb4354844f6553e37501deffde8373e.tar.gz busybox-w32-27f64e1f4eb4354844f6553e37501deffde8373e.tar.bz2 busybox-w32-27f64e1f4eb4354844f6553e37501deffde8373e.zip | |
Port over the last of the tinylogin applets
-Erik
Diffstat (limited to 'include')
| -rw-r--r-- | include/applets.h | 9 | ||||
| -rw-r--r-- | include/libbb.h | 30 | ||||
| -rw-r--r-- | include/shadow_.h | 82 | ||||
| -rw-r--r-- | include/usage.h | 34 |
4 files changed, 155 insertions, 0 deletions
diff --git a/include/applets.h b/include/applets.h index 3a8c731a5..c2d7acf4b 100644 --- a/include/applets.h +++ b/include/applets.h | |||
| @@ -335,6 +335,9 @@ | |||
| 335 | #ifdef CONFIG_OD | 335 | #ifdef CONFIG_OD |
| 336 | APPLET(od, od_main, _BB_DIR_USR_BIN, _BB_SUID_NEVER) | 336 | APPLET(od, od_main, _BB_DIR_USR_BIN, _BB_SUID_NEVER) |
| 337 | #endif | 337 | #endif |
| 338 | #ifdef CONFIG_PASSWD | ||
| 339 | APPLET(passwd, passwd_main, _BB_DIR_USR_BIN, _BB_SUID_ALWAYS) | ||
| 340 | #endif | ||
| 338 | #ifdef CONFIG_PIDOF | 341 | #ifdef CONFIG_PIDOF |
| 339 | APPLET(pidof, pidof_main, _BB_DIR_BIN, _BB_SUID_NEVER) | 342 | APPLET(pidof, pidof_main, _BB_DIR_BIN, _BB_SUID_NEVER) |
| 340 | #endif | 343 | #endif |
| @@ -419,6 +422,9 @@ | |||
| 419 | #ifdef CONFIG_SU | 422 | #ifdef CONFIG_SU |
| 420 | APPLET(su, su_main, _BB_DIR_BIN, _BB_SUID_ALWAYS) | 423 | APPLET(su, su_main, _BB_DIR_BIN, _BB_SUID_ALWAYS) |
| 421 | #endif | 424 | #endif |
| 425 | #ifdef CONFIG_SULOGIN | ||
| 426 | APPLET(sulogin, sulogin_main, _BB_DIR_SBIN, _BB_SUID_NEVER) | ||
| 427 | #endif | ||
| 422 | #ifdef CONFIG_SWAPONOFF | 428 | #ifdef CONFIG_SWAPONOFF |
| 423 | APPLET(swapoff, swap_on_off_main, _BB_DIR_SBIN, _BB_SUID_NEVER) | 429 | APPLET(swapoff, swap_on_off_main, _BB_DIR_SBIN, _BB_SUID_NEVER) |
| 424 | #endif | 430 | #endif |
| @@ -505,6 +511,9 @@ | |||
| 505 | #ifdef CONFIG_VI | 511 | #ifdef CONFIG_VI |
| 506 | APPLET(vi, vi_main, _BB_DIR_BIN, _BB_SUID_NEVER) | 512 | APPLET(vi, vi_main, _BB_DIR_BIN, _BB_SUID_NEVER) |
| 507 | #endif | 513 | #endif |
| 514 | #ifdef CONFIG_VLOCK | ||
| 515 | APPLET(vlock, vlock_main, _BB_DIR_USR_BIN, _BB_SUID_ALWAYS) | ||
| 516 | #endif | ||
| 508 | #ifdef CONFIG_WATCHDOG | 517 | #ifdef CONFIG_WATCHDOG |
| 509 | APPLET(watchdog, watchdog_main, _BB_DIR_SBIN, _BB_SUID_NEVER) | 518 | APPLET(watchdog, watchdog_main, _BB_DIR_SBIN, _BB_SUID_NEVER) |
| 510 | #endif | 519 | #endif |
diff --git a/include/libbb.h b/include/libbb.h index 0b2411fcd..2b9fd5fd6 100644 --- a/include/libbb.h +++ b/include/libbb.h | |||
| @@ -39,6 +39,16 @@ | |||
| 39 | 39 | ||
| 40 | #include "config.h" | 40 | #include "config.h" |
| 41 | 41 | ||
| 42 | #include "pwd.h" | ||
| 43 | #include "grp.h" | ||
| 44 | #ifdef CONFIG_FEATURE_SHADOWPASSWDS | ||
| 45 | #include "shadow_.h" | ||
| 46 | #endif | ||
| 47 | #ifdef CONFIG_FEATURE_SHA1_PASSWORDS | ||
| 48 | # include "sha1.h" | ||
| 49 | #endif | ||
| 50 | |||
| 51 | |||
| 42 | #if (__GNU_LIBRARY__ < 5) && (!defined __dietlibc__) | 52 | #if (__GNU_LIBRARY__ < 5) && (!defined __dietlibc__) |
| 43 | /* libc5 doesn't define socklen_t */ | 53 | /* libc5 doesn't define socklen_t */ |
| 44 | typedef unsigned int socklen_t; | 54 | typedef unsigned int socklen_t; |
| @@ -260,6 +270,15 @@ extern const char * const too_few_args; | |||
| 260 | extern const char * const name_longer_than_foo; | 270 | extern const char * const name_longer_than_foo; |
| 261 | extern const char * const unknown; | 271 | extern const char * const unknown; |
| 262 | extern const char * const can_not_create_raw_socket; | 272 | extern const char * const can_not_create_raw_socket; |
| 273 | extern const char * const nologin_file; | ||
| 274 | extern const char * const passwd_file; | ||
| 275 | extern const char * const shadow_file; | ||
| 276 | extern const char * const gshadow_file; | ||
| 277 | extern const char * const group_file; | ||
| 278 | extern const char * const securetty_file; | ||
| 279 | extern const char * const motd_file; | ||
| 280 | extern const char * const issue_file; | ||
| 281 | extern const char * const _path_login; | ||
| 263 | 282 | ||
| 264 | #ifdef CONFIG_FEATURE_DEVFS | 283 | #ifdef CONFIG_FEATURE_DEVFS |
| 265 | # define CURRENT_VC "/dev/vc/0" | 284 | # define CURRENT_VC "/dev/vc/0" |
| @@ -299,4 +318,15 @@ void reset_ino_dev_hashtable(void); | |||
| 299 | extern size_t xstrlen(const char *string); | 318 | extern size_t xstrlen(const char *string); |
| 300 | #define strlen(x) xstrlen(x) | 319 | #define strlen(x) xstrlen(x) |
| 301 | 320 | ||
| 321 | |||
| 322 | #define FAIL_DELAY 3 | ||
| 323 | extern void change_identity ( const struct passwd *pw ); | ||
| 324 | extern void run_shell ( const char *shell, int loginshell, const char *command, const char **additional_args ); | ||
| 325 | extern int restricted_shell ( const char *shell ); | ||
| 326 | extern void setup_environment ( const char *shell, int loginshell, int changeenv, const struct passwd *pw ); | ||
| 327 | extern int correct_password ( const struct passwd *pw ); | ||
| 328 | extern char *pw_encrypt(const char *clear, const char *salt); | ||
| 329 | extern struct spwd *pwd_to_spwd(const struct passwd *pw); | ||
| 330 | extern int obscure(const char *old, const char *newval, const struct passwd *pwdp); | ||
| 331 | |||
| 302 | #endif /* __LIBCONFIG_H__ */ | 332 | #endif /* __LIBCONFIG_H__ */ |
diff --git a/include/shadow_.h b/include/shadow_.h new file mode 100644 index 000000000..a677d5262 --- /dev/null +++ b/include/shadow_.h | |||
| @@ -0,0 +1,82 @@ | |||
| 1 | /* | ||
| 2 | * Copyright 1988 - 1994, Julianne Frances Haugh <jockgrrl@austin.rr.com> | ||
| 3 | * All rights reserved. | ||
| 4 | * | ||
| 5 | * Redistribution and use in source and binary forms, with or without | ||
| 6 | * modification, are permitted provided that the following conditions | ||
| 7 | * are met: | ||
| 8 | * 1. Redistributions of source code must retain the above copyright | ||
| 9 | * notice, this list of conditions and the following disclaimer. | ||
| 10 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 11 | * notice, this list of conditions and the following disclaimer in the | ||
| 12 | * documentation and/or other materials provided with the distribution. | ||
| 13 | * 3. Neither the name of Julianne F. Haugh nor the names of its contributors | ||
| 14 | * may be used to endorse or promote products derived from this software | ||
| 15 | * without specific prior written permission. | ||
| 16 | * | ||
| 17 | * THIS SOFTWARE IS PROVIDED BY JULIE HAUGH AND CONTRIBUTORS ``AS IS'' AND | ||
| 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 19 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 20 | * ARE DISCLAIMED. IN NO EVENT SHALL JULIE HAUGH OR CONTRIBUTORS BE LIABLE | ||
| 21 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 22 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 23 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 24 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 25 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 26 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 27 | * SUCH DAMAGE. | ||
| 28 | */ | ||
| 29 | |||
| 30 | #ifndef _H_SHADOW | ||
| 31 | #define _H_SHADOW | ||
| 32 | |||
| 33 | |||
| 34 | #ifdef USE_SYSTEM_SHADOW | ||
| 35 | #include <shadow.h> | ||
| 36 | #else | ||
| 37 | |||
| 38 | /* | ||
| 39 | * This information is not derived from AT&T licensed sources. Posted | ||
| 40 | * to the USENET 11/88, and updated 11/90 with information from SVR4. | ||
| 41 | * | ||
| 42 | * $Id: shadow_.h,v 1.1 2002/06/23 04:24:20 andersen Exp $ | ||
| 43 | */ | ||
| 44 | |||
| 45 | typedef long sptime; | ||
| 46 | |||
| 47 | /* | ||
| 48 | * Shadow password security file structure. | ||
| 49 | */ | ||
| 50 | |||
| 51 | struct spwd { | ||
| 52 | char *sp_namp; /* login name */ | ||
| 53 | char *sp_pwdp; /* encrypted password */ | ||
| 54 | sptime sp_lstchg; /* date of last change */ | ||
| 55 | sptime sp_min; /* minimum number of days between changes */ | ||
| 56 | sptime sp_max; /* maximum number of days between changes */ | ||
| 57 | sptime sp_warn; /* number of days of warning before password | ||
| 58 | expires */ | ||
| 59 | sptime sp_inact; /* number of days after password expires | ||
| 60 | until the account becomes unusable. */ | ||
| 61 | sptime sp_expire; /* days since 1/1/70 until account expires */ | ||
| 62 | unsigned long sp_flag; /* reserved for future use */ | ||
| 63 | }; | ||
| 64 | |||
| 65 | /* | ||
| 66 | * Shadow password security file functions. | ||
| 67 | */ | ||
| 68 | |||
| 69 | #include <stdio.h> /* for FILE */ | ||
| 70 | |||
| 71 | extern struct spwd *getspent(void); | ||
| 72 | extern struct spwd *sgetspent(const char *); | ||
| 73 | extern struct spwd *fgetspent(FILE *); | ||
| 74 | extern void setspent(void); | ||
| 75 | extern void endspent(void); | ||
| 76 | extern int putspent(const struct spwd *, FILE *); | ||
| 77 | extern struct spwd *getspnam(const char *name); | ||
| 78 | extern struct spwd *pwd_to_spwd(const struct passwd *pw); | ||
| 79 | |||
| 80 | #endif /* USE_LOCAL_SHADOW */ | ||
| 81 | |||
| 82 | #endif /* _H_SHADOW */ | ||
diff --git a/include/usage.h b/include/usage.h index 08ee00d77..18593fb1d 100644 --- a/include/usage.h +++ b/include/usage.h | |||
| @@ -1321,6 +1321,24 @@ | |||
| 1321 | "Write an unambiguous representation, octal bytes by default, of FILE\n"\ | 1321 | "Write an unambiguous representation, octal bytes by default, of FILE\n"\ |
| 1322 | "to standard output. With no FILE, or when FILE is -, read standard input." | 1322 | "to standard output. With no FILE, or when FILE is -, read standard input." |
| 1323 | 1323 | ||
| 1324 | #ifdef CONFIG_FEATURE_SHA1_PASSWORDS | ||
| 1325 | #define PASSWORD_ALG_TYPES(a) a | ||
| 1326 | #else | ||
| 1327 | #define PASSWORD_ALG_TYPES(a) | ||
| 1328 | #endif | ||
| 1329 | #define passwd_trivial_usage \ | ||
| 1330 | "[OPTION] [name]" | ||
| 1331 | #define passwd_full_usage \ | ||
| 1332 | "CChange a user password. If no name is specified,\n" \ | ||
| 1333 | "changes the password for the current user.\n" \ | ||
| 1334 | "Options:\n" \ | ||
| 1335 | "\t-a\tDefine which algorithm shall be used for the password.\n" \ | ||
| 1336 | "\t\t\t(Choices: des, md5" \ | ||
| 1337 | CONFIG_FEATURE_SHA1_PASSWORDS(", sha1") \ | ||
| 1338 | ")\n\t-d\tDelete the password for the specified user account.\n" \ | ||
| 1339 | "\t-l\tLocks (disables) the specified user account.\n" \ | ||
| 1340 | "\t-u\tUnlocks (re-enables) the specified user account."; | ||
| 1341 | |||
| 1324 | #define pidof_trivial_usage \ | 1342 | #define pidof_trivial_usage \ |
| 1325 | "process-name [process-name ...]" | 1343 | "process-name [process-name ...]" |
| 1326 | #define pidof_full_usage \ | 1344 | #define pidof_full_usage \ |
| @@ -1586,6 +1604,15 @@ | |||
| 1586 | "Options:\n" \ | 1604 | "Options:\n" \ |
| 1587 | "\t-p\tPreserve environment" | 1605 | "\t-p\tPreserve environment" |
| 1588 | 1606 | ||
| 1607 | #define sulogin_trivial_usage \ | ||
| 1608 | "[OPTION]... [tty-device]" | ||
| 1609 | #define sulogin_full_usage \ | ||
| 1610 | "Single user login\n" \ | ||
| 1611 | "Options:\n" \ | ||
| 1612 | "\t-f\tDo not authenticate (user already authenticated)\n" \ | ||
| 1613 | "\t-h\tName of the remote host for this login.\n" \ | ||
| 1614 | "\t-p\tPreserve environment." | ||
| 1615 | |||
| 1589 | #define swapoff_trivial_usage \ | 1616 | #define swapoff_trivial_usage \ |
| 1590 | "[OPTION] [DEVICE]" | 1617 | "[OPTION] [DEVICE]" |
| 1591 | #define swapoff_full_usage \ | 1618 | #define swapoff_full_usage \ |
| @@ -1956,6 +1983,13 @@ | |||
| 1956 | "Options:\n" \ | 1983 | "Options:\n" \ |
| 1957 | "\t-R\tRead-only- do not write to the file." | 1984 | "\t-R\tRead-only- do not write to the file." |
| 1958 | 1985 | ||
| 1986 | #define vlock_trivial_usage \ | ||
| 1987 | "[OPTIONS]" | ||
| 1988 | #define vlock_full_usage \ | ||
| 1989 | "Lock a virtual terminal. A password is required to unlock\n" \ | ||
| 1990 | "Options:\n" \ | ||
| 1991 | "\t-a\tLock all VTs" | ||
| 1992 | |||
| 1959 | #define watchdog_trivial_usage \ | 1993 | #define watchdog_trivial_usage \ |
| 1960 | "DEV" | 1994 | "DEV" |
| 1961 | #define watchdog_full_usage \ | 1995 | #define watchdog_full_usage \ |
