[svn-upgrade] Integrating new upstream version, shadow (4.0.0)

This commit is contained in:
nekral-guest
2007-10-07 11:44:51 +00:00
parent 8fee8c57ae
commit 3bc4996775
260 changed files with 36835 additions and 18839 deletions

3
lib/.indent.pro vendored Normal file
View File

@ -0,0 +1,3 @@
-kr
-i8
-bad

View File

@ -1,13 +1,60 @@
AUTOMAKE_OPTIONS = 1.0 foreign
noinst_HEADERS = commonio.h defines.h dialchk.h dialup.h \
faillog.h getdef.h groupio.h md5.h pam_defs.h port.h prototypes.h \
pwauth.h pwio.h rcsid.h sgroupio.h shadowio.h snprintf.h \
tcfsio.h
DEFS =
INCLUDES = -I$(top_srcdir)
localedir = $(datadir)/locale
DEFS = -DLOCALEDIR=\"$(localedir)\" -I. -I$(srcdir) -I.. @DEFS@
lib_LTLIBRARIES = libshadow.la
libshadow_la_LDFLAGS = -version-info 0:0:0
libshadow_la_LIBADD = $(INTLLIBS) $(LIBCRYPT) $(LIBTCFS) $(LIBSKEY) $(LIBMD) \
$(top_builddir)/libmisc/libmisc.la
libshadow_la_SOURCES = \
commonio.c \
commonio.h \
defines.h \
dialchk.c \
dialchk.h \
dialup.c \
dialup.h \
encrypt.c \
faillog.h \
fputsx.c \
getdef.c \
getdef.h \
getpass.c \
groupio.c \
groupio.h \
gshadow.c \
lockpw.c \
md5.h \
pam_defs.h \
port.c \
port.h \
prototypes.h \
pwauth.c \
pwauth.h \
pwio.c \
pwio.h \
rad64.c \
rcsid.h \
sgetgrent.c \
sgetpwent.c \
sgroupio.c \
sgroupio.h\
shadow.c \
shadowio.c \
shadowio.h \
snprintf.h \
tcfsio.c \
tcfsio.h \
utent.c
EXTRA_libshadow_la_SOURCESS = grent.c pwent.c mkdir.c rename.c rmdir.c \
strdup.c strcasecmp.c strerror.c strstr.c putgrent.c \
putpwent.c putspent.c sgetgrent.c sgetpwent.c sgetspent.c \
snprintf.c md5.c md5crypt.c
# These files are unneeded for some reason, listed in
# order of appearance:
@ -17,41 +64,8 @@ DEFS = -DLOCALEDIR=\"$(localedir)\" -I. -I$(srcdir) -I.. @DEFS@
# sources for LIBOBJS (which are normally in libc)
# misc header sources
EXTRA_DIST = grdbm.c gsdbm.c pwdbm.c spdbm.c \
grpack.c gspack.c pwpack.c sppack.c \
gshadow_.h shadow_.h lastlog_.h snprintf.h
EXTRA_libshadow_a_SOURCESS = grent.c pwent.c \
mkdir.c rename.c rmdir.c strdup.c strcasecmp.c strerror.c strstr.c \
putgrent.c putpwent.c putspent.c \
sgetgrent.c sgetpwent.c sgetspent.c snprintf.c \
md5.c md5crypt.c
# We build libshadow for our tools.
noinst_LIBRARIES = libshadow.a
libshadow_a_SOURCES = commonio.c dialchk.c dialup.c encrypt.c \
fputsx.c getdef.c getpass.c groupio.c gshadow.c lockpw.c port.c \
pwauth.c pwio.c rad64.c sgroupio.c shadow.c shadowio.c utent.c \
tcfsio.c
libshadow_a_LIBADD = @LIBOBJS@
INCLUDES = -I$(top_srcdir)/lib
# shared library support
libdir = ${exec_prefix}/lib
#lib_PROGRAMS = libshadow.la
lib_LTLIBRARIES = libshadow.la
libshadow_la_SOURCES = ${libshadow_a_SOURCES}
libshadow_la_LIBADD = @LTLIBOBJS@
#libshadow_la_LDFLAGS = -version-info 0:0:0 -rpath $(libdir)
libshadow_la_LDFLAGS = -version-info 0:0:0
# remove the libshadow.so -> libshadow.so.x.x symlink, because this
# library is for internal use by this package only. Shadow support
# is in libc and no one should be using -lshadow anymore.
install-exec-hook:
rm -f $(libdir)/libshadow.so
EXTRA_DIST = \
.indent.pro \
grdbm.c gsdbm.c pwdbm.c spdbm.c \
grpack.c gspack.c pwpack.c sppack.c \
gshadow_.h shadow_.h lastlog_.h snprintf.h

View File

