Debian Bug report logs - #45964
adding password box support to dialog

version graph

Package: dialog; Maintainer for dialog is Santiago Vila <sanvila@debian.org>; Source for dialog is src:dialog.

Reported by: Joey Hess <joey@kitenet.net>

Date: Sat, 25 Sep 1999 08:03:01 UTC

Severity: normal

Found in version 0.9a-16

Done: Santiago Vila <sanvila@unex.es>

Bug is archived. No further changes may be made.

Toggle useless messages

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to debian-bugs-dist@lists.debian.org, Santiago Vila <sanvila@ctv.es>:
Bug#45964; Package dialog. Full text and rfc822 format available.

Acknowledgement sent to Joey Hess <joey@kitenet.net>:
New Bug report received and forwarded. Copy sent to Santiago Vila <sanvila@ctv.es>. Full text and rfc822 format available.

Message #5 received at submit@bugs.debian.org (full text, mbox):

From: Joey Hess <joey@kitenet.net>
To: submit@bugs.debian.org
Subject: adding password box support to dialog
Date: Sat, 25 Sep 1999 00:58:41 -0700
Package: dialog
Version: 0.9a-16

It would be very useful for me with the stuff I'm doing with debconf if
it were possible for dialog to prompt for a password, and not echo what the
user typed. So here's a patch to do that. I've also implemented the same
option in whiptail, and sent in a patch there, so the two programs remain
consitent.

Only in dialog-0.9a: checklist.o
Common subdirectories: old/dialog-0.9a/debian and dialog-0.9a/debian
Only in dialog-0.9a: dialog
diff -u old/dialog-0.9a/dialog.1 dialog-0.9a/dialog.1
--- old/dialog-0.9a/dialog.1	Mon Jan 15 14:53:00 1996
+++ dialog-0.9a/dialog.1	Sat Sep 25 00:56:12 1999
@@ -30,7 +30,8 @@
 .LP
 .BR yes/no " box," " menu" " box," " input" " box,"
 .BR message " box," " text" " box," " info" " box,"
-.BR checklist " box," " radiolist" " box, and" " guage" " box."
+.BR checklist " box," " radiolist" " box" " gauge" " box, and"
+.BR password " box."
 .SH OPTIONS
 .TP
 .B \-\-clear
@@ -121,6 +122,14 @@
 can be fitted in the dialog box, the input field will be scrolled. On exit,
 the input string will be printed on
 .IR stderr "."
+.TP
+.BI \-\-passwordbox " text height width [init]"
+.RB "A " password " box is similar to an input box, except the text the user"
+enters is not displayed. This is useful when prompting for passwords or other
+sensative information. Be aware that if anything is passed in "init", it
+will be visible in the system's process table to casual snoopers. Also, it
+is very confusing to the user to provide them with a default password they
+cannot see. For these reasons, using "init" is highly discouraged.
 .TP
 .BI \-\-textbox " file height width"
 .RB A " text" " box lets you display the contents of a text file in a"
Only in dialog-0.9a: dialog.1~
diff -u old/dialog-0.9a/dialog.c dialog-0.9a/dialog.c
--- old/dialog-0.9a/dialog.c	Sat Sep 25 00:55:10 1999
+++ dialog-0.9a/dialog.c	Sat Sep 25 00:38:01 1999
@@ -46,7 +46,7 @@
 
 jumperFn j_yesno, j_msgbox, j_infobox, j_textbox, j_menu;
 jumperFn j_checklist, j_radiolist, j_inputbox, j_guage;
