Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 12 Nov 2016 12:03:43 +0200
From:      Daniel Braniss <danny@cs.huji.ac.il>
To:        Freebsd hackers list <freebsd-hackers@FreeBSD.org>
Subject:   ipmitool crashing, getpass()
Message-ID:  <65C0C11B-123E-4536-B7C1-2EBC0DDA37FE@cs.huji.ac.il>

next in thread | raw e-mail | index | archive | help
Hi,
I have no idea when this started to happen, but with a relative new =
11.3-stable, ipmitool core dumps.
ipmi_main() calls getpass(=E2=80=A6) and coredumps trying to strdup the =
password. My guess it=E2=80=99s not
calling libc=E2=80=99s getpass(), because adding this patch t works:

--- lib/ipmi_main.c~	2016-05-06 17:48:54.000000000 +0300
+++ lib/ipmi_main.c	2016-11-12 11:55:39.396032000 +0200
@@ -97,6 +97,20 @@
=20
 static struct ipmi_intf * ipmi_main_intf =3D NULL;
=20
+#include <pwd.h>
+#include <readpassphrase.h>
+
+
+static char *
+getpass(const char *prompt)
+{
+     static char buf[ _PASSWORD_LEN + 1];
+    =20
+     if (readpassphrase(prompt, buf, sizeof(buf), RPP_ECHO_OFF)=3D=3D =
NULL)
+	  buf[0] =3D '\0';
+     return(buf);
+}
+
 /* ipmi_password_file_read  -  Open file and read password from it
  *
  * @filename:	file name to read from

the code was cut-n-pasted from libc.

cheers,
	danny




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?65C0C11B-123E-4536-B7C1-2EBC0DDA37FE>