@ -1,6 +1,7 @@
# Makefile.in generated automatically by automake 1.4a from Makefile.am
# Makefile.in generated automatically by automake 1.5 from Makefile.am.
# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
# Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@ -10,6 +11,7 @@
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
SHELL = @SHELL@
@ -26,17 +28,14 @@ datadir = @datadir@
sysconfdir = @sysconfdir@
sharedstatedir = @sharedstatedir@
localstatedir = @localstatedir@
libdir = @libdir@
infodir = @infodir@
mandir = @mandir@
includedir = @includedir@
oldincludedir = /usr/include
DESTDIR =
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = ..
ACLOCAL = @ACLOCAL@
@ -48,9 +47,8 @@ INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_FLAG =
INSTALL_HEADER = $(INSTALL_DATA)
transform = @program_transform_name@
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
@ -59,54 +57,116 @@ PRE_UNINSTALL = :
POST_UNINSTALL = :
host_alias = @host_alias@
host_triplet = @host@
AMTAR = @AMTAR@
AS = @AS@
AWK = @AWK@
BUILD_INCLUDED_LIBINTL = @BUILD_INCLUDED_LIBINTL@
CATALOGS = @CATALOGS@
CATOBJEXT = @CATOBJEXT@
CC = @CC@
CPP = @CPP@
DATADIRNAME = @DATADIRNAME@
DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
ECHO = @ECHO@
EXEEXT = @EXEEXT@
GENCAT = @GENCAT@
GLIBC21 = @GLIBC21@
GMOFILES = @GMOFILES@
GMSGFMT = @GMSGFMT@
GT_NO = @GT_NO@
GT_YES = @GT_YES@
INCLUDE_LOCALE_H = @INCLUDE_LOCALE_H@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
INSTOBJEXT = @INSTOBJEXT@
INTLDEPS = @INTLDEPS@
INTLBISON = @INTLBISON@
INTLLIBS = @INTLLIBS@
INTLOBJS = @INTLOBJS@
INTL_LIBTOOL_SUFFIX_PREFIX = @INTL_LIBTOOL_SUFFIX_PREFIX@
LIBCRACK = @LIBCRACK@
LIBCRYPT = @LIBCRYPT@
LIBICONV = @LIBICONV@
LIBMD = @LIBMD@
LIBPAM = @LIBPAM@
LIBSKEY = @LIBSKEY@
LIBTCFS = @LIBTCFS@
LIBTOOL = @LIBTOOL@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
MKINSTALLDIRS = @MKINSTALLDIRS@
MSGFMT = @MSGFMT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
POFILES = @POFILES@
POSUB = @POSUB@
RANLIB = @RANLIB@
STRIP = @STRIP@
U = @U@
USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@
USE_NLS = @USE_NLS@
VERSION = @VERSION@
YACC = @YACC@
l = @l@
am__include = @am__include@
am__quote = @am__quote@
install_sh = @install_sh@
AUTOMAKE_OPTIONS = 1.0 foreign
noinst_HEADERS = commonio.h defines.h dialchk.h dialup.h faillog.h getdef.h groupio.h md5.h pam_defs.h port.h prototypes.h pwauth.h pwio.h rcsid.h sgroupio.h shadowio.h snprintf.h tcfsio.h
DEFS =
INCLUDES = -I$(top_srcdir)
lib_LTLIBRARIES = libshadow.la
libshadow_la_LDFLAGS = -version-info 0:0:0
libshadow_la_LIBADD = $(INTLLIBS) $(LIBCRYPT) $(LIBTCFS) $(LIBSKEY) $(LIBMD) \
$(top_builddir)/libmisc/libmisc.la
libshadow_la_SOURCES = \
commonio.c \
commonio.h \
defines.h \
dialchk.c \
dialchk.h \
dialup.c \
dialup.h \
encrypt.c \
faillog.h \
fputsx.c \
getdef.c \
getdef.h \
getpass.c \
groupio.c \
groupio.h \
gshadow.c \
lockpw.c \
md5.h \
pam_defs.h \
port.c \
port.h \
prototypes.h \
pwauth.c \
pwauth.h \
pwio.c \
pwio.h \
rad64.c \
rcsid.h \
sgetgrent.c \
sgetpwent.c \
sgroupio.c \
sgroupio.h\
shadow.c \
shadowio.c \
shadowio.h \
snprintf.h \
tcfsio.c \
tcfsio.h \
utent.c
EXTRA_libshadow_la_SOURCESS = grent.c pwent.c mkdir.c rename.c rmdir.c \
strdup.c strcasecmp.c strerror.c strstr.c putgrent.c \
putpwent.c putspent.c sgetgrent.c sgetpwent.c sgetspent.c \
snprintf.c md5.c md5crypt.c
localedir = $(datadir)/locale
DEFS = -DLOCALEDIR=\"$(localedir)\" -I. -I$(srcdir) -I.. @DEFS@
# These files are unneeded for some reason, listed in
# order of appearance:
@ -115,119 +175,56 @@ DEFS = -DLOCALEDIR=\"$(localedir)\" -I. -I$(srcdir) -I.. @DEFS@
# sources for dbm support (not yet used)
# sources for LIBOBJS (which are normally in libc)
# misc header sources
EXTRA_DIST = \
.indent.pro \
grdbm.c gsdbm.c pwdbm.c spdbm.c \
grpack.c gspack.c pwpack.c sppack.c \
gshadow_.h shadow_.h lastlog_.h snprintf.h
EXTRA_DIST = grdbm.c gsdbm.c pwdbm.c spdbm.c grpack.c gspack.c pwpack.c sppack.c gshadow_.h shadow_.h lastlog_.h snprintf.h
EXTRA_libshadow_a_SOURCESS = grent.c pwent.c mkdir.c rename.c rmdir.c strdup.c strcasecmp.c strerror.c strstr.c putgrent.c putpwent.c putspent.c sgetgrent.c sgetpwent.c sgetspent.c snprintf.c md5.c md5crypt.c
# We build libshadow for our tools.
noinst_LIBRARIES = libshadow.a
libshadow_a_SOURCES = commonio.c dialchk.c dialup.c encrypt.c fputsx.c getdef.c getpass.c groupio.c gshadow.c lockpw.c port.c pwauth.c pwio.c rad64.c sgroupio.c shadow.c shadowio.c utent.c tcfsio.c
libshadow_a_LIBADD = @LIBOBJS@
INCLUDES = -I$(top_srcdir)/lib
# shared library support
libdir = ${exec_prefix}/lib
#lib_PROGRAMS = libshadow.la
lib_LTLIBRARIES = libshadow.la
libshadow_la_SOURCES = ${libshadow_a_SOURCES}
libshadow_la_LIBADD = @LTLIBOBJS@
#libshadow_la_LDFLAGS = -version-info 0:0:0 -rpath $(libdir)
libshadow_la_LDFLAGS = -version-info 0:0:0
subdir = lib
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = ../config.h
CONFIG_CLEAN_FILES =
LIBRARIES = $(noinst_LIBRARIES)
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
LTLIBRARIES = $(lib_LTLIBRARIES)
libshadow_la_DEPENDENCIES = $(top_builddir)/libmisc/libmisc.la
am_libshadow_la_OBJECTS = commonio.lo dialchk.lo dialup.lo encrypt.lo \
fputsx.lo getdef.lo getpass.lo groupio.lo gshadow.lo lockpw.lo \
port.lo pwauth.lo pwio.lo rad64.lo sgetgrent.lo sgetpwent.lo \
sgroupio.lo shadow.lo shadowio.lo tcfsio.lo utent.lo
libshadow_la_OBJECTS = $(am_libshadow_la_OBJECTS)
DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
CPPFLAGS = @CPPFLAGS@
LDFLAGS = @LDFLAGS@
LIBS = @LIBS@
libshadow_a_DEPENDENCIES = @LIBOBJS@
libshadow_a_OBJECTS = commonio.o dialchk.o dialup.o encrypt.o fputsx.o \
getdef.o getpass.o groupio.o gshadow.o lockpw.o port.o pwauth.o pwio.o \
rad64.o sgroupio.o shadow.o shadowio.o utent.o tcfsio.o
AR = ar
LTLIBRARIES = $(lib_LTLIBRARIES)
libshadow_la_DEPENDENCIES = @LTLIBOBJS@
libshadow_la_OBJECTS = commonio.lo dialchk.lo dialup.lo encrypt.lo \
fputsx.lo getdef.lo getpass.lo groupio.lo gshadow.lo lockpw.lo port.lo \
pwauth.lo pwio.lo rad64.lo sgroupio.lo shadow.lo shadowio.lo utent.lo \
tcfsio.lo
CFLAGS = @CFLAGS@
COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
depcomp = $(SHELL) $(top_srcdir)/depcomp
@AMDEP_TRUE@DEP_FILES = $(DEPDIR)/commonio.Plo $(DEPDIR)/dialchk.Plo \
@AMDEP_TRUE@ $(DEPDIR)/dialup.Plo $(DEPDIR)/encrypt.Plo \
@AMDEP_TRUE@ $(DEPDIR)/fputsx.Plo $(DEPDIR)/getdef.Plo \
@AMDEP_TRUE@ $(DEPDIR)/getpass.Plo $(DEPDIR)/groupio.Plo \
@AMDEP_TRUE@ $(DEPDIR)/gshadow.Plo $(DEPDIR)/lockpw.Plo \
@AMDEP_TRUE@ $(DEPDIR)/port.Plo $(DEPDIR)/pwauth.Plo \
@AMDEP_TRUE@ $(DEPDIR)/pwio.Plo $(DEPDIR)/rad64.Plo \
@AMDEP_TRUE@ $(DEPDIR)/sgetgrent.Plo $(DEPDIR)/sgetpwent.Plo \
@AMDEP_TRUE@ $(DEPDIR)/sgroupio.Plo $(DEPDIR)/shadow.Plo \
@AMDEP_TRUE@ $(DEPDIR)/shadowio.Plo $(DEPDIR)/tcfsio.Plo \
@AMDEP_TRUE@ $(DEPDIR)/utent.Plo
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) \
$(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
HEADERS = $(noinst_HEADERS)
LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(AM_LDFLAGS) $(LDFLAGS) -o $@
CFLAGS = @CFLAGS@
DIST_SOURCES = $(libshadow_la_SOURCES)
DIST_COMMON = Makefile.am Makefile.in
SOURCES = $(libshadow_la_SOURCES)
DIST_COMMON = Makefile.am Makefile.in md5.c md5crypt.c mkdir.c \
putgrent.c putpwent.c putspent.c rename.c rmdir.c sgetgrent.c \
sgetpwent.c sgetspent.c snprintf.c strcasecmp.c strdup.c strerror.c \
strstr.c
all: all-am
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
TAR = gtar
GZIP_ENV = --best
SOURCES = $(libshadow_a_SOURCES) $(libshadow_la_SOURCES)
OBJECTS = $(libshadow_a_OBJECTS) $(libshadow_la_OBJECTS)
all: all-redirect
.SUFFIXES:
.SUFFIXES: .S .c .lo .o .s
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
cd $(top_srcdir) && $(AUTOMAKE) --foreign --include-deps lib/Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
cd $(top_builddir) \
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
mostlyclean-noinstLIBRARIES:
clean-noinstLIBRARIES:
-test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
distclean-noinstLIBRARIES:
maintainer-clean-noinstLIBRARIES:
.c.o:
$(COMPILE) -c $<
.s.o:
$(COMPILE) -c $<
.S.o:
$(COMPILE) -c $<
mostlyclean-compile:
-rm -f *.o core *.core
clean-compile:
distclean-compile:
-rm -f *.tab.c
maintainer-clean-compile:
.c.lo:
$(LIBTOOL) --mode=compile $(COMPILE) -c $<
.s.lo:
$(LIBTOOL) --mode=compile $(COMPILE) -c $<
.S.lo:
$(LIBTOOL) --mode=compile $(COMPILE) -c $<
.SUFFIXES: .c .lo .o .obj
mostlyclean-libtool:
-rm -f *.lo
@ -236,174 +233,220 @@ clean-libtool:
-rm -rf .libs _libs
distclean-libtool:
maintainer-clean-libtool:
libshadow.a: $(libshadow_a_OBJECTS) $(libshadow_a_DEPENDENCIES)
-rm -f libshadow.a
$(AR) cru libshadow.a $(libshadow_a_OBJECTS) $(libshadow_a_LIBADD)
$(RANLIB) libshadow.a
mostlyclean-libLTLIBRARIES:
clean-libLTLIBRARIES:
-test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
distclean-libLTLIBRARIES:
maintainer-clean-libLTLIBRARIES:
-rm -f libtool
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
cd $(top_srcdir) && \
$(AUTOMAKE) --foreign lib/Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
cd $(top_builddir) && \
CONFIG_HEADERS= CONFIG_LINKS= \
CONFIG_FILES=$(subdir)/$@ $(SHELL) ./config.status
install-libLTLIBRARIES: $(lib_LTLIBRARIES)
@$(NORMAL_INSTALL)
$(mkinstalldirs) $(DESTDIR)$(libdir)
@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
if test -f $$p; then \
echo "$(LIBTOOL) --mode=install $(INSTALL) $$p $(DESTDIR)$(libdir)/$$p"; \
$(LIBTOOL) --mode=install $(INSTALL) $$p $(DESTDIR)$(libdir)/$$p; \
echo " $(LIBTOOL) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(libdir)/$$p"; \
$(LIBTOOL) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(libdir)/$$p; \
else :; fi; \
done
uninstall-libLTLIBRARIES:
@$(NORMAL_UNINSTALL)
list='$(lib_LTLIBRARIES)'; for p in $$list; do \
$(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/$$p; \
@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
echo " $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/$$p"; \
$(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/$$p; \
done
libshadow.la: $(libshadow_la_OBJECTS) $(libshadow_la_DEPENDENCIES)
clean-libLTLIBRARIES:
-test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
libshadow.la: $(libshadow_la_OBJECTS) $(libshadow_la_DEPENDENCIES)
$(LINK) -rpath $(libdir) $(libshadow_la_LDFLAGS) $(libshadow_la_OBJECTS) $(libshadow_la_LIBADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT) core *.core
distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/commonio.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/dialchk.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/dialup.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/encrypt.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/fputsx.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/getdef.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/getpass.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/groupio.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/gshadow.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/lockpw.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/port.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/pwauth.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/pwio.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/rad64.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/sgetgrent.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/sgetpwent.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/sgroupio.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/shadow.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/shadowio.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/tcfsio.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/utent.Plo@am__quote@
distclean-depend:
-rm -rf $(DEPDIR)
.c.o:
@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
$(COMPILE) -c `test -f $< || echo '$(srcdir)/'`$<
.c.obj:
@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
$(COMPILE) -c `cygpath -w $<`
.c.lo:
@AMDEP_TRUE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' @AMDEPBACKSLASH@
@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
$(LTCOMPILE) -c -o $@ `test -f $< || echo '$(srcdir)/'`$<
CCDEPMODE = @CCDEPMODE@
uninstall-info-am:
tags: TAGS
ID: $(HEADERS) $(SOURCES) $(LISP)
list='$(SOURCES) $(HEADERS)'; \
unique=`for i in $$list; do echo $$i; done | \
awk ' { files[$$0] = 1; } \
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
here=`pwd` && cd $(srcdir) \
&& mkid -f$$here/ID $$unique $(LISP)
mkid -fID $$unique $(LISP)
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP)
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS)'; \
unique=`for i in $$list; do echo $$i; done | \
awk ' { files[$$0] = 1; } \
list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
|| (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS)
|| etags $(ETAGS_ARGS) $$tags $$unique $(LISP)
mostlyclean-tags:
clean-tags:
GTAGS:
here=`CDPATH=: && cd $(top_builddir) && pwd` \
&& cd $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) $$here
distclean-tags:
-rm -f TAGS ID
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH
maintainer-clean-tags:
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
subdir = lib
top_distdir = ..
distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
distdir: $(DISTFILES)
@for file in $(DISTFILES); do \
d=$(srcdir); \
if test -f $$file; then d=.; else d=$(srcdir); fi; \
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
$(mkinstalldirs) "$(distdir)/$$dir"; \
fi; \
if test -d $$d/$$file; then \
cp -pr $$d/$$file $(distdir)/$$file; \
cp -pR $$d/$$file $(distdir) \
|| exit 1; \
else \
test -f $(distdir)/$$file \
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|| cp -p $$d/$$file $(distdir)/$$file || :; \
|| cp -p $$d/$$file $(distdir)/$$file \
|| exit 1; \
fi; \
done
info-am:
info: info-am
dvi-am:
dvi: dvi-am
check-am: all-am
check: check-am
installcheck-am:
installcheck: installcheck-am
install-exec-am: install-libLTLIBRARIES
@$(NORMAL_INSTALL)
$(MAKE) $(AM_MAKEFLAGS) install-exec-hook
install-exec: install-exec-am
all-am: Makefile $(LTLIBRARIES)
install-data-am:
installdirs:
$(mkinstalldirs) $(DESTDIR)$(libdir)
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
install: install-am
uninstall-am: uninstall-libLTLIBRARIES
uninstall: uninstall-am
all-am: Makefile $(LIBRARIES) $(LTLIBRARIES) $(HEADERS)
all-redirect: all-am
installcheck: installcheck-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_STRIP_FLAG=-s install
installdirs:
$(mkinstalldirs) $(DESTDIR)$(libdir)
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
-rm -f Makefile $(CONFIG_CLEAN_FILES)
-rm -f config.cache config.log stamp-h stamp-h[0-9]*
-rm -f Makefile $(CONFIG_CLEAN_FILES) stamp-h stamp-h[0-9]*
maintainer-clean-generic:
mostlyclean-am: mostlyclean-noinstLIBRARIES mostlyclean-compile \
mostlyclean-libtool mostlyclean-libLTLIBRARIES \
mostlyclean-tags mostlyclean-generic
mostlyclean: mostlyclean-am
clean-am: clean-noinstLIBRARIES clean-compile clean-libtool \
clean-libLTLIBRARIES clean-tags clean-generic \
mostlyclean-am
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
distclean-am: distclean-noinstLIBRARIES distclean-compile \
distclean-libtool distclean-libLTLIBRARIES \
distclean-tags distclean-generic clean-am
-rm -f libtool
clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \
mostlyclean-am
distclean: distclean-am
maintainer-clean-am: maintainer-clean-noinstLIBRARIES \
maintainer-clean-compile maintainer-clean-libtool \
maintainer-clean-libLTLIBRARIES maintainer-clean-tags \
maintainer-clean-generic distclean-am
@echo "This command is intended for maintainers to use;"
@echo "it deletes files that may require special tools to rebuild."
distclean-am: clean-am distclean-compile distclean-depend \
distclean-generic distclean-libtool distclean-tags
dvi: dvi-am
dvi-am:
info: info-am
info-am:
install-data-am:
install-exec-am: install-libLTLIBRARIES
install-info: install-info-am
install-man:
installcheck-am:
maintainer-clean: maintainer-clean-am
.PHONY: mostlyclean-noinstLIBRARIES distclean-noinstLIBRARIES \
clean-noinstLIBRARIES maintainer-clean-noinstLIBRARIES \
mostlyclean-compile distclean-compile clean-compile \
maintainer-clean-compile mostlyclean-libtool distclean-libtool \
clean-libtool maintainer-clean-libtool mostlyclean-libLTLIBRARIES \
distclean-libLTLIBRARIES clean-libLTLIBRARIES \
maintainer-clean-libLTLIBRARIES uninstall-libLTLIBRARIES \
install-libLTLIBRARIES tags mostlyclean-tags distclean-tags clean-tags \
maintainer-clean-tags distdir info-am info dvi-am dvi check check-am \
installcheck-am installcheck install-exec-am install-exec \
install-data-am install-data install-am install uninstall-am uninstall \
all-redirect all-am all installdirs mostlyclean-generic \
distclean-generic clean-generic maintainer-clean-generic clean \
mostlyclean distclean maintainer-clean
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
# remove the libshadow.so -> libshadow.so.x.x symlink, because this
# library is for internal use by this package only. Shadow support
# is in libc and no one should be using -lshadow anymore.
install-exec-hook:
rm -f $(libdir)/libshadow.so
mostlyclean-am: mostlyclean-compile mostlyclean-generic \
mostlyclean-libtool
uninstall-am: uninstall-info-am uninstall-libLTLIBRARIES
.PHONY: GTAGS all all-am check check-am clean clean-generic \
clean-libLTLIBRARIES clean-libtool distclean distclean-compile \
distclean-depend distclean-generic distclean-libtool \
distclean-tags distdir dvi dvi-am info info-am install \
install-am install-data install-data-am install-exec \
install-exec-am install-info install-info-am \
install-libLTLIBRARIES install-man install-strip installcheck \
installcheck-am installdirs maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-compile \
mostlyclean-generic mostlyclean-libtool tags uninstall \
uninstall-am uninstall-info-am uninstall-libLTLIBRARIES
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.

View File

@ -2,7 +2,7 @@
#include <config.h>
#include "rcsid.h"
RCSID("$Id: commonio.c,v 1.16 2000/09/02 18:40:42 marekm Exp $")
RCSID("$Id: commonio.c,v 1.20 2001/09/07 15:35:57 kloczek Exp $")
#include "defines.h"
#include <sys/stat.h>
@ -210,7 +210,7 @@ free_linked_list(struct commonio_db *db)
int
commonio_setname(struct commonio_db *db, const char *name)
{
strcpy(db->filename, name);
snprintf(db->filename, sizeof(db->filename), "%s", name);
return 1;
}
@ -305,6 +305,7 @@ commonio_lock(struct commonio_db *db)
static void
reload_nscd(void)
{
#ifdef ENABLE_NSCD_SIGHUP /* not every version of nscd can handle it */
FILE *pidfile;
int pid;
@ -316,6 +317,7 @@ reload_nscd(void)
kill(pid, SIGHUP);
fclose(pidfile);
}
#endif
}
@ -470,12 +472,15 @@ commonio_open(struct commonio_db *db, int mode)
while (db->ops->fgets(buf, buflen, db->fp)) {
while (!(cp = strrchr(buf, '\n')) && !feof(db->fp)) {
int len;
buflen += BUFLEN;
cp = (char *) realloc(buf, buflen);
if (!cp)
goto cleanup_buf;
buf = cp;
db->ops->fgets(buf + buflen - BUFLEN, BUFLEN, db->fp);
len = strlen(buf);
db->ops->fgets(buf + len, buflen - len, db->fp);
}
if ((cp = strrchr(buf, '\n')))
*cp = '\0';
@ -521,6 +526,83 @@ cleanup:
return 0;
}
/*
* Sort given db according to cmp function (usually compares uids)
*/
int
commonio_sort(struct commonio_db *db, int (*cmp)(const void *, const void *))
{
struct commonio_entry **entries, *ptr;
int n = 0, i;
for (ptr = db->head; ptr; ptr = ptr->next)
n++;
if (n <= 1)
return 0;
entries = malloc(n * sizeof(struct commonio_entry*));
if (entries == NULL)
return -1;
n = 0;
for (ptr = db->head; ptr; ptr = ptr->next)
entries[n++] = ptr;
qsort(entries, n, sizeof(struct commonio_entry*), cmp);
db->head = entries[0];
db->tail = entries[--n];
db->head->prev = NULL;
db->head->next = entries[1];
db->tail->prev = entries[n-1];
db->tail->next = NULL;
for (i = 1; i < n; i++) {
entries[i]->prev = entries[i-1];
entries[i]->next = entries[i+1];
}
free(entries);
db->changed = 1;
return 0;
}
/*
* Sort entries in db according to order in another.
*/
int
commonio_sort_wrt(struct commonio_db *shadow, struct commonio_db *passwd)
{
struct commonio_entry *head = NULL, *pw_ptr, *spw_ptr;
const char *name;
for (pw_ptr = passwd->head; pw_ptr; pw_ptr = pw_ptr->next) {
name = passwd->ops->getname(pw_ptr->eptr);
for (spw_ptr = shadow->head; spw_ptr; spw_ptr = spw_ptr->next)
if (strcmp(name, shadow->ops->getname(spw_ptr->eptr)) == 0)
break;
if (spw_ptr == NULL)
continue;
commonio_del_entry(shadow, spw_ptr);
spw_ptr->next = head;
head = spw_ptr;
}
for (spw_ptr = head; spw_ptr; spw_ptr = head) {
head = head->next;
if (shadow->head)
shadow->head->prev = spw_ptr;
spw_ptr->next = shadow->head;
shadow->head = spw_ptr;
}
shadow->head->prev = NULL;
shadow->changed = 1;
return 0;
}
static int
write_all(const struct commonio_db *db)

View File

@ -1,4 +1,4 @@
/* $Id: commonio.h,v 1.6 2000/09/02 18:40:43 marekm Exp $ */
/* $Id: commonio.h,v 1.7 2001/08/14 21:09:54 malekith Exp $ */
/*
* Linked list entry.
@ -97,4 +97,6 @@ extern const void *commonio_next(struct commonio_db *);
extern int commonio_close(struct commonio_db *);
extern int commonio_unlock(struct commonio_db *);
extern void commonio_del_entry(struct commonio_db *, const struct commonio_entry *);
extern int commonio_sort_wrt(struct commonio_db *shadow, struct commonio_db *passwd);
extern int commonio_sort(struct commonio_db *db, int (*cmp)(const void *, const void *));

View File

@ -1,4 +1,4 @@
/* $Id: defines.h,v 1.17 2000/09/02 18:40:43 marekm Exp $ */
/* $Id: defines.h,v 1.18 2001/06/28 20:47:05 kloczek Exp $ */
/* some useful defines */
#ifndef _DEFINES_H_
@ -339,10 +339,4 @@ extern char *strerror();
#define SHADOW_PASSWD_STRING "x"
#endif
#ifdef PAM_STRERROR_NEEDS_TWO_ARGS /* Linux-PAM 0.59+ */
#define PAM_STRERROR(pamh, err) pam_strerror(pamh, err)
#else
#define PAM_STRERROR(pamh, err) pam_strerror(err)
#endif
#endif /* _DEFINES_H_ */

View File

@ -2,7 +2,7 @@
#include <config.h>
#include "rcsid.h"
RCSID("$Id: groupio.c,v 1.9 2000/09/02 18:40:43 marekm Exp $")
RCSID("$Id: groupio.c,v 1.10 2001/08/14 21:10:36 malekith Exp $")
#include "prototypes.h"
#include "defines.h"
@ -177,8 +177,42 @@ __gr_get_head(void)
return group_db.head;
}
struct commonio_db *
__gr_get_db(void)
{
return &group_db;
}
void
__gr_del_entry(const struct commonio_entry *ent)
{
commonio_del_entry(&group_db, ent);
}
static int
gr_cmp(const void *p1, const void *p2)
{
gid_t u1, u2;
if ((*(struct commonio_entry**)p1)->eptr == NULL)
return 1;
if ((*(struct commonio_entry**)p2)->eptr == NULL)
return -1;
u1 = ((struct group *)(*(struct commonio_entry**)p1)->eptr)->gr_gid;
u2 = ((struct group *)(*(struct commonio_entry**)p2)->eptr)->gr_gid;
if (u1 < u2)
return -1;
else if (u1 > u2)
return 1;
else
return 0;
}
/* Sort entries by gid */
int
gr_sort()
{
return commonio_sort(&group_db, gr_cmp);
}

View File

@ -10,3 +10,4 @@ extern int gr_remove(const char *);
extern int gr_rewind(void);
extern int gr_unlock(void);
extern int gr_update(const struct group *);
extern int gr_sort(void);

261
lib/md5.c
View File

@ -1,261 +0,0 @@
/*
* This code implements the MD5 message-digest algorithm.
* The algorithm is due to Ron Rivest. This code was
* written by Colin Plumb in 1993, no copyright is claimed.
* This code is in the public domain; do with it what you wish.
*
* Equivalent code is available from RSA Data Security, Inc.
* This code has been tested against that, and is equivalent,
* except that you don't need to include two pages of legalese
* with every copy.
*
* To compute the message digest of a chunk of bytes, declare an
* MD5Context structure, pass it to MD5Init, call MD5Update as
* needed on buffers full of bytes, and then call MD5Final, which
* will fill a supplied 16-byte array with the digest.
*/
#include <config.h>
#ifdef MD5_CRYPT
#include <string.h> /* for memcpy() */
#include "md5.h"
#ifndef HIGHFIRST
#define byteReverse(buf, len) /* Nothing */
#else
void byteReverse(unsigned char *buf, unsigned longs);
#ifndef ASM_MD5
/*
* Note: this code is harmless on little-endian machines.
*/
void
byteReverse(unsigned char *buf, unsigned longs)
{
uint32 t;
do {
t = (uint32) ((unsigned) buf[3] << 8 | buf[2]) << 16 |
((unsigned) buf[1] << 8 | buf[0]);
*(uint32 *) buf = t;
buf += 4;
} while (--longs);
}
#endif
#endif
/*
* Start MD5 accumulation. Set bit count to 0 and buffer to mysterious
* initialization constants.
*/
void
MD5Init(struct MD5Context *ctx)
{
ctx->buf[0] = 0x67452301;
ctx->buf[1] = 0xefcdab89;
ctx->buf[2] = 0x98badcfe;
ctx->buf[3] = 0x10325476;
ctx->bits[0] = 0;
ctx->bits[1] = 0;
}
/*
* Update context to reflect the concatenation of another buffer full
* of bytes.
*/
void
MD5Update(struct MD5Context *ctx, unsigned char const *buf, unsigned len)
{
uint32 t;
/* Update bitcount */
t = ctx->bits[0];
if ((ctx->bits[0] = t + ((uint32) len << 3)) < t)
ctx->bits[1]++; /* Carry from low to high */
ctx->bits[1] += len >> 29;
t = (t >> 3) & 0x3f; /* Bytes already in shsInfo->data */
/* Handle any leading odd-sized chunks */
if (t) {
unsigned char *p = (unsigned char *) ctx->in + t;
t = 64 - t;
if (len < t) {
memcpy(p, buf, len);
return;
}
memcpy(p, buf, t);
byteReverse(ctx->in, 16);
MD5Transform(ctx->buf, (uint32 *) ctx->in);
buf += t;
len -= t;
}
/* Process data in 64-byte chunks */
while (len >= 64) {
memcpy(ctx->in, buf, 64);
byteReverse(ctx->in, 16);
MD5Transform(ctx->buf, (uint32 *) ctx->in);
buf += 64;
len -= 64;
}
/* Handle any remaining bytes of data. */
memcpy(ctx->in, buf, len);
}
/*
* Final wrapup - pad to 64-byte boundary with the bit pattern
* 1 0* (64-bit count of bits processed, MSB-first)
*/
void
MD5Final(unsigned char digest[16], struct MD5Context *ctx)
{
unsigned count;
unsigned char *p;
/* Compute number of bytes mod 64 */
count = (ctx->bits[0] >> 3) & 0x3F;
/* Set the first char of padding to 0x80. This is safe since there is
always at least one byte free */
p = ctx->in + count;
*p++ = 0x80;
/* Bytes of padding needed to make 64 bytes */
count = 64 - 1 - count;
/* Pad out to 56 mod 64 */
if (count < 8) {
/* Two lots of padding: Pad the first block to 64 bytes */
memset(p, 0, count);
byteReverse(ctx->in, 16);
MD5Transform(ctx->buf, (uint32 *) ctx->in);
/* Now fill the next block with 56 bytes */
memset(ctx->in, 0, 56);
} else {
/* Pad block to 56 bytes */
memset(p, 0, count - 8);
}
byteReverse(ctx->in, 14);
/* Append length in bits and transform */
((uint32 *) ctx->in)[14] = ctx->bits[0];
((uint32 *) ctx->in)[15] = ctx->bits[1];
MD5Transform(ctx->buf, (uint32 *) ctx->in);
byteReverse((unsigned char *) ctx->buf, 4);
memcpy(digest, ctx->buf, 16);
memset((char *) ctx, 0, sizeof(ctx)); /* In case it's sensitive */
}
#ifndef ASM_MD5
/* The four core functions - F1 is optimized somewhat */
/* #define F1(x, y, z) (x & y | ~x & z) */
#define F1(x, y, z) (z ^ (x & (y ^ z)))
#define F2(x, y, z) F1(z, x, y)
#define F3(x, y, z) (x ^ y ^ z)
#define F4(x, y, z) (y ^ (x | ~z))
/* This is the central step in the MD5 algorithm. */
#define MD5STEP(f, w, x, y, z, data, s) \
( w += f(x, y, z) + data, w = w<<s | w>>(32-s), w += x )
/*
* The core of the MD5 algorithm, this alters an existing MD5 hash to
* reflect the addition of 16 longwords of new data. MD5Update blocks
* the data and converts bytes into longwords for this routine.
*/
void
MD5Transform(uint32 buf[4], uint32 const in[16])
{
register uint32 a, b, c, d;
a = buf[0];
b = buf[1];
c = buf[2];
d = buf[3];
MD5STEP(F1, a, b, c, d, in[0] + 0xd76aa478, 7);
MD5STEP(F1, d, a, b, c, in[1] + 0xe8c7b756, 12);
MD5STEP(F1, c, d, a, b, in[2] + 0x242070db, 17);
MD5STEP(F1, b, c, d, a, in[3] + 0xc1bdceee, 22);
MD5STEP(F1, a, b, c, d, in[4] + 0xf57c0faf, 7);
MD5STEP(F1, d, a, b, c, in[5] + 0x4787c62a, 12);
MD5STEP(F1, c, d, a, b, in[6] + 0xa8304613, 17);
MD5STEP(F1, b, c, d, a, in[7] + 0xfd469501, 22);
MD5STEP(F1, a, b, c, d, in[8] + 0x698098d8, 7);
MD5STEP(F1, d, a, b, c, in[9] + 0x8b44f7af, 12);
MD5STEP(F1, c, d, a, b, in[10] + 0xffff5bb1, 17);
MD5STEP(F1, b, c, d, a, in[11] + 0x895cd7be, 22);
MD5STEP(F1, a, b, c, d, in[12] + 0x6b901122, 7);
MD5STEP(F1, d, a, b, c, in[13] + 0xfd987193, 12);
MD5STEP(F1, c, d, a, b, in[14] + 0xa679438e, 17);
MD5STEP(F1, b, c, d, a, in[15] + 0x49b40821, 22);
MD5STEP(F2, a, b, c, d, in[1] + 0xf61e2562, 5);
MD5STEP(F2, d, a, b, c, in[6] + 0xc040b340, 9);
MD5STEP(F2, c, d, a, b, in[11] + 0x265e5a51, 14);
MD5STEP(F2, b, c, d, a, in[0] + 0xe9b6c7aa, 20);
MD5STEP(F2, a, b, c, d, in[5] + 0xd62f105d, 5);
MD5STEP(F2, d, a, b, c, in[10] + 0x02441453, 9);
MD5STEP(F2, c, d, a, b, in[15] + 0xd8a1e681, 14);
MD5STEP(F2, b, c, d, a, in[4] + 0xe7d3fbc8, 20);
MD5STEP(F2, a, b, c, d, in[9] + 0x21e1cde6, 5);
MD5STEP(F2, d, a, b, c, in[14] + 0xc33707d6, 9);
MD5STEP(F2, c, d, a, b, in[3] + 0xf4d50d87, 14);
MD5STEP(F2, b, c, d, a, in[8] + 0x455a14ed, 20);
MD5STEP(F2, a, b, c, d, in[13] + 0xa9e3e905, 5);
MD5STEP(F2, d, a, b, c, in[2] + 0xfcefa3f8, 9);
MD5STEP(F2, c, d, a, b, in[7] + 0x676f02d9, 14);
MD5STEP(F2, b, c, d, a, in[12] + 0x8d2a4c8a, 20);
MD5STEP(F3, a, b, c, d, in[5] + 0xfffa3942, 4);
MD5STEP(F3, d, a, b, c, in[8] + 0x8771f681, 11);
MD5STEP(F3, c, d, a, b, in[11] + 0x6d9d6122, 16);
MD5STEP(F3, b, c, d, a, in[14] + 0xfde5380c, 23);
MD5STEP(F3, a, b, c, d, in[1] + 0xa4beea44, 4);
MD5STEP(F3, d, a, b, c, in[4] + 0x4bdecfa9, 11);
MD5STEP(F3, c, d, a, b, in[7] + 0xf6bb4b60, 16);
MD5STEP(F3, b, c, d, a, in[10] + 0xbebfbc70, 23);
MD5STEP(F3, a, b, c, d, in[13] + 0x289b7ec6, 4);
MD5STEP(F3, d, a, b, c, in[0] + 0xeaa127fa, 11);
MD5STEP(F3, c, d, a, b, in[3] + 0xd4ef3085, 16);
MD5STEP(F3, b, c, d, a, in[6] + 0x04881d05, 23);
MD5STEP(F3, a, b, c, d, in[9] + 0xd9d4d039, 4);
MD5STEP(F3, d, a, b, c, in[12] + 0xe6db99e5, 11);
MD5STEP(F3, c, d, a, b, in[15] + 0x1fa27cf8, 16);
MD5STEP(F3, b, c, d, a, in[2] + 0xc4ac5665, 23);
MD5STEP(F4, a, b, c, d, in[0] + 0xf4292244, 6);
MD5STEP(F4, d, a, b, c, in[7] + 0x432aff97, 10);
MD5STEP(F4, c, d, a, b, in[14] + 0xab9423a7, 15);
MD5STEP(F4, b, c, d, a, in[5] + 0xfc93a039, 21);
MD5STEP(F4, a, b, c, d, in[12] + 0x655b59c3, 6);
MD5STEP(F4, d, a, b, c, in[3] + 0x8f0ccc92, 10);
MD5STEP(F4, c, d, a, b, in[10] + 0xffeff47d, 15);
MD5STEP(F4, b, c, d, a, in[1] + 0x85845dd1, 21);
MD5STEP(F4, a, b, c, d, in[8] + 0x6fa87e4f, 6);
MD5STEP(F4, d, a, b, c, in[15] + 0xfe2ce6e0, 10);
MD5STEP(F4, c, d, a, b, in[6] + 0xa3014314, 15);
MD5STEP(F4, b, c, d, a, in[13] + 0x4e0811a1, 21);
MD5STEP(F4, a, b, c, d, in[4] + 0xf7537e82, 6);
MD5STEP(F4, d, a, b, c, in[11] + 0xbd3af235, 10);
MD5STEP(F4, c, d, a, b, in[2] + 0x2ad7d2bb, 15);
MD5STEP(F4, b, c, d, a, in[9] + 0xeb86d391, 21);
buf[0] += a;
buf[1] += b;
buf[2] += c;
buf[3] += d;
}
#endif
#endif /* MD5_CRYPT */

