[Pkg-shadow-commits] r359 - trunk/debian/patches
Nicolas FRANCOIS
pkg-shadow-devel@lists.alioth.debian.org
Fri, 08 Jul 2005 06:55:05 +0000
Author: nekral-guest
Date: 2005-07-08 06:55:03 +0000 (Fri, 08 Jul 2005)
New Revision: 359
Modified:
trunk/debian/patches/426_grpck_group-gshadow_members_consistency
Log:
Fix the segmentation fault reported by Daniel C. Chao (#317366).
And fix the same issue in pwck.
Modified: trunk/debian/patches/426_grpck_group-gshadow_members_consistency
===================================================================
--- trunk/debian/patches/426_grpck_group-gshadow_members_consistency 2005-07-08 05:58:29 UTC (rev 358)
+++ trunk/debian/patches/426_grpck_group-gshadow_members_consistency 2005-07-08 06:55:03 UTC (rev 359)
@@ -9,8 +9,8 @@
Index: shadow-4.0.3/src/grpck.c
===================================================================
---- shadow-4.0.3.orig/src/grpck.c 2005-06-24 00:02:49.000000000 +0200
-+++ shadow-4.0.3/src/grpck.c 2005-06-26 22:05:06.668559000 +0200
+--- shadow-4.0.3.orig/src/grpck.c 2005-07-08 03:22:42.000000000 +0200
++++ shadow-4.0.3/src/grpck.c 2005-07-08 03:22:45.000000000 +0200
@@ -144,7 +144,7 @@
{
int arg;
@@ -29,7 +29,7 @@
__gr_del_entry (gre);
continue;
-@@ -432,11 +432,76 @@
+@@ -432,11 +432,78 @@
SYSLOG ((LOG_INFO, "delete member `%s' group `%s'",
grp->gr_mem[i], grp->gr_name));
@@ -56,6 +56,7 @@
+ if (yes_or_no ())
+ {
+ struct sgrp sg;
++ struct group gr;
+ static char *empty = NULL;
+ sg.sg_name = grp->gr_name;
+ sg.sg_passwd = grp->gr_passwd;
@@ -73,11 +74,12 @@
+ exit (E_CANT_UPDATE);
+ }
+ /* remove password from /etc/group */
-+ grp->gr_passwd = SHADOW_PASSWD_STRING; /* XXX warning: const */
-+ if (!gr_update (grp)) {
++ gr = *grp;
++ gr.gr_passwd = SHADOW_PASSWD_STRING; /* XXX warning: const */
++ if (!gr_update (&gr)) {
+ fprintf (stderr,
+ _("%s: can't update entry for group %s\n"),
-+ Prog, grp->gr_name);
++ Prog, gr.gr_name);
+ exit (E_CANT_UPDATE);
+ }
+ }
@@ -107,7 +109,7 @@
}
#ifdef SHADOWGRP
-@@ -483,7 +548,7 @@
+@@ -483,7 +550,7 @@
delete_sg:
SYSLOG ((LOG_INFO, "delete shadow line `%s'",
sge->line));
@@ -116,7 +118,7 @@
__sgr_del_entry (sge);
continue;
-@@ -541,12 +606,32 @@
+@@ -541,12 +608,32 @@
* Make sure this entry exists in the /etc/group file.
*/
@@ -151,7 +153,7 @@
}
/*
-@@ -574,7 +659,7 @@
+@@ -574,7 +661,7 @@
SYSLOG ((LOG_INFO,
"delete admin `%s' from shadow group `%s'",
sgr->sg_adm[i], sgr->sg_name));
@@ -160,7 +162,7 @@
delete_member (sgr->sg_adm, sgr->sg_adm[i]);
sge->changed = 1;
__sgr_set_changed ();
-@@ -603,7 +688,7 @@
+@@ -603,7 +690,7 @@
SYSLOG ((LOG_INFO,
"delete member `%s' from shadow group `%s'",
sgr->sg_mem[i], sgr->sg_name));
@@ -169,7 +171,7 @@
delete_member (sgr->sg_mem, sgr->sg_mem[i]);
sge->changed = 1;
__sgr_set_changed ();
-@@ -614,11 +699,11 @@
+@@ -614,11 +701,11 @@
#endif /* SHADOWGRP */
/*
@@ -183,7 +185,7 @@
write_and_bye:
if (!gr_close ()) {
fprintf (stderr, _("%s: cannot update file %s\n"),
-@@ -650,12 +735,12 @@
+@@ -650,12 +737,12 @@
if (errors)
#ifdef NDBM
@@ -201,7 +203,7 @@
Index: shadow-4.0.3/src/pwck.c
===================================================================
--- shadow-4.0.3.orig/src/pwck.c 2002-01-10 14:01:28.000000000 +0100
-+++ shadow-4.0.3/src/pwck.c 2005-06-26 21:51:43.068559000 +0200
++++ shadow-4.0.3/src/pwck.c 2005-07-08 08:48:15.000000000 +0200
@@ -45,6 +45,7 @@
#ifdef SHADOWPWD
@@ -210,7 +212,25 @@
extern void __spw_del_entry (const struct commonio_entry *);
extern struct commonio_entry *__spw_get_head (void);
#endif
-@@ -421,6 +422,51 @@
+@@ -127,7 +128,7 @@
+ {
+ int arg;
+ int errors = 0;
+- int deleted = 0;
++ int changed = 0;
+ struct commonio_entry *pfe, *tpfe;
+ struct passwd *pwd;
+ int sort_mode = 0;
+@@ -313,7 +314,7 @@
+ delete_pw:
+ SYSLOG ((LOG_INFO, "delete passwd line `%s'",
+ pfe->line));
+- deleted++;
++ changed++;
+
+ __pw_del_entry (pfe);
+ continue;
+@@ -421,6 +422,55 @@
pwd->pw_name, pwd->pw_shell);
errors++;
}
@@ -231,6 +251,7 @@
+ if (yes_or_no())
+ {
+ struct spwd sp;
++ struct passwd pw;
+ sp.sp_namp = pwd->pw_name;
+ sp.sp_pwdp = pwd->pw_passwd;
+ sp.sp_min = getdef_num ("PASS_MIN_DAYS", -1);
@@ -240,6 +261,8 @@
+ sp.sp_expire = -1;
+ sp.sp_flag = -1;
+ sp.sp_lstchg = time ((time_t *) 0) / (24L * 3600L);
++ changed++;
++
+ if (!spw_update (&sp))
+ {
+ fprintf (stderr,
@@ -248,11 +271,12 @@
+ exit (E_CANTUPDATE);
+ }
+ /* remove password from /etc/passwd */
-+ pwd->pw_passwd = SHADOW_PASSWD_STRING;/* XXX warning: const */
-+ if (!pw_update (pwd)) {
++ pw = *pwd;
++ pw.pw_passwd = SHADOW_PASSWD_STRING;/* XXX warning: const */
++ if (!pw_update (&pw)) {
+ fprintf (stderr,
+ _("%s: can't update passwd entry for %s\n"),
-+ Prog, pwd->pw_name);
++ Prog, pw.pw_name);
+ exit (E_CANTUPDATE);
+ }
+ }
@@ -262,7 +286,30 @@
}
#ifdef SHADOWPWD
-@@ -539,7 +585,8 @@
+@@ -433,6 +483,13 @@
+
+ for (spe = __spw_get_head (); spe; spe = spe->next) {
+ /*
++ * Do not treat lines which were missing in gshadow
++ * and were added earlier.
++ */
++ if (spe->line == NULL)
++ continue;
++
++ /*
+ * If this is a NIS line, skip it. You can't "know" what NIS
+ * is going to do without directly asking NIS ...
+ */
+@@ -474,7 +531,7 @@
+ delete_spw:
+ SYSLOG ((LOG_INFO, "delete shadow line `%s'",
+ spe->line));
+- deleted++;
++ changed++;
+
+ __spw_del_entry (spe);
+ continue;
+@@ -539,7 +596,8 @@
* /etc/passwd entry and ask them to delete it.
*/
@@ -272,3 +319,32 @@
printf (_("delete line `%s'? "), spe->line);
errors++;
+@@ -567,11 +625,11 @@
+ #endif
+
+ /*
+- * All done. If there were no deletions we can just abandon any
++ * All done. If there were no change we can just abandon any
+ * changes to the files.
+ */
+
+- if (deleted) {
++ if (changed) {
+ write_and_bye:
+ if (!pw_close ()) {
+ fprintf (stderr, _("%s: cannot update file %s\n"),
+@@ -607,12 +665,12 @@
+
+ if (errors)
+ #ifdef NDBM
+- printf (deleted ?
++ printf (changed ?
+ _
+ ("%s: the files have been updated; run mkpasswd\n")
+ : _("%s: no changes\n"), Prog);
+ #else
+- printf (deleted ?
++ printf (changed ?
+ _("%s: the files have been updated\n") :
+ _("%s: no changes\n"), Prog);
+ #endif