]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Add "-4" and "-6" options to tlscheck.
authormsweet <msweet@a1ca3aef-8c08-0410-bb20-df032aa958be>
Tue, 12 Jan 2016 17:21:23 +0000 (17:21 +0000)
committermsweet <msweet@a1ca3aef-8c08-0410-bb20-df032aa958be>
Tue, 12 Jan 2016 17:21:23 +0000 (17:21 +0000)
git-svn-id: svn+ssh://src.apple.com/svn/cups/cups.org/trunk@13041 a1ca3aef-8c08-0410-bb20-df032aa958be

cups/tlscheck.c

index 861222ef2adc242097dc519f5b00510fe9b78da1..e78bf28c6223f0b357737cc9a6a85468bfba1655 100644 (file)
@@ -53,7 +53,8 @@ main(int  argc,                               /* I - Number of command-line arguments */
                host[256],              /* Hostname */
                userpass[256],          /* Username/password */
                resource[256];          /* Resource path */
-  int          tls_options = _HTTP_TLS_NONE,
+  int          af = AF_UNSPEC,         /* Address family */
+               tls_options = _HTTP_TLS_NONE,
                                        /* TLS options */
                verbose = 0;            /* Verbosity */
   ipp_t                *request,               /* IPP Get-Printer-Attributes request */
@@ -95,6 +96,14 @@ main(int  argc,                              /* I - Number of command-line arguments */
     {
       verbose = 1;
     }
+    else if (!strcmp(argv[i], "-4"))
+    {
+      af = AF_INET;
+    }
+    else if (!strcmp(argv[i], "-6"))
+    {
+      af = AF_INET6;
+    }
     else if (argv[i][0] == '-')
     {
       printf("tlscheck: Unknown option '%s'.\n", argv[i]);
@@ -135,7 +144,7 @@ main(int  argc,                             /* I - Number of command-line arguments */
 
   _httpTLSSetOptions(tls_options);
 
-  http = httpConnect2(server, port, NULL, AF_UNSPEC, HTTP_ENCRYPTION_ALWAYS, 1, 30000, NULL);
+  http = httpConnect2(server, port, NULL, af, HTTP_ENCRYPTION_ALWAYS, 1, 30000, NULL);
   if (!http)
   {
     printf("%s: ERROR (%s)\n", server, cupsLastErrorString());
@@ -725,6 +734,8 @@ usage(void)
   puts("  --no-tls10  Disable TLS/1.0");
   puts("  --rc4       Allow RC4 encryption");
   puts("  --verbose   Be verbose");
+  puts("  -4          Connect using IPv4 addresses only");
+  puts("  -6          Connect using IPv6 addresses only");
   puts("  -v          Be verbose");
   puts("");
   puts("The default port is 631.");