Skip to content

Commit 430fc90

Browse files
committed
Fix regression in username handling (Issue #1145)
1 parent 5bdec19 commit 430fc90

1 file changed

Lines changed: 17 additions & 17 deletions

File tree

backend/ipp.c

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,9 @@ static int job_canceled = 0,
8383
/* Job cancelled? */
8484
uri_credentials = 0;
8585
/* Credentials supplied in URI? */
86-
static char username[256] = "",
86+
static char device_username[256] = "",
8787
/* Username for device URI */
88-
*password = NULL;
88+
*device_password = NULL;
8989
/* Password for device URI */
9090
static const char * const pattrs[] = /* Printer attributes we want */
9191
{
@@ -412,7 +412,7 @@ main(int argc, /* I - Number of command-line args */
412412
*/
413413

414414
httpSeparateURI(HTTP_URI_CODING_ALL, device_uri, scheme, sizeof(scheme),
415-
username, sizeof(username), hostname, sizeof(hostname), &port,
415+
device_username, sizeof(device_username), hostname, sizeof(hostname), &port,
416416
resource, sizeof(resource));
417417

418418
if (!port)
@@ -637,16 +637,16 @@ main(int argc, /* I - Number of command-line args */
637637

638638
cupsSetPasswordCB2((cups_password_cb2_t)password_cb, &password_tries);
639639

640-
if (username[0])
640+
if (device_username[0])
641641
{
642642
/*
643643
* Use authentication information in the device URI...
644644
*/
645645

646-
if ((password = strchr(username, ':')) != NULL)
647-
*password++ = '\0';
646+
if ((device_password = strchr(device_username, ':')) != NULL)
647+
*device_password++ = '\0';
648648

649-
cupsSetUser(username);
649+
cupsSetUser(device_username);
650650
uri_credentials = 1;
651651
}
652652
else
@@ -659,11 +659,11 @@ main(int argc, /* I - Number of command-line args */
659659

660660
if (ptr)
661661
{
662-
strlcpy(username, ptr, sizeof(username));
662+
strlcpy(device_username, ptr, sizeof(device_username));
663663
cupsSetUser(ptr);
664664
}
665665

666-
password = getenv("AUTH_PASSWORD");
666+
device_password = getenv("AUTH_PASSWORD");
667667
}
668668

669669
/*
@@ -2564,8 +2564,8 @@ monitor_printer(
25642564
http = httpConnect2(monitor->hostname, monitor->port, NULL, AF_UNSPEC,
25652565
monitor->encryption, 1, 0, NULL);
25662566
httpSetTimeout(http, 30.0, timeout_cb, NULL);
2567-
if (username[0])
2568-
cupsSetUser(username);
2567+
if (device_username[0])
2568+
cupsSetUser(device_username);
25692569

25702570
cupsSetPasswordCB2((cups_password_cb2_t)password_cb, &password_tries);
25712571

@@ -3042,9 +3042,9 @@ password_cb(const char *prompt, /* I - Prompt (not used) */
30423042

30433043

30443044
fprintf(stderr, "DEBUG: password_cb(prompt=\"%s\", http=%p, method=\"%s\", "
3045-
"resource=\"%s\", password_tries=%p(%d)), password=%p\n",
3046-
prompt, http, method, resource, password_tries, *password_tries,
3047-
password);
3045+
"resource=\"%s\", password_tries=%p(%d)), device_password=%p\n",
3046+
prompt, (void *)http, method, resource, (void *)password_tries, *password_tries,
3047+
(void *)device_password);
30483048

30493049
(void)prompt;
30503050
(void)method;
@@ -3067,13 +3067,13 @@ password_cb(const char *prompt, /* I - Prompt (not used) */
30673067
}
30683068
}
30693069

3070-
if (password && *password && *password_tries < 3)
3070+
if (device_password && *device_password && *password_tries < 3)
30713071
{
30723072
(*password_tries) ++;
30733073

3074-
cupsSetUser(username);
3074+
cupsSetUser(device_username);
30753075

3076-
return (password);
3076+
return (device_password);
30773077
}
30783078
else
30793079
{

0 commit comments

Comments
 (0)