Skip to content

Move shadow APIs to lib/shadow/ #1197

New issue

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

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

Already on GitHub? Sign in to your account

Open
wants to merge 14 commits into
base: master
Choose a base branch
from

Conversation

alejandro-colomar
Copy link
Collaborator

@alejandro-colomar alejandro-colomar commented Jan 24, 2025


Revisions:

v1b
  • Rebase
$ git range-diff master..gh/shadow shadow/master..shadow
 1:  ca7fc68d !  1:  5882c687 lib/shadow/gshadow/, lib/: putsgent(): Move to separate file
    @@ lib/shadow/gshadow/putsgent.c (new)
     + * writes the result to the given stream.  This is the logical
     + * opposite of fgetsgent.
     + */
    -+#if defined(SHADOWGRP) && !defined(HAVE_GSHADOW_H)
    ++#if defined(SHADOWGRP) && !__has_include(<gshadow.h>)
     +int
     +putsgent(const struct sgrp *sgrp, FILE *fp)
     +{
    @@ lib/shadow/gshadow/putsgent.h (new)
     +#include "gshadow_.h"
     +
     +
    -+#if defined(HAVE_GSHADOW_H)
    ++#if __has_include(<gshadow.h>)
     +# include <gshadow.h>
     +#else
     +int putsgent(const struct sgrp *sgrp, FILE *fp);
 2:  900eddbd =  2:  0c2830e3 lib/shadow/gshadow/, lib/: gshadow: Move to separate file and rename
 3:  9e533b79 !  3:  c243ddd9 lib/shadow/gshadow/, lib/, src/: endsgent(): Move to separate file
    @@ lib/shadow/gshadow/endsgent.c (new)
     +#include "shadow/gshadow/gshadow.h"
     +
     +
    -+#if defined(SHADOWGRP) && !defined(HAVE_GSHADOW_H)
    ++#if defined(SHADOWGRP) && !__has_include(<gshadow.h>)
     +void
     +endsgent(void)
     +{
    @@ lib/shadow/gshadow/endsgent.h (new)
     +#include <config.h>
     +
     +
    -+#if defined(HAVE_GSHADOW_H)
    ++#if __has_include(<gshadow.h>)
     +# include <gshadow.h>
     +#else
     +void endsgent(void);
 4:  ed05446b =  4:  02fc437b lib/shadow/gshadow/gshadow.h, lib/, src/: GSHADOW_FILE: Move definition and rename it
 5:  ce49f474 !  5:  8aa68871 lib/shadow/gshadow/, lib/: setsgent(): Move to separate file
    @@ lib/shadow/gshadow/setsgent.c (new)
     +#include "shadow/gshadow/gshadow.h"
     +
     +
    -+#if defined(SHADOWGRP) && !defined(HAVE_GSHADOW_H)
    ++#if defined(SHADOWGRP) && !__has_include(<gshadow.h>)
     +void
     +setsgent(void)
     +{
    @@ lib/shadow/gshadow/setsgent.h (new)
     +#include <config.h>
     +
     +
    -+#if defined(HAVE_GSHADOW_H)
    ++#if __has_include(<gshadow.h>)
     +# include <gshadow.h>
     +#else
     +void setsgent(void);
 6:  72dab352 !  6:  2aa3f65d lib/shadow/gshadow/, lib/, src/: struct sgrp: Move to separate file
    @@ lib/shadow/gshadow/putsgent.h
     +#include "shadow/gshadow/sgrp.h"
      
      
    - #if defined(HAVE_GSHADOW_H)
    + #if __has_include(<gshadow.h>)
     
      ## lib/shadow/gshadow/sgrp.c (new) ##
     @@
    @@ lib/shadow/gshadow/sgrp.h (new)
     +#define SHADOW_INCLUDE_LIB_SHADOW_GSHADOW_SGRP_H_
     +
     +
    -+#if defined(HAVE_GSHADOW_H)
    ++#if __has_include(<gshadow.h>)
     +# include <gshadow.h>
     +#else
     +struct sgrp {
 7:  b0d63a72 !  7:  66b0763d lib/shadow/gshadow/, lib/: fgetsgent(): Move to separate file
    @@ lib/shadow/gshadow/fgetsgent.c (new)
     + * fgetsgent() reads the next line from the provided stream and
     + * converts it to a (struct sgrp).  NULL is returned on EOF.
     + */
    -+#if defined(SHADOWGRP) && !defined(HAVE_GSHADOW_H)
    ++#if defined(SHADOWGRP) && !__has_include(<gshadow.h>)
     +struct sgrp *
     +fgetsgent(FILE *fp)
     +{
    @@ lib/shadow/gshadow/fgetsgent.h (new)
     +#include "shadow/gshadow/sgrp.h"
     +
     +
    -+#if defined(HAVE_GSHADOW_H)
    ++#if __has_include(<gshadow.h>)
     +# include <gshadow.h>
     +#else
     +struct sgrp *fgetsgent(FILE *stream);
 8:  a7822d17 !  8:  51c7ad87 lib/shadow/gshadow/, lib/: sgetsgent(): Move to separate file
    @@ lib/shadow/gshadow/sgetsgent.c (new)
     +#define FIELDS    4
     +
     +
    -+#if defined(SHADOWGRP) && !defined(HAVE_GSHADOW_H)
    ++#if defined(SHADOWGRP) && !__has_include(<gshadow.h>)
     +static struct sgrp  sgroup = {};
     +
     +
    @@ lib/shadow/gshadow/sgetsgent.h (new)
     +#include "shadow/gshadow/sgrp.h"
     +
     +
    -+#if defined(HAVE_GSHADOW_H)
    ++#if __has_include(<gshadow.h>)
     +# include <gshadow.h>
     +#else
     +struct sgrp *sgetsgent(const char *);
 9:  1f7b88f4 !  9:  b3a67122 lib/shadow/gshadow/, lib/, src/: getsgnam(): Move to separate file
    @@ lib/shadow/gshadow/getsgnam.c (new)
     +/*
     + * getsgnam - get a shadow group entry by name
     + */
    -+#if defined(SHADOWGRP) && !defined(HAVE_GSHADOW_H)
    ++#if defined(SHADOWGRP) && !__has_include(<gshadow.h>)
     +struct sgrp *
     +getsgnam(const char *name)
     +{
    @@ lib/shadow/gshadow/getsgnam.h (new)
     +#include "shadow/gshadow/sgrp.h"
     +
     +
    -+#if defined(HAVE_GSHADOW_H)
    ++#if __has_include(<gshadow.h>)
     +# include <gshadow.h>
     +#else
     +struct sgrp *getsgnam(const char *);
10:  f3b9c46e ! 10:  c3ea1881 lib/shadow/gshadow/, lib/: getsgent(): Move to separate file
    @@ lib/gshadow.c (deleted)
     -
     -#include <config.h>
     -
    --#if defined(SHADOWGRP) && !defined(HAVE_GSHADOW_H)
    +-#if defined(SHADOWGRP) && !__has_include(<gshadow.h>)
     -
     -#ident "$Id$"
     -
    @@ lib/shadow/gshadow/getsgent.c (new)
     +#include "shadow/gshadow/sgrp.h"
     +
     +
    -+#if defined(SHADOWGRP) && !defined(HAVE_GSHADOW_H)
    ++#if defined(SHADOWGRP) && !__has_include(<gshadow.h>)
     +/*
     + * getsgent - get a single shadow group entry
     + */
    @@ lib/shadow/gshadow/getsgent.h (new)
     +#include "shadow/gshadow/sgrp.h"
     +
     +
    -+#if defined(HAVE_GSHADOW_H)
    ++#if __has_include(<gshadow.h>)
     +# include <gshadow.h>
     +#else
     +struct sgrp *getsgent(void);
11:  f1216144 ! 11:  2b373a55 lib/: GSHADOW: Remove unused macro
    @@ lib/gshadow_.h (deleted)
     -#define SHADOW_INCLUDE_LIB_GSHADOW__H_
     -
     -
    --#if defined(HAVE_GSHADOW_H)
    +-#if __has_include(<gshadow.h>)
     -# include <gshadow.h>
     -#else
     -
    @@ lib/gshadow_.h (deleted)
     -#define   GSHADOW "/etc/gshadow"
     -
     -
    --#endif  // !HAVE_GSHADOW_H
    +-#endif  // !__has_include(<gshadow.h>)
     -#endif  // include guard
12:  64dc60fc = 12:  ca661d7e lib/, po/: sgetgrent(): Move to under lib/shadow/group/
13:  819db775 = 13:  e7293129 lib/, po/: sgetpwent(): Move to under lib/shadow/passwd/
v1c
  • Rebase
$ git range-diff master..gh/shadow shadow/master..shadow
 1:  5882c687 =  1:  4389741a lib/shadow/gshadow/, lib/: putsgent(): Move to separate file
 2:  0c2830e3 =  2:  a2792533 lib/shadow/gshadow/, lib/: gshadow: Move to separate file and rename
 3:  c243ddd9 =  3:  df19bcf0 lib/shadow/gshadow/, lib/, src/: endsgent(): Move to separate file
 4:  02fc437b =  4:  e612ae79 lib/shadow/gshadow/gshadow.h, lib/, src/: GSHADOW_FILE: Move definition and rename it
 5:  8aa68871 =  5:  aa4588ff lib/shadow/gshadow/, lib/: setsgent(): Move to separate file
 6:  2aa3f65d =  6:  188b75be lib/shadow/gshadow/, lib/, src/: struct sgrp: Move to separate file
 7:  66b0763d =  7:  dd092a8f lib/shadow/gshadow/, lib/: fgetsgent(): Move to separate file
 8:  51c7ad87 =  8:  84ca3b10 lib/shadow/gshadow/, lib/: sgetsgent(): Move to separate file
 9:  b3a67122 =  9:  13c382c7 lib/shadow/gshadow/, lib/, src/: getsgnam(): Move to separate file
10:  c3ea1881 = 10:  b453908b lib/shadow/gshadow/, lib/: getsgent(): Move to separate file
11:  2b373a55 = 11:  bb9fb4cb lib/: GSHADOW: Remove unused macro
12:  ca661d7e = 12:  08c1562e lib/, po/: sgetgrent(): Move to under lib/shadow/group/
13:  e7293129 = 13:  a5079cb6 lib/, po/: sgetpwent(): Move to under lib/shadow/passwd/
v2
  • Add comments expanding the meaning of the letter soup API names. [@hallyn ]
$ git range-diff shadow/master gh/shadow shadow
 1:  4389741a !  1:  4777704a lib/shadow/gshadow/, lib/: putsgent(): Move to separate file
    @@ lib/shadow/gshadow/putsgent.c (new)
     + * opposite of fgetsgent.
     + */
     +#if defined(SHADOWGRP) && !__has_include(<gshadow.h>)
    ++// put shadow group entry
     +int
     +putsgent(const struct sgrp *sgrp, FILE *fp)
     +{
 2:  a2792533 =  2:  1fc9be8a lib/shadow/gshadow/, lib/: gshadow: Move to separate file and rename
 3:  df19bcf0 !  3:  15cbe6a7 lib/shadow/gshadow/, lib/, src/: endsgent(): Move to separate file
    @@ lib/shadow/gshadow/endsgent.c (new)
     +
     +
     +#if defined(SHADOWGRP) && !__has_include(<gshadow.h>)
    ++// end-working-with shadow group entries
     +void
     +endsgent(void)
     +{
 4:  e612ae79 =  4:  5105aeae lib/shadow/gshadow/gshadow.h, lib/, src/: GSHADOW_FILE: Move definition and rename it
 5:  aa4588ff !  5:  df996ad3 lib/shadow/gshadow/, lib/: setsgent(): Move to separate file
    @@ lib/shadow/gshadow/setsgent.c (new)
     +
     +
     +#if defined(SHADOWGRP) && !__has_include(<gshadow.h>)
    ++// set-resources-for-working-with shadow group entries
     +void
     +setsgent(void)
     +{
 6:  188b75be =  6:  de18a731 lib/shadow/gshadow/, lib/, src/: struct sgrp: Move to separate file
 7:  dd092a8f !  7:  694d0ada lib/shadow/gshadow/, lib/: fgetsgent(): Move to separate file
    @@ lib/shadow/gshadow/fgetsgent.c (new)
     + * converts it to a (struct sgrp).  NULL is returned on EOF.
     + */
     +#if defined(SHADOWGRP) && !__has_include(<gshadow.h>)
    ++// from-FILE get-next shadow group entry
     +struct sgrp *
     +fgetsgent(FILE *fp)
     +{
 8:  84ca3b10 !  8:  6818c7cf lib/shadow/gshadow/, lib/: sgetsgent(): Move to separate file
    @@ lib/shadow/gshadow/sgetsgent.c (new)
     +static char **build_list(char *s);
     +
     +
    ++// from-string get shadow group entry
     +struct sgrp *
     +sgetsgent(const char *string)
     +{
 9:  13c382c7 !  9:  5803f452 lib/shadow/gshadow/, lib/, src/: getsgnam(): Move to separate file
    @@ lib/shadow/gshadow/getsgnam.c (new)
     + * getsgnam - get a shadow group entry by name
     + */
     +#if defined(SHADOWGRP) && !__has_include(<gshadow.h>)
    ++// get shadow group entry-by-name
     +struct sgrp *
     +getsgnam(const char *name)
     +{
10:  b453908b ! 10:  b4391be0 lib/shadow/gshadow/, lib/: getsgent(): Move to separate file
    @@ lib/shadow/gshadow/getsgent.c (new)
     +
     +
     +#if defined(SHADOWGRP) && !__has_include(<gshadow.h>)
    -+/*
    -+ * getsgent - get a single shadow group entry
    -+ */
    ++// get-next shadow group entry
     +struct sgrp *
     +getsgent(void)
     +{
11:  bb9fb4cb = 11:  8684b300 lib/: GSHADOW: Remove unused macro
12:  08c1562e ! 12:  bca9fbc3 lib/, po/: sgetgrent(): Move to under lib/shadow/group/
    @@ lib/shadow/group/sgetgrent.c: list(char *s)
      
      
     -struct group *sgetgrent (const char *buf)
    ++// from-string get group entry
     +struct group *
     +sgetgrent(const char *buf)
      {
13:  a5079cb6 ! 13:  9ad790d4 lib/, po/: sgetpwent(): Move to under lib/shadow/passwd/
    @@ lib/sgetpwent.c => lib/shadow/passwd/sgetpwent.c
      /*
       * sgetpwent - convert a string to a (struct passwd)
       *
    +@@
    +  *        performance reasons.  I am going to come up with some conditional
    +  *        compilation glarp to improve on this in the future.
    +  */
    ++// from-string get pasword entry
    + struct passwd *
    + sgetpwent(const char *buf)
    + {
     @@ lib/shadow/passwd/sgetpwent.c: sgetpwent(const char *buf)
      
        return &pwent;
v2b
  • Rebase
$ git range-diff master..gh/shadow shadow/master..shadow
 1:  4777704a =  1:  dab65d54 lib/shadow/gshadow/, lib/: putsgent(): Move to separate file
 2:  1fc9be8a =  2:  533f0178 lib/shadow/gshadow/, lib/: gshadow: Move to separate file and rename
 3:  15cbe6a7 =  3:  b58f9ff0 lib/shadow/gshadow/, lib/, src/: endsgent(): Move to separate file
 4:  5105aeae =  4:  c8b50d36 lib/shadow/gshadow/gshadow.h, lib/, src/: GSHADOW_FILE: Move definition and rename it
 5:  df996ad3 =  5:  a0e09b71 lib/shadow/gshadow/, lib/: setsgent(): Move to separate file
 6:  de18a731 =  6:  1ede63f4 lib/shadow/gshadow/, lib/, src/: struct sgrp: Move to separate file
 7:  694d0ada =  7:  a0a2759f lib/shadow/gshadow/, lib/: fgetsgent(): Move to separate file
 8:  6818c7cf =  8:  b3877b2e lib/shadow/gshadow/, lib/: sgetsgent(): Move to separate file
 9:  5803f452 =  9:  a3eddb96 lib/shadow/gshadow/, lib/, src/: getsgnam(): Move to separate file
10:  b4391be0 = 10:  b1ed4aa9 lib/shadow/gshadow/, lib/: getsgent(): Move to separate file
11:  8684b300 = 11:  a2b77599 lib/: GSHADOW: Remove unused macro
12:  bca9fbc3 = 12:  2d04f252 lib/, po/: sgetgrent(): Move to under lib/shadow/group/
13:  9ad790d4 = 13:  c27bde07 lib/, po/: sgetpwent(): Move to under lib/shadow/passwd/
v2c
  • Rebase
$ git range-diff master..gh/shadow shadow/master..shadow
 1:  dab65d54 =  1:  ed28fd33 lib/shadow/gshadow/, lib/: putsgent(): Move to separate file
 2:  533f0178 =  2:  9ed6e910 lib/shadow/gshadow/, lib/: gshadow: Move to separate file and rename
 3:  b58f9ff0 =  3:  840b6e7d lib/shadow/gshadow/, lib/, src/: endsgent(): Move to separate file
 4:  c8b50d36 =  4:  b513d1ab lib/shadow/gshadow/gshadow.h, lib/, src/: GSHADOW_FILE: Move definition and rename it
 5:  a0e09b71 =  5:  203913cc lib/shadow/gshadow/, lib/: setsgent(): Move to separate file
 6:  1ede63f4 =  6:  6c395e63 lib/shadow/gshadow/, lib/, src/: struct sgrp: Move to separate file
 7:  a0a2759f =  7:  47fbfb56 lib/shadow/gshadow/, lib/: fgetsgent(): Move to separate file
 8:  b3877b2e =  8:  fcecd00d lib/shadow/gshadow/, lib/: sgetsgent(): Move to separate file
 9:  a3eddb96 =  9:  ba24dac1 lib/shadow/gshadow/, lib/, src/: getsgnam(): Move to separate file
10:  b1ed4aa9 = 10:  3648d73f lib/shadow/gshadow/, lib/: getsgent(): Move to separate file
11:  a2b77599 = 11:  70923d56 lib/: GSHADOW: Remove unused macro
12:  2d04f252 = 12:  d52ffeb1 lib/, po/: sgetgrent(): Move to under lib/shadow/group/
13:  c27bde07 = 13:  dd9501d7 lib/, po/: sgetpwent(): Move to under lib/shadow/passwd/
v3
  • Move another API.
$ git range-diff master gh/shadow shadow
 1:  ed28fd33 =  1:  ed28fd33 lib/shadow/gshadow/, lib/: putsgent(): Move to separate file
 2:  9ed6e910 =  2:  9ed6e910 lib/shadow/gshadow/, lib/: gshadow: Move to separate file and rename
 3:  840b6e7d =  3:  840b6e7d lib/shadow/gshadow/, lib/, src/: endsgent(): Move to separate file
 4:  b513d1ab =  4:  b513d1ab lib/shadow/gshadow/gshadow.h, lib/, src/: GSHADOW_FILE: Move definition and rename it
 5:  203913cc =  5:  203913cc lib/shadow/gshadow/, lib/: setsgent(): Move to separate file
 6:  6c395e63 =  6:  6c395e63 lib/shadow/gshadow/, lib/, src/: struct sgrp: Move to separate file
 7:  47fbfb56 =  7:  47fbfb56 lib/shadow/gshadow/, lib/: fgetsgent(): Move to separate file
 8:  fcecd00d =  8:  fcecd00d lib/shadow/gshadow/, lib/: sgetsgent(): Move to separate file
 9:  ba24dac1 =  9:  ba24dac1 lib/shadow/gshadow/, lib/, src/: getsgnam(): Move to separate file
10:  3648d73f = 10:  3648d73f lib/shadow/gshadow/, lib/: getsgent(): Move to separate file
11:  70923d56 = 11:  70923d56 lib/: GSHADOW: Remove unused macro
12:  d52ffeb1 = 12:  d52ffeb1 lib/, po/: sgetgrent(): Move to under lib/shadow/group/
13:  dd9501d7 = 13:  dd9501d7 lib/, po/: sgetpwent(): Move to under lib/shadow/passwd/
 -:  -------- > 14:  01ef2eba lib/shadow/shadow/, lib/: sgetspent(): Move to under lib/shadow/shadow/
v3b
  • Remove reference to the file in po/.
$ git range-diff master gh/shadow shadow
 1:  ed28fd33 =  1:  ed28fd33 lib/shadow/gshadow/, lib/: putsgent(): Move to separate file
 2:  9ed6e910 =  2:  9ed6e910 lib/shadow/gshadow/, lib/: gshadow: Move to separate file and rename
 3:  840b6e7d =  3:  840b6e7d lib/shadow/gshadow/, lib/, src/: endsgent(): Move to separate file
 4:  b513d1ab =  4:  b513d1ab lib/shadow/gshadow/gshadow.h, lib/, src/: GSHADOW_FILE: Move definition and rename it
 5:  203913cc =  5:  203913cc lib/shadow/gshadow/, lib/: setsgent(): Move to separate file
 6:  6c395e63 =  6:  6c395e63 lib/shadow/gshadow/, lib/, src/: struct sgrp: Move to separate file
 7:  47fbfb56 =  7:  47fbfb56 lib/shadow/gshadow/, lib/: fgetsgent(): Move to separate file
 8:  fcecd00d =  8:  fcecd00d lib/shadow/gshadow/, lib/: sgetsgent(): Move to separate file
 9:  ba24dac1 =  9:  ba24dac1 lib/shadow/gshadow/, lib/, src/: getsgnam(): Move to separate file
10:  3648d73f = 10:  3648d73f lib/shadow/gshadow/, lib/: getsgent(): Move to separate file
11:  70923d56 = 11:  70923d56 lib/: GSHADOW: Remove unused macro
12:  d52ffeb1 = 12:  d52ffeb1 lib/, po/: sgetgrent(): Move to under lib/shadow/group/
13:  dd9501d7 = 13:  dd9501d7 lib/, po/: sgetpwent(): Move to under lib/shadow/passwd/
14:  01ef2eba ! 14:  430d7dcd lib/shadow/shadow/, lib/: sgetspent(): Move to under lib/shadow/shadow/
    @@ Metadata
     Author: Alejandro Colomar <[email protected]>
     
      ## Commit message ##
    -    lib/shadow/shadow/, lib/: sgetspent(): Move to under lib/shadow/shadow/
    +    lib/shadow/shadow/, lib/, po/: sgetspent(): Move to under lib/shadow/shadow/
     
         Signed-off-by: Alejandro Colomar <[email protected]>
     
    @@ lib/shadowio.c
      #include "shadowio.h"
      #ifdef WITH_TCB
      #include <tcb.h>
    +
    + ## po/POTFILES.in ##
    +@@ po/POTFILES.in: lib/selinux.c
    + lib/semanage.c
    + lib/setugid.c
    + lib/setupenv.c
    +-lib/sgetspent.c
    + lib/sgroupio.c
    + lib/shadow.c
    + lib/shadow/group/sgetgrent.c
v3c
  • Rebase
$ git range-diff master..gh/shadow shadow/master..shadow
 1:  ed28fd33 =  1:  c3332329 lib/shadow/gshadow/, lib/: putsgent(): Move to separate file
 2:  9ed6e910 =  2:  c9a10a88 lib/shadow/gshadow/, lib/: gshadow: Move to separate file and rename
 3:  840b6e7d =  3:  1811620d lib/shadow/gshadow/, lib/, src/: endsgent(): Move to separate file
 4:  b513d1ab =  4:  42b2c2c9 lib/shadow/gshadow/gshadow.h, lib/, src/: GSHADOW_FILE: Move definition and rename it
 5:  203913cc =  5:  9f4bd4d3 lib/shadow/gshadow/, lib/: setsgent(): Move to separate file
 6:  6c395e63 =  6:  fce2744e lib/shadow/gshadow/, lib/, src/: struct sgrp: Move to separate file
 7:  47fbfb56 =  7:  352b4f78 lib/shadow/gshadow/, lib/: fgetsgent(): Move to separate file
 8:  fcecd00d =  8:  948bdcaa lib/shadow/gshadow/, lib/: sgetsgent(): Move to separate file
 9:  ba24dac1 =  9:  79e9d3df lib/shadow/gshadow/, lib/, src/: getsgnam(): Move to separate file
10:  3648d73f = 10:  21947186 lib/shadow/gshadow/, lib/: getsgent(): Move to separate file
11:  70923d56 = 11:  b5acda59 lib/: GSHADOW: Remove unused macro
12:  d52ffeb1 = 12:  7cebadf7 lib/, po/: sgetgrent(): Move to under lib/shadow/group/
13:  dd9501d7 = 13:  fa284dd0 lib/, po/: sgetpwent(): Move to under lib/shadow/passwd/
14:  430d7dcd = 14:  3813478c lib/shadow/shadow/, lib/, po/: sgetspent(): Move to under lib/shadow/shadow/
v3e
  • Rebase
$ git rd
 1:  c3332329 =  1:  2964608e lib/shadow/gshadow/, lib/: putsgent(): Move to separate file
 2:  c9a10a88 =  2:  cd5dcb4b lib/shadow/gshadow/, lib/: gshadow: Move to separate file and rename
 3:  1811620d =  3:  7e7918d2 lib/shadow/gshadow/, lib/, src/: endsgent(): Move to separate file
 4:  42b2c2c9 =  4:  0371b900 lib/shadow/gshadow/gshadow.h, lib/, src/: GSHADOW_FILE: Move definition and rename it
 5:  9f4bd4d3 =  5:  734bba06 lib/shadow/gshadow/, lib/: setsgent(): Move to separate file
 6:  fce2744e =  6:  06201ed8 lib/shadow/gshadow/, lib/, src/: struct sgrp: Move to separate file
 7:  352b4f78 =  7:  4267f485 lib/shadow/gshadow/, lib/: fgetsgent(): Move to separate file
 8:  948bdcaa =  8:  14159986 lib/shadow/gshadow/, lib/: sgetsgent(): Move to separate file
 9:  79e9d3df =  9:  e7bda68a lib/shadow/gshadow/, lib/, src/: getsgnam(): Move to separate file
10:  21947186 = 10:  5817ff29 lib/shadow/gshadow/, lib/: getsgent(): Move to separate file
11:  b5acda59 = 11:  ce8dbb7e lib/: GSHADOW: Remove unused macro
12:  7cebadf7 = 12:  fe126315 lib/, po/: sgetgrent(): Move to under lib/shadow/group/
13:  fa284dd0 = 13:  1e6067da lib/, po/: sgetpwent(): Move to under lib/shadow/passwd/
14:  3813478c = 14:  5a19e0a4 lib/shadow/shadow/, lib/, po/: sgetspent(): Move to under lib/shadow/shadow/
v3f
  • Rebase
$ git rd
 1:  2964608e =  1:  b05808a4 lib/shadow/gshadow/, lib/: putsgent(): Move to separate file
 2:  cd5dcb4b =  2:  3aff37a4 lib/shadow/gshadow/, lib/: gshadow: Move to separate file and rename
 3:  7e7918d2 =  3:  abfef439 lib/shadow/gshadow/, lib/, src/: endsgent(): Move to separate file
 4:  0371b900 =  4:  8278a8c9 lib/shadow/gshadow/gshadow.h, lib/, src/: GSHADOW_FILE: Move definition and rename it
 5:  734bba06 =  5:  ddb24ced lib/shadow/gshadow/, lib/: setsgent(): Move to separate file
 6:  06201ed8 =  6:  77734f84 lib/shadow/gshadow/, lib/, src/: struct sgrp: Move to separate file
 7:  4267f485 =  7:  780f208a lib/shadow/gshadow/, lib/: fgetsgent(): Move to separate file
 8:  14159986 =  8:  bcd4d3c0 lib/shadow/gshadow/, lib/: sgetsgent(): Move to separate file
 9:  e7bda68a =  9:  ecc5d7f1 lib/shadow/gshadow/, lib/, src/: getsgnam(): Move to separate file
10:  5817ff29 = 10:  695abb44 lib/shadow/gshadow/, lib/: getsgent(): Move to separate file
11:  ce8dbb7e = 11:  0f2fa2ae lib/: GSHADOW: Remove unused macro
12:  fe126315 = 12:  3ba94bc3 lib/, po/: sgetgrent(): Move to under lib/shadow/group/
13:  1e6067da = 13:  87f20fc1 lib/, po/: sgetpwent(): Move to under lib/shadow/passwd/
14:  5a19e0a4 = 14:  039ece70 lib/shadow/shadow/, lib/, po/: sgetspent(): Move to under lib/shadow/shadow/
v3g
  • Rebase
$ git rd
 1:  b05808a4 =  1:  3e7a0be8 lib/shadow/gshadow/, lib/: putsgent(): Move to separate file
 2:  3aff37a4 =  2:  dba3d88f lib/shadow/gshadow/, lib/: gshadow: Move to separate file and rename
 3:  abfef439 =  3:  300f40c0 lib/shadow/gshadow/, lib/, src/: endsgent(): Move to separate file
 4:  8278a8c9 =  4:  23510daa lib/shadow/gshadow/gshadow.h, lib/, src/: GSHADOW_FILE: Move definition and rename it
 5:  ddb24ced =  5:  b05c67f5 lib/shadow/gshadow/, lib/: setsgent(): Move to separate file
 6:  77734f84 =  6:  67d1e585 lib/shadow/gshadow/, lib/, src/: struct sgrp: Move to separate file
 7:  780f208a =  7:  0765ec0b lib/shadow/gshadow/, lib/: fgetsgent(): Move to separate file
 8:  bcd4d3c0 =  8:  0f9d121a lib/shadow/gshadow/, lib/: sgetsgent(): Move to separate file
 9:  ecc5d7f1 =  9:  9b877ba3 lib/shadow/gshadow/, lib/, src/: getsgnam(): Move to separate file
10:  695abb44 = 10:  692fd0db lib/shadow/gshadow/, lib/: getsgent(): Move to separate file
11:  0f2fa2ae = 11:  14f3190e lib/: GSHADOW: Remove unused macro
12:  3ba94bc3 = 12:  36cd3aa8 lib/, po/: sgetgrent(): Move to under lib/shadow/group/
13:  87f20fc1 = 13:  3cbe652b lib/, po/: sgetpwent(): Move to under lib/shadow/passwd/
14:  039ece70 = 14:  932160fe lib/shadow/shadow/, lib/, po/: sgetspent(): Move to under lib/shadow/shadow/
v3h
  • Rebase
$ git rd
 1:  3e7a0be8 !  1:  ff103594 lib/shadow/gshadow/, lib/: putsgent(): Move to separate file
    @@ lib/Makefile.am: libshadow_la_SOURCES = \
        sgroupio.c \
     -  sgroupio.h\
     +  sgroupio.h \
    -   shadow.c \
        shadow/grp/agetgroups.c \
        shadow/grp/agetgroups.h \
     +  shadow/gshadow/putsgent.c \
 2:  dba3d88f !  2:  27528248 lib/shadow/gshadow/, lib/: gshadow: Move to separate file and rename
    @@ Commit message
     
      ## lib/Makefile.am ##
     @@ lib/Makefile.am: libshadow_la_SOURCES = \
    -   shadow.c \
    +   sgroupio.h \
        shadow/grp/agetgroups.c \
        shadow/grp/agetgroups.h \
     +  shadow/gshadow/gshadow.c \
 3:  300f40c0 !  3:  4ad33bbe lib/shadow/gshadow/, lib/, src/: endsgent(): Move to separate file
    @@ Commit message
     
      ## lib/Makefile.am ##
     @@ lib/Makefile.am: libshadow_la_SOURCES = \
    -   shadow.c \
    +   sgroupio.h \
        shadow/grp/agetgroups.c \
        shadow/grp/agetgroups.h \
     +  shadow/gshadow/endsgent.c \
 4:  23510daa =  4:  3c95d7ef lib/shadow/gshadow/gshadow.h, lib/, src/: GSHADOW_FILE: Move definition and rename it
 5:  b05c67f5 =  5:  a2e7bb34 lib/shadow/gshadow/, lib/: setsgent(): Move to separate file
 6:  67d1e585 =  6:  8da1146a lib/shadow/gshadow/, lib/, src/: struct sgrp: Move to separate file
 7:  0765ec0b =  7:  5c220086 lib/shadow/gshadow/, lib/: fgetsgent(): Move to separate file
 8:  0f9d121a =  8:  71cf1bee lib/shadow/gshadow/, lib/: sgetsgent(): Move to separate file
 9:  9b877ba3 =  9:  4c498212 lib/shadow/gshadow/, lib/, src/: getsgnam(): Move to separate file
10:  692fd0db = 10:  dcf85320 lib/shadow/gshadow/, lib/: getsgent(): Move to separate file
11:  14f3190e = 11:  5af09e5a lib/: GSHADOW: Remove unused macro
12:  36cd3aa8 ! 12:  e72596bf lib/, po/: sgetgrent(): Move to under lib/shadow/group/
    @@ lib/Makefile.am: libshadow_la_SOURCES = \
        sgetspent.c \
        sgroupio.c \
        sgroupio.h \
    -   shadow.c \
     +  shadow/group/sgetgrent.c \
     +  shadow/group/sgetgrent.h \
        shadow/grp/agetgroups.c \
    @@ po/POTFILES.in: lib/selinux.c
      lib/sgetpwent.c
      lib/sgetspent.c
      lib/sgroupio.c
    - lib/shadow.c
     +lib/shadow/group/sgetgrent.c
      lib/shadowio.c
      lib/shadowmem.c
13:  3cbe652b ! 13:  4f0a8554 lib/, po/: sgetpwent(): Move to under lib/shadow/passwd/
    @@ po/POTFILES.in: lib/selinux.c
     -lib/sgetpwent.c
      lib/sgetspent.c
      lib/sgroupio.c
    - lib/shadow.c
      lib/shadow/group/sgetgrent.c
     +lib/shadow/passwd/sgetpwent.c
      lib/shadowio.c
14:  932160fe ! 14:  18be16bc lib/shadow/shadow/, lib/, po/: sgetspent(): Move to under lib/shadow/shadow/
    @@ lib/Makefile.am: libshadow_la_SOURCES = \
     -  sgetspent.c \
        sgroupio.c \
        sgroupio.h \
    -   shadow.c \
    +   shadow/group/sgetgrent.c \
     @@ lib/Makefile.am: libshadow_la_SOURCES = \
        shadow/gshadow/sgrp.h \
        shadow/passwd/sgetpwent.c \
    @@ po/POTFILES.in: lib/selinux.c
      lib/setupenv.c
     -lib/sgetspent.c
      lib/sgroupio.c
    - lib/shadow.c
      lib/shadow/group/sgetgrent.c
    + lib/shadow/passwd/sgetpwent.c
v4
  • Rebase
$ git rd
 1:  ff103594 !  1:  e34a6822 lib/shadow/gshadow/, lib/: putsgent(): Move to separate file
    @@ lib/Makefile.am: libshadow_la_SOURCES = \
        shadowlog.c \
     
      ## lib/gshadow.c ##
    -@@ lib/gshadow.c: sgetsgent(const char *string)
    +@@ lib/gshadow.c: sgetsgent(const char *s)
        }
        return sgrp;
      }
 2:  27528248 !  2:  843e53b3 lib/shadow/gshadow/, lib/: gshadow: Move to separate file and rename
    @@ lib/gshadow.c: build_list(char *s)
      }
      
      /*@observer@*//*@null@*/struct sgrp *
    -@@ lib/gshadow.c: sgetsgent(const char *string)
    +@@ lib/gshadow.c: sgetsgent(const char *s)
      
      /*@observer@*//*@null@*/struct sgrp *getsgent (void)
      {
 3:  4ad33bbe !  3:  7d78fb77 lib/shadow/gshadow/, lib/, src/: endsgent(): Move to separate file
    @@ lib/gshadow.c: void setsgent (void)
     -}
     -
      /*@observer@*//*@null@*/struct sgrp *
    - sgetsgent(const char *string)
    + sgetsgent(const char *s)
      {
     
      ## lib/gshadow_.h ##
 4:  3c95d7ef =  4:  de0811d6 lib/shadow/gshadow/gshadow.h, lib/, src/: GSHADOW_FILE: Move definition and rename it
 5:  a2e7bb34 !  5:  82a2665a lib/shadow/gshadow/, lib/: setsgent(): Move to separate file
    @@ lib/gshadow.c: build_list(char *s)
     -}
     -
      /*@observer@*//*@null@*/struct sgrp *
    - sgetsgent(const char *string)
    + sgetsgent(const char *s)
      {
     
      ## lib/gshadow_.h ##
 6:  8da1146a =  6:  9273061c lib/shadow/gshadow/, lib/, src/: struct sgrp: Move to separate file
 7:  5c220086 !  7:  3c313a42 lib/shadow/gshadow/, lib/: fgetsgent(): Move to separate file
    @@ lib/gshadow.c
      #include "shadow/gshadow/gshadow.h"
      #include "shadow/gshadow/setsgent.h"
      #include "shadow/gshadow/sgrp.h"
    -@@ lib/gshadow.c: sgetsgent(const char *string)
    +@@ lib/gshadow.c: sgetsgent(const char *s)
        return &sgroup;
      }
      
 8:  71cf1bee !  8:  8385f091 lib/shadow/gshadow/, lib/: sgetsgent(): Move to separate file
    @@ lib/gshadow.c
     -}
     -
     -/*@observer@*//*@null@*/struct sgrp *
    --sgetsgent(const char *string)
    +-sgetsgent(const char *s)
     -{
    --  static char *sgrbuf = NULL;
    --  static size_t sgrbuflen = 0;
    +-  static char  *dup = NULL;
     -
    --  char *fields[FIELDS];
    +-  char  *fields[FIELDS];
     -  char *cp;
     -  int i;
    --  size_t len = strlen (string) + 1;
     -
    --  if (len > sgrbuflen) {
    --          char *buf = REALLOC(sgrbuf, len, char);
    --          if (NULL == buf)
    --                  return NULL;
    +-  free(dup);
    +-  dup = strdup(s);
    +-  if (dup == NULL)
    +-          return NULL;
     -
    --          sgrbuf = buf;
    --          sgrbuflen = len;
    --  }
    --
    --  strcpy (sgrbuf, string);
    --  stpsep(sgrbuf, "\n");
    +-  stpsep(dup, "\n");
     -
     -  /*
     -   * There should be exactly 4 colon separated fields.  Find
     -   * all 4 of them and save the starting addresses in fields[].
     -   */
     -
    --  for (cp = sgrbuf, i = 0; (i < FIELDS) && (NULL != cp); i++)
    +-  for (cp = dup, i = 0; (i < FIELDS) && (NULL != cp); i++)
     -          fields[i] = strsep(&cp, ":");
     -
     -  /*
    @@ lib/shadow/gshadow/sgetsgent.c (new)
     +
     +// from-string get shadow group entry
     +struct sgrp *
    -+sgetsgent(const char *string)
    ++sgetsgent(const char *s)
     +{
    -+  static char *sgrbuf = NULL;
    -+  static size_t sgrbuflen = 0;
    ++  static char    *dup = NULL;
     +
    -+  char *fields[FIELDS];
    ++  char  *fields[FIELDS];
     +  char *cp;
     +  int i;
    -+  size_t len = strlen (string) + 1;
     +
    -+  if (len > sgrbuflen) {
    -+          char *buf = REALLOC(sgrbuf, len, char);
    -+          if (NULL == buf)
    -+                  return NULL;
    ++  free(dup);
    ++  dup = strdup(s);
    ++  if (dup == NULL)
    ++          return NULL;
     +
    -+          sgrbuf = buf;
    -+          sgrbuflen = len;
    -+  }
    -+
    -+  strcpy (sgrbuf, string);
    -+  stpsep(sgrbuf, "\n");
    ++  stpsep(dup, "\n");
     +
     +  /*
     +   * There should be exactly 4 colon separated fields.  Find
     +   * all 4 of them and save the starting addresses in fields[].
     +   */
     +
    -+  for (cp = sgrbuf, i = 0; (i < FIELDS) && (NULL != cp); i++)
    ++  for (cp = dup, i = 0; (i < FIELDS) && (NULL != cp); i++)
     +          fields[i] = strsep(&cp, ":");
     +
     +  /*
 9:  4c498212 =  9:  f521a66d lib/shadow/gshadow/, lib/, src/: getsgnam(): Move to separate file
10:  dcf85320 ! 10:  77a86e0f lib/shadow/gshadow/, lib/: getsgent(): Move to separate file
    @@ lib/gshadow.c (deleted)
     -
     -#include <stddef.h>
     -#include <stdio.h>
    +-#include <stdlib.h>
     -#include <string.h>
     -
     -#include "alloc/malloc.h"
11:  5af09e5a = 11:  f0144738 lib/: GSHADOW: Remove unused macro
12:  e72596bf ! 12:  49809700 lib/, po/: sgetgrent(): Move to under lib/shadow/group/
    @@ lib/sgetgrent.c => lib/shadow/group/sgetgrent.c
     -#ident "$Id$"
     +#include "shadow/group/sgetgrent.h"
      
    + #include <grp.h>
      #include <stdio.h>
    - #include <sys/types.h>
     @@
      
      #define   NFIELDS 4
    @@ lib/shadow/group/sgetgrent.c: list(char *s)
      }
      
      
    --struct group *sgetgrent (const char *buf)
     +// from-string get group entry
    -+struct group *
    -+sgetgrent(const char *buf)
    + struct group *
    + sgetgrent(const char *s)
      {
    -   static char *grpbuf = NULL;
    -   static size_t size = 0;
    -@@ lib/shadow/group/sgetgrent.c: struct group *sgetgrent (const char *buf)
    - 
    -   return &grent;
    - }
    --
     
      ## lib/shadow/group/sgetgrent.h (new) ##
     @@
13:  4f0a8554 ! 13:  d36c24f7 lib/, po/: sgetpwent(): Move to under lib/shadow/passwd/
    @@ lib/sgetpwent.c => lib/shadow/passwd/sgetpwent.c
     -#ident "$Id$"
     +#include "shadow/passwd/sgetpwent.h"
      
    - #include <sys/types.h>
    + #include <pwd.h>
      #include <stdio.h>
     @@
      
    @@ lib/sgetpwent.c => lib/shadow/passwd/sgetpwent.c
       */
     +// from-string get pasword entry
      struct passwd *
    - sgetpwent(const char *buf)
    + sgetpwent(const char *s)
      {
    -@@ lib/shadow/passwd/sgetpwent.c: sgetpwent(const char *buf)
    +@@ lib/shadow/passwd/sgetpwent.c: sgetpwent(const char *s)
      
        return &pwent;
      }
14:  18be16bc ! 14:  a70d6b7d lib/shadow/shadow/, lib/, po/: sgetspent(): Move to under lib/shadow/shadow/
    @@ lib/sgetspent.c => lib/shadow/shadow/sgetspent.c
     -
      #include <stddef.h>
      #include <stdio.h>
    - #include <sys/types.h>
    + #include <stdlib.h>
     
      ## lib/shadow/shadow/sgetspent.h (new) ##
     @@
v4b
  • Rebase
$ git rd
 1:  e34a6822 =  1:  618e372d lib/shadow/gshadow/, lib/: putsgent(): Move to separate file
 2:  843e53b3 =  2:  5bb8da5c lib/shadow/gshadow/, lib/: gshadow: Move to separate file and rename
 3:  7d78fb77 =  3:  2826bacc lib/shadow/gshadow/, lib/, src/: endsgent(): Move to separate file
 4:  de0811d6 =  4:  648e26ee lib/shadow/gshadow/gshadow.h, lib/, src/: GSHADOW_FILE: Move definition and rename it
 5:  82a2665a =  5:  276cd0b6 lib/shadow/gshadow/, lib/: setsgent(): Move to separate file
 6:  9273061c =  6:  9e26fdad lib/shadow/gshadow/, lib/, src/: struct sgrp: Move to separate file
 7:  3c313a42 =  7:  5ac994b5 lib/shadow/gshadow/, lib/: fgetsgent(): Move to separate file
 8:  8385f091 =  8:  0fe029f9 lib/shadow/gshadow/, lib/: sgetsgent(): Move to separate file
 9:  f521a66d =  9:  894ed755 lib/shadow/gshadow/, lib/, src/: getsgnam(): Move to separate file
10:  77a86e0f = 10:  4fb96120 lib/shadow/gshadow/, lib/: getsgent(): Move to separate file
11:  f0144738 = 11:  16ff5c0f lib/: GSHADOW: Remove unused macro
12:  49809700 = 12:  652e5655 lib/, po/: sgetgrent(): Move to under lib/shadow/group/
13:  d36c24f7 = 13:  18246bbe lib/, po/: sgetpwent(): Move to under lib/shadow/passwd/
14:  a70d6b7d = 14:  87699a61 lib/shadow/shadow/, lib/, po/: sgetspent(): Move to under lib/shadow/shadow/
v4c
  • Rebase
$ git rd
 1:  618e372d =  1:  28d630c8 lib/shadow/gshadow/, lib/: putsgent(): Move to separate file
 2:  5bb8da5c =  2:  26a44a8d lib/shadow/gshadow/, lib/: gshadow: Move to separate file and rename
 3:  2826bacc =  3:  65d3e775 lib/shadow/gshadow/, lib/, src/: endsgent(): Move to separate file
 4:  648e26ee =  4:  86992f3f lib/shadow/gshadow/gshadow.h, lib/, src/: GSHADOW_FILE: Move definition and rename it
 5:  276cd0b6 =  5:  cee76ec7 lib/shadow/gshadow/, lib/: setsgent(): Move to separate file
 6:  9e26fdad =  6:  a3f7be42 lib/shadow/gshadow/, lib/, src/: struct sgrp: Move to separate file
 7:  5ac994b5 =  7:  02f84581 lib/shadow/gshadow/, lib/: fgetsgent(): Move to separate file
 8:  0fe029f9 =  8:  1b30a921 lib/shadow/gshadow/, lib/: sgetsgent(): Move to separate file
 9:  894ed755 =  9:  a5a560aa lib/shadow/gshadow/, lib/, src/: getsgnam(): Move to separate file
10:  4fb96120 = 10:  5fb01c5a lib/shadow/gshadow/, lib/: getsgent(): Move to separate file
11:  16ff5c0f = 11:  24c8429e lib/: GSHADOW: Remove unused macro
12:  652e5655 = 12:  b76638ee lib/, po/: sgetgrent(): Move to under lib/shadow/group/
13:  18246bbe = 13:  bcbb3e9c lib/, po/: sgetpwent(): Move to under lib/shadow/passwd/
14:  87699a61 = 14:  fb6f4e1f lib/shadow/shadow/, lib/, po/: sgetspent(): Move to under lib/shadow/shadow/
v4d
  • Rebase
$ git rd 
 1:  28d630c8 !  1:  00c8d066 lib/shadow/gshadow/, lib/: putsgent(): Move to separate file
    @@ lib/gshadow_.h: struct sgrp {
     
      ## lib/sgroupio.c ##
     @@
    - #include "commonio.h"
    + #include "fields.h"
      #include "getdef.h"
      #include "sgroupio.h"
     +#include "shadow/gshadow/putsgent.h"
 2:  26a44a8d =  2:  42b7c0f8 lib/shadow/gshadow/, lib/: gshadow: Move to separate file and rename
 3:  65d3e775 =  3:  6b8ebf9e lib/shadow/gshadow/, lib/, src/: endsgent(): Move to separate file
 4:  86992f3f !  4:  2995d9b0 lib/shadow/gshadow/gshadow.h, lib/, src/: GSHADOW_FILE: Move definition and rename it
    @@ lib/prefix_flag.c: extern const char* process_prefix_flag (const char* short_opt
     
      ## lib/sgroupio.c ##
     @@
    - #include "commonio.h"
    + #include "fields.h"
      #include "getdef.h"
      #include "sgroupio.h"
     +#include "shadow/gshadow/gshadow.h"
 5:  cee76ec7 =  5:  e8db6ece lib/shadow/gshadow/, lib/: setsgent(): Move to separate file
 6:  a3f7be42 =  6:  51be03cd lib/shadow/gshadow/, lib/, src/: struct sgrp: Move to separate file
 7:  02f84581 =  7:  c5449fe1 lib/shadow/gshadow/, lib/: fgetsgent(): Move to separate file
 8:  1b30a921 =  8:  11bec2ad lib/shadow/gshadow/, lib/: sgetsgent(): Move to separate file
 9:  a5a560aa =  9:  3c92bc5f lib/shadow/gshadow/, lib/, src/: getsgnam(): Move to separate file
10:  5fb01c5a = 10:  aea1dd2e lib/shadow/gshadow/, lib/: getsgent(): Move to separate file
11:  24c8429e = 11:  70e5b9f1 lib/: GSHADOW: Remove unused macro
12:  b76638ee = 12:  f1f54f3c lib/, po/: sgetgrent(): Move to under lib/shadow/group/
13:  bcbb3e9c ! 13:  daa3e80f lib/, po/: sgetpwent(): Move to under lib/shadow/passwd/
    @@ lib/prototypes.h: extern void setup (struct passwd *);
     
      ## lib/pwio.c ##
     @@
    - #include <stdio.h>
    - #include "commonio.h"
    + #include "fields.h"
    + #include "prototypes.h"
      #include "pwio.h"
     +#include "shadow/passwd/sgetpwent.h"
     +
14:  fb6f4e1f ! 14:  064c6c96 lib/shadow/shadow/, lib/, po/: sgetspent(): Move to under lib/shadow/shadow/
    @@ lib/shadow/shadow/sgetspent.h (new)
     
      ## lib/shadowio.c ##
     @@
    - 
    - #ident "$Id$"
    - 
    --#include "prototypes.h"
    --#include "defines.h"
    - #include <shadow.h>
    - #include <stdio.h>
    -+
    - #include "commonio.h"
    -+#include "defines.h"
    + #include "fields.h"
      #include "getdef.h"
    -+#include "prototypes.h"
    + #include "prototypes.h"
     +#include "shadow/shadow/sgetspent.h"
      #include "shadowio.h"
    + 
      #ifdef WITH_TCB
    - #include <tcb.h>
     
      ## po/POTFILES.in ##
     @@ po/POTFILES.in: lib/selinux.c
v4e
  • Rebase
$ git rd 
 1:  00c8d066 =  1:  84ec3820 lib/shadow/gshadow/, lib/: putsgent(): Move to separate file
 2:  42b7c0f8 =  2:  3c80dee8 lib/shadow/gshadow/, lib/: gshadow: Move to separate file and rename
 3:  6b8ebf9e =  3:  7ecd3049 lib/shadow/gshadow/, lib/, src/: endsgent(): Move to separate file
 4:  2995d9b0 !  4:  d2ff47b9 lib/shadow/gshadow/gshadow.h, lib/, src/: GSHADOW_FILE: Move definition and rename it
    @@ lib/prefix_flag.c
      #include "getdef.h"
     +#include "shadow/gshadow/gshadow.h"
      #include "shadowlog.h"
    - #include "string/sprintf/xasprintf.h"
    + #include "string/sprintf/xaprintf.h"
      #include "string/strcmp/streq.h"
     @@ lib/prefix_flag.c: extern const char* process_prefix_flag (const char* short_opt, int argc, char **
                gr_setdbname(group_db_file);
      
      #ifdef  SHADOWGRP
    --          xasprintf(&sgroup_db_file, "%s/%s", prefix, SGROUP_FILE);
    -+          xasprintf(&sgroup_db_file, "%s/%s", prefix, GSHADOW_FILE);
    +-          sgroup_db_file = xaprintf("%s/%s", prefix, SGROUP_FILE);
    ++          sgroup_db_file = xaprintf("%s/%s", prefix, GSHADOW_FILE);
                sgr_setdbname(sgroup_db_file);
      #endif
      
 5:  e8db6ece =  5:  8c08d206 lib/shadow/gshadow/, lib/: setsgent(): Move to separate file
 6:  51be03cd !  6:  1d182683 lib/shadow/gshadow/, lib/, src/: struct sgrp: Move to separate file
    @@ src/userdel.c
      #endif                            /* ENABLE_SUBIDS */
     +#include "shadow/gshadow/sgrp.h"
      #include "shadowlog.h"
    - #include "string/sprintf/xasprintf.h"
    - #include "string/strcmp/streq.h"
    + #include "string/sprintf/aprintf.h"
    + #include "string/sprintf/xaprintf.h"
     
      ## src/usermod.c ##
     @@
 7:  c5449fe1 =  7:  8a4a1a9c lib/shadow/gshadow/, lib/: fgetsgent(): Move to separate file
 8:  11bec2ad =  8:  23c52cc5 lib/shadow/gshadow/, lib/: sgetsgent(): Move to separate file
 9:  3c92bc5f =  9:  783d1904 lib/shadow/gshadow/, lib/, src/: getsgnam(): Move to separate file
10:  aea1dd2e = 10:  43c4081e lib/shadow/gshadow/, lib/: getsgent(): Move to separate file
11:  70e5b9f1 = 11:  981e83b3 lib/: GSHADOW: Remove unused macro
12:  f1f54f3c ! 12:  52de5866 lib/, po/: sgetgrent(): Move to under lib/shadow/group/
    @@ lib/groupio.c
      #include "groupio.h"
      #include "prototypes.h"
     +#include "shadow/group/sgetgrent.h"
    + #include "string/sprintf/aprintf.h"
      #include "string/strcmp/streq.h"
      
    - 
     
      ## lib/prototypes.h ##
     @@ lib/prototypes.h: extern void setup (struct passwd *);
13:  daa3e80f = 13:  da71a92f lib/, po/: sgetpwent(): Move to under lib/shadow/passwd/
14:  064c6c96 = 14:  a634b541 lib/shadow/shadow/, lib/, po/: sgetspent(): Move to under lib/shadow/shadow/
v5
  • Rebase
$ git rd 
 1:  84ec3820 =  1:  235199e5 lib/shadow/gshadow/, lib/: putsgent(): Move to separate file
 2:  3c80dee8 !  2:  00bc6130 lib/shadow/gshadow/, lib/: gshadow: Move to separate file and rename
    @@ lib/Makefile.am: libshadow_la_SOURCES = \
     
      ## lib/gshadow.c ##
     @@
    - #include "alloc/x/xmalloc.h"
    + #include "alloc/realloc.h"
      #include "defines.h"
      #include "prototypes.h"
     +#include "shadow/gshadow/gshadow.h"
    - #include "string/strchr/strchrcnt.h"
      #include "string/strcmp/streq.h"
      #include "string/strtok/stpsep.h"
    + #include "string/strtok/strsep2arr.h"
    + #include "string/strtok/xastrsep2ls.h"
      
      
     -static /*@null@*/FILE *shadow;
      static struct sgrp  sgroup = {};
      
    - #define   FIELDS  4
    + 
     @@ lib/gshadow.c: build_list(char *s)
      
      void setsgent (void)
 3:  7ecd3049 =  3:  d013f7fe lib/shadow/gshadow/, lib/, src/: endsgent(): Move to separate file
 4:  d2ff47b9 =  4:  079893e0 lib/shadow/gshadow/gshadow.h, lib/, src/: GSHADOW_FILE: Move definition and rename it
 5:  8c08d206 !  5:  5cc54c56 lib/shadow/gshadow/, lib/: setsgent(): Move to separate file
    @@ lib/gshadow.c
      #include "prototypes.h"
      #include "shadow/gshadow/gshadow.h"
     +#include "shadow/gshadow/setsgent.h"
    - #include "string/strchr/strchrcnt.h"
      #include "string/strcmp/streq.h"
      #include "string/strtok/stpsep.h"
    + #include "string/strtok/strsep2arr.h"
     @@ lib/gshadow.c: build_list(char *s)
        return l;
      }
 6:  1d182683 !  6:  d885ae8d lib/shadow/gshadow/, lib/, src/: struct sgrp: Move to separate file
    @@ lib/gshadow.c
      #include "shadow/gshadow/gshadow.h"
      #include "shadow/gshadow/setsgent.h"
     +#include "shadow/gshadow/sgrp.h"
    - #include "string/strchr/strchrcnt.h"
      #include "string/strcmp/streq.h"
      #include "string/strtok/stpsep.h"
    + #include "string/strtok/strsep2arr.h"
     
      ## lib/gshadow_.h ##
     @@
 7:  8a4a1a9c !  7:  c03c7b59 lib/shadow/gshadow/, lib/: fgetsgent(): Move to separate file
    @@ lib/Makefile.am: libshadow_la_SOURCES = \
     
      ## lib/gshadow.c ##
     @@
    - #include "alloc/x/xmalloc.h"
    + #include "alloc/realloc.h"
      #include "defines.h"
      #include "prototypes.h"
     +#include "shadow/gshadow/fgetsgent.h"
 8:  23c52cc5 !  8:  438428c2 lib/shadow/gshadow/, lib/: sgetsgent(): Move to separate file
    @@ lib/Makefile.am: libshadow_la_SOURCES = \
     
      ## lib/gshadow.c ##
     @@
    - #include "string/strtok/stpsep.h"
    + #include <stdlib.h>
    + #include <string.h>
    + 
    +-#include "alloc/malloc.h"
    +-#include "alloc/realloc.h"
    + #include "defines.h"
    + #include "prototypes.h"
    + #include "shadow/gshadow/fgetsgent.h"
    +@@
    + #include "shadow/gshadow/setsgent.h"
    + #include "shadow/gshadow/sgrp.h"
    + #include "string/strcmp/streq.h"
    +-#include "string/strtok/stpsep.h"
    +-#include "string/strtok/strsep2arr.h"
    +-#include "string/strtok/xastrsep2ls.h"
      
      
     -static struct sgrp  sgroup = {};
     -
    --#define   FIELDS  4
    --
     -
     -static /*@null@*/char **
     -build_list(char *s)
     -{
     -  char    **l;
    --  size_t  i;
    +-  size_t  n;
     -
    --  l = XMALLOC(strchrcnt(s, ',') + 2, char *);
    +-  l = xastrsep2ls(s, ",", &n);
     -
    --  for (i = 0; s != NULL && !streq(s, ""); i++)
    --          l[i] = strsep(&s, ",");
    --
    --  l[i] = NULL;
    +-  if (streq(l[n-1], ""))
    +-          l[n-1] = NULL;
     -
     -  return l;
     -}
    @@ lib/gshadow.c
     -{
     -  static char  *dup = NULL;
     -
    --  char  *fields[FIELDS];
    --  char *cp;
    --  int i;
    +-  char  *fields[4];
     -
     -  free(dup);
     -  dup = strdup(s);
    @@ lib/gshadow.c
     -
     -  stpsep(dup, "\n");
     -
    --  /*
    --   * There should be exactly 4 colon separated fields.  Find
    --   * all 4 of them and save the starting addresses in fields[].
    --   */
    --
    --  for (cp = dup, i = 0; (i < FIELDS) && (NULL != cp); i++)
    --          fields[i] = strsep(&cp, ":");
    --
    --  /*
    --   * If there was an extra field somehow, or perhaps not enough,
    --   * the line is invalid.
    --   */
    --
    --  if (NULL != cp || i != FIELDS)
    +-  if (STRSEP2ARR(dup, ":", fields) == -1)
     -          return NULL;
     -
     -  sgroup.sg_namp = fields[0];
    @@ lib/shadow/gshadow/sgetsgent.c (new)
     +// SPDX-FileCopyrightText: 1996-1998, Marek Michałkiewicz
     +// SPDX-FileCopyrightText: 2005, Tomasz Kłoczko
     +// SPDX-FileCopyrightText: 2008-2009, Nicolas François
    -+// SPDX-FileCopyrightText: 2024, Alejandro Colomar <[email protected]>
    ++// SPDX-FileCopyrightText: 2024-2025, Alejandro Colomar <[email protected]>
     +// SPDX-License-Identifier: BSD-3-Clause
     +
     +
    @@ lib/shadow/gshadow/sgetsgent.c (new)
     +#include <stddef.h>
     +#include <string.h>
     +
    -+#include "alloc/realloc.h"
    -+#include "alloc/x/xmalloc.h"
     +#include "shadow/gshadow/sgrp.h"
    -+#include "string/strchr/strchrcnt.h"
    ++#include "string/strcmp/streq.h"
     +#include "string/strtok/stpsep.h"
    ++#include "string/strtok/strsep2arr.h"
    ++#include "string/strtok/xastrsep2ls.h"
     +
     +
     +#define FIELDS    4
    @@ lib/shadow/gshadow/sgetsgent.c (new)
     +struct sgrp *
     +sgetsgent(const char *s)
     +{
    -+  static char    *dup = NULL;
    ++  static char  *dup = NULL;
     +
    -+  char  *fields[FIELDS];
    -+  char *cp;
    -+  int i;
    ++  char  *fields[4];
     +
     +  free(dup);
     +  dup = strdup(s);
    @@ lib/shadow/gshadow/sgetsgent.c (new)
     +
     +  stpsep(dup, "\n");
     +
    -+  /*
    -+   * There should be exactly 4 colon separated fields.  Find
    -+   * all 4 of them and save the starting addresses in fields[].
    -+   */
    -+
    -+  for (cp = dup, i = 0; (i < FIELDS) && (NULL != cp); i++)
    -+          fields[i] = strsep(&cp, ":");
    -+
    -+  /*
    -+   * If there was an extra field somehow, or perhaps not enough,
    -+   * the line is invalid.
    -+   */
    -+
    -+  if (NULL != cp || i != FIELDS)
    ++  if (STRSEP2ARR(dup, ":", fields) == -1)
     +          return NULL;
     +
     +  sgroup.sg_namp = fields[0];
    @@ lib/shadow/gshadow/sgetsgent.c (new)
     +build_list(char *s)
     +{
     +  char    **l;
    -+  size_t  i;
    ++  size_t  n;
     +
    -+  l = XMALLOC(strchrcnt(s, ',') + 2, char *);
    ++  l = xastrsep2ls(s, ",", &n);
     +
    -+  for (i = 0; s != NULL && !streq(s, ""); i++)
    -+          l[i] = strsep(&s, ",");
    -+
    -+  l[i] = NULL;
    ++  if (streq(l[n-1], ""))
    ++          l[n-1] = NULL;
     +
     +  return l;
     +}
 9:  783d1904 =  9:  73278ca3 lib/shadow/gshadow/, lib/, src/: getsgnam(): Move to separate file
10:  43c4081e ! 10:  0f2bee75 lib/shadow/gshadow/, lib/: getsgent(): Move to separate file
    @@ lib/gshadow.c (deleted)
     -#include <stdlib.h>
     -#include <string.h>
     -
    --#include "alloc/malloc.h"
    --#include "alloc/realloc.h"
    --#include "alloc/x/xmalloc.h"
     -#include "defines.h"
     -#include "prototypes.h"
     -#include "shadow/gshadow/fgetsgent.h"
     -#include "shadow/gshadow/gshadow.h"
     -#include "shadow/gshadow/setsgent.h"
     -#include "shadow/gshadow/sgrp.h"
    --#include "string/strchr/strchrcnt.h"
     -#include "string/strcmp/streq.h"
    --#include "string/strtok/stpsep.h"
     -
     -
     -/*
11:  981e83b3 = 11:  f1aa9a91 lib/: GSHADOW: Remove unused macro
12:  52de5866 ! 12:  bfdd9d78 lib/, po/: sgetgrent(): Move to under lib/shadow/group/
    @@ lib/sgetgrent.c => lib/shadow/group/sgetgrent.c
      
      #include <grp.h>
      #include <stdio.h>
    -@@
    - 
    - #define   NFIELDS 4
    - 
    -+
    - /*
    -  * list - turn a comma-separated string into an array of (char *)'s
    -  *
     @@ lib/shadow/group/sgetgrent.c: list(char *s)
      }
      
13:  da71a92f ! 13:  6f4d7e73 lib/, po/: sgetpwent(): Move to under lib/shadow/passwd/
    @@ lib/sgetpwent.c => lib/shadow/passwd/sgetpwent.c
      #include <pwd.h>
      #include <stdio.h>
     @@
    - 
    - #define   NFIELDS 7
    - 
    -+
    - /*
    -  * sgetpwent - convert a string to a (struct passwd)
    -  *
    -@@
       *        performance reasons.  I am going to come up with some conditional
       *        compilation glarp to improve on this in the future.
       */
14:  a634b541 = 14:  aa04acb2 lib/shadow/shadow/, lib/, po/: sgetspent(): Move to under lib/shadow/shadow/
v5b
  • Rebase
$ git rd 
 1:  235199e5 =  1:  1e2281d1 lib/shadow/gshadow/, lib/: putsgent(): Move to separate file
 2:  00bc6130 =  2:  3f174a86 lib/shadow/gshadow/, lib/: gshadow: Move to separate file and rename
 3:  d013f7fe =  3:  e9a6f6b2 lib/shadow/gshadow/, lib/, src/: endsgent(): Move to separate file
 4:  079893e0 =  4:  af08fd3f lib/shadow/gshadow/gshadow.h, lib/, src/: GSHADOW_FILE: Move definition and rename it
 5:  5cc54c56 =  5:  3730d350 lib/shadow/gshadow/, lib/: setsgent(): Move to separate file
 6:  d885ae8d =  6:  41d6231a lib/shadow/gshadow/, lib/, src/: struct sgrp: Move to separate file
 7:  c03c7b59 =  7:  e68f6341 lib/shadow/gshadow/, lib/: fgetsgent(): Move to separate file
 8:  438428c2 =  8:  ddf4868b lib/shadow/gshadow/, lib/: sgetsgent(): Move to separate file
 9:  73278ca3 =  9:  2b66e9f3 lib/shadow/gshadow/, lib/, src/: getsgnam(): Move to separate file
10:  0f2bee75 = 10:  211bae55 lib/shadow/gshadow/, lib/: getsgent(): Move to separate file
11:  f1aa9a91 = 11:  8a8dabbb lib/: GSHADOW: Remove unused macro
12:  bfdd9d78 = 12:  80213ca7 lib/, po/: sgetgrent(): Move to under lib/shadow/group/
13:  6f4d7e73 = 13:  68132d40 lib/, po/: sgetpwent(): Move to under lib/shadow/passwd/
14:  aa04acb2 = 14:  de785d52 lib/shadow/shadow/, lib/, po/: sgetspent(): Move to under lib/shadow/shadow/

@alejandro-colomar

This comment was marked as outdated.

…on and rename it

Rename it for consistency with the file name itself, and with the FILE*
variable that holds the handle to the open file.

Also, we don't need to wrap it in conditionals.  Just define it
unconditionally, and let it be unused if we don't need it.

Signed-off-by: Alejandro Colomar <[email protected]>
And with it, the file that defines it, which does nothing else.

Signed-off-by: Alejandro Colomar <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant