vishalmishra434 / rpms / openssh

Forked from rpms/openssh 3 months ago
Clone
Jakub Jelen 134139
diff -up openssh-7.4p1/session.c.update-pw openssh-7.4p1/session.c
Jakub Jelen 134139
--- openssh-7.4p1/session.c.update-pw	2019-03-04 14:10:57.287054645 +0100
Jakub Jelen 134139
+++ openssh-7.4p1/session.c	2019-03-04 14:12:39.259997218 +0100
Jakub Jelen 134139
@@ -1522,9 +1522,18 @@ do_child(Session *s, const char *command
Jakub Jelen 134139
 	char **env;
Jakub Jelen 134139
 	char *argv[ARGV_MAX];
Jakub Jelen 134139
 	const char *shell, *shell0;
Jakub Jelen 134139
-	struct passwd *pw = s->pw;
Jakub Jelen 134139
+	struct passwd *pw = NULL;
Jakub Jelen 134139
 	int r = 0;
Jakub Jelen 134139
 
Jakub Jelen 134139
+	/* Update the users passwd structure after successful login */
Jakub Jelen 134139
+	pw = getpwuid(s->pw->pw_uid);
Jakub Jelen 134139
+	if (pw != NULL) {
Jakub Jelen 134139
+		free(s->pw);
Jakub Jelen 134139
+		s->pw = pw;
Jakub Jelen 134139
+	} else {
Jakub Jelen 134139
+		pw = s->pw;
Jakub Jelen 134139
+	}
Jakub Jelen 134139
+
Jakub Jelen 134139
 	/* remove hostkey from the child's memory */
Jakub Jelen 134139
 	destroy_sensitive_data();
Jakub Jelen 134139
 	packet_clear_keys();