aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2002-06-23 04:24:25 +0000
committerEric Andersen <andersen@codepoet.org>2002-06-23 04:24:25 +0000
commit27f64e1f4eb4354844f6553e37501deffde8373e (patch)
tree632fbb26b13ad67f6efa335c33a22551b2707930 /include
parent0fbff134f400ea51540cfd6ef5eeaeab60f9a5de (diff)
downloadbusybox-27f64e1f4eb4354844f6553e37501deffde8373e.tar.gz
Port over the last of the tinylogin applets
-Erik
Diffstat (limited to 'include')
-rw-r--r--include/applets.h9
-rw-r--r--include/libbb.h30
-rw-r--r--include/shadow_.h82
-rw-r--r--include/usage.h34
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 @@
#ifdef CONFIG_OD
APPLET(od, od_main, _BB_DIR_USR_BIN, _BB_SUID_NEVER)
#endif
+#ifdef CONFIG_PASSWD
+ APPLET(passwd, passwd_main, _BB_DIR_USR_BIN, _BB_SUID_ALWAYS)
+#endif
#ifdef CONFIG_PIDOF
APPLET(pidof, pidof_main, _BB_DIR_BIN, _BB_SUID_NEVER)
#endif
@@ -419,6 +422,9 @@
#ifdef CONFIG_SU
APPLET(su, su_main, _BB_DIR_BIN, _BB_SUID_ALWAYS)
#endif
+#ifdef CONFIG_SULOGIN
+ APPLET(sulogin, sulogin_main, _BB_DIR_SBIN, _BB_SUID_NEVER)
+#endif
#ifdef CONFIG_SWAPONOFF
APPLET(swapoff, swap_on_off_main, _BB_DIR_SBIN, _BB_SUID_NEVER)
#endif
@@ -505,6 +511,9 @@
#ifdef CONFIG_VI
APPLET(vi, vi_main, _BB_DIR_BIN, _BB_SUID_NEVER)
#endif
+#ifdef CONFIG_VLOCK
+ APPLET(vlock, vlock_main, _BB_DIR_USR_BIN, _BB_SUID_ALWAYS)
+#endif
#ifdef CONFIG_WATCHDOG
APPLET(watchdog, watchdog_main, _BB_DIR_SBIN, _BB_SUID_NEVER)
#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 @@
#include "config.h"
+#include "pwd.h"
+#include "grp.h"
+#ifdef CONFIG_FEATURE_SHADOWPASSWDS
+#include "shadow_.h"
+#endif
+#ifdef CONFIG_FEATURE_SHA1_PASSWORDS
+# include "sha1.h"
+#endif
+
+
#if (__GNU_LIBRARY__ < 5) && (!defined __dietlibc__)
/* libc5 doesn't define socklen_t */
typedef unsigned int socklen_t;
@@ -260,6 +270,15 @@ extern const char * const too_few_args;
extern const char * const name_longer_than_foo;
extern const char * const unknown;
extern const char * const can_not_create_raw_socket;
+extern const char * const nologin_file;
+extern const char * const passwd_file;
+extern const char * const shadow_file;
+extern const char * const gshadow_file;
+extern const char * const group_file;
+extern const char * const securetty_file;
+extern const char * const motd_file;
+extern const char * const issue_file;
+extern const char * const _path_login;
#ifdef CONFIG_FEATURE_DEVFS
# define CURRENT_VC "/dev/vc/0"
@@ -299,4 +318,15 @@ void reset_ino_dev_hashtable(void);
extern size_t xstrlen(const char *string);
#define strlen(x) xstrlen(x)
+
+#define FAIL_DELAY 3
+extern void change_identity ( const struct passwd *pw );
+extern void run_shell ( const char *shell, int loginshell, const char *command, const char **additional_args );
+extern int restricted_shell ( const char *shell );
+extern void setup_environment ( const char *shell, int loginshell, int changeenv, const struct passwd *pw );
+extern int correct_password ( const struct passwd *pw );
+extern char *pw_encrypt(const char *clear, const char *salt);
+extern struct spwd *pwd_to_spwd(const struct passwd *pw);
+extern int obscure(const char *old, const char *newval, const struct passwd *pwdp);
+
#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 @@
+/*
+ * Copyright 1988 - 1994, Julianne Frances Haugh <jockgrrl@austin.rr.com>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Julianne F. Haugh nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY JULIE HAUGH AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL JULIE HAUGH OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifndef _H_SHADOW
+#define _H_SHADOW
+
+
+#ifdef USE_SYSTEM_SHADOW
+#include <shadow.h>
+#else
+
+/*
+ * This information is not derived from AT&T licensed sources. Posted
+ * to the USENET 11/88, and updated 11/90 with information from SVR4.
+ *
+ * $Id: shadow_.h,v 1.1 2002/06/23 04:24:20 andersen Exp $
+ */
+
+typedef long sptime;
+
+/*
+ * Shadow password security file structure.
+ */
+
+struct spwd {
+ char *sp_namp; /* login name */
+ char *sp_pwdp; /* encrypted password */
+ sptime sp_lstchg; /* date of last change */
+ sptime sp_min; /* minimum number of days between changes */
+ sptime sp_max; /* maximum number of days between changes */
+ sptime sp_warn; /* number of days of warning before password
+ expires */
+ sptime sp_inact; /* number of days after password expires
+ until the account becomes unusable. */
+ sptime sp_expire; /* days since 1/1/70 until account expires */
+ unsigned long sp_flag; /* reserved for future use */
+};
+
+/*
+ * Shadow password security file functions.
+ */
+
+#include <stdio.h> /* for FILE */
+
+extern struct spwd *getspent(void);
+extern struct spwd *sgetspent(const char *);
+extern struct spwd *fgetspent(FILE *);
+extern void setspent(void);
+extern void endspent(void);
+extern int putspent(const struct spwd *, FILE *);
+extern struct spwd *getspnam(const char *name);
+extern struct spwd *pwd_to_spwd(const struct passwd *pw);
+
+#endif /* USE_LOCAL_SHADOW */
+
+#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 @@
"Write an unambiguous representation, octal bytes by default, of FILE\n"\
"to standard output. With no FILE, or when FILE is -, read standard input."
+#ifdef CONFIG_FEATURE_SHA1_PASSWORDS
+ #define PASSWORD_ALG_TYPES(a) a
+#else
+ #define PASSWORD_ALG_TYPES(a)
+#endif
+#define passwd_trivial_usage \
+ "[OPTION] [name]"
+#define passwd_full_usage \
+ "CChange a user password. If no name is specified,\n" \
+ "changes the password for the current user.\n" \
+ "Options:\n" \
+ "\t-a\tDefine which algorithm shall be used for the password.\n" \
+ "\t\t\t(Choices: des, md5" \
+ CONFIG_FEATURE_SHA1_PASSWORDS(", sha1") \
+ ")\n\t-d\tDelete the password for the specified user account.\n" \
+ "\t-l\tLocks (disables) the specified user account.\n" \
+ "\t-u\tUnlocks (re-enables) the specified user account.";
+
#define pidof_trivial_usage \
"process-name [process-name ...]"
#define pidof_full_usage \
@@ -1586,6 +1604,15 @@
"Options:\n" \
"\t-p\tPreserve environment"
+#define sulogin_trivial_usage \
+ "[OPTION]... [tty-device]"
+#define sulogin_full_usage \
+ "Single user login\n" \
+ "Options:\n" \
+ "\t-f\tDo not authenticate (user already authenticated)\n" \
+ "\t-h\tName of the remote host for this login.\n" \
+ "\t-p\tPreserve environment."
+
#define swapoff_trivial_usage \
"[OPTION] [DEVICE]"
#define swapoff_full_usage \
@@ -1956,6 +1983,13 @@
"Options:\n" \
"\t-R\tRead-only- do not write to the file."
+#define vlock_trivial_usage \
+ "[OPTIONS]"
+#define vlock_full_usage \
+ "Lock a virtual terminal. A password is required to unlock\n" \
+ "Options:\n" \
+ "\t-a\tLock all VTs"
+
#define watchdog_trivial_usage \
"DEV"
#define watchdog_full_usage \