Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Password prompt doesn't use translated string #2121

Closed
michaelrsweet opened this issue Nov 23, 2006 · 3 comments
Closed

Password prompt doesn't use translated string #2121

michaelrsweet opened this issue Nov 23, 2006 · 3 comments
Milestone

Comments

@michaelrsweet
Copy link
Collaborator

Version: 1.2.6
CUPS.org User: twaugh.redhat

We have translated strings for "Password for %s on %s?" but they aren't used. Here's the patch to fix that.

@michaelrsweet
Copy link
Collaborator Author

CUPS.org User: mike

Fixed in Subversion repository.

The attached patch uses the (cached) global default language and doesn't use a temporary variable for the format string...

@michaelrsweet
Copy link
Collaborator Author

"cups-translate-prompt.patch":

--- cups-1.2.7/cups/auth.c~ 2006-09-16 20:08:36.000000000 +0100
+++ cups-1.2.7/cups/auth.c 2006-11-23 09:41:55.000000000 +0000
@@ -114,7 +114,10 @@
* Nope - get a new password from the user...
*/

  • snprintf(prompt, sizeof(prompt), _("Password for %s on %s? "), cupsUser(),
  • cups_lang_t *lang = cupsLangDefault();
  • const char *prompt_fmt = _cupsLangString (lang,
  •                     _("Password for %s on %s? "));
    
  • snprintf(prompt, sizeof(prompt), prompt_fmt, cupsUser(),
    http->hostname[0] == '/' ? "localhost" : http->hostname);

http->digest_tries = strncasecmp(http->fields[HTTP_FIELD_WWW_AUTHENTICATE],

@michaelrsweet
Copy link
Collaborator Author

"str2121.patch":

Index: auth.c

--- auth.c (revision 6131)
+++ auth.c (working copy)
@@ -75,6 +75,7 @@
realm[HTTP_MAX_VALUE], /* realm="xyz" string /
nonce[HTTP_MAX_VALUE], /
nonce="xyz" string /
encode[512]; /
Encoded username:password */

  • _cups_globals_t cg; / Global data */

DEBUG_printf(("cupsDoAuthentication(http=%p, method="%s", resource="%s")\n",
@@ -114,9 +115,16 @@

  • Nope - get a new password from the user...
    */
  • snprintf(prompt, sizeof(prompt), _("Password for %s on %s? "), cupsUser(),
  •         http->hostname[0] == '/' ? "localhost" : http->hostname);
    
  • cg = _cupsGlobals();
  • if (!cg->lang_default)
  •  cg->lang_default = cupsLangDefault();
    
  • snprintf(prompt, sizeof(prompt),
  •         _cupsLangString(cg->lang_default, _("Password for %s on %s? ")),
    
  •    cupsUser(),
    
  •    http->hostname[0] == '/' ? "localhost" : http->hostname);
    
    http->digest_tries = strncasecmp(http->fields[HTTP_FIELD_WWW_AUTHENTICATE],
    "Digest", 5) != 0;
    http->userpass[0] = '\0';

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant