Skip to content

Integrate su into util-linux #11

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 106 commits into from
May 29, 2012
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
106 commits
Select commit Hold shift + click to select a range
0728090
Initial revision
meyering Oct 31, 1992
9678ebc
Initial revision
meyering Nov 1, 1992
385fd9d
Make still more file-scope variables `static'.
meyering Nov 1, 1992
b4a5684
all files: make most variables static and const when possible.
meyering Nov 12, 1992
a261f05
Convert static declarations of struct option to use new macros from
meyering Dec 2, 1992
b6a55b2
merge with 1.8.1 + partial --version and --help
meyering Sep 8, 1993
9fd214f
merge with 1.8.1b
meyering Oct 12, 1993
217825f
merge with 1.8.1d
meyering Oct 12, 1993
bc7510e
merge with 1.8.1g
meyering Oct 17, 1993
7af6dac
merge with 1.8.1h
meyering Oct 24, 1993
e41cfda
merge with 1.8.1i
meyering Oct 26, 1993
9ce9129
merge with 1.9
meyering Nov 9, 1993
a7f2355
.
meyering Feb 1, 1994
3e13ef4
.
meyering Apr 20, 1994
4e7c6e0
.
meyering Jul 26, 1994
e3feb4f
.
meyering Aug 3, 1994
99d439a
.
meyering Aug 3, 1994
4214f67
.
meyering Sep 18, 1994
e34290f
.
meyering Sep 25, 1994
8303e08
merge with 1.10n2
meyering Sep 27, 1994
f014992
.
meyering Oct 1, 1994
db90b9d
.
meyering Oct 11, 1994
55eef5a
* src/*.c: Include "error.h" instead of simply declaring
meyering Dec 20, 1994
742f505
(correct_password): Use memset instead of bzero.
meyering Feb 27, 1995
070d354
add 1995 to Copyright dates
meyering Mar 9, 1995
a36c9ac
(usage): Add one- and two-line descriptions to --help output.
meyering May 15, 1995
684cda5
Annotate localizable strings with _(...). From Franc,ois.
meyering Aug 8, 1995
7e9dc9c
Indent cpp directives.
meyering Nov 18, 1995
3551197
s/non-zero/nonzero/g
meyering Nov 27, 1995
6c3b4df
Remove NGROUPS_MAX junk. It wasn't being used.
meyering Jan 6, 1996
be07a3a
(main): Initialize for internationalized message support:
meyering Mar 12, 1996
1c85117
Don't include version.h.
meyering Mar 16, 1996
1f79a1b
(main): Declare to be of type int, not void.
meyering Mar 21, 1996
59b9536
Protoize and reorder functions.
meyering Mar 24, 1996
0dc92fd
Update FSF's address.
meyering Mar 24, 1996
5debca5
update Copyright years for 1996
meyering Apr 24, 1996
4c3e205
(usage): Tell where to report bugs.
meyering Sep 2, 1996
b5209f2
(main): update --version output to conform to coding standard
meyering Oct 5, 1996
f7e6720
change bug-reporting address
meyering Nov 2, 1996
c49b337
change bug-reporting address
meyering Nov 3, 1996
5c0a603
[HAVE_PATHS_H]: Include <paths.h>.
meyering Dec 19, 1996
89105fd
Compare getopt_long return value against -1, not EOF. Use NULL, not …
meyering Feb 1, 1997
6fdfb79
bracket bug address with <> and append a period
meyering Feb 1, 1997
8dab010
update copyrights for 1997
meyering Feb 9, 1997
1ae8eaf
(log_su): Resort to getpwuid if getlogin fails.
meyering Mar 18, 1997
cf407c6
cpp-indent
meyering Mar 19, 1997
8e07d01
Use base_name, not basename.
meyering May 27, 1997
132449e
Redefine/undef getusershell around inclusion of <unistd.h>
meyering Jul 5, 1997
d143db7
indent
meyering Jul 13, 1997
2ca4f15
update bug-reporting address
meyering Oct 7, 1997
012be24
Remove old-style xmalloc and xrealloc decls.
meyering Oct 25, 1997
bb677c2
(main): Make sure pw->pw_shell is non-NULL before trying to strdup it.
meyering Dec 10, 1997
3c35aec
use NULL, '\0' instead of zeroes
meyering Dec 10, 1997
8cd5e17
Don't include limits.h.
meyering Dec 21, 1997
935e4d4
(longopts): Use corresponding short-option character
meyering Aug 30, 1998
84404df
update bug-reporting address
meyering Sep 19, 1998
82fcfb1
(usage): Remove static attribute.
meyering Jan 25, 1999
0b66228
update copyright dates
meyering Feb 16, 1999
0133410
Include long-options.h.
meyering Mar 6, 1999
83cafa6
(PROGRAM_NAME, AUTHORS): Define and use.
meyering Mar 31, 1999
0d6cfd6
No longer include long-options.h.
meyering Mar 31, 1999
aaad75e
(run_shell): Declare with noreturn attribute.
meyering Aug 22, 1999
dcdc31f
split a long line.
meyering Aug 30, 1999
7f143c6
Remove declaration of xstrdup.
meyering Sep 8, 1999
ecf3be4
meyering Jan 30, 2000
3c19ad6
(correct_password): Correct HAVE_STRUCT_* name in #if guard
meyering Feb 9, 2000
73a902b
Include "closeout.h".
meyering May 7, 2000
26d6d3f
Include <sys/param.h> if HAVE_SYS_PARAM_H is defined,
meyering Jul 23, 2000
55cb4d4
(xputenv): Invoke xalloc_die instead of printing our own message.
meyering Aug 7, 2000
3758e1f
Correct the indentation of an `#endif'.
meyering Jan 7, 2001
1b78135
back out last, prematurely-committed, change
meyering Jan 7, 2001
787ac7c
Include "dirname.h".
meyering May 12, 2001
7eaedbe
(xputenv): Remove parameter's const qualifier.
meyering Aug 14, 2001
9b586e5
Use new macros, HELP_OPTION_DESCRIPTION and VERSION_OPTION_DESCRIPTION
meyering Dec 15, 2001
f691ff2
(usage): Use the PACKAGE_BUGREPORT e-mail address, rather than hard-c…
meyering Jul 2, 2002
9fa7b2b
(run_shell): Exit with status 126 or 127 when execvp or
meyering Aug 1, 2002
046582e
Change `error (1, ...' to `error (EXIT_FAILURE, ...'.
meyering Aug 30, 2002
722bc00
Change `exit (0)' to `exit (EXIT_SUCCESS)',
meyering Aug 31, 2002
6c940ac
Remove anachronistic casts of xmalloc,
meyering Apr 11, 2003
cf4bd2f
(main): Call initialize_main.
meyering Jun 17, 2003
f7a168d
(usage): Don't call close_stdout here.
meyering Jul 18, 2003
8e5b5ee
Don't include headers already included by system.h:
meyering Jul 23, 2003
6fa9096
(WRITTEN_BY): Rename from AUTHORS.
meyering Sep 18, 2003
571b609
Most .c files (AUTHORS): Revert the WRITTEN_BY/AUTHORS change
meyering Oct 18, 2003
12f1e56
(usage): Use EXIT_SUCCESS, not 0, for clarity.
meyering Jan 22, 2004
179a982
(correct_password, restricted_shell, main):
meyering Jun 1, 2004
0c606e8
(run_shell): Pass a new n_additional_args arg, so that
eggert Aug 3, 2004
47cf26b
Update FSF postal mail address.
meyering May 14, 2005
7d33c6f
Update FSF postal mail address.
meyering May 14, 2005
63f1886
Remove unnecessary parens in `#if defined (SYMBOL)' expressions.
meyering Aug 23, 2005
989f035
(log_su, run_shell): Use new last_component, in place of base_name.
meyering Mar 26, 2006
0d4e003
* src/su.c (usage): Correct typo in --help output: s/commmand/command/
meyering Jul 21, 2006
5b6aef6
Add a bootstrap procedure, so that the CVS version contains fewer
eggert Aug 21, 2006
7943f79
Don't include dirname.h, since system.h does it now.
eggert Sep 3, 2006
ce5f2f2
Help translators include translation team's web or email address.
meyering Mar 28, 2007
d6586bf
merge coreutils' last GPL2 version of su.c
lnussel May 24, 2012
8171142
pam support for su
lnussel Aug 17, 2010
b14d022
log all su attempts
lnussel Aug 17, 2010
a9980c8
set sane default path
lnussel Aug 9, 2010
589554a
honor settings in /etc/default/su resp /etc/login.defs
lnussel Aug 9, 2010
a6fdd3f
make sure /sbin resp /usr/sbin are in PATH
bitstreamout Aug 17, 2010
c6a1746
call setsid() when called with -c
twaugh Jun 10, 2011
ff6b15d
make su build as part of util-linux
lnussel Feb 15, 2012
c92880e
remove non pam code
lnussel May 25, 2012
f29fc7e
syslog always
lnussel May 25, 2012
9c44ac5
use existing logindefs.c and pathnames.h
lnussel May 25, 2012
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions login-utils/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ endif # BUILD_SULOGIN


if BUILD_LOGIN_UTILS
bin_PROGRAMS += login
bin_PROGRAMS += \
login \
su
usrbin_exec_PROGRAMS += \
chfn \
chsh \
Expand All @@ -41,7 +43,7 @@ dist_man_MANS += \
vigr.8 \
vipw.8

# login, chfn and chsh libs
# login, su, chfn and chsh libs
login_ldadd_common =

chfn_SOURCES = \
Expand All @@ -67,20 +69,27 @@ vipw_SOURCES = \
vipw.c \
setpwnam.h \
$(top_srcdir)/lib/fileutils.c
su_SOURCES = \
su.c \
logindefs.c \
logindefs.h

chfn_LDADD = $(login_ldadd_common)
chsh_LDADD = $(login_ldadd_common)
login_LDADD = $(login_ldadd_common)
su_LDADD = $(login_ldadd_common)
newgrp_LDADD =
vipw_LDADD =

chfn_CFLAGS = $(SUID_CFLAGS) $(AM_CFLAGS)
chsh_CFLAGS = $(SUID_CFLAGS) $(AM_CFLAGS)
newgrp_CFLAGS = $(SUID_CFLAGS) $(AM_CFLAGS)
su_CFLAGS = -DUSE_PAM=1 $(SUID_CFLAGS) $(AM_CFLAGS)

chfn_LDFLAGS = $(SUID_LDFLAGS) $(AM_LDFLAGS)
chsh_LDFLAGS = $(SUID_LDFLAGS) $(AM_LDFLAGS)
newgrp_LDFLAGS = $(SUID_LDFLAGS) $(AM_LDFLAGS)
su_LDFLAGS = $(SUID_LDFLAGS)

login_ldadd_common += -lpam -lpam_misc

Expand Down
16 changes: 13 additions & 3 deletions login-utils/logindefs.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ struct item {

static struct item *list = NULL;

void (*logindefs_load_defaults)(void) = NULL;

void free_getlogindefs_data(void)
{
struct item *ptr;
Expand Down Expand Up @@ -77,7 +79,7 @@ static void store(const char *name, const char *value, const char *path)
list = new;
}

static void load_defaults(const char *filename)
void logindefs_load_file(const char *filename)
{
FILE *f;
char buf[BUFSIZ];
Expand Down Expand Up @@ -139,12 +141,20 @@ static void load_defaults(const char *filename)
fclose(f);
}

static void load_defaults()
{
if (logindefs_load_defaults)
logindefs_load_defaults();
else
logindefs_load_file(_PATH_LOGINDEFS);
}

static struct item *search(const char *name)
{
struct item *ptr;

if (!list)
load_defaults(_PATH_LOGINDEFS);
load_defaults();

ptr = list;
while (ptr != NULL) {
Expand Down Expand Up @@ -259,7 +269,7 @@ int main(int argc, char *argv[])
errx(EXIT_FAILURE, "usage: %s <filename> "
"[<str|num|bool> <valname>]", argv[0]);

load_defaults(argv[1]);
logindefs_load_file(argv[1]);

if (argc != 4) { /* list all */
struct item *ptr;
Expand Down
2 changes: 2 additions & 0 deletions login-utils/logindefs.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#ifndef UTIL_LINUX_LOGINDEFS_H
#define UTIL_LINUX_LOGINDEFS_H

extern void logindefs_load_file(const char *filename);
extern void (*logindefs_load_defaults)(void);
extern int getlogindefs_bool(const char *name, int dflt);
extern long getlogindefs_num(const char *name, long dflt);
extern const char *getlogindefs_str(const char *name, const char *dflt);
Expand Down
Loading