View File

@ -1,151 +0,0 @@
/*
* ----------------------------------------------------------------------------
* "THE BEER-WARE LICENSE" (Revision 42):
* <phk@login.dknet.dk> wrote this file. As long as you retain this notice you
* can do whatever you want with this stuff. If we meet some day, and you think
* this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
* ----------------------------------------------------------------------------
*/
/*
* Ported from FreeBSD to Linux, only minimal changes. --marekm
*/
#include <config.h>
#ifdef MD5_CRYPT
#include "rcsid.h"
RCSID("$Id: md5crypt.c,v 1.3 1998/01/29 23:22:29 marekm Exp $")
#include <unistd.h>
/* #include <stdio.h> */
#include <string.h>
#include "md5.h"
static unsigned char itoa64[] = /* 0 ... 63 => ascii - 64 */
"./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
static void
to64(char *s, unsigned long v, int n)
{
while (--n >= 0) {
*s++ = itoa64[v&0x3f];
v >>= 6;
}
}
/*
* UNIX password
*
* Use MD5 for what it is best at...
*/
char *
libshadow_md5_crypt(const char *pw, const char *salt)
{
static char *magic = "$1$"; /*
* This string is magic for
* this algorithm. Having
* it this way, we can get
* get better later on
*/
static char passwd[120], *p;
static const char *sp,*ep;
unsigned char final[16];
int sl,pl,i,j;
MD5_CTX ctx,ctx1;
unsigned long l;
/* Refine the Salt first */
sp = salt;
/* If it starts with the magic string, then skip that */
if(!strncmp(sp,magic,strlen(magic)))
sp += strlen(magic);
/* It stops at the first '$', max 8 chars */
for(ep=sp;*ep && *ep != '$' && ep < (sp+8);ep++)
continue;
/* get the length of the true salt */
sl = ep - sp;
MD5Init(&ctx);
/* The password first, since that is what is most unknown */
MD5Update(&ctx,pw,strlen(pw));
/* Then our magic string */
MD5Update(&ctx,magic,strlen(magic));
/* Then the raw salt */
MD5Update(&ctx,sp,sl);
/* Then just as many characters of the MD5(pw,salt,pw) */
MD5Init(&ctx1);
MD5Update(&ctx1,pw,strlen(pw));
MD5Update(&ctx1,sp,sl);
MD5Update(&ctx1,pw,strlen(pw));
MD5Final(final,&ctx1);
for(pl = strlen(pw); pl > 0; pl -= 16)
MD5Update(&ctx,final,pl>16 ? 16 : pl);
/* Don't leave anything around in vm they could use. */
memset(final,0,sizeof final);
/* Then something really weird... */
for (j=0,i = strlen(pw); i ; i >>= 1)
if(i&1)
MD5Update(&ctx, final+j, 1);
else
MD5Update(&ctx, pw+j, 1);
/* Now make the output string */
strcpy(passwd,magic);
strncat(passwd,sp,sl);
strcat(passwd,"$");
MD5Final(final,&ctx);
/*
* and now, just to make sure things don't run too fast
* On a 60 Mhz Pentium this takes 34 msec, so you would
* need 30 seconds to build a 1000 entry dictionary...
*/
for(i=0;i<1000;i++) {
MD5Init(&ctx1);
if(i & 1)
MD5Update(&ctx1,pw,strlen(pw));
else
MD5Update(&ctx1,final,16);
if(i % 3)
MD5Update(&ctx1,sp,sl);
if(i % 7)
MD5Update(&ctx1,pw,strlen(pw));
if(i & 1)
MD5Update(&ctx1,final,16);
else
MD5Update(&ctx1,pw,strlen(pw));
MD5Final(final,&ctx1);
}
p = passwd + strlen(passwd);
l = (final[ 0]<<16) | (final[ 6]<<8) | final[12]; to64(p,l,4); p += 4;
l = (final[ 1]<<16) | (final[ 7]<<8) | final[13]; to64(p,l,4); p += 4;
l = (final[ 2]<<16) | (final[ 8]<<8) | final[14]; to64(p,l,4); p += 4;
l = (final[ 3]<<16) | (final[ 9]<<8) | final[15]; to64(p,l,4); p += 4;
l = (final[ 4]<<16) | (final[10]<<8) | final[ 5]; to64(p,l,4); p += 4;
l = final[11] ; to64(p,l,2); p += 2;
*p = '\0';
/* Don't leave anything around in vm they could use. */
memset(final,0,sizeof final);
return passwd;
}
#endif

