cntlm -H prompts for the password on stdout. This makes it unnecessarily difficult to use cntlm -H in a pipeline. E.g., the most natural way to update hashes in
the cntlm.conf file in vi is the command
:r !cntlm -H -uuser -ddomain
which reads the output of the cntlm -H into the file being edited.
As currently implemented, cntlm -H seems to hang, as it's Password: prompt to stdout
is directed into the pipeline and does not appear on the screen. After entering the
password, the resulting output interpolated into the file includes the Password: prompt;
this line must be deleted.
These problems are avoided by writing prompts to /dev/tty.
For example, the block starting at main.c:1200 could be changed to
if (interactivehash || magic_detect || (interactivepwd && !ntlmbasic)) { FILE *tty_file; if (!(tty_file = fopen ("/dev/tty", "rw")) tty_file = stdin; fprintf(tty_file, "Password: "); fflush(tty_file); tcgetattr(0, &termold); termnew = termold; termnew.c_lflag &= ~(ISIG | ECHO); tcsetattr(0, TCSADRAIN, &termnew); tmp = fgets(cpassword, MINIBUF_SIZE, stdin); tcsetattr(0, TCSADRAIN, &termold); i = strlen(cpassword) - 1; if (cpassword[i] == '\n') { cpassword[i] = 0; if (cpassword[i - 1] == '\r') cpassword[i - 1] = 0; } fprintf(tty_file, "\n"); if (stdin != tty_file) fclose (tty_file); }
(I may have reported this issue already, but without code.)