ipmitool crashing, getpass()

Daniel Braniss danny at cs.huji.ac.il
Sat Nov 12 10:03:59 UTC 2016


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(…) and coredumps trying to strdup the password. My guess it’s not
calling libc’s 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 @@
 
 static struct ipmi_intf * ipmi_main_intf = NULL;
 
+#include <pwd.h>
+#include <readpassphrase.h>
+
+
+static char *
+getpass(const char *prompt)
+{
+     static char buf[ _PASSWORD_LEN + 1];
+     
+     if (readpassphrase(prompt, buf, sizeof(buf), RPP_ECHO_OFF)== NULL)
+	  buf[0] = '\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



More information about the freebsd-hackers mailing list