-jumperFn j_tailbox, j_tailboxbg;
+jumperFn j_tailbox, j_tailboxbg, j_passwordbox;
 
 /*
  * All functions are used in the slackware root disk, apart from "guage"
@@ -62,6 +62,7 @@
     {"--checklist", 9, 0, j_checklist},
     {"--radiolist", 9, 0, j_radiolist},
     {"--inputbox", 5, 6, j_inputbox},
+    {"--passwordbox", 5, 6, j_passwordbox},
 #ifdef HAVE_GUAGE
     {"--guage", 6, 6, j_guage},
 #endif
@@ -363,17 +364,18 @@
 \nGlobal options: [--shadow] [--no-shadow] [--separate-widget \"<str>\"]\
 \n\
 \nBox options:\
-\n  --yesno     <text> <height> <width>\
-\n  --msgbox    <text> <height> <width>\
-\n  --infobox   <text> <height> <width>\
-\n  --inputbox  <text> <height> <width> [<init>]\
-\n  --textbox   <file> <height> <width>\
-\n  --menu      <text> <height> <width> <menu height> <tag1> <item1>...\
-\n  --checklist <text> <height> <width> <list height> <tag1> <item1> <status1>...\
-\n  --radiolist <text> <height> <width> <list height> <tag1> <item1> <status1>...\
-\n  --guage     <text> <height> <width> <percent>\
-\n  --tailbox   <file> <height> <width>\
-\n  --tailboxbg <file> <height> <width>\
+\n  --yesno       <text> <height> <width>\
+\n  --msgbox      <text> <height> <width>\
+\n  --infobox     <text> <height> <width>\
+\n  --inputbox    <text> <height> <width> [<init>]\
+\n  --textbox     <file> <height> <width>\
+\n  --passwordbox <text> <height> <width> [<init>]\
+\n  --menu        <text> <height> <width> <menu height> <tag1> <item1>...\
+\n  --checklist   <text> <height> <width> <list height> <tag1> <item1> <status1>...\
+\n  --radiolist   <text> <height> <width> <list height> <tag1> <item1> <status1>...\
+\n  --guage       <text> <height> <width> <percent>\
+\n  --tailbox     <file> <height> <width>\
+\n  --tailboxbg   <file> <height> <width>\
 \n\
 \n (auto-size with height and width = 0. Maximize with height and width = -1)\
 \n (global-auto-size if also menu_height/list_height = 0)\
@@ -493,10 +495,27 @@
 
     *offset_add=4+((init_inputbox == NULL) ? 0 : 1);
     ret = dialog_inputbox (t, av[offset+2], atoi (av[offset+3]), atoi (av[offset+4]),
-			    init_inputbox);
+			    init_inputbox, 0);
     if (ret == 0)
 	fprintf(stderr, "%s", dialog_input_result);
     return ret;
+}
+
+int
+j_passwordbox (const char *t, int ac, const char * const * av, int offset, int *offset_add)
+{
+    int ret;
+    char *init_inputbox=(char *) NULL;
+    if (offset+5 < ac)
+      if (strcmp(av[offset+5], "--and-widget"))
+        init_inputbox=av[offset+5];
+  
+  *offset_add=4+((init_inputbox == NULL) ? 0 : 1);
+  ret = dialog_inputbox (t, av[offset+2], atoi (av[offset+3]), atoi (av[offset+4]),
+			  init_inputbox, 1);
+  if (ret == 0)
+      fprintf(stderr, "%s", dialog_input_result);
+  return ret;
 }
 
 #ifdef HAVE_GUAGE
Only in dialog-0.9a: dialog.c~
diff -u old/dialog-0.9a/dialog.h dialog-0.9a/dialog.h
--- old/dialog-0.9a/dialog.h	Sat Sep 25 00:55:10 1999
+++ dialog-0.9a/dialog.h	Sat Sep 25 00:35:47 1999
@@ -209,7 +209,7 @@
 		const char * const * items, int flag, int separate_output);
 extern unsigned char dialog_input_result[];
 int dialog_inputbox (const char *title, const char *cprompt, int height,
-		int width, const char *init);
+		int width, const char *init, const int password);
 int dialog_guage (const char *title, const char *cprompt, int height, int width,
 		int percent);
 int dialog_tailbox (const char *title, const char *file, int height, int width);
Only in dialog-0.9a: dialog.h~
Only in dialog-0.9a: dialog.o
Only in dialog-0.9a: guage.o
diff -u old/dialog-0.9a/inputbox.c dialog-0.9a/inputbox.c
--- old/dialog-0.9a/inputbox.c	Sat Sep 25 00:55:10 1999
+++ dialog-0.9a/inputbox.c	Sat Sep 25 00:53:58 1999
@@ -27,7 +27,7 @@
  */
 int
 dialog_inputbox (const char *title, const char *cprompt, int height, int width,
-		 const char *init)
+		 const char *init, const int password)
 {
     int i, x, y, box_y, box_x, box_width;
     int input_x = 0, scroll = 0, key = 0, button = -1;
@@ -111,16 +111,16 @@
     if (input_x >= box_width) {
 	scroll = input_x - box_width + 1;
 	input_x = box_width - 1;
-	for (i = 0; i < box_width - 1; i++)
-	    waddch (dialog, instr[scroll + i]);
-    } else {
+      	if (! password)
+	  for (i = 0; i < box_width - 1; i++)
+	      waddch (dialog, instr[scroll + i]);
+    } else if (! password)
 	waddstr (dialog, instr);
-	for (i = 0; i < box_width - 1 - input_x; i++)
-	  waddch (dialog, ' ');
-    }
-
-    wmove (dialog, box_y, box_x + input_x);
-
+        for (i = 0; i < box_width - 1 - input_x; i++)
+          waddch (dialog, ' ');
+    
+    wmove (dialog, box_y, box_x + (password ? 0 : input_x));
+  
     wrefresh_lock(dialog);
     wtimeout(dialog, WTIMEOUT_VAL);
 
