[openssh-commits] [openssh] 12/20: upstream commit

git+noreply at mindrot.org git+noreply at mindrot.org
Wed May 31 14:57:09 AEST 2017


This is an automated email from the git hooks/post-receive script.

djm pushed a commit to branch master
in repository openssh.

commit 60306b2d2f029f91927c6aa7c8e08068519a0fa2
Author: markus at openbsd.org <markus at openbsd.org>
Date:   Tue May 30 14:26:49 2017 +0000

    upstream commit
    
    switch auth2-passwd.c to modern APIs; ok djm@
    
    Upstream-ID: cba0a8b72b4f97adfb7e3b3fd2f8ba3159981fc7
---
 auth2-passwd.c | 31 ++++++++++++++-----------------
 1 file changed, 14 insertions(+), 17 deletions(-)

diff --git a/auth2-passwd.c b/auth2-passwd.c
index b638e871..d36b0cba 100644
--- a/auth2-passwd.c
+++ b/auth2-passwd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: auth2-passwd.c,v 1.12 2014/07/15 15:54:14 millert Exp $ */
+/* $OpenBSD: auth2-passwd.c,v 1.13 2017/05/30 14:26:49 markus Exp $ */
 /*
  * Copyright (c) 2000 Markus Friedl.  All rights reserved.
  *
@@ -30,10 +30,10 @@
 #include <string.h>
 #include <stdarg.h>
 
-#include "xmalloc.h"
 #include "packet.h"
+#include "ssherr.h"
 #include "log.h"
-#include "key.h"
+#include "sshkey.h"
 #include "hostfile.h"
 #include "auth.h"
 #include "buffer.h"
@@ -50,24 +50,21 @@ extern ServerOptions options;
 static int
 userauth_passwd(Authctxt *authctxt)
 {
-	char *password, *newpass;
-	int authenticated = 0;
-	int change;
-	u_int len, newlen;
+	struct ssh *ssh = active_state; /* XXX */
+	char *password;
+	int authenticated = 0, r;
+	u_char change;
+	size_t len;
 
-	change = packet_get_char();
-	password = packet_get_string(&len);
-	if (change) {
-		/* discard new password from packet */
-		newpass = packet_get_string(&newlen);
-		explicit_bzero(newpass, newlen);
-		free(newpass);
-	}
-	packet_check_eom();
+	if ((r = sshpkt_get_u8(ssh, &change)) != 0 ||
+	    (r = sshpkt_get_cstring(ssh, &password, &len)) != 0 ||
+	    (change && (r = sshpkt_get_cstring(ssh, NULL, NULL)) != 0) ||
+	    (r = sshpkt_get_end(ssh)) != 0)
+		fatal("%s: %s", __func__, ssh_err(r));
 
 	if (change)
 		logit("password change not supported");
-	else if (PRIVSEP(auth_password(authctxt, password)) == 1)
+	else if (PRIVSEP(auth_password(ssh->authctxt, password)) == 1)
 		authenticated = 1;
 	explicit_bzero(password, len);
 	free(password);

-- 
To stop receiving notification emails like this one, please contact
djm at mindrot.org.


More information about the openssh-commits mailing list