]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Mirror fix from trunk.
authormsweet <msweet@a1ca3aef-8c08-0410-bb20-df032aa958be>
Wed, 19 Mar 2014 18:38:23 +0000 (18:38 +0000)
committermsweet <msweet@a1ca3aef-8c08-0410-bb20-df032aa958be>
Wed, 19 Mar 2014 18:38:23 +0000 (18:38 +0000)
git-svn-id: svn+ssh://src.apple.com/svn/cups/cups.org/branches/branch-1.7@11707 a1ca3aef-8c08-0410-bb20-df032aa958be

backend/ipp.c
doc/help/man-ipptool.html
doc/help/man-ipptoolfile.html
test/ipptool.c

index c4f6d3eefff842aab29f4a5c1ea37d8a8c004ca9..2f19e3d37dd8db30cb48c5fae37c53d852595807 100644 (file)
@@ -2985,6 +2985,8 @@ password_cb(const char *prompt,           /* I - Prompt (not used) */
   {
     (*password_tries) ++;
 
+    cupsSetUser(username);
+
     return (password);
   }
   else
index 486080c6ac909dd427842257879e19c086919d44..5d3b5bea2a3986b95d8717b7304438c2fee6a9dd 100644 (file)
@@ -38,10 +38,14 @@ The following options are recognized by <i>ipptool</i>:
 <dt>--help
 </dt>
 <dd>Shows program help.
---stop-after-include-error
-Tells <i>ipptool</i> to stop if an error occurs in an included file. Normally <i>ipptool</i> will continue with subsequent tests after the INCLUDE directive.
---version
-Shows the version of <i>ipptool</i> being used.
+</dd>
+<dt>--stop-after-include-error
+</dt>
+<dd>Tells <i>ipptool</i> to stop if an error occurs in an included file. Normally <i>ipptool</i> will continue with subsequent tests after the INCLUDE directive.
+</dd>
+<dt>--version
+</dt>
+<dd>Shows the version of <i>ipptool</i> being used.
 </dd>
 <dt>-4
 </dt>
@@ -165,11 +169,15 @@ The following standard files are available:
     validate-job.test
 </pre>
 <h2 class="title"><a name="SEE_ALSO">See Also</a></h2>
-<a href='man-ipptoolfile.html?TOPIC=Man+Pages'>ipptoolfile(5)</a>,
+<a href='man-ipptoolfile.html?TOPIC=Man+Pages'>ipptoolfile(5)</a>, RFC 2911,
 <br>
 <a href='http://localhost:631/help'>http://localhost:631/help</a>
+<br>
+<a href='http://www.iana.org/assignments/ipp-registrations'>http://www.iana.org/assignments/ipp-registrations</a>
+<br>
+<a href='http://www.pwg.org/ipp'>http://www.pwg.org/ipp</a>
 <h2 class="title"><a name="COPYRIGHT">Copyright</a></h2>
-Copyright 2007-2013 by Apple Inc.
+Copyright 2007-2014 by Apple Inc.
 
 </body>
 </html>
index 1ce4f195dd6a78b95b4abebfe36619c4db807f18..e655bec978aa2f551265d90b485fe6ea38ecad6c 100644 (file)
@@ -174,7 +174,7 @@ The following directives are understood in a test:
 <dt>ATTR tag attribute-name value(s)
 </dt>
 <dd>Adds an attribute to the test request. Values are separated by the comma (",")
-character - escape commas using the "" character.
+character - escape commas using the "" character. Common attributes and values are listed in the IANA IPP registry - see references below.
 </dd>
 <dt>ATTR collection attribute-name { MEMBER tag member-name value(s) ... } [ ... { ... } ]
 </dt>
@@ -735,12 +735,15 @@ no notify-subscription-id has been seen.
 </dd>
 </dl>
 <h2 class="title"><a name="SEE_ALSO">See Also</a></h2>
-<a href='man-ipptool.html?TOPIC=Man+Pages'>ipptool(1)</a>,
+<a href='man-ipptool.html?TOPIC=Man+Pages'>ipptool(1)</a>, RFC 2911,
 <br>
 <a href='http://localhost:631/help'>http://localhost:631/help</a>
-
+<br>
+<a href='http://www.iana.org/assignments/ipp-registrations'>http://www.iana.org/assignments/ipp-registrations</a>
+<br>
+<a href='http://www.pwg.org/ipp'>http://www.pwg.org/ipp</a>
 <h2 class="title"><a name="COPYRIGHT">Copyright</a></h2>
-Copyright 2007-2013 by Apple Inc.
+Copyright 2007-2014 by Apple Inc.
 
 </body>
 </html>
index 56bb8cc65fea11cefc247381f7da3e57c506ea8b..1de7c363b6747c3b87179cc10daa6fac280ab147 100644 (file)
@@ -3,7 +3,7 @@
  *
  * ipptool command for CUPS.
  *
- * Copyright 2007-2013 by Apple Inc.
+ * Copyright 2007-2014 by Apple Inc.
  * Copyright 1997-2007 by Easy Software Products.
  *
  * These coded instructions, statements, and computer programs are the
@@ -138,7 +138,9 @@ int         Cancel = 0,             /* Cancel test? */
                PassCount = 0,          /* Number of passing tests */
                FailCount = 0,          /* Number of failing tests */
                SkipCount = 0;          /* Number of skipped tests */
-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 */
 const char * const URIStatusStrings[] =        /* URI status strings */
 {
   "URI too large",
@@ -608,7 +610,7 @@ main(int  argc,                             /* I - Number of command-line args */
         if ((Password = strchr(vars.userpass, ':')) != NULL)
          *Password++ = '\0';
 
-        cupsSetUser(vars.userpass);
+        Username = vars.userpass;
        cupsSetPasswordCB(password_cb);
        set_variable(&vars, "uriuser", vars.userpass);
       }
@@ -2427,6 +2429,7 @@ do_tests(_cups_vars_t *vars,              /* I - Variables */
       goto skip_error;
     }
 
+    PasswordTries   = 0;
     repeat_count    = 0;
     repeat_interval = 1;
     repeat_prev     = 1;
@@ -2435,7 +2438,7 @@ do_tests(_cups_vars_t *vars,              /* I - Variables */
     {
       repeat_count ++;
 
-      status = HTTP_OK;
+      status = HTTP_STATUS_OK;
 
       if (transfer == _CUPS_TRANSFER_CHUNKED ||
          (transfer == _CUPS_TRANSFER_AUTO && filename[0]))
@@ -2475,7 +2478,7 @@ do_tests(_cups_vars_t *vars,              /* I - Variables */
       repeat_test = 0;
       prev_pass   = 1;
 
-      if (status != HTTP_ERROR)
+      if (status != HTTP_STATUS_ERROR)
       {
        while (!response && !Cancel && prev_pass)
        {
@@ -2486,7 +2489,7 @@ do_tests(_cups_vars_t *vars,              /* I - Variables */
            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)
@@ -2495,7 +2498,7 @@ do_tests(_cups_vars_t *vars,              /* I - Variables */
                     (bytes = cupsFileRead(reqfile, buffer,
                                           sizeof(buffer))) > 0)
                if ((status = cupsWriteRequestData(http, buffer,
-                                                  bytes)) != HTTP_CONTINUE)
+                                                  bytes)) != HTTP_STATUS_CONTINUE)
                  break;
 
              cupsFileClose(reqfile);
@@ -2506,7 +2509,7 @@ do_tests(_cups_vars_t *vars,              /* I - Variables */
                       strerror(errno));
              _cupsSetError(IPP_INTERNAL_ERROR, buffer, 0);
 
-             status = HTTP_ERROR;
+             status = HTTP_STATUS_ERROR;
            }
          }
 
@@ -2514,13 +2517,13 @@ do_tests(_cups_vars_t *vars,            /* I - Variables */
          * 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
@@ -2530,12 +2533,12 @@ do_tests(_cups_vars_t *vars,            /* I - Variables */
            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);
 
@@ -2547,7 +2550,7 @@ do_tests(_cups_vars_t *vars,              /* I - Variables */
        }
       }
 
-      if (!Cancel && status == HTTP_ERROR && http->error != EINVAL &&
+      if (!Cancel && status == HTTP_STATUS_ERROR && http->error != EINVAL &&
 #ifdef WIN32
          http->error != WSAETIMEDOUT)
 #else
@@ -2557,14 +2560,14 @@ do_tests(_cups_vars_t *vars,            /* I - Variables */
        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;
@@ -3929,7 +3932,16 @@ password_cb(const char *prompt)          /* I - Prompt (unused) */
 {
   (void)prompt;
 
-  return (Password);
+  if (PasswordTries < 3)
+  {
+    PasswordTries ++;
+
+    cupsSetUser(Username);
+
+    return (Password);
+  }
+  else
+    return (NULL);
 }