@@ -147,29 +147,35 @@
 		    if (!input_x) {
 			scroll = scroll < box_width - 1 ?
 			    0 : scroll - (box_width - 1);
-			wmove (dialog, box_y, box_x);
-			for (i = 0; i < box_width; i++)
-			    waddch (dialog, instr[scroll + input_x + i] ?
-				    instr[scroll + input_x + i] : ' ');
+		        if (! password) {
+			  wmove (dialog, box_y, box_x);
+			  for (i = 0; i < box_width; i++)
+			      waddch (dialog, instr[scroll + input_x + i] ?
+				      instr[scroll + input_x + i] : ' ');
+			}
 			input_x = strlen (instr) - scroll;
 		    } else
 			input_x--;
 		    instr[scroll + input_x] = '\0';
-		    wmove (dialog, box_y, input_x + box_x);
-		    waddch (dialog, ' ');
-		    wmove (dialog, box_y, input_x + box_x);
-		    wrefresh_lock (dialog);
+		    if (! password) {
+		      wmove (dialog, box_y, input_x + box_x);
+		      waddch (dialog, ' ');
+		      wmove (dialog, box_y, input_x + box_x);
+		      wrefresh_lock (dialog);
+		    }
 		}
 		continue;
             case 21:  /* ^U   support by Martin Schulze <joey@artis.uni-oldenburg.de> */
                 input_x = 0;
                 scroll = 0;
-                wmove (dialog, box_y, box_x);
-                for (i = 0; i < box_width - 1; i++)
-                  waddch (dialog, ' ');
-                instr[0] = '\0';
-                wmove (dialog, box_y, input_x + box_x);
-                wrefresh_lock (dialog);
+	        if (! password) {
+                  wmove (dialog, box_y, box_x);
+                  for (i = 0; i < box_width - 1; i++)
+                    waddch (dialog, ' ');
+                  instr[0] = '\0';
+                  wmove (dialog, box_y, input_x + box_x);
+                  wrefresh_lock (dialog);
+		}
                 continue;
 	    default:
 		if (key < 0x100 && isprint (key)) {
@@ -179,14 +185,20 @@
 			instr[scroll + input_x + 1] = '\0';
 			if (input_x == box_width - 1) {
 			    scroll++;
-			    wmove (dialog, box_y, box_x);
-			    for (i = 0; i < box_width - 1; i++)
-				waddch (dialog, instr[scroll + i]);
-			} else {
+			    if (! password) {
+			      wmove (dialog, box_y, box_x);
+			      for (i = 0; i < box_width - 1; i++)
+				  waddch (dialog, instr[scroll + i]);
+			    }
+			} else if (! password) {
 			    wmove (dialog, box_y, input_x++ + box_x);
 			    waddch (dialog, key);
 			}
-			wrefresh_lock (dialog);
+		        else
+			    input_x++;
+		      
+		        if (! password)
+			  wrefresh_lock (dialog);
 		    } else
 			flash ();	/* Alarm user about overflow */
 		    continue;
