Dave Dykstra
2001-Jun-21  16:51 UTC
pw_expire/pw_change in current portable openssh CVS bombs
The references to pw_expire and pw_change in pwcopy() in misc.c cause
compilation errors at least on solaris.  How about doing a memcpy of the
whole structure and only explicitly setting those that need xstrdup?
That would work on openbsd and everywhere else.
- Dave Dykstra
--- misc.c.O	Thu Jun 21 11:35:28 2001
+++ misc.c	Thu Jun 21 11:36:09 2001
@@ -125,14 +125,10 @@
 {
 	struct passwd *copy = xmalloc(sizeof(*copy));
 
-	memset(copy, 0, sizeof(*copy));
+	memcpy(copy, pw, sizeof(*copy));
 	copy->pw_name = xstrdup(pw->pw_name);
 	copy->pw_passwd = xstrdup(pw->pw_passwd);
 	copy->pw_gecos = xstrdup(pw->pw_gecos);
-	copy->pw_uid = pw->pw_uid;
-	copy->pw_gid = pw->pw_gid;
-	copy->pw_expire = pw->pw_expire;
-	copy->pw_change = pw->pw_change;
 #ifdef HAVE_PW_CLASS_IN_PASSWD
 	copy->pw_class = xstrdup(pw->pw_class);
 #endif
Kevin Steves
2001-Jun-21  20:19 UTC
pw_expire/pw_change in current portable openssh CVS bombs
On Thu, 21 Jun 2001, Dave Dykstra wrote: :The references to pw_expire and pw_change in pwcopy() in misc.c cause :compilation errors at least on solaris. How about doing a memcpy of the :whole structure and only explicitly setting those that need xstrdup? :That would work on openbsd and everywhere else. that will work until they are referenced, at which point we'll still need to have configure define HAVE_FOO and use that around the reference.
Reasonably Related Threads
- PATCH: pidfile/sigterm race
- [PATCH]: auth.c (pwcopy): Copy pw_gecos field when build for Cygwin
- [PATCH] Fix login.conf, expiration, BSD compatibility in OpenSSH
- [Bug 298] New: sshd fails to set user context, preventing all logins, also setgroups is failing
- OpenSSH changes for BSD/OS