diff --git a/lib/gshadow.c b/lib/gshadow.c index 4c1ddf258..d1ca70706 100644 --- a/lib/gshadow.c +++ b/lib/gshadow.c @@ -106,7 +106,7 @@ sgetsgent(const char *string) if (NULL != cp || i != FIELDS) return NULL; - sgroup.sg_name = fields[0]; + sgroup.sg_namp = fields[0]; sgroup.sg_passwd = fields[1]; free(sgroup.sg_adm); @@ -192,7 +192,7 @@ sgetsgent(const char *string) setsgent (); while ((sgrp = getsgent ()) != NULL) { - if (streq(name, sgrp->sg_name)) { + if (streq(name, sgrp->sg_namp)) { break; } } @@ -218,7 +218,7 @@ int putsgent (const struct sgrp *sgrp, FILE * fp) } /* calculate the required buffer size */ - size = strlen (sgrp->sg_name) + strlen (sgrp->sg_passwd) + 10; + size = strlen (sgrp->sg_namp) + strlen (sgrp->sg_passwd) + 10; for (i = 0; (NULL != sgrp->sg_adm) && (NULL != sgrp->sg_adm[i]); i++) { size += strlen (sgrp->sg_adm[i]) + 1; } @@ -235,7 +235,7 @@ int putsgent (const struct sgrp *sgrp, FILE * fp) /* * Copy the group name and passwd. */ - cp = stpcpy(stpcpy(cp, sgrp->sg_name), ":"); + cp = stpcpy(stpcpy(cp, sgrp->sg_namp), ":"); cp = stpcpy(stpcpy(cp, sgrp->sg_passwd), ":"); /* diff --git a/lib/gshadow_.h b/lib/gshadow_.h index a52330828..be1f0f1c2 100644 --- a/lib/gshadow_.h +++ b/lib/gshadow_.h @@ -18,7 +18,7 @@ */ struct sgrp { - char *sg_name; /* group name */ + char *sg_namp; /* group name */ char *sg_passwd; /* group password */ char **sg_adm; /* group administrator list */ char **sg_mem; /* group membership list */ diff --git a/lib/sgroupio.c b/lib/sgroupio.c index acb140d87..980576124 100644 --- a/lib/sgroupio.c +++ b/lib/sgroupio.c @@ -36,9 +36,9 @@ /* Do the same as the other _dup function, even if we know the * structure. */ /*@-mustfreeonly@*/ - sg->sg_name = strdup (sgent->sg_name); + sg->sg_namp = strdup (sgent->sg_namp); /*@=mustfreeonly@*/ - if (NULL == sg->sg_name) { + if (NULL == sg->sg_namp) { free (sg); return NULL; } @@ -46,7 +46,7 @@ sg->sg_passwd = strdup (sgent->sg_passwd); /*@=mustfreeonly@*/ if (NULL == sg->sg_passwd) { - free (sg->sg_name); + free (sg->sg_namp); free (sg); return NULL; } @@ -57,7 +57,7 @@ /*@=mustfreeonly@*/ if (NULL == sg->sg_adm) { free (sg->sg_passwd); - free (sg->sg_name); + free (sg->sg_namp); free (sg); return NULL; } @@ -69,7 +69,7 @@ } free (sg->sg_adm); free (sg->sg_passwd); - free (sg->sg_name); + free (sg->sg_namp); free (sg); return NULL; } @@ -86,7 +86,7 @@ } free (sg->sg_adm); free (sg->sg_passwd); - free (sg->sg_name); + free (sg->sg_namp); free (sg); return NULL; } @@ -102,7 +102,7 @@ } free (sg->sg_adm); free (sg->sg_passwd); - free (sg->sg_name); + free (sg->sg_namp); free (sg); return NULL; } @@ -131,7 +131,7 @@ void sgr_free(/*@only@*/struct sgrp *sgent) { size_t i; - free (sgent->sg_name); + free (sgent->sg_namp); if (NULL != sgent->sg_passwd) free(strzero(sgent->sg_passwd)); @@ -150,7 +150,7 @@ static const char *gshadow_getname (const void *ent) { const struct sgrp *gr = ent; - return gr->sg_name; + return gr->sg_namp; } static void *gshadow_parse (const char *line) @@ -163,7 +163,7 @@ static int gshadow_put (const void *ent, FILE * file) const struct sgrp *sg = ent; if ( (NULL == sg) - || (valid_field (sg->sg_name, ":\n") == -1) + || (valid_field (sg->sg_namp, ":\n") == -1) || (valid_field (sg->sg_passwd, ":\n") == -1)) { return -1; } diff --git a/src/chgpasswd.c b/src/chgpasswd.c index 1625e8540..c5f302844 100644 --- a/src/chgpasswd.c +++ b/src/chgpasswd.c @@ -557,7 +557,7 @@ int main (int argc, char **argv) * group, but there are no entries in * gshadow, create one. */ - newsg.sg_name = name; + newsg.sg_namp = name; /* newsg.sg_passwd = NULL; will be set later */ newsg.sg_adm = ∅ newsg.sg_mem = dup_list (gr->gr_mem); @@ -595,7 +595,7 @@ int main (int argc, char **argv) if (sgr_update (&newsg) == 0) { fprintf (stderr, _("%s: line %jd: failed to prepare the new %s entry '%s'\n"), - Prog, line, sgr_dbname (), newsg.sg_name); + Prog, line, sgr_dbname (), newsg.sg_namp); errors = true; continue; } diff --git a/src/gpasswd.c b/src/gpasswd.c index 650e47929..13abbdab7 100644 --- a/src/gpasswd.c +++ b/src/gpasswd.c @@ -708,7 +708,7 @@ static void update_group (struct group *gr) if (is_shadowgrp && (sgr_update (sg) == 0)) { fprintf (stderr, _("%s: failed to prepare the new %s entry '%s'\n"), - Prog, sgr_dbname (), sg->sg_name); + Prog, sgr_dbname (), sg->sg_namp); exit (1); } #endif /* SHADOWGRP */ @@ -774,13 +774,13 @@ static void get_group (struct group *gr) tmpsg = sgr_locate (group); if (NULL != tmpsg) { *sg = *tmpsg; - sg->sg_name = xstrdup (tmpsg->sg_name); + sg->sg_namp = xstrdup (tmpsg->sg_namp); sg->sg_passwd = xstrdup (tmpsg->sg_passwd); sg->sg_mem = dup_list (tmpsg->sg_mem); sg->sg_adm = dup_list (tmpsg->sg_adm); } else { - sg->sg_name = xstrdup (group); + sg->sg_namp = xstrdup (group); sg->sg_passwd = gr->gr_passwd; gr->gr_passwd = SHADOW_PASSWD_STRING; /* XXX warning: const */ diff --git a/src/groupadd.c b/src/groupadd.c index 9f0eb2e50..ab30960e3 100644 --- a/src/groupadd.c +++ b/src/groupadd.c @@ -149,7 +149,7 @@ static void new_grent (struct group *grent) static void new_sgent (struct sgrp *sgent) { memzero (sgent, sizeof *sgent); - sgent->sg_name = group_name; + sgent->sg_namp = group_name; if (pflg) { sgent->sg_passwd = group_passwd; } else { @@ -231,7 +231,7 @@ grp_update(void) if (is_shadow_grp && (sgr_update (&sgrp) == 0)) { fprintf (stderr, _("%s: failed to prepare the new %s entry '%s'\n"), - Prog, sgr_dbname (), sgrp.sg_name); + Prog, sgr_dbname (), sgrp.sg_namp); exit (E_GRP_UPDATE); } #endif /* SHADOWGRP */ diff --git a/src/groupmems.c b/src/groupmems.c index 53729b767..d37b237f2 100644 --- a/src/groupmems.c +++ b/src/groupmems.c @@ -128,7 +128,7 @@ static void add_user (const char *user, if (NULL == sg) { /* Create a shadow group based on this group */ static struct sgrp sgrent; - sgrent.sg_name = xstrdup (newgrp->gr_name); + sgrent.sg_namp = xstrdup (newgrp->gr_name); sgrent.sg_mem = dup_list (newgrp->gr_mem); sgrent.sg_adm = XMALLOC(1, char *); sgrent.sg_adm[0] = NULL; @@ -154,7 +154,7 @@ static void add_user (const char *user, if (sgr_update (newsg) == 0) { fprintf (stderr, _("%s: failed to prepare the new %s entry '%s'\n"), - Prog, sgr_dbname (), newsg->sg_name); + Prog, sgr_dbname (), newsg->sg_namp); fail_exit (13); } } @@ -203,7 +203,7 @@ static void remove_user (const char *user, if (NULL == sg) { /* Create a shadow group based on this group */ static struct sgrp sgrent; - sgrent.sg_name = xstrdup (newgrp->gr_name); + sgrent.sg_namp = xstrdup (newgrp->gr_name); sgrent.sg_mem = dup_list (newgrp->gr_mem); sgrent.sg_adm = XMALLOC(1, char *); sgrent.sg_adm[0] = NULL; @@ -230,7 +230,7 @@ static void remove_user (const char *user, if (sgr_update (newsg) == 0) { fprintf (stderr, _("%s: failed to prepare the new %s entry '%s'\n"), - Prog, sgr_dbname (), newsg->sg_name); + Prog, sgr_dbname (), newsg->sg_namp); fail_exit (13); } } @@ -269,7 +269,7 @@ static void purge_members (const struct group *grp) if (NULL == sg) { /* Create a shadow group based on this group */ static struct sgrp sgrent; - sgrent.sg_name = xstrdup (newgrp->gr_name); + sgrent.sg_namp = xstrdup (newgrp->gr_name); sgrent.sg_mem = XMALLOC(1, char *); sgrent.sg_mem[0] = NULL; sgrent.sg_adm = XMALLOC(1, char *); @@ -299,7 +299,7 @@ static void purge_members (const struct group *grp) if (sgr_update (newsg) == 0) { fprintf (stderr, _("%s: failed to prepare the new %s entry '%s'\n"), - Prog, sgr_dbname (), newsg->sg_name); + Prog, sgr_dbname (), newsg->sg_namp); fail_exit (13); } } diff --git a/src/groupmod.c b/src/groupmod.c index 7342707d0..5164c4c3f 100644 --- a/src/groupmod.c +++ b/src/groupmod.c @@ -178,7 +178,7 @@ static void new_grent (struct group *grent) static void new_sgent (struct sgrp *sgent) { if (nflg) { - sgent->sg_name = xstrdup (group_newname); + sgent->sg_namp = xstrdup (group_newname); } /* Always update the shadowed password if there is a shadow entry @@ -238,7 +238,7 @@ grp_update(void) * gshadow entry when a new password is requested. */ bzero(&sgrp, sizeof sgrp); - sgrp.sg_name = xstrdup (grp.gr_name); + sgrp.sg_namp = xstrdup (grp.gr_name); sgrp.sg_passwd = xstrdup (grp.gr_passwd); sgrp.sg_adm = ∅ sgrp.sg_mem = dup_list (grp.gr_mem); @@ -318,7 +318,7 @@ grp_update(void) if (sgr_update (&sgrp) == 0) { fprintf (stderr, _("%s: failed to prepare the new %s entry '%s'\n"), - Prog, sgr_dbname (), sgrp.sg_name); + Prog, sgr_dbname (), sgrp.sg_namp); exit (E_GRP_UPDATE); } if (nflg && (sgr_remove (group_name) == 0)) { diff --git a/src/grpck.c b/src/grpck.c index e959f0adb..d3f2baee6 100644 --- a/src/grpck.c +++ b/src/grpck.c @@ -613,7 +613,7 @@ static void check_grp_file (bool *errors, bool *changed) struct group gr; static char *empty = NULL; - sg.sg_name = grp->gr_name; + sg.sg_namp = grp->gr_name; sg.sg_passwd = grp->gr_passwd; sg.sg_adm = ∅ sg.sg_mem = grp->gr_mem; @@ -625,7 +625,7 @@ static void check_grp_file (bool *errors, bool *changed) if (sgr_update (&sg) == 0) { fprintf (stderr, _("%s: failed to prepare the new %s entry '%s'\n"), - Prog, sgr_dbname (), sg.sg_name); + Prog, sgr_dbname (), sg.sg_namp); fail_exit (E_CANT_UPDATE); } /* remove password from /etc/group */ @@ -740,7 +740,7 @@ static void check_sgr_file (bool *errors, bool *changed) continue; } - if (!streq(sgr->sg_name, ent->sg_name)) { + if (!streq(sgr->sg_namp, ent->sg_namp)) { continue; } @@ -763,7 +763,7 @@ static void check_sgr_file (bool *errors, bool *changed) /* * Make sure this entry exists in the /etc/group file. */ - grp = gr_locate (sgr->sg_name); + grp = gr_locate (sgr->sg_namp); if (grp == NULL) { printf (_("no matching group file entry in %s\n"), grp_file); @@ -777,7 +777,7 @@ static void check_sgr_file (bool *errors, bool *changed) * Verify that the all members defined in /etc/gshadow are also * present in /etc/group. */ - compare_members_lists (sgr->sg_name, + compare_members_lists (sgr->sg_namp, sgr->sg_mem, grp->gr_mem, sgr_file, grp_file); } @@ -785,7 +785,7 @@ static void check_sgr_file (bool *errors, bool *changed) /* * Make sure each administrator exists */ - if (check_members (sgr->sg_name, sgr->sg_adm, + if (check_members (sgr->sg_namp, sgr->sg_adm, _("shadow group %s: no administrative user %s\n"), _("delete administrative member '%s'? "), "delete admin '%s' from shadow group '%s'", @@ -798,7 +798,7 @@ static void check_sgr_file (bool *errors, bool *changed) /* * Make sure each member exists */ - if (check_members (sgr->sg_name, sgr->sg_mem, + if (check_members (sgr->sg_namp, sgr->sg_mem, _("shadow group %s: no user %s\n"), _("delete member '%s'? "), "delete member '%s' from shadow group '%s'", diff --git a/src/grpconv.c b/src/grpconv.c index 16cd52c9a..1b31cb85a 100644 --- a/src/grpconv.c +++ b/src/grpconv.c @@ -172,17 +172,17 @@ int main (int argc, char **argv) */ (void) sgr_rewind (); while ((sg = sgr_next ()) != NULL) { - if (gr_locate (sg->sg_name) != NULL) { + if (gr_locate (sg->sg_namp) != NULL) { continue; } - if (sgr_remove (sg->sg_name) == 0) { + if (sgr_remove (sg->sg_namp) == 0) { /* * This shouldn't happen (the entry exists) but... */ fprintf (stderr, _("%s: cannot remove entry '%s' from %s\n"), - Prog, sg->sg_name, sgr_dbname ()); + Prog, sg->sg_namp, sgr_dbname ()); fail_exit (3); } (void) sgr_rewind (); @@ -205,7 +205,7 @@ int main (int argc, char **argv) /* add new shadow group entry */ bzero(&sgent, sizeof sgent); - sgent.sg_name = gr->gr_name; + sgent.sg_namp = gr->gr_name; sgent.sg_passwd = gr->gr_passwd; sgent.sg_adm = ∅ } @@ -220,7 +220,7 @@ int main (int argc, char **argv) if (sgr_update (&sgent) == 0) { fprintf (stderr, _("%s: failed to prepare the new %s entry '%s'\n"), - Prog, sgr_dbname (), sgent.sg_name); + Prog, sgr_dbname (), sgent.sg_namp); fail_exit (3); } /* remove password from /etc/group */ diff --git a/src/newusers.c b/src/newusers.c index 5fde8bbe3..e3685efe9 100644 --- a/src/newusers.c +++ b/src/newusers.c @@ -323,7 +323,7 @@ static int add_group (const char *name, const char *gid, gid_t *ngid, uid_t uid) if (is_shadow_grp) { struct sgrp sgrent; char *admins[1]; - sgrent.sg_name = grent.gr_name; + sgrent.sg_namp = grent.gr_name; sgrent.sg_passwd = "*"; /* XXX warning: const */ grent.gr_passwd = "x"; /* XXX warning: const */ admins[0] = NULL; diff --git a/src/useradd.c b/src/useradd.c index 498619e31..70a48cb8d 100644 --- a/src/useradd.c +++ b/src/useradd.c @@ -1098,11 +1098,11 @@ static void grp_update (void) * user_groups. All these groups should be checked * for existence with gr_locate already. */ - if (gr_locate (sgrp->sg_name) == NULL) { + if (gr_locate (sgrp->sg_namp) == NULL) { continue; } - if (!is_on_list (user_groups, sgrp->sg_name)) { + if (!is_on_list (user_groups, sgrp->sg_namp)) { continue; } @@ -1133,7 +1133,7 @@ static void grp_update (void) if (sgr_update (nsgrp) == 0) { fprintf (stderr, _("%s: failed to prepare the new %s entry '%s'\n"), - Prog, sgr_dbname (), nsgrp->sg_name); + Prog, sgr_dbname (), nsgrp->sg_namp); SYSLOG ((LOG_ERR, "failed to prepare the new %s entry '%s'", sgr_dbname (), user_name)); #ifdef WITH_AUDIT audit_logger (AUDIT_ADD_USER, Prog, @@ -1151,7 +1151,7 @@ static void grp_update (void) #endif SYSLOG ((LOG_INFO, "add '%s' to shadow group '%s'", - user_name, nsgrp->sg_name)); + user_name, nsgrp->sg_namp)); } #endif /* SHADOWGRP */ } @@ -1913,7 +1913,7 @@ static void new_grent (struct group *grent) static void new_sgent (struct sgrp *sgent) { memzero (sgent, sizeof *sgent); - sgent->sg_name = (char *) user_name; + sgent->sg_namp = (char *) user_name; sgent->sg_passwd = "!"; /* XXX warning: const */ sgent->sg_adm = &empty_list; sgent->sg_mem = &empty_list; @@ -1965,7 +1965,7 @@ static void grp_add (void) if (is_shadow_grp && (sgr_update (&sgrp) == 0)) { fprintf (stderr, _("%s: failed to prepare the new %s entry '%s'\n"), - Prog, sgr_dbname (), sgrp.sg_name); + Prog, sgr_dbname (), sgrp.sg_namp); #ifdef WITH_AUDIT audit_logger (AUDIT_ADD_GROUP, Prog, "adding group", diff --git a/src/userdel.c b/src/userdel.c index 1703f0e05..a267ae1d0 100644 --- a/src/userdel.c +++ b/src/userdel.c @@ -264,7 +264,7 @@ static void update_groups (void) if (sgr_update (nsgrp) == 0) { fprintf (stderr, _("%s: failed to prepare the new %s entry '%s'\n"), - Prog, sgr_dbname (), nsgrp->sg_name); + Prog, sgr_dbname (), nsgrp->sg_namp); exit (E_GRP_UPDATE); } #ifdef WITH_AUDIT @@ -273,7 +273,7 @@ static void update_groups (void) user_name, user_id, SHADOW_AUDIT_SUCCESS); #endif /* WITH_AUDIT */ SYSLOG ((LOG_INFO, "delete '%s' from shadow group '%s'\n", - user_name, nsgrp->sg_name)); + user_name, nsgrp->sg_namp)); } #endif /* SHADOWGRP */ } diff --git a/src/usermod.c b/src/usermod.c index 80ab4989e..7ea1a7244 100644 --- a/src/usermod.c +++ b/src/usermod.c @@ -850,7 +850,7 @@ update_gshadow(const struct sgrp *sgrp) * concurrent groups. */ is_member = Gflg && ( (was_member && aflg) - || is_on_list (user_groups, sgrp->sg_name)); + || is_on_list (user_groups, sgrp->sg_namp)); if (!was_member && !was_admin && !is_member) return; @@ -885,7 +885,7 @@ update_gshadow(const struct sgrp *sgrp) #endif SYSLOG ((LOG_INFO, "change admin '%s' to '%s' in shadow group '%s'", - user_name, user_newname, nsgrp->sg_name)); + user_name, user_newname, nsgrp->sg_namp)); } if (was_member) { @@ -908,7 +908,7 @@ update_gshadow(const struct sgrp *sgrp) SYSLOG ((LOG_INFO, "change '%s' to '%s' in shadow group '%s'", user_name, user_newname, - nsgrp->sg_name)); + nsgrp->sg_namp)); } } else { /* User was a member but is no more a @@ -923,7 +923,7 @@ update_gshadow(const struct sgrp *sgrp) #endif SYSLOG ((LOG_INFO, "delete '%s' from shadow group '%s'", - user_name, nsgrp->sg_name)); + user_name, nsgrp->sg_namp)); } } else if (is_member) { /* User was not a member but is now a member this @@ -937,7 +937,7 @@ update_gshadow(const struct sgrp *sgrp) user_newname, AUDIT_NO_ID, 1); #endif SYSLOG ((LOG_INFO, "add '%s' to shadow group '%s'", - user_newname, nsgrp->sg_name)); + user_newname, nsgrp->sg_namp)); } if (!changed) goto free_nsgrp; @@ -948,9 +948,9 @@ update_gshadow(const struct sgrp *sgrp) if (sgr_update (nsgrp) == 0) { fprintf (stderr, _("%s: failed to prepare the new %s entry '%s'\n"), - Prog, sgr_dbname (), nsgrp->sg_name); + Prog, sgr_dbname (), nsgrp->sg_namp); SYSLOG ((LOG_WARN, "failed to prepare the new %s entry '%s'", - sgr_dbname (), nsgrp->sg_name)); + sgr_dbname (), nsgrp->sg_namp)); fail_exit (E_GRP_UPDATE); }