View File

@ -1,60 +0,0 @@
/*
* Copyright 1991, Julianne Frances Haugh
* 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.
*/
#include <config.h>
#include <fcntl.h>
#include "rcsid.h"
RCSID("$Id: mkdir.c,v 1.4 1998/01/29 23:22:30 marekm Exp $")
/*
* mkdir - create a directory
*
* mkdir is provided for systems which do not include the mkdir()
* system call.
*/
int
mkdir(const char *dir, int mode)
{
int status;
if (fork()) {
while (wait(&status) != -1)
;
return status >> 8;
}
close(2);
open("/dev/null", O_WRONLY);
umask(0777 & ~ mode);
execl("/bin/mkdir", "mkdir", dir, 0);
_exit(127);
/*NOTREACHED*/
}

View File

@ -14,8 +14,3 @@
#ifndef PAM_DATA_SILENT
#define PAM_DATA_SILENT 0
#endif
#ifdef PAM_STRERROR_NEEDS_TWO_ARGS /* Linux-PAM 0.59+ */
#define PAM_STRERROR(pamh, err) pam_strerror(pamh, err)
#else
#define PAM_STRERROR(pamh, err) pam_strerror(err)
#endif

View File

@ -1,75 +0,0 @@
/*
* Copyright 1990 - 1994, Julianne Frances Haugh
* 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.
*/
#include <config.h>
#include <stdio.h>
#include <grp.h>
#include "prototypes.h"
#include "defines.h"
int
putgrent(const struct group *g, FILE *f)
{
char *buf, *cp;
int i;
size_t size;
if (!g || !f)
return -1;
/* calculate the required buffer size (40 is added for the
numeric GID, colons, newline, and terminating NUL). */
size = strlen(g->gr_name) + strlen(g->gr_passwd) + 40;
for (i = 0; g->gr_mem && g->gr_mem[i]; i++)
size += strlen(g->gr_mem[i]) + 1;
buf = malloc(size);
if (!buf)
return -1;
sprintf(buf, "%s:%s:%ld:", g->gr_name, g->gr_passwd, (long) g->gr_gid);
cp = buf + strlen(buf);
for (i = 0; g->gr_mem && g->gr_mem[i]; i++) {
if (i > 0)
*cp++ = ',';
strcpy(cp, g->gr_mem[i]);
cp += strlen(cp);
}
*cp++ = '\n';
*cp = '\0';
if (fputsx(buf, f) == EOF || ferror(f)) {
free(buf);
return -1;
}
free(buf);
return 0;
}

