source: clfs-sysroot/patches/shadow-4.0.18.1-sysroot_hacks-1.patch@ ff91a87

Last change on this file since ff91a87 was 1d53724, checked in by Joe Ciccone <jciccone@…>, 18 years ago

Added: shadow-4.0.18.1-sysroot_hacks-1.patch

  • Property mode set to 100644
File size: 14.3 KB
  • lib/Makefile.am

    Submitted By: Joe Ciccone <jciccone@linuxfromscratch.org>
    Date: 2006-11-24
    Initial Package Version: 4.0.18.1
    Origin: Joe Ciccone
    Upstream Status: None
    Description: Changes the hardcoded /etc to the value of the --sysconfdir 
                 parameter passed to configure. Allows the utilities to be run
                 as a user other then root and properly modify the passwd and group
                 files for the target system.
    
    diff -Naur shadow-4.0.18.1.orig/lib/Makefile.am shadow-4.0.18.1/lib/Makefile.am
    old new  
    22AUTOMAKE_OPTIONS = 1.0 foreign
    33
    44DEFS =
     5AM_CPPFLAGS = -DSYSCONFDIR=\"$(sysconfdir)\"
    56
    67lib_LTLIBRARIES = libshadow.la
    78
  • lib/Makefile.in

    diff -Naur shadow-4.0.18.1.orig/lib/Makefile.in shadow-4.0.18.1/lib/Makefile.in
    old new  
    217217sharedstatedir = @sharedstatedir@
    218218sysconfdir = @sysconfdir@
    219219target_alias = @target_alias@
     220AM_CPPFLAGS = -DSYSCONFDIR=\"$(sysconfdir)\"
    220221AUTOMAKE_OPTIONS = 1.0 foreign
    221222lib_LTLIBRARIES = libshadow.la
    222223libshadow_la_LDFLAGS = -version-info 0:0:0
  • lib/commonio.c

    diff -Naur shadow-4.0.18.1.orig/lib/commonio.c shadow-4.0.18.1/lib/commonio.c
    old new  
    153153        if (!fp)
    154154                return NULL;
    155155
    156 #ifdef HAVE_FCHOWN
    157         if (fchown (fileno (fp), sb->st_uid, sb->st_gid))
    158                 goto fail;
    159 #else
    160         if (chown (name, sb->st_mode))
    161                 goto fail;
    162 #endif
    163 
    164156#ifdef HAVE_FCHMOD
    165157        if (fchmod (fileno (fp), sb->st_mode & 0664))
    166158                goto fail;
     
    703695                 * Default permissions for new [g]shadow files.
    704696                 * (passwd and group always exist...)
    705697                 */
    706                 sb.st_mode = 0400;
     698                sb.st_mode = 0600;
    707699                sb.st_uid = 0;
    708700                sb.st_gid = 0;
    709701        }
  • shadow-4.0.18.1

    diff -Naur shadow-4.0.18.1.orig/lib/defines.h shadow-4.0.18.1/lib/defines.h
    old new  
    284284#endif
    285285
    286286#ifndef PASSWD_FILE
    287 #define PASSWD_FILE "/etc/passwd"
     287#define PASSWD_FILE SYSCONFDIR"/passwd"
    288288#endif
    289289
    290290#ifndef GROUP_FILE
    291 #define GROUP_FILE "/etc/group"
     291#define GROUP_FILE SYSCONFDIR"/group"
    292292#endif
    293293
    294294#ifndef SHADOW_FILE
    295 #define SHADOW_FILE "/etc/shadow"
     295#define SHADOW_FILE SYSCONFDIR"/shadow"
    296296#endif
    297297
    298298#ifdef SHADOWGRP
    299299#ifndef SGROUP_FILE
    300 #define SGROUP_FILE "/etc/gshadow"
     300#define SGROUP_FILE SYSCONFDIR"/gshadow"
    301301#endif
    302302#endif
    303303
  • shadow-4.0.18.1

    diff -Naur shadow-4.0.18.1.orig/lib/getdef.c shadow-4.0.18.1/lib/getdef.c
    old new  
    114114};
    115115
    116116#ifndef LOGINDEFS
    117 #define LOGINDEFS "/etc/login.defs"
     117#define LOGINDEFS SYSCONFDIR"/login.defs"
    118118#endif
    119119
    120120static char def_fname[] = LOGINDEFS;    /* login config defs file       */
  • lib/gshadow_.h

    diff -Naur shadow-4.0.18.1.orig/lib/gshadow_.h shadow-4.0.18.1/lib/gshadow_.h
    old new  
    6767int putsgent ();
    6868#endif
    6969
    70 #define GSHADOW "/etc/gshadow"
     70#define GSHADOW SYSCONFDIR"/gshadow"
    7171#endif                          /* ifndef _H_GSHADOW */
  • shadow-4.0.18.1

    diff -Naur shadow-4.0.18.1.orig/lib/port.h shadow-4.0.18.1/lib/port.h
    old new  
    5050 * PORT_DAY - Day of the week to a bit value (0 = Sunday).
    5151 */
    5252
    53 #define PORTS   "/etc/porttime"
     53#define PORTS   SYSCONFDIR"/porttime"
    5454#define PORT_IDS        64
    5555#define PORT_TTY        64
    5656#define PORT_TIMES      24
  • libmisc/Makefile.am

    diff -Naur shadow-4.0.18.1.orig/libmisc/Makefile.am shadow-4.0.18.1/libmisc/Makefile.am
    old new  
    11
    22EXTRA_DOST = .indent.pro
    33
     4AM_CPPFLAGS = -DSYSCONFDIR=\"$(sysconfdir)\"
     5
    46INCLUDES = -I$(top_srcdir)/lib
    57
    68noinst_LIBRARIES = libmisc.a
  • libmisc/Makefile.in

    diff -Naur shadow-4.0.18.1.orig/libmisc/Makefile.in shadow-4.0.18.1/libmisc/Makefile.in
    old new  
    224224target_alias = @target_alias@
    225225EXTRA_DOST = .indent.pro
    226226INCLUDES = -I$(top_srcdir)/lib
     227AM_CPPFLAGS = -DSYSCONFDIR=\"$(sysconfdir)\"
    227228noinst_LIBRARIES = libmisc.a
    228229libmisc_a_SOURCES = \
    229230        addgrps.c \
  • libmisc/limits.c

    diff -Naur shadow-4.0.18.1.orig/libmisc/limits.c shadow-4.0.18.1/libmisc/limits.c
    old new  
    5151#endif
    5252#ifdef LIMITS
    5353#ifndef LIMITS_FILE
    54 #define LIMITS_FILE "/etc/limits"
     54#define LIMITS_FILE SYSCONFDIR"/limits"
    5555#endif
    5656#define LOGIN_ERROR_RLIMIT      1
    5757#define LOGIN_ERROR_LOGIN       2
  • src/Makefile.am

    diff -Naur shadow-4.0.18.1.orig/src/Makefile.am shadow-4.0.18.1/src/Makefile.am
    old new  
    33        .indent.pro
    44
    55ubindir = ${prefix}/bin
    6 usbindir = ${prefix}/sbin
     6usbindir = ${prefix}/bin
    77
    88INCLUDES = \
    99        -I${top_srcdir}/lib \
     
    5151
    5252LDADD          = $(top_builddir)/libmisc/libmisc.a \
    5353                 $(top_builddir)/lib/libshadow.la
    54 AM_CPPFLAGS    = -DLOCALEDIR=\"$(datadir)/locale\"
     54AM_CPPFLAGS    = -DSYSCONFDIR=\"$(sysconfdir)\" -DLOCALEDIR=\"$(datadir)/locale\" -DSG=\"`echo sg | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`\" -DVIGR=\"`echo vigr | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`\"
    5555
    5656chage_LDADD    = $(LDADD) $(LIBPAM) $(LIBAUDIT) $(LIBSELINUX)
    5757chfn_LDADD     = $(LDADD) $(LIBPAM) $(LIBSELINUX)
     
    8888
    8989install-am: all-am
    9090        $(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
    91         ln -sf newgrp   $(DESTDIR)$(ubindir)/sg
    92         ln -sf vipw     $(DESTDIR)$(usbindir)/vigr
     91        ln -sf `echo newgrp | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'` $(DESTDIR)$(ubindir)/`echo sg | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`
     92        ln -sf `echo vipw | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'` $(DESTDIR)$(usbindir)/`echo vigr | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`
    9393        for i in $(suidbins); do \
    94                 chmod -f 4755 $(DESTDIR)$(bindir)/$$i; \
     94                chmod -f 4755 $(DESTDIR)$(bindir)/`echo $$i | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
    9595        done
    9696        for i in $(suidubins); do \
    97                 chmod -f 4755 $(DESTDIR)$(ubindir)/$$i; \
     97                chmod -f 4755 $(DESTDIR)$(ubindir)/`echo $$i | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
    9898        done
     99
  • src/Makefile.in

    diff -Naur shadow-4.0.18.1.orig/src/Makefile.in shadow-4.0.18.1/src/Makefile.in
    old new  
    368368        .indent.pro
    369369
    370370ubindir = ${prefix}/bin
    371 usbindir = ${prefix}/sbin
     371usbindir = ${prefix}/bin
    372372INCLUDES = \
    373373        -I${top_srcdir}/lib \
    374374        -I$(top_srcdir)/libmisc
     
    378378LDADD = $(top_builddir)/libmisc/libmisc.a \
    379379                 $(top_builddir)/lib/libshadow.la
    380380
    381 AM_CPPFLAGS = -DLOCALEDIR=\"$(datadir)/locale\"
     381AM_CPPFLAGS = -DSYSCONFDIR=\"$(sysconfdir)\" -DLOCALEDIR=\"$(datadir)/locale\" -DSG=\"`echo sg | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`\" -DVIGR=\"`echo vigr | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`\"
    382382chage_LDADD = $(LDADD) $(LIBPAM) $(LIBAUDIT) $(LIBSELINUX)
    383383chfn_LDADD = $(LDADD) $(LIBPAM) $(LIBSELINUX)
    384384chgpasswd_LDADD = $(LDADD) $(LIBPAM) $(LIBSELINUX)
     
    914914
    915915install-am: all-am
    916916        $(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
    917         ln -sf newgrp   $(DESTDIR)$(ubindir)/sg
    918         ln -sf vipw     $(DESTDIR)$(usbindir)/vigr
     917        ln -sf `echo newgrp | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'` $(DESTDIR)$(ubindir)/`echo sg | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`
     918        ln -sf `echo vipw | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'` $(DESTDIR)$(usbindir)/`echo vigr | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`
    919919        for i in $(suidbins); do \
    920                 chmod -f 4755 $(DESTDIR)$(bindir)/$$i; \
     920                chmod -f 4755 $(DESTDIR)$(bindir)/`echo $$i | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
    921921        done
    922922        for i in $(suidubins); do \
    923                 chmod -f 4755 $(DESTDIR)$(ubindir)/$$i; \
     923                chmod -f 4755 $(DESTDIR)$(ubindir)/`echo $$i | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
    924924        done
     925
    925926# Tell versions [3.59,3.63) of GNU make to not export all variables.
    926927# Otherwise a system limit (for SysV at least) may be exceeded.
    927928.NOEXPORT:
  • shadow-4.0.18.1

    diff -Naur shadow-4.0.18.1.orig/src/chage.c shadow-4.0.18.1/src/chage.c
    old new  
    361361        textdomain (PACKAGE);
    362362
    363363        ruid = getuid ();
    364         amroot = (ruid == 0);
     364        amroot = 1; //(ruid == 0);
    365365#ifdef WITH_SELINUX
    366366        if (amroot && is_selinux_enabled () > 0)
    367367                amroot = (selinux_check_passwd_access (PASSWD__ROOTOK) == 0);
  • shadow-4.0.18.1

    diff -Naur shadow-4.0.18.1.orig/src/chsh.c shadow-4.0.18.1/src/chsh.c
    old new  
    5555#include "pam_defs.h"
    5656#endif
    5757#ifndef SHELLS_FILE
    58 #define SHELLS_FILE "/etc/shells"
     58#define SHELLS_FILE SYSCONFDIR"/shells"
    5959#endif
    6060/*
    6161 * Global variables
     
    195195        /*
    196196         * This command behaves different for root and non-root users.
    197197         */
    198         amroot = getuid () == 0;
     198        amroot = 1; //getuid () == 0;
    199199
    200200        /*
    201201         * Get the program name. The program name is used as a prefix to
  • shadow-4.0.18.1

    diff -Naur shadow-4.0.18.1.orig/src/gpasswd.c shadow-4.0.18.1/src/gpasswd.c
    old new  
    202202         * prevent the invoker from issuing signals which would interfer
    203203         * with this command.
    204204         */
    205         amroot = getuid () == 0;
     205        amroot = 1; //getuid () == 0;
    206206        bywho = getuid ();
    207207        Prog = Basename (argv[0]);
    208208
     
    628628         * output, etc.
    629629         */
    630630      output:
    631         if (setuid (0)) {
    632                 fprintf (stderr, _("Cannot change ID to root.\n"));
    633                 SYSLOG ((LOG_ERR, "can't setuid(0)"));
    634 #ifdef WITH_AUDIT
    635                 audit_logger (AUDIT_USER_CHAUTHTOK, Prog, "changing id to root",
    636                               group, -1, 0);
    637 #endif
    638                 closelog ();
    639                 exit (1);
    640         }
    641631        pwd_init ();
    642632
    643633        if (!gr_lock ()) {
  • src/login_nopam.c

    diff -Naur shadow-4.0.18.1.orig/src/login_nopam.c shadow-4.0.18.1/src/login_nopam.c
    old new  
    6060 /* Path name of the access control file. */
    6161
    6262#ifndef TABLE
    63 #define TABLE   "/etc/login.access"
     63#define TABLE   SYSCONFDIR"/login.access"
    6464#endif
    6565
    6666/* Delimiters for fields and for lists of users, ttys or hosts. */
  • shadow-4.0.18.1

    diff -Naur shadow-4.0.18.1.orig/src/logoutd.c shadow-4.0.18.1/src/logoutd.c
    old new  
    4848#endif
    4949
    5050#ifndef HUP_MESG_FILE
    51 #define HUP_MESG_FILE "/etc/logoutd.mesg"
     51#define HUP_MESG_FILE SYSCONFDIR"/logoutd.mesg"
    5252#endif
    5353
    5454#if HAVE_UTMPX_H
  • shadow-4.0.18.1

    diff -Naur shadow-4.0.18.1.orig/src/newgrp.c shadow-4.0.18.1/src/newgrp.c
    old new  
    153153         */
    154154        Prog = Basename (argv[0]);
    155155        is_newgrp = (strcmp (Prog, "newgrp") == 0);
    156         OPENLOG (is_newgrp ? "newgrp" : "sg");
     156        OPENLOG (is_newgrp ? "newgrp" : SG);
    157157        gid = getgid ();
    158158        argc--;
    159159        argv++;
     
    466466                if (child < 0) {
    467467                        /* error in fork() */
    468468                        fprintf (stderr, _("%s: failure forking: %s"),
    469                                  is_newgrp ? "newgrp" : "sg", strerror (errno));
     469                                 is_newgrp ? "newgrp" : SG, strerror (errno));
    470470#ifdef WITH_AUDIT
    471471                        audit_logger (AUDIT_USER_START, Prog, "changing",
    472472                                      NULL, getuid (), 0);
  • shadow-4.0.18.1

    diff -Naur shadow-4.0.18.1.orig/src/passwd.c shadow-4.0.18.1/src/passwd.c
    old new  
    614614         * The program behaves differently when executed by root than when
    615615         * executed by a normal user.
    616616         */
    617         amroot = (getuid () == 0);
     617        amroot = 1; //(getuid () == 0);
    618618
    619619        /*
    620620         * Get the program name. The program name is used as a prefix to
     
    878878                exit (E_SUCCESS);
    879879        }
    880880#endif                          /* USE_PAM */
    881         if (setuid (0)) {
    882                 fprintf (stderr, _("Cannot change ID to root.\n"));
    883                 SYSLOG ((LOG_ERR, "can't setuid(0)"));
    884                 closelog ();
    885                 exit (E_NOPERM);
    886         }
    887881        if (spw_file_present ())
    888882                update_shadow ();
    889883        else
  • shadow-4.0.18.1

    diff -Naur shadow-4.0.18.1.orig/src/suauth.c shadow-4.0.18.1/src/suauth.c
    old new  
    88#include "prototypes.h"
    99
    1010#ifndef SUAUTHFILE
    11 #define SUAUTHFILE "/etc/suauth"
     11#define SUAUTHFILE SYSCONFDIR"/suauth"
    1212#endif
    1313
    1414#define NOACTION        0
  • shadow-4.0.18.1

    diff -Naur shadow-4.0.18.1.orig/src/useradd.c shadow-4.0.18.1/src/useradd.c
    old new  
    6060#include "shadowio.h"
    6161
    6262#ifndef SKEL_DIR
    63 #define SKEL_DIR "/etc/skel"
     63#define SKEL_DIR SYSCONFDIR"/skel"
    6464#endif
    6565#ifndef USER_DEFAULTS_FILE
    66 #define USER_DEFAULTS_FILE "/etc/default/useradd"
    67 #define NEW_USER_FILE "/etc/default/nuaddXXXXXX"
     66#define USER_DEFAULTS_FILE SYSCONFDIR"/default/useradd"
     67#define NEW_USER_FILE SYSCONFDIR"/default/nuaddXXXXXX"
    6868#endif
    6969/*
    7070 * Needed for MkLinux DR1/2/2.1 - J.
  • shadow-4.0.18.1

    diff -Naur shadow-4.0.18.1.orig/src/vipw.c shadow-4.0.18.1/src/vipw.c
    old new  
    245245        textdomain (PACKAGE);
    246246
    247247        progname = ((a = strrchr (*argv, '/')) ? a + 1 : *argv);
    248         do_vipw = (strcmp (progname, "vigr") != 0);
     248        do_vipw = (strcmp (progname, VIGR) != 0);
    249249
    250250        {
    251251                /*
Note: See TracBrowser for help on using the repository browser.