Only in dialog-0.9a: inputbox.c~
Only in dialog-0.9a: inputbox.o
Only in dialog-0.9a: libdialog.a
Only in dialog-0.9a: menubox.o
Only in dialog-0.9a: mousewget.o
Only in dialog-0.9a: msgbox.o
Only in dialog-0.9a: result
Common subdirectories: old/dialog-0.9a/samples and dialog-0.9a/samples
Only in dialog-0.9a: tailbox.o
Only in dialog-0.9a: textbox.o
Only in dialog-0.9a: util.o
Only in dialog-0.9a: yesno.o

-- 
see shy jo


Information forwarded to debian-bugs-dist@lists.debian.org, Santiago Vila <sanvila@ctv.es>:
Bug#45964; Package dialog. Full text and rfc822 format available.

Acknowledgement sent to Santiago Vila <sanvila@unex.es>:
Extra info received and forwarded to list. Copy sent to Santiago Vila <sanvila@ctv.es>. Full text and rfc822 format available.

Message #10 received at 45964@bugs.debian.org (full text, mbox):

From: Santiago Vila <sanvila@unex.es>
To: Joey Hess <joey@kitenet.net>, 45964@bugs.debian.org
Subject: Re: Bug#45964: adding password box support to dialog
Date: Wed, 29 Sep 1999 13:43:05 +0200 (CET)
On Sat, 25 Sep 1999, Joey Hess wrote:

> Package: dialog
> Version: 0.9a-16
> 
> It would be very useful for me with the stuff I'm doing with debconf if
> it were possible for dialog to prompt for a password, and not echo what the
> user typed. So here's a patch to do that. I've also implemented the same
> option in whiptail, and sent in a patch there, so the two programs remain
> consitent.

Thanks a lot!

[ Comments: Please note that the --checklist and --radiolist lines in
dialog help (shown when running dialog with no args) are too long to be
moved at the right, so I'm going to try to keep them unchanged.  Hope you
don't mind :-). btw: "sensative" is a typo isn't it? I'll assume you mean
"sensitive" ].

I will test this patch and hope to apply it soon.

Thanks again.

-- 
 "3b23aed0c8a748ce6ac56d887b562ed9" (a truly random sig)



Reply sent to Santiago Vila <sanvila@unex.es>:
You have taken responsibility. Full text and rfc822 format available.

Notification sent to Joey Hess <joey@kitenet.net>:
Bug acknowledged by developer. Full text and rfc822 format available.

Message #15 received at 45964-done@bugs.debian.org (full text, mbox):

From: Santiago Vila <sanvila@unex.es>
To: Joey Hess <joey@kitenet.net>, 45964-done@bugs.debian.org
Subject: Re: Bug#45964: adding password box support to dialog
Date: Mon, 11 Oct 1999 16:28:16 +0200 (CET)
On Sat, 25 Sep 1999, Joey Hess wrote:

> Package: dialog
> Version: 0.9a-16
> 
> It would be very useful for me with the stuff I'm doing with debconf if
> it were possible for dialog to prompt for a password, and not echo what the
> user typed. So here's a patch to do that. I've also implemented the same
> option in whiptail, and sent in a patch there, so the two programs remain
> consitent.
> [...]

Applied the patch (with very small changes) to dialog_0.9a-17, now
available in potato.

Thanks a lot.

-- 
 "a85f163181e7a617239a4463ddabbde8" (a truly random sig)



Send a report that this bug log contains spam.


Debian bug tracking system administrator <owner@bugs.debian.org>. Last modified: Wed Apr 23 18:24:10 2014; Machine Name: beach.debian.org

Debian Bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.