View File

@ -1,72 +0,0 @@
/*
* Copyright 1989 - 1994, Julianne Frances Haugh
* 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.
*/
#include <config.h>
#include "rcsid.h"
RCSID("$Id: putpwent.c,v 1.3 1997/12/07 23:26:54 marekm Exp $")
#include "defines.h"
#include <stdio.h>
#include <pwd.h>
/*
* putpwent - Output a (struct passwd) in character format
*
* putpwent() writes out a (struct passwd) in the format it appears
* in in flat ASCII files.
*
* (Author: Dr. Micheal Newberry)
*/
int
putpwent(const struct passwd *p, FILE *f)
{
int status;
#if defined(SUN) || defined(BSD) || defined(SUN4)
status = fprintf (f, "%s:%s:%d:%d:%s,%s:%s:%s\n",
p->pw_name, p->pw_passwd, p->pw_uid, p->pw_gid,
p->pw_gecos, p->pw_comment, p->pw_dir, p->pw_shell) == EOF;
#else
status = fprintf (f, "%s:%s", p->pw_name, p->pw_passwd) == EOF;
#ifdef ATT_AGE
if (p->pw_age && p->pw_age[0])
status |= fprintf (f, ",%s", p->pw_age) == EOF;
#endif
status |= fprintf (f, ":%d:%d:%s", p->pw_uid, p->pw_gid,
p->pw_gecos) == EOF;
#ifdef ATT_COMMENT
if (p->pw_comment && p->pw_comment[0])
status |= fprintf (f, ",%s", p->pw_comment) == EOF;
#endif
status |= fprintf (f, ":%s:%s\n", p->pw_dir, p->pw_shell) == EOF;
#endif
return status;
}

View File

@ -1,103 +0,0 @@
/*
* Copyright 1989 - 1994, Julianne Frances Haugh
* 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.
*/
#include <config.h>
#ifdef SHADOWPWD /*{*/
#ifndef HAVE_PUTSPENT
#include "rcsid.h"
RCSID("$Id: putspent.c,v 1.3 1997/12/07 23:26:54 marekm Exp $")
#include <sys/types.h>
#include "prototypes.h"
#include "defines.h"
#include <stdio.h>
int
putspent(const struct spwd *sp, FILE *fp)
{
int errors = 0;
if (! fp || ! sp)
return -1;
if (fprintf (fp, "%s:%s:", sp->sp_namp, sp->sp_pwdp) < 0)
errors++;
if (sp->sp_lstchg != -1) {
if (fprintf (fp, "%ld:", sp->sp_lstchg) < 0)
errors++;
} else if (putc (':', fp) == EOF)
errors++;
if (sp->sp_min != -1) {
if (fprintf (fp, "%ld:", sp->sp_min) < 0)
errors++;
} else if (putc (':', fp) == EOF)
errors++;
if (sp->sp_max != -1) {
if (fprintf (fp, "%ld:", sp->sp_max) < 0)
errors++;
} else if (putc (':', fp) == EOF)
errors++;
if (sp->sp_warn != -1) {
if (fprintf (fp, "%ld:", sp->sp_warn) < 0)
errors++;
} else if (putc (':', fp) == EOF)
errors++;
if (sp->sp_inact != -1) {
if (fprintf (fp, "%ld:", sp->sp_inact) < 0)
errors++;
} else if (putc (':', fp) == EOF)
errors++;
if (sp->sp_expire != -1) {
if (fprintf (fp, "%ld:", sp->sp_expire) < 0)
errors++;
} else if (putc (':', fp) == EOF)
errors++;
if (sp->sp_flag != -1) {
if (fprintf (fp, "%ld", sp->sp_flag) < 0)
errors++;
}
if (putc ('\n', fp) == EOF)
errors++;
if (errors)
return -1;
else
return 0;
}
#endif
#endif /*}*/

View File

@ -2,7 +2,7 @@
#include <config.h>
#include "rcsid.h"
RCSID("$Id: pwio.c,v 1.11 2000/09/02 18:40:43 marekm Exp $")
RCSID("$Id: pwio.c,v 1.12 2001/08/14 21:10:36 malekith Exp $")
#include "prototypes.h"
#include "defines.h"
@ -184,3 +184,37 @@ __pw_del_entry(const struct commonio_entry *ent)
{
commonio_del_entry(&passwd_db, ent);
}
struct commonio_db *
__pw_get_db(void)
{
return &passwd_db;
}
static int
pw_cmp(const void *p1, const void *p2)
{
uid_t u1, u2;
if ((*(struct commonio_entry**)p1)->eptr == NULL)
return 1;
if ((*(struct commonio_entry**)p2)->eptr == NULL)
return -1;
u1 = ((struct passwd *)(*(struct commonio_entry**)p1)->eptr)->pw_uid;
u2 = ((struct passwd *)(*(struct commonio_entry**)p2)->eptr)->pw_uid;
if (u1 < u2)
return -1;
else if (u1 > u2)
return 1;
else
return 0;
}
/* Sort entries by uid */
int
pw_sort()
{
return commonio_sort(&passwd_db, pw_cmp);
}

