Handle passwords longer than 16 characters.
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@511 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
@@ -38,7 +38,9 @@ char realm[REALM_SZ + 1];
|
|||||||
char *SPACE_STRING = " ";
|
char *SPACE_STRING = " ";
|
||||||
char STRING[] = "****************";
|
char STRING[] = "****************";
|
||||||
|
|
||||||
#define MAX_PASSWD_LENGTH (sizeof(STRING))
|
#define STRING_LENGTH sizeof(STRING)
|
||||||
|
#define MAX_PASSWD_LENGTH 256
|
||||||
|
/* (sizeof(STRING)) */
|
||||||
|
|
||||||
#ifndef MAXPATHLEN
|
#ifndef MAXPATHLEN
|
||||||
#define MAXPATHLEN BUFSIZ
|
#define MAXPATHLEN BUFSIZ
|
||||||
@@ -56,6 +58,10 @@ char STRING[] = "****************";
|
|||||||
#define XNLOCK_CTRL 1
|
#define XNLOCK_CTRL 1
|
||||||
#define XNLOCK_NOCTRL 0
|
#define XNLOCK_NOCTRL 0
|
||||||
|
|
||||||
|
#ifndef min
|
||||||
|
#define min(x,y) (((x)<(y))?(x):(y))
|
||||||
|
#endif
|
||||||
|
|
||||||
XtAppContext app;
|
XtAppContext app;
|
||||||
Display *dpy;
|
Display *dpy;
|
||||||
unsigned short Width, Height;
|
unsigned short Width, Height;
|
||||||
@@ -417,8 +423,8 @@ post_prompt_box(Window window)
|
|||||||
if (height < 100)
|
if (height < 100)
|
||||||
height = 100;
|
height = 100;
|
||||||
|
|
||||||
if(width < 105 + font->max_bounds.width*MAX_PASSWD_LENGTH)
|
if(width < 105 + font->max_bounds.width*STRING_LENGTH)
|
||||||
width = 105 + font->max_bounds.width*MAX_PASSWD_LENGTH;
|
width = 105 + font->max_bounds.width*STRING_LENGTH;
|
||||||
box_x = (Width - width) / 2;
|
box_x = (Width - width) / 2;
|
||||||
time_x = prompt_x = box_x + 105;
|
time_x = prompt_x = box_x + 105;
|
||||||
|
|
||||||
@@ -526,6 +532,7 @@ GetPasswd(Widget w, XEvent *_event, String *_s, Cardinal *_n)
|
|||||||
static int is_ctrl = XNLOCK_NOCTRL;
|
static int is_ctrl = XNLOCK_NOCTRL;
|
||||||
char c;
|
char c;
|
||||||
KeySym keysym;
|
KeySym keysym;
|
||||||
|
int echolen;
|
||||||
|
|
||||||
if (event->type == ButtonPress) {
|
if (event->type == ButtonPress) {
|
||||||
x = event->x, y = event->y;
|
x = event->x, y = event->y;
|
||||||
@@ -632,7 +639,7 @@ GetPasswd(Widget w, XEvent *_event, String *_s, Cardinal *_n)
|
|||||||
prompt_x, prompt_y, STRING, cnt);
|
prompt_x, prompt_y, STRING, cnt);
|
||||||
XDrawImageString(dpy, XtWindow(w), gc,
|
XDrawImageString(dpy, XtWindow(w), gc,
|
||||||
prompt_x + XTextWidth(font, STRING, cnt),
|
prompt_x + XTextWidth(font, STRING, cnt),
|
||||||
prompt_y, SPACE_STRING, MAX_PASSWD_LENGTH - cnt + 1);
|
prompt_y, SPACE_STRING, STRING_LENGTH - cnt + 1);
|
||||||
}
|
}
|
||||||
} else if (isprint(c))
|
} else if (isprint(c))
|
||||||
if ((cnt + 1) >= MAX_PASSWD_LENGTH)
|
if ((cnt + 1) >= MAX_PASSWD_LENGTH)
|
||||||
@@ -641,11 +648,12 @@ GetPasswd(Widget w, XEvent *_event, String *_s, Cardinal *_n)
|
|||||||
passwd[cnt++] = c;
|
passwd[cnt++] = c;
|
||||||
else
|
else
|
||||||
return;
|
return;
|
||||||
|
echolen = min(cnt, STRING_LENGTH);
|
||||||
XDrawImageString(dpy, XtWindow(w), gc,
|
XDrawImageString(dpy, XtWindow(w), gc,
|
||||||
prompt_x, prompt_y, STRING, cnt);
|
prompt_x, prompt_y, STRING, echolen);
|
||||||
XDrawImageString(dpy, XtWindow(w), gc,
|
XDrawImageString(dpy, XtWindow(w), gc,
|
||||||
prompt_x + XTextWidth(font, STRING, cnt),
|
prompt_x + XTextWidth(font, STRING, cnt),
|
||||||
prompt_y, SPACE_STRING, MAX_PASSWD_LENGTH - cnt + 1);
|
prompt_y, SPACE_STRING, STRING_LENGTH - echolen + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
#include "nose.0.left"
|
#include "nose.0.left"
|
||||||
|
Reference in New Issue
Block a user