[xscreensaver/f15/master] Trial patch to allow non-ascii characters on passwd window (Ubuntu bug 671923)
Mamoru Tasaka
mtasaka at fedoraproject.org
Mon Mar 21 04:34:43 UTC 2011
commit 2b93f818c30d2b927d53a7fb8291616a61193545
Author: Mamoru Tasaka <tasaka1 at localhost.localdomain>
Date: Mon Mar 21 13:34:32 2011 +0900
Trial patch to allow non-ascii characters on passwd window (Ubuntu bug 671923)
...aver-5.12-XLookupString-may-return-string.patch | 127 ++++++++++++++++++++
xscreensaver.spec | 12 ++-
2 files changed, 137 insertions(+), 2 deletions(-)
---
diff --git a/xscreensaver-5.12-XLookupString-may-return-string.patch b/xscreensaver-5.12-XLookupString-may-return-string.patch
new file mode 100644
index 0000000..c172739
--- /dev/null
+++ b/xscreensaver-5.12-XLookupString-may-return-string.patch
@@ -0,0 +1,127 @@
+--- xscreensaver-5.12/driver/lock.c.debug 2010-09-15 17:43:26.000000000 +0900
++++ xscreensaver-5.12/driver/lock.c 2011-03-08 02:28:39.000000000 +0900
+@@ -89,6 +89,9 @@
+ int previous_mouse_x, previous_mouse_y;
+
+ char typed_passwd [80];
++ char keysym_buf_size [80]; /* note that each item stored in the array
++ keysym_buf_size should be 0 - 10 */
++
+ XtIntervalId timer;
+ int i_beam;
+
+@@ -1234,6 +1237,7 @@
+ }
+
+ memset (pw->typed_passwd, 0, sizeof(pw->typed_passwd));
++ memset (pw->keysym_buf_size, 0, sizeof(pw->keysym_buf_size));
+ memset (pw->passwd_string, 0, strlen(pw->passwd_string));
+
+ if (pw->timer)
+@@ -1695,14 +1699,18 @@
+ passwd_dialog_data *pw = si->pw_data;
+ int pw_size = sizeof (pw->typed_passwd) - 1;
+ char *typed_passwd = pw->typed_passwd;
+- char s[2];
++ char *keysym_buf_size = pw->keysym_buf_size;
++ char s[11];
+ char *stars = 0;
+ int i;
+- int size = XLookupString (event, s, 1, 0, compose_status);
++ /* So XLookupString may return string when the meaning of a KeySym
++ is rebinded by XRebindKeysym, for example. So let's try to read
++ not only 1 byte. */
++ int size = XLookupString (event, s, 10, 0, compose_status);
+
+- if (size != 1) return;
++ if (size > 10) return;
+
+- s[1] = 0;
++ s[size] = 0;
+
+ pw->passwd_changed_p = True;
+
+@@ -1716,37 +1724,58 @@
+ if (!*typed_passwd)
+ XBell (si->dpy, 0);
+ else
+- typed_passwd [strlen(typed_passwd)-1] = 0;
++ {
++ int keysym_buf_len = (int) strlen(keysym_buf_size);
++ int last_keysym_buf_size = keysym_buf_size[keysym_buf_len - 1];
++ char *c;
++ int j;
++
++ keysym_buf_size[keysym_buf_len - 1] = 0;
++ c = typed_passwd + (strlen(typed_passwd) - 1);
++ /* Delete the last characters of the length which
++ XLookupString returned and was preserved in
++ keysym_buf_size
++ */
++ for ( j = 0; j < last_keysym_buf_size; j++ )
++ *c-- = 0;
++ }
+ break;
+
+ case '\025': case '\030': /* Erase line */
+ memset (typed_passwd, 0, pw_size);
++ memset (keysym_buf_size, 0, pw_size);
+ break;
+
+ case '\012': case '\015': /* Enter */
++ memset (keysym_buf_size, 0, pw_size);
+ finished_typing_passwd(si, pw);
+ break;
+
+ case '\033': /* Escape */
++ memset (keysym_buf_size, 0, pw_size);
+ si->unlock_state = ul_cancel;
+ break;
+
+ default:
+- /* Though technically the only illegal characters in Unix passwords
+- are LF and NUL, most GUI programs (e.g., GDM) use regular text-entry
+- fields that only let you type printable characters. So, people
+- who use funky characters in their passwords are already broken.
+- We follow that precedent.
+- */
+- if (isprint ((unsigned char) *s))
++ /* As user may be using non-ascii character, let's allow
++ any character */
++ if (1 || isprint ((unsigned char) *s))
+ {
+ i = strlen (typed_passwd);
+- if (i >= pw_size-1)
++ if (i >= pw_size - size)
+ XBell (si->dpy, 0);
+ else
+ {
+- typed_passwd [i] = *s;
+- typed_passwd [i+1] = 0;
++ char *c = keysym_buf_size;
++ int j;
++ int keysym_buf_len = strlen(keysym_buf_size);
++
++ c+= keysym_buf_len;
++ *c++ = (char) size; /* save what size XLookupString returned,
++ should be 0 - 10 */
++ *c = 0;
++ for (j = 0; j <= size; j++)
++ typed_passwd [i + j] = s[j];
+ }
+ }
+ else
+@@ -1911,6 +1940,13 @@
+
+ memcpy (pw->typed_passwd, si->unlock_typeahead, i);
+ pw->typed_passwd [i] = 0;
++ {
++ int j;
++ char *c = pw->keysym_buf_size;
++ for (j = 0; j < i; j++)
++ *c++ = 1;
++ *c = 0;
++ }
+
+ memset (si->unlock_typeahead, '*', strlen(si->unlock_typeahead));
+ si->unlock_typeahead[i] = 0;
diff --git a/xscreensaver.spec b/xscreensaver.spec
index c641c5c..c13521b 100644
--- a/xscreensaver.spec
+++ b/xscreensaver.spec
@@ -10,7 +10,7 @@
%define split_getimage 1
%endif
-%define fedora_rel 12
+%define fedora_rel 13
%undefine extrarel
@@ -32,7 +32,7 @@ Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
Summary: X screen saver and locker
Name: %{name}
Version: %{mainversion}
-Release: %{fedora_rel}%{?dist}%{?extrarel}.1
+Release: %{fedora_rel}%{?dist}%{?extrarel}
Epoch: 1
License: MIT
Group: Amusements/Graphics
@@ -90,6 +90,10 @@ Patch38: xscreensaver-5.12-apple2-1byte-ahead.patch
# should be fixed in gdk-pixbuf side, so the upstream may not apply the
# following patch, however on Fedora let's carry this.
Patch39: xscreensaver-5.12-webcollage-ppm-gnome569671.patch
+# Cannot type non-ascii character on password window
+# https://bugs.launchpad.net/ubuntu/+source/xscreensaver/+bug/671923
+# The following patch is still under discussion with jwz
+Patch40: xscreensaver-5.12-XLookupString-may-return-string.patch
# Patches end
Requires: xscreensaver-base = %{epoch}:%{version}-%{release}
Requires: xscreensaver-extras = %{epoch}:%{version}-%{release}
@@ -287,6 +291,7 @@ This package contains some test programs to debug XScreenSaver.
%patch37 -p1 -b .wormhole
%patch38 -p1 -b .apple2_byte
%patch39 -p1 -b .webc.ppm
+%patch40 -p1 -b .non_ascii
change_option(){
set +x
@@ -810,6 +815,9 @@ exit 0
%defattr(-,root,root,-)
%changelog
+* Sun Mar 20 2011 Mamoru Tasaka <mtasaka at fedoraproject.org> - 1:5.12-13
+- Trial patch to allow non-ascii characters on passwd window (Ubuntu bug 671923)
+
* Tue Feb 08 2011 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 1:5.12-12.1
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
More information about the scm-commits
mailing list