View File

@ -10,3 +10,4 @@ extern int pw_remove(const char *);
extern int pw_rewind(void);
extern int pw_unlock(void);
extern int pw_update(const struct passwd *);
extern int pw_sort(void);

View File

@ -1,91 +0,0 @@
/*
* Copyright 1993 - 1994, Julianne Frances Haugh
* 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.
*/
#include <config.h>
#include "rcsid.h"
RCSID("$Id: rename.c,v 1.3 1997/12/07 23:26:57 marekm Exp $")
#include "defines.h"
#include <sys/stat.h>
#include <errno.h>
/*
* rename - rename a file to another name
*
* rename is provided for systems which do not include the rename()
* system call.
*/
int
rename(const char *begin, const char *end)
{
struct stat s1, s2;
extern int errno;
int orig_err = errno;
if (stat (begin, &s1))
return -1;
if (stat (end, &s2)) {
errno = orig_err;
} else {
/*
* See if this is a cross-device link. We do this to
* insure that the link below has a chance of working.
*/
if (s1.st_dev != s2.st_dev) {
errno = EXDEV;
return -1;
}
/*
* See if we can unlink the existing destination
* file. If the unlink works the directory is writable,
* so there is no need here to figure that out.
*/
if (unlink (end))
return -1;
}
/*
* Now just link the original name to the final name. If there
* was no file previously, this link will fail if the target
* directory isn't writable. The unlink will fail if the source
* directory isn't writable, but life stinks ...
*/
if (link (begin, end) || unlink (begin))
return -1;
return 0;
}

View File

@ -1,59 +0,0 @@
/*
* Copyright 1991, Julianne Frances Haugh
* 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.
*/
#include <config.h>
#include <fcntl.h>
#include "rcsid.h"
RCSID("$Id: rmdir.c,v 1.4 1998/01/29 23:22:31 marekm Exp $")
/*
* rmdir - remove a directory
*
* rmdir is provided for systems which do not include the rmdir()
* system call.
*/
int
rmdir(const char *dir)
{
int status;
if (fork()) {
while (wait(&status) != -1)
;
return status >> 8;
}
close(2);
open("/dev/null", O_WRONLY);
execl("/bin/rmdir", "rmdir", dir, 0);
_exit(127);
/*NOTREACHED*/
}

View File

@ -1,198 +0,0 @@
/*
* Copyright 1989 - 1994, Julianne Frances Haugh
* 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.
*/
#include <config.h>
#ifdef SHADOWPWD /*{*/
#include "rcsid.h"
RCSID("$Id: sgetspent.c,v 1.5 1998/04/02 21:51:47 marekm Exp $")
#include <sys/types.h>
#include "prototypes.h"
#include "defines.h"
#include <stdio.h>
#define FIELDS 9
#define OFIELDS 5
/*
* sgetspent - convert string in shadow file format to (struct spwd *)
*/
struct spwd *
sgetspent(const char *string)
{
static char spwbuf[1024];
static struct spwd spwd;
char *fields[FIELDS];
char *cp;
char *cpp;
int i;
/*
* Copy string to local buffer. It has to be tokenized and we
* have to do that to our private copy.
*/
if (strlen(string) >= sizeof spwbuf)
return 0; /* fail if too long */
strcpy(spwbuf, string);
if ((cp = strrchr (spwbuf, '\n')))
*cp = '\0';
/*
* Tokenize the string into colon separated fields. Allow up to
* FIELDS different fields.
*/
for (cp = spwbuf, i = 0;*cp && i < FIELDS;i++) {
fields[i] = cp;
while (*cp && *cp != ':')
cp++;
if (*cp)
*cp++ = '\0';
}
/*
* It is acceptable for the last SVR4 field to be blank. This
* results in the loop being terminated early. In which case,
* we just make the last field be blank and be done with it.
*/
if (i == (FIELDS-1))
fields[i++] = cp;
if ((cp && *cp) || (i != FIELDS && i != OFIELDS))
return 0;
/*
* Start populating the structure. The fields are all in
* static storage, as is the structure we pass back.
*/
spwd.sp_namp = fields[0];
spwd.sp_pwdp = fields[1];
/*
* Get the last changed date. For all of the integer fields,
* we check for proper format. It is an error to have an
* incorrectly formatted number.
*/
if ((spwd.sp_lstchg = strtol (fields[2], &cpp, 10)) == 0 && *cpp) {
return 0;
} else if (fields[2][0] == '\0')
spwd.sp_lstchg = -1;
/*
* Get the minimum period between password changes.
*/
if ((spwd.sp_min = strtol (fields[3], &cpp, 10)) == 0 && *cpp) {
return 0;
} else if (fields[3][0] == '\0')
spwd.sp_min = -1;
/*
* Get the maximum number of days a password is valid.
*/
if ((spwd.sp_max = strtol (fields[4], &cpp, 10)) == 0 && *cpp) {
return 0;
} else if (fields[4][0] == '\0')
spwd.sp_max = -1;
/*
* If there are only OFIELDS fields (this is a SVR3.2 /etc/shadow
* formatted file), initialize the other field members to -1.
*/
#if 0 /* SVR4 */
if (i == OFIELDS)
return 0;
#else
if (i == OFIELDS) {
spwd.sp_warn = spwd.sp_inact = spwd.sp_expire =
spwd.sp_flag = -1;
return &spwd;
}
#endif
/*
* The rest of the fields are mandatory for SVR4, but optional
* for anything else. However, if one is present the others
* must be as well.
*/
/*
* Get the number of days of password expiry warning.
*/
if ((spwd.sp_warn = strtol (fields[5], &cpp, 10)) == 0 && *cpp) {
return 0;
} else if (fields[5][0] == '\0')
spwd.sp_warn = -1;
/*
* Get the number of days of inactivity before an account is
* disabled.
*/
if ((spwd.sp_inact = strtol (fields[6], &cpp, 10)) == 0 && *cpp) {
return 0;
} else if (fields[6][0] == '\0')
spwd.sp_inact = -1;
/*
* Get the number of days after the epoch before the account is
* set to expire.
*/
if ((spwd.sp_expire = strtol (fields[7], &cpp, 10)) == 0 && *cpp) {
return 0;
} else if (fields[7][0] == '\0')
spwd.sp_expire = -1;
/*
* This field is reserved for future use. But it isn't supposed
* to have anything other than a valid integer in it.
*/
if ((spwd.sp_flag = strtol (fields[8], &cpp, 10)) == 0 && *cpp) {
return 0;
} else if (fields[8][0] == '\0')
spwd.sp_flag = -1;
return (&spwd);
}
#endif /*}*/

View File

@ -4,7 +4,7 @@
#ifdef SHADOWGRP
#include "rcsid.h"
RCSID("$Id: sgroupio.c,v 1.11 2000/09/02 18:40:43 marekm Exp $")
RCSID("$Id: sgroupio.c,v 1.12 2001/08/14 21:10:36 malekith Exp $")
#include "prototypes.h"
#include "defines.h"
@ -207,6 +207,15 @@ __sgr_del_entry(const struct commonio_entry *ent)
{
commonio_del_entry(&gshadow_db, ent);
}
/* Sort with respect to group ordering. */
int
sgr_sort()
{
extern struct commonio_db *__gr_get_db();
return commonio_sort_wrt(&gshadow_db, __gr_get_db());
}
#else
extern int errno; /* warning: ANSI C forbids an empty source file */
#endif

View File

@ -11,3 +11,4 @@ extern int sgr_remove(const char *);
extern int sgr_rewind(void);
extern int sgr_unlock(void);
extern int sgr_update(const struct sgrp *);
extern int sgr_sort(void);

View File

@ -4,7 +4,7 @@
#ifdef SHADOWPWD
#include "rcsid.h"
RCSID("$Id: shadowio.c,v 1.12 2000/09/02 18:40:43 marekm Exp $")
RCSID("$Id: shadowio.c,v 1.13 2001/08/14 21:10:36 malekith Exp $")
#include "prototypes.h"
#include "defines.h"
@ -168,4 +168,13 @@ __spw_del_entry(const struct commonio_entry *ent)
{
commonio_del_entry(&shadow_db, ent);
}
/* Sort with respect to passwd ordering. */
int
spw_sort()
{
extern struct commonio_db *__pw_get_db();
return commonio_sort_wrt(&shadow_db, __pw_get_db());
}
#endif

View File

@ -11,3 +11,4 @@ extern int spw_remove(const char *);
extern int spw_rewind(void);
extern int spw_unlock(void);
extern int spw_update(const struct spwd *);
extern int spw_sort(void);

View File

@ -1,320 +0,0 @@
/**************************************************************
* Original:
* Patrick Powell Tue Apr 11 09:48:21 PDT 1995
* A bombproof version of doprnt (dopr) included.
* Sigh. This sort of thing is always nasty do deal with. Note that
* the version here does not include floating point...
*
* snprintf() is used instead of sprintf() as it does limit checks
* for string length. This covers a nasty loophole.
*
* The other functions are there to prevent NULL pointers from
* causing nast effects.
**************************************************************/
/* $XFree86: xc/lib/misc/snprintf.c,v 3.0 1996/08/26 06:19:23 dawes Exp $ */
#include <ctype.h>
#include "snprintf.h"
static void dopr();
static char *end;
/* varargs declarations: */
#if defined(HAVE_STDARG_H)
# include <stdarg.h>
# define HAVE_STDARGS /* let's hope that works everywhere (mj) */
# define VA_LOCAL_DECL va_list ap;
# define VA_START(f) va_start(ap, f)
# define VA_SHIFT(v,t) ; /* no-op for ANSI */
# define VA_END va_end(ap)
#else
# if defined(HAVE_VARARGS_H)
# include <varargs.h>
# undef HAVE_STDARGS
# define VA_LOCAL_DECL va_list ap;
# define VA_START(f) va_start(ap) /* f is ignored! */
# define VA_SHIFT(v,t) v = va_arg(ap,t)
# define VA_END va_end(ap)
# else
/*XX ** NO VARARGS ** XX*/
# endif
#endif
#ifdef HAVE_STDARGS
int snprintf (char *str, size_t count, const char *fmt, ...);
int vsnprintf (char *str, size_t count, const char *fmt, va_list arg);
#else
int snprintf ();
int vsnprintf ();
#endif
int
vsnprintf(str, count, fmt, args)
char *str;
size_t count;
const char *fmt;
va_list args;
{
str[0] = 0;
end = str+count-1;
dopr( str, fmt, args );
if( count>0 ){
end[0] = 0;
}
return(strlen(str));
}
/* VARARGS3 */
#ifdef HAVE_STDARGS
int
snprintf (char *str,size_t count,const char *fmt,...)
#else
int
snprintf (va_alist) va_dcl
#endif
{
#ifndef HAVE_STDARGS
char *str;
size_t count;
char *fmt;
#endif
VA_LOCAL_DECL
VA_START (fmt);
VA_SHIFT (str, char *);
VA_SHIFT (count, size_t );
VA_SHIFT (fmt, char *);
(void) vsnprintf ( str, count, fmt, ap);
VA_END;
return( strlen( str ) );
}
/*
* dopr(): poor man's version of doprintf
*/
static void fmtstr(
#if NeedFunctionPrototypes
char *value, int ljust, int len, int zpad
#endif
);
static void fmtnum(
#if NeedFunctionPrototypes
long value, int base, int dosign, int ljust, int len, int zpad
#endif
);
static void dostr(
#if NeedFunctionPrototypes
char *
#endif
);
static char *output;
static void dopr_outch(
#if NeedFunctionPrototypes
int c
#endif
);
static void
dopr( buffer, format, args )
char *buffer;
char *format;
va_list args;
{
int ch;
long value;
int longflag = 0;
char *strvalue;
int ljust;
int len;
int zpad;
output = buffer;
while( (ch = *format++) ){
switch( ch ){
case '%':
ljust = len = zpad = 0;
nextch:
ch = *format++;
switch( ch ){
case 0:
dostr( "**end of format**" );
return;
case '-': ljust = 1; goto nextch;
case '0': /* set zero padding if len not set */
if(len==0) zpad = '0';
case '1': case '2': case '3':
case '4': case '5': case '6':
case '7': case '8': case '9':
len = len*10 + ch - '0';
goto nextch;
case 'l': longflag = 1; goto nextch;
case 'u': case 'U':
/*fmtnum(value,base,dosign,ljust,len,zpad) */
if( longflag ){
value = va_arg( args, long );
} else {
value = va_arg( args, int );
}
fmtnum( value, 10,0, ljust, len, zpad ); break;
case 'o': case 'O':
/*fmtnum(value,base,dosign,ljust,len,zpad) */
if( longflag ){
value = va_arg( args, long );
} else {
value = va_arg( args, int );
}
fmtnum( value, 8,0, ljust, len, zpad ); break;
case 'd': case 'D':
if( longflag ){
value = va_arg( args, long );
} else {
value = va_arg( args, int );
}
fmtnum( value, 10,1, ljust, len, zpad ); break;
case 'x':
if( longflag ){
value = va_arg( args, long );
} else {
value = va_arg( args, int );
}
fmtnum( value, 16,0, ljust, len, zpad ); break;
case 'X':
if( longflag ){
value = va_arg( args, long );
} else {
value = va_arg( args, int );
}
fmtnum( value,-16,0, ljust, len, zpad ); break;
case 's':
strvalue = va_arg( args, char *);
fmtstr( strvalue,ljust,len,zpad ); break;
case 'c':
ch = va_arg( args, int );
dopr_outch( ch ); break;
case '%': dopr_outch( ch ); continue;
default:
dostr( "???????" );
}
longflag = 0;
break;
default:
dopr_outch( ch );
break;
}
}
*output = 0;
}
static void
fmtstr( value, ljust, len, zpad )
char *value;
int ljust, len, zpad;
{
int padlen, strlen; /* amount to pad */
if( value == 0 ){
value = "<NULL>";
}
for( strlen = 0; value[strlen]; ++ strlen ); /* strlen */
padlen = len - strlen;
if( padlen < 0 ) padlen = 0;
if( ljust ) padlen = -padlen;
while( padlen > 0 ) {
dopr_outch( ' ' );
--padlen;
}
dostr( value );
while( padlen < 0 ) {
dopr_outch( ' ' );
++padlen;
}
}
static void
fmtnum( value, base, dosign, ljust, len, zpad )
long value;
int base, dosign, ljust, len, zpad;
{
int signvalue = 0;
unsigned long uvalue;
char convert[20];
int place = 0;
int padlen = 0; /* amount to pad */
int caps = 0;
/* DEBUGP(("value 0x%x, base %d, dosign %d, ljust %d, len %d, zpad %d\n",
value, base, dosign, ljust, len, zpad )); */
uvalue = value;
if( dosign ){
if( value < 0 ) {
signvalue = '-';
uvalue = -value;
}
}
if( base < 0 ){
caps = 1;
base = -base;
}
do{
convert[place++] =
(caps? "0123456789ABCDEF":"0123456789abcdef")
[uvalue % (unsigned)base ];
uvalue = (uvalue / (unsigned)base );
}while(uvalue);
convert[place] = 0;
padlen = len - place;
if( padlen < 0 ) padlen = 0;
if( ljust ) padlen = -padlen;
/* DEBUGP(( "str '%s', place %d, sign %c, padlen %d\n",
convert,place,signvalue,padlen)); */
if( zpad && padlen > 0 ){
if( signvalue ){
dopr_outch( signvalue );
--padlen;
signvalue = 0;
}
while( padlen > 0 ){
dopr_outch( zpad );
--padlen;
}
}
while( padlen > 0 ) {
dopr_outch( ' ' );
--padlen;
}
if( signvalue ) dopr_outch( signvalue );
while( place > 0 ) dopr_outch( convert[--place] );
while( padlen < 0 ){
dopr_outch( ' ' );
++padlen;
}
}
static void
dostr( str )
char *str;
{
while(*str) dopr_outch(*str++);
}
static void
dopr_outch( c )
int c;
{
if( iscntrl(c) && c != '\n' && c != '\t' ){
c = '@' + (c & 0x1F);
if( end == 0 || output < end ){
*output++ = '^';
}
}
if( end == 0 || output < end ){
*output++ = c;
}
}

View File

@ -1,25 +0,0 @@
#include <config.h>
#include "defines.h"
#include <ctype.h>
#include "rcsid.h"
RCSID("$Id: strcasecmp.c,v 1.1 1999/07/09 18:02:43 marekm Exp $")
/*
* strcasecmp - compare strings, ignoring case
*/
char *
strcasecmp(const char *s1, const char *s2)
{
int ret;
for (;;) {
ret = tolower(*s1) - tolower(*s2);
if (ret || *s1 == '\0' || *s2 == '\0')
break;
s1++;
s2++;
}
return ret;
}

View File

@ -1,16 +0,0 @@
#include <config.h>
#include "defines.h"
#include "rcsid.h"
RCSID("$Id: strdup.c,v 1.2 1997/12/07 23:26:59 marekm Exp $")
extern char *malloc();
char *
strdup(const char *str)
{
char *s = malloc(strlen(str) + 1);
if (s)
strcpy(s, str);
return s;
}

View File

@ -1,23 +0,0 @@
#include <config.h>
#include <errno.h>
#include "defines.h"
#include "rcsid.h"
RCSID("$Id: strerror.c,v 1.3 1998/12/28 20:34:39 marekm Exp $")
#include <stdio.h>
extern int sys_nerr;
extern char *sys_errlist[];
char *
strerror(int err)
{
static char unknown[80];
if (err >= 0 && err < sys_nerr)
return sys_errlist[err];
snprintf(unknown, sizeof unknown, _("Unknown error %d"), err);
errno = EINVAL;
return unknown;
}

View File

@ -1,55 +0,0 @@
/*
* Copyright 1989 - 1994, Julianne Frances Haugh
* 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.
*/
#include <config.h>
#include "defines.h"
#include "rcsid.h"
RCSID("$Id: strstr.c,v 1.4 1998/01/29 23:22:32 marekm Exp $")
/*
* strstr - find substring in string
*/
char *
strstr(const char *string, const char *pattern)
{
char *cp;
int len;
len = strlen (pattern);
for (cp = string;cp = strchr (cp, *pattern);) {
if (strncmp (cp, pattern, len) == 0)
return cp;
cp++;
}
return 0;
}