Reset upstream to 4.16.0
Gbp-Dch: ignore
This commit is contained in:
@@ -119,7 +119,6 @@ libshadow_la_SOURCES = \
|
||||
pwdcheck.c \
|
||||
pwmem.c \
|
||||
remove_tree.c \
|
||||
rlogin.c \
|
||||
root_flag.c \
|
||||
run_part.h \
|
||||
run_part.c \
|
||||
|
||||
+39
-53
@@ -139,22 +139,21 @@ am__libshadow_la_SOURCES_DIST = addgrps.c adds.c adds.h age.c \
|
||||
pam_pass.c pam_pass_non_interactive.c port.c port.h \
|
||||
prefix_flag.c prototypes.h pwauth.c pwauth.h pwio.c pwio.h \
|
||||
pwd_init.c pwd2spwd.c pwdcheck.c pwmem.c remove_tree.c \
|
||||
rlogin.c root_flag.c run_part.h run_part.c salt.c selinux.c \
|
||||
semanage.c setugid.c setupenv.c sgetgrent.c sgetpwent.c \
|
||||
sgetspent.c sgroupio.c sgroupio.h shadow.c shadowio.c \
|
||||
shadowio.h shadowlog.c shadowlog.h shadowlog_internal.h \
|
||||
shadowmem.c shell.c sizeof.h spawn.c sssd.c sssd.h \
|
||||
string/sprintf.c string/sprintf.h string/stpecpy.c \
|
||||
string/stpecpy.h string/stpeprintf.c string/stpeprintf.h \
|
||||
string/strftime.c string/strftime.h string/strncpy.h \
|
||||
string/strtcpy.c string/strtcpy.h string/zustr2stp.h \
|
||||
strtoday.c sub.c subordinateio.h subordinateio.c sulog.c \
|
||||
time/day_to_str.c time/day_to_str.h ttytype.c tz.c ulimit.c \
|
||||
user_busy.c valid.c write_full.c xgetpwnam.c \
|
||||
xprefix_getpwnam.c xgetpwuid.c xgetgrnam.c xgetgrgid.c \
|
||||
xgetspnam.c yesno.c tcbfuncs.c tcbfuncs.h btrfs.c log.c \
|
||||
logind.c utmp.c freezero.h freezero.c readpassphrase.h \
|
||||
readpassphrase.c
|
||||
root_flag.c run_part.h run_part.c salt.c selinux.c semanage.c \
|
||||
setugid.c setupenv.c sgetgrent.c sgetpwent.c sgetspent.c \
|
||||
sgroupio.c sgroupio.h shadow.c shadowio.c shadowio.h \
|
||||
shadowlog.c shadowlog.h shadowlog_internal.h shadowmem.c \
|
||||
shell.c sizeof.h spawn.c sssd.c sssd.h string/sprintf.c \
|
||||
string/sprintf.h string/stpecpy.c string/stpecpy.h \
|
||||
string/stpeprintf.c string/stpeprintf.h string/strftime.c \
|
||||
string/strftime.h string/strncpy.h string/strtcpy.c \
|
||||
string/strtcpy.h string/zustr2stp.h strtoday.c sub.c \
|
||||
subordinateio.h subordinateio.c sulog.c time/day_to_str.c \
|
||||
time/day_to_str.h ttytype.c tz.c ulimit.c user_busy.c valid.c \
|
||||
write_full.c xgetpwnam.c xprefix_getpwnam.c xgetpwuid.c \
|
||||
xgetgrnam.c xgetgrgid.c xgetspnam.c yesno.c tcbfuncs.c \
|
||||
tcbfuncs.h btrfs.c log.c logind.c utmp.c freezero.h freezero.c \
|
||||
readpassphrase.h readpassphrase.c
|
||||
am__dirstamp = $(am__leading_dot)dirstamp
|
||||
@WITH_TCB_TRUE@am__objects_1 = libshadow_la-tcbfuncs.lo
|
||||
@WITH_BTRFS_TRUE@am__objects_2 = libshadow_la-btrfs.lo
|
||||
@@ -197,17 +196,16 @@ am_libshadow_la_OBJECTS = libshadow_la-addgrps.lo libshadow_la-adds.lo \
|
||||
libshadow_la-pwio.lo libshadow_la-pwd_init.lo \
|
||||
libshadow_la-pwd2spwd.lo libshadow_la-pwdcheck.lo \
|
||||
libshadow_la-pwmem.lo libshadow_la-remove_tree.lo \
|
||||
libshadow_la-rlogin.lo libshadow_la-root_flag.lo \
|
||||
libshadow_la-run_part.lo libshadow_la-salt.lo \
|
||||
libshadow_la-selinux.lo libshadow_la-semanage.lo \
|
||||
libshadow_la-setugid.lo libshadow_la-setupenv.lo \
|
||||
libshadow_la-sgetgrent.lo libshadow_la-sgetpwent.lo \
|
||||
libshadow_la-sgetspent.lo libshadow_la-sgroupio.lo \
|
||||
libshadow_la-shadow.lo libshadow_la-shadowio.lo \
|
||||
libshadow_la-shadowlog.lo libshadow_la-shadowmem.lo \
|
||||
libshadow_la-shell.lo libshadow_la-spawn.lo \
|
||||
libshadow_la-sssd.lo string/libshadow_la-sprintf.lo \
|
||||
string/libshadow_la-stpecpy.lo \
|
||||
libshadow_la-root_flag.lo libshadow_la-run_part.lo \
|
||||
libshadow_la-salt.lo libshadow_la-selinux.lo \
|
||||
libshadow_la-semanage.lo libshadow_la-setugid.lo \
|
||||
libshadow_la-setupenv.lo libshadow_la-sgetgrent.lo \
|
||||
libshadow_la-sgetpwent.lo libshadow_la-sgetspent.lo \
|
||||
libshadow_la-sgroupio.lo libshadow_la-shadow.lo \
|
||||
libshadow_la-shadowio.lo libshadow_la-shadowlog.lo \
|
||||
libshadow_la-shadowmem.lo libshadow_la-shell.lo \
|
||||
libshadow_la-spawn.lo libshadow_la-sssd.lo \
|
||||
string/libshadow_la-sprintf.lo string/libshadow_la-stpecpy.lo \
|
||||
string/libshadow_la-stpeprintf.lo \
|
||||
string/libshadow_la-strftime.lo string/libshadow_la-strtcpy.lo \
|
||||
libshadow_la-strtoday.lo libshadow_la-sub.lo \
|
||||
@@ -313,7 +311,6 @@ am__depfiles_remade = ./$(DEPDIR)/libshadow_la-addgrps.Plo \
|
||||
./$(DEPDIR)/libshadow_la-pwmem.Plo \
|
||||
./$(DEPDIR)/libshadow_la-readpassphrase.Plo \
|
||||
./$(DEPDIR)/libshadow_la-remove_tree.Plo \
|
||||
./$(DEPDIR)/libshadow_la-rlogin.Plo \
|
||||
./$(DEPDIR)/libshadow_la-root_flag.Plo \
|
||||
./$(DEPDIR)/libshadow_la-run_part.Plo \
|
||||
./$(DEPDIR)/libshadow_la-salt.Plo \
|
||||
@@ -449,7 +446,6 @@ EGREP = @EGREP@
|
||||
ETAGS = @ETAGS@
|
||||
EXEEXT = @EXEEXT@
|
||||
FGREP = @FGREP@
|
||||
FILECMD = @FILECMD@
|
||||
GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@
|
||||
GMSGFMT = @GMSGFMT@
|
||||
GMSGFMT_015 = @GMSGFMT_015@
|
||||
@@ -622,20 +618,20 @@ libshadow_la_SOURCES = addgrps.c adds.c adds.h age.c agetpass.c \
|
||||
nscd.c nscd.h obscure.c pam_defs.h pam_pass.c \
|
||||
pam_pass_non_interactive.c port.c port.h prefix_flag.c \
|
||||
prototypes.h pwauth.c pwauth.h pwio.c pwio.h pwd_init.c \
|
||||
pwd2spwd.c pwdcheck.c pwmem.c remove_tree.c rlogin.c \
|
||||
root_flag.c run_part.h run_part.c salt.c selinux.c semanage.c \
|
||||
setugid.c setupenv.c sgetgrent.c sgetpwent.c sgetspent.c \
|
||||
sgroupio.c sgroupio.h shadow.c shadowio.c shadowio.h \
|
||||
shadowlog.c shadowlog.h shadowlog_internal.h shadowmem.c \
|
||||
shell.c sizeof.h spawn.c sssd.c sssd.h string/sprintf.c \
|
||||
string/sprintf.h string/stpecpy.c string/stpecpy.h \
|
||||
string/stpeprintf.c string/stpeprintf.h string/strftime.c \
|
||||
string/strftime.h string/strncpy.h string/strtcpy.c \
|
||||
string/strtcpy.h string/zustr2stp.h strtoday.c sub.c \
|
||||
subordinateio.h subordinateio.c sulog.c time/day_to_str.c \
|
||||
time/day_to_str.h ttytype.c tz.c ulimit.c user_busy.c valid.c \
|
||||
write_full.c xgetpwnam.c xprefix_getpwnam.c xgetpwuid.c \
|
||||
xgetgrnam.c xgetgrgid.c xgetspnam.c yesno.c $(am__append_2) \
|
||||
pwd2spwd.c pwdcheck.c pwmem.c remove_tree.c root_flag.c \
|
||||
run_part.h run_part.c salt.c selinux.c semanage.c setugid.c \
|
||||
setupenv.c sgetgrent.c sgetpwent.c sgetspent.c sgroupio.c \
|
||||
sgroupio.h shadow.c shadowio.c shadowio.h shadowlog.c \
|
||||
shadowlog.h shadowlog_internal.h shadowmem.c shell.c sizeof.h \
|
||||
spawn.c sssd.c sssd.h string/sprintf.c string/sprintf.h \
|
||||
string/stpecpy.c string/stpecpy.h string/stpeprintf.c \
|
||||
string/stpeprintf.h string/strftime.c string/strftime.h \
|
||||
string/strncpy.h string/strtcpy.c string/strtcpy.h \
|
||||
string/zustr2stp.h strtoday.c sub.c subordinateio.h \
|
||||
subordinateio.c sulog.c time/day_to_str.c time/day_to_str.h \
|
||||
ttytype.c tz.c ulimit.c user_busy.c valid.c write_full.c \
|
||||
xgetpwnam.c xprefix_getpwnam.c xgetpwuid.c xgetgrnam.c \
|
||||
xgetgrgid.c xgetspnam.c yesno.c $(am__append_2) \
|
||||
$(am__append_3) $(am__append_4) $(am__append_5) \
|
||||
$(am__append_6) $(am__append_7)
|
||||
|
||||
@@ -815,7 +811,6 @@ distclean-compile:
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libshadow_la-pwmem.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libshadow_la-readpassphrase.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libshadow_la-remove_tree.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libshadow_la-rlogin.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libshadow_la-root_flag.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libshadow_la-run_part.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libshadow_la-salt.Plo@am__quote@ # am--include-marker
|
||||
@@ -1370,13 +1365,6 @@ libshadow_la-remove_tree.lo: remove_tree.c
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libshadow_la_CPPFLAGS) $(CPPFLAGS) $(libshadow_la_CFLAGS) $(CFLAGS) -c -o libshadow_la-remove_tree.lo `test -f 'remove_tree.c' || echo '$(srcdir)/'`remove_tree.c
|
||||
|
||||
libshadow_la-rlogin.lo: rlogin.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libshadow_la_CPPFLAGS) $(CPPFLAGS) $(libshadow_la_CFLAGS) $(CFLAGS) -MT libshadow_la-rlogin.lo -MD -MP -MF $(DEPDIR)/libshadow_la-rlogin.Tpo -c -o libshadow_la-rlogin.lo `test -f 'rlogin.c' || echo '$(srcdir)/'`rlogin.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libshadow_la-rlogin.Tpo $(DEPDIR)/libshadow_la-rlogin.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='rlogin.c' object='libshadow_la-rlogin.lo' libtool=yes @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libshadow_la_CPPFLAGS) $(CPPFLAGS) $(libshadow_la_CFLAGS) $(CFLAGS) -c -o libshadow_la-rlogin.lo `test -f 'rlogin.c' || echo '$(srcdir)/'`rlogin.c
|
||||
|
||||
libshadow_la-root_flag.lo: root_flag.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libshadow_la_CPPFLAGS) $(CPPFLAGS) $(libshadow_la_CFLAGS) $(CFLAGS) -MT libshadow_la-root_flag.lo -MD -MP -MF $(DEPDIR)/libshadow_la-root_flag.Tpo -c -o libshadow_la-root_flag.lo `test -f 'root_flag.c' || echo '$(srcdir)/'`root_flag.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libshadow_la-root_flag.Tpo $(DEPDIR)/libshadow_la-root_flag.Plo
|
||||
@@ -1925,7 +1913,6 @@ distclean: distclean-am
|
||||
-rm -f ./$(DEPDIR)/libshadow_la-pwmem.Plo
|
||||
-rm -f ./$(DEPDIR)/libshadow_la-readpassphrase.Plo
|
||||
-rm -f ./$(DEPDIR)/libshadow_la-remove_tree.Plo
|
||||
-rm -f ./$(DEPDIR)/libshadow_la-rlogin.Plo
|
||||
-rm -f ./$(DEPDIR)/libshadow_la-root_flag.Plo
|
||||
-rm -f ./$(DEPDIR)/libshadow_la-run_part.Plo
|
||||
-rm -f ./$(DEPDIR)/libshadow_la-salt.Plo
|
||||
@@ -2087,7 +2074,6 @@ maintainer-clean: maintainer-clean-am
|
||||
-rm -f ./$(DEPDIR)/libshadow_la-pwmem.Plo
|
||||
-rm -f ./$(DEPDIR)/libshadow_la-readpassphrase.Plo
|
||||
-rm -f ./$(DEPDIR)/libshadow_la-remove_tree.Plo
|
||||
-rm -f ./$(DEPDIR)/libshadow_la-rlogin.Plo
|
||||
-rm -f ./$(DEPDIR)/libshadow_la-root_flag.Plo
|
||||
-rm -f ./$(DEPDIR)/libshadow_la-run_part.Plo
|
||||
-rm -f ./$(DEPDIR)/libshadow_la-salt.Plo
|
||||
|
||||
+2
-10
@@ -23,7 +23,6 @@
|
||||
#include "sizeof.h"
|
||||
|
||||
|
||||
static uint32_t csrand32(void);
|
||||
static uint32_t csrand_uniform32(uint32_t n);
|
||||
static unsigned long csrand_uniform_slow(unsigned long n);
|
||||
|
||||
@@ -98,13 +97,6 @@ csrand_interval(unsigned long min, unsigned long max)
|
||||
}
|
||||
|
||||
|
||||
static uint32_t
|
||||
csrand32(void)
|
||||
{
|
||||
return csrand();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Fast Random Integer Generation in an Interval
|
||||
* ACM Transactions on Modeling and Computer Simulation 29 (1), 2019
|
||||
@@ -117,12 +109,12 @@ csrand_uniform32(uint32_t n)
|
||||
uint64_t r, mult;
|
||||
|
||||
if (n == 0)
|
||||
return csrand32();
|
||||
return csrand();
|
||||
|
||||
bound = -n % n; // analogous to `2^32 % n`, since `x % y == (x-y) % y`
|
||||
|
||||
do {
|
||||
r = csrand32();
|
||||
r = csrand();
|
||||
mult = r * n;
|
||||
rem = mult; // analogous to `mult % 2^32`
|
||||
} while (rem < bound); // p = (2^32 % n) / 2^32; W.C.: n=2^31+1, p=0.5
|
||||
|
||||
@@ -131,6 +131,11 @@ void nss_init(const char *nsswitch_path) {
|
||||
fprintf(shadow_logfd, "%s did not provide @find_subid_owners@\n", libname);
|
||||
goto close_lib;
|
||||
}
|
||||
subid_nss->free = dlsym(h, "shadow_subid_free");
|
||||
if (!subid_nss->free) {
|
||||
fprintf(shadow_logfd, "%s did not provide @subid_free@\n", libname);
|
||||
goto close_lib;
|
||||
}
|
||||
subid_nss->handle = h;
|
||||
goto done;
|
||||
|
||||
|
||||
+13
-4
@@ -284,6 +284,19 @@ struct subid_nss_ops {
|
||||
*/
|
||||
enum subid_status (*find_subid_owners)(unsigned long id, enum subid_type id_type, uid_t **uids, int *count);
|
||||
|
||||
/*
|
||||
* nss_free: free a memory block allocated by a subid plugin.
|
||||
*
|
||||
* @ptr - a pointer to a memory block to deallocate
|
||||
*
|
||||
* Some routines of subid_nss_ops allocate memory which should be freed by
|
||||
* caller after use. In order to deallocate that memory block, one should
|
||||
* use this routine to release that memory. By default, this function
|
||||
* pointer is set to free(3) for backward compatibility. However, it is
|
||||
* strongly recommended to define this routine explicitly.
|
||||
*/
|
||||
void (*free)(void *ptr);
|
||||
|
||||
/* The dlsym handle to close */
|
||||
void *handle;
|
||||
};
|
||||
@@ -356,10 +369,6 @@ unsigned long csrand_interval (unsigned long min, unsigned long max);
|
||||
/* remove_tree.c */
|
||||
extern int remove_tree (const char *root, bool remove_root);
|
||||
|
||||
/* rlogin.c */
|
||||
extern int do_rlogin(const char *remote_host, char *name, size_t namesize,
|
||||
char *term, size_t termsize);
|
||||
|
||||
/* root_flag.c */
|
||||
extern void process_root_flag (const char* short_opt, int argc, char **argv);
|
||||
|
||||
|
||||
-135
@@ -1,135 +0,0 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 1989 - 1994, Julianne Frances Haugh
|
||||
* SPDX-FileCopyrightText: 1996 - 1999, Marek Michałkiewicz
|
||||
* SPDX-FileCopyrightText: 2003 - 2005, Tomasz Kłoczko
|
||||
* SPDX-FileCopyrightText: 2007 - 2008, Nicolas François
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#ifdef RLOGIN
|
||||
|
||||
#ident "$Id$"
|
||||
|
||||
#include "prototypes.h"
|
||||
#include "defines.h"
|
||||
#include <stdio.h>
|
||||
#include <pwd.h>
|
||||
#include <netdb.h>
|
||||
|
||||
#include "atoi/str2i.h"
|
||||
|
||||
|
||||
static struct {
|
||||
int spd_name;
|
||||
int spd_baud;
|
||||
} speed_table[] =
|
||||
{
|
||||
{ B50, 50},
|
||||
{ B75, 75},
|
||||
{ B110, 110},
|
||||
{ B134, 134},
|
||||
{ B150, 150},
|
||||
{ B200, 200},
|
||||
{ B300, 300},
|
||||
{ B600, 600},
|
||||
{ B1200, 1200},
|
||||
{ B1800, 1800},
|
||||
{ B2400, 2400},
|
||||
{ B4800, 4800},
|
||||
{ B9600, 9600},
|
||||
{ B19200, 19200},
|
||||
{ B38400, 38400},
|
||||
{ -1, -1}
|
||||
};
|
||||
|
||||
|
||||
static void
|
||||
get_remote_string(char *buf, size_t size)
|
||||
{
|
||||
for (;;) {
|
||||
if (read (0, buf, 1) != 1) {
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
if ('\0' == *buf) {
|
||||
return;
|
||||
}
|
||||
--size;
|
||||
if (size > 0) {
|
||||
++buf;
|
||||
}
|
||||
}
|
||||
/*NOTREACHED*/
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
do_rlogin(const char *remote_host, char *name, size_t namesize, char *term,
|
||||
size_t termsize)
|
||||
{
|
||||
struct passwd *pwd;
|
||||
char remote_name[32];
|
||||
char *cp;
|
||||
unsigned long remote_speed = 9600;
|
||||
int speed_name = B9600;
|
||||
int i;
|
||||
TERMIO termio;
|
||||
|
||||
get_remote_string(remote_name, sizeof(remote_name));
|
||||
get_remote_string(name, namesize);
|
||||
get_remote_string(term, termsize);
|
||||
|
||||
cp = strchr (term, '/');
|
||||
if (NULL != cp) {
|
||||
*cp = '\0';
|
||||
cp++;
|
||||
|
||||
if (str2ul(&remote_speed, cp) == -1)
|
||||
remote_speed = 9600;
|
||||
}
|
||||
for (i = 0;
|
||||
( (speed_table[i].spd_baud != remote_speed)
|
||||
&& (speed_table[i].spd_name != -1));
|
||||
i++);
|
||||
|
||||
if (-1 != speed_table[i].spd_name) {
|
||||
speed_name = speed_table[i].spd_name;
|
||||
}
|
||||
|
||||
/*
|
||||
* Put the terminal in cooked mode with echo turned on.
|
||||
*/
|
||||
|
||||
GTTY (0, &termio);
|
||||
termio.c_iflag |= ICRNL | IXON;
|
||||
termio.c_oflag |= OPOST | ONLCR;
|
||||
termio.c_lflag |= ICANON | ECHO | ECHOE;
|
||||
#ifdef CBAUD
|
||||
termio.c_cflag = (termio.c_cflag & ~CBAUD) | speed_name;
|
||||
#else
|
||||
termio.c_cflag = (termio.c_cflag) | speed_name;
|
||||
#endif
|
||||
STTY (0, &termio);
|
||||
|
||||
pwd = getpwnam (name); /* local, no need for xgetpwnam */
|
||||
if (NULL == pwd) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* ruserok() returns 0 for success on modern systems, and 1 on
|
||||
* older ones. If you are having trouble with people logging
|
||||
* in without giving a required password, THIS is the culprit -
|
||||
* go fix the #define in config.h.
|
||||
*/
|
||||
|
||||
#ifndef RUSEROK
|
||||
return 0;
|
||||
#else
|
||||
return ruserok (remote_host, pwd->pw_uid == 0,
|
||||
remote_name, name) == RUSEROK;
|
||||
#endif
|
||||
}
|
||||
#endif /* RLOGIN */
|
||||
+43
-59
@@ -274,8 +274,40 @@ static const struct subordinate_range *find_range(struct commonio_db *db,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* have_range: check whether @owner is authorized to use the range
|
||||
* (@start .. @start+@count-1).
|
||||
* @db: database to check
|
||||
* @owner: owning uid being queried
|
||||
* @start: start of range
|
||||
* @count: number of uids in range
|
||||
*
|
||||
* Returns true if @owner is authorized to use the range, false otherwise.
|
||||
*/
|
||||
static bool have_range(struct commonio_db *db,
|
||||
const char *owner, unsigned long start, unsigned long count);
|
||||
const char *owner, unsigned long start, unsigned long count)
|
||||
{
|
||||
const struct subordinate_range *range;
|
||||
unsigned long end;
|
||||
|
||||
if (count == 0)
|
||||
return false;
|
||||
|
||||
end = start + count - 1;
|
||||
range = find_range (db, owner, start);
|
||||
while (range) {
|
||||
unsigned long last;
|
||||
|
||||
last = range->start + range->count - 1;
|
||||
if (last >= (start + count - 1))
|
||||
return true;
|
||||
|
||||
count = end - last;
|
||||
start = last + 1;
|
||||
range = find_range(db, owner, start);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool append_range(struct subid_range **ranges, const struct subordinate_range *new, int n)
|
||||
{
|
||||
@@ -542,64 +574,6 @@ static struct commonio_db subordinate_uid_db = {
|
||||
false /* setname */
|
||||
};
|
||||
|
||||
/*
|
||||
* have_range: check whether @owner is authorized to use the range
|
||||
* (@start .. @start+@count-1).
|
||||
* @db: database to check
|
||||
* @owner: owning uid being queried
|
||||
* @start: start of range
|
||||
* @count: number of uids in range
|
||||
*
|
||||
* Returns true if @owner is authorized to use the range, false otherwise.
|
||||
*/
|
||||
static bool have_range(struct commonio_db *db,
|
||||
const char *owner, unsigned long start, unsigned long count)
|
||||
{
|
||||
const struct subordinate_range *range;
|
||||
unsigned long end;
|
||||
bool doclose = false;
|
||||
bool ret = false;
|
||||
int rc;
|
||||
|
||||
if (count == 0)
|
||||
return false;
|
||||
|
||||
if (!db->isopen) {
|
||||
doclose = true;
|
||||
if (db == &subordinate_uid_db)
|
||||
rc = sub_uid_open(O_RDONLY);
|
||||
else
|
||||
rc = sub_gid_open(O_RDONLY);
|
||||
if (rc < 0)
|
||||
return false;
|
||||
}
|
||||
|
||||
end = start + count - 1;
|
||||
range = find_range (db, owner, start);
|
||||
while (range) {
|
||||
unsigned long last;
|
||||
|
||||
last = range->start + range->count - 1;
|
||||
if (last >= (start + count - 1)) {
|
||||
ret = true;
|
||||
break;
|
||||
}
|
||||
|
||||
count = end - last;
|
||||
start = last + 1;
|
||||
range = find_range(db, owner, start);
|
||||
}
|
||||
|
||||
if (doclose) {
|
||||
if (db == &subordinate_uid_db)
|
||||
sub_uid_close();
|
||||
else
|
||||
sub_gid_close();
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int sub_uid_setdbname (const char *filename)
|
||||
{
|
||||
return commonio_setname (&subordinate_uid_db, filename);
|
||||
@@ -1143,6 +1117,16 @@ bool release_subid_range(struct subordinate_range *range, enum subid_type id_typ
|
||||
return ret;
|
||||
}
|
||||
|
||||
void free_subid_pointer(void *ptr)
|
||||
{
|
||||
struct subid_nss_ops *h = get_subid_nss_handle();
|
||||
if (h) {
|
||||
h->free(ptr);
|
||||
} else {
|
||||
free(ptr);
|
||||
}
|
||||
}
|
||||
|
||||
#else /* !ENABLE_SUBIDS */
|
||||
extern int ISO_C_forbids_an_empty_translation_unit;
|
||||
#endif /* !ENABLE_SUBIDS */
|
||||
|
||||
@@ -43,6 +43,9 @@ extern int sub_gid_unlock (void);
|
||||
extern int sub_gid_add (const char *owner, gid_t start, unsigned long count);
|
||||
extern int sub_gid_remove (const char *owner, gid_t start, unsigned long count);
|
||||
extern uid_t sub_gid_find_free_range(gid_t min, gid_t max, unsigned long count);
|
||||
|
||||
extern void free_subid_pointer(void *ptr);
|
||||
|
||||
#endif /* ENABLE_SUBIDS */
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user