PassCount = 0, /* Number of passing tests */
FailCount = 0, /* Number of failing tests */
SkipCount = 0; /* Number of skipped tests */
-static char *Password = NULL; /* Password from URI */
+static char *Username = NULL, /* Username from URI */
+ *Password = NULL; /* Password from URI */
+static int PasswordTries = 0; /* Number of tries with password */
/*
if ((Password = strchr(vars.userpass, ':')) != NULL)
*Password++ = '\0';
- cupsSetUser(vars.userpass);
+ Username = vars.userpass;
cupsSetPasswordCB(password_cb);
set_variable(&vars, "uriuser", vars.userpass);
}
goto skip_error;
}
+ PasswordTries = 0;
repeat_count = 0;
repeat_interval = 1;
repeat_prev = 1;
{
repeat_count ++;
- status = HTTP_OK;
+ status = HTTP_STATUS_OK;
if (transfer == _CUPS_TRANSFER_CHUNKED ||
(transfer == _CUPS_TRANSFER_AUTO && filename[0]))
repeat_test = 0;
prev_pass = 1;
- if (status != HTTP_ERROR)
+ if (status != HTTP_STATUS_ERROR)
{
while (!response && !Cancel && prev_pass)
{
httpSetField(http, HTTP_FIELD_CONTENT_ENCODING, compression);
#endif /* HAVE_LIBZ */
- if (!Cancel && status == HTTP_CONTINUE &&
+ if (!Cancel && status == HTTP_STATUS_CONTINUE &&
request->state == IPP_DATA && filename[0])
{
if ((reqfile = cupsFileOpen(filename, "r")) != NULL)
{
while (!Cancel &&
(bytes = cupsFileRead(reqfile, buffer, sizeof(buffer))) > 0)
- if ((status = cupsWriteRequestData(http, buffer, (size_t)bytes)) != HTTP_CONTINUE)
+ if ((status = cupsWriteRequestData(http, buffer, (size_t)bytes)) != HTTP_STATUS_CONTINUE)
break;
cupsFileClose(reqfile);
strerror(errno));
_cupsSetError(IPP_INTERNAL_ERROR, buffer, 0);
- status = HTTP_ERROR;
+ status = HTTP_STATUS_ERROR;
}
}
* Get the server's response...
*/
- if (!Cancel && status != HTTP_ERROR)
+ if (!Cancel && status != HTTP_STATUS_ERROR)
{
response = cupsGetResponse(http, resource);
status = httpGetStatus(http);
}
- if (!Cancel && status == HTTP_ERROR && http->error != EINVAL &&
+ if (!Cancel && status == HTTP_STATUS_ERROR && http->error != EINVAL &&
#ifdef WIN32
http->error != WSAETIMEDOUT)
#else
if (httpReconnect(http))
prev_pass = 0;
}
- else if (status == HTTP_ERROR)
+ else if (status == HTTP_STATUS_ERROR || status == HTTP_STATUS_CUPS_AUTHORIZATION_CANCELED)
{
prev_pass = 0;
break;
}
- else if (status != HTTP_OK)
+ else if (status != HTTP_STATUS_OK)
{
httpFlush(http);
}
}
- if (!Cancel && status == HTTP_ERROR && http->error != EINVAL &&
+ if (!Cancel && status == HTTP_STATUS_ERROR && http->error != EINVAL &&
#ifdef WIN32
http->error != WSAETIMEDOUT)
#else
if (httpReconnect(http))
prev_pass = 0;
}
- else if (status == HTTP_ERROR)
+ else if (status == HTTP_STATUS_ERROR)
{
if (!Cancel)
httpReconnect(http);
prev_pass = 0;
}
- else if (status != HTTP_OK)
+ else if (status != HTTP_STATUS_OK)
{
httpFlush(http);
prev_pass = 0;
{
(void)prompt;
- return (Password);
+ if (PasswordTries < 3)
+ {
+ PasswordTries ++;
+
+ cupsSetUser(Username);
+
+ return (Password);
+ }
+ else
+ return (NULL);
}