pw_expire/pw_change in current portable openssh CVS bombs

Dave Dykstra dwd at bell-labs.com
Fri Jun 22 02:51:12 EST 2001


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



More information about the openssh-unix-dev mailing list