summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2011-02-21 15:53:23 -0800
committerAlan Coopersmith <alan.coopersmith@oracle.com>2011-02-21 16:52:36 -0800
commit3297eb892017c850f25d3dc4a37095612a20a381 (patch)
treeb50dd87f1794b3acd2f2caa1deb72f6ef98fe55e
parent472dc516e7d0190d81fdedd817261ee41bf8ada6 (diff)
greeter: Add echoPasswdChar resource to set character to display
Stop hardcoding it to '*'. Allows setting a resource with no value to to advance the cursor without drawing text (as was previously the default). Resolves https://bugs.freedesktop.org/show_bug.cgi?id=32794 Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r--greeter/Login.c24
-rw-r--r--greeter/Login.h2
-rw-r--r--greeter/LoginP.h4
-rw-r--r--man/xdm.man8
4 files changed, 24 insertions, 14 deletions
diff --git a/greeter/Login.c b/greeter/Login.c
index 020bfd4..9fd07c4 100644
--- a/greeter/Login.c
+++ b/greeter/Login.c
@@ -217,7 +217,9 @@ static XtResource resources[] = {
{XtNallowRootLogin, XtCAllowRootLogin, XtRBoolean, sizeof(Boolean),
offset(allow_root_login), XtRImmediate, (XtPointer) True},
{XtNechoPasswd, XtCEchoPasswd, XtRBoolean, sizeof(Boolean),
- offset(echo_passwd), XtRImmediate, (XtPointer) False}
+ offset(echo_passwd), XtRImmediate, (XtPointer) False},
+ {XtNechoPasswdChar, XtCEchoPasswdChar, XtRString, sizeof (char *),
+ offset(echo_passwd_char), XtRString, (XtPointer) "*" }
};
#undef offset
@@ -370,7 +372,7 @@ realizeValue (LoginWidget w, int cursor, int promptNum, GC gc)
while (i < length)
{
- text[i++] = '*';
+ text[i++] = w->login.echo_passwd_char[0];
}
text[i] = 0;
@@ -488,16 +490,16 @@ realizeCursor (LoginWidget w, GC gc)
break;
case LOGIN_PROMPT_ECHO_OFF:
if (w->login.echo_passwd == True) {
- int len = PROMPT_CURSOR(w, w->login.activePrompt) -
- VALUE_SHOW_START(w, w->login.activePrompt);
+ if (w->login.echo_passwd_char[0] != 0) {
+ int len = PROMPT_CURSOR(w, w->login.activePrompt) -
+ VALUE_SHOW_START(w, w->login.activePrompt);
- x += len*TEXT_WIDTH(text, "*", 1);
- }
- else
- {
- /* Move cursor one pixel per character to give some feedback
- without giving away the password length */
- x += PROMPT_CURSOR(w, w->login.activePrompt);
+ x += len*TEXT_WIDTH(text, w->login.echo_passwd_char, 1);
+ } else {
+ /* Move cursor one pixel per character to give some feedback
+ without giving away the password length */
+ x += PROMPT_CURSOR(w, w->login.activePrompt);
+ }
}
break;
}
diff --git a/greeter/Login.h b/greeter/Login.h
index 22529a5..9b5212c 100644
--- a/greeter/Login.h
+++ b/greeter/Login.h
@@ -101,6 +101,7 @@ from The Open Group.
# define XtNallowNullPasswd "allowNullPasswd"
# define XtNallowRootLogin "allowRootLogin"
# define XtNechoPasswd "echoPasswd"
+# define XtNechoPasswdChar "echoPasswdChar"
# define XtNface "face"
# define XtCFace "Face"
@@ -142,6 +143,7 @@ from The Open Group.
# define XtCAllowNullPasswd "AllowNullPasswd"
# define XtCAllowRootLogin "AllowRootLogin"
# define XtCEchoPasswd "EchoPasswd"
+# define XtCEchoPasswdChar "EchoPasswdChar"
# define XtNchangePasswdMessage "changePasswdMessage"
# define XtCChangePasswdMessage "ChangePasswdMessage"
diff --git a/greeter/LoginP.h b/greeter/LoginP.h
index 3279110..ef2151d 100644
--- a/greeter/LoginP.h
+++ b/greeter/LoginP.h
@@ -130,8 +130,10 @@ typedef struct {
Boolean allow_access; /* disable access control on login */
Boolean allow_null_passwd; /* allow null password on login */
Boolean allow_root_login; /* allow root login */
- /* show password as asterisks, i.e. '**...' */
+ /* option to display characters such as asterisks, i.e. '**...'
+ for no-echo prompts like passwords */
Boolean echo_passwd;
+ char * echo_passwd_char;
XIC xic; /* input method of input context */
loginPromptData prompts[NUM_PROMPTS];
time_t msgTimeout;
diff --git a/man/xdm.man b/man/xdm.man
index 721dade..3c4b385 100644
--- a/man/xdm.man
+++ b/man/xdm.man
@@ -1062,9 +1062,13 @@ if the account does not require a password at all.
The default is ``false'', so only users that have passwords assigned can
log in.
.IP "\fBxlogin.Login.echoPasswd\fP"
-If set to ``true'', stars will be rendered instead of the password itself,
-i.e. '***...'.
+If set to ``true'', a placeholder character (echoPasswdChar) will be shown
+for fields normally set to not echo, such as password input.
The default is ``false''.
+.IP "\fBxlogin.Login.echoPasswdChar\fP"
+Character to display if echoPasswd is true. The default is ``*''.
+If set to an empty value, the cursor will advance for each character input,
+but no text will be drawn.
.IP "\fBxlogin.Login.translations\fP"
This specifies the translations used for the login widget. Refer to the X
Toolkit documentation for a complete discussion on translations. The default