/*
* Online help index routines for CUPS.
*
- * Copyright 2007-2015 by Apple Inc.
+ * Copyright 2007-2017 by Apple Inc.
* Copyright 1997-2007 by Easy Software Products.
*
* Licensed under Apache License v2.0. See the file "LICENSE" for more information.
* Look for "<TITLE>", "<A NAME", or "<!-- SECTION:" prefix...
*/
- if (!_cups_strncasecmp(line, "<!-- SECTION:", 13))
+ if ((ptr = strstr(line, "<!-- SECTION:")) != NULL)
{
/*
* Got section line, copy it!
*/
- for (ptr = line + 13; isspace(*ptr & 255); ptr ++);
+ for (ptr += 13; isspace(*ptr & 255); ptr ++);
strlcpy(section, ptr, sizeof(section));
if ((ptr = strstr(section, "-->")) != NULL)
anchor = NULL;
ptr += 6;
}
- else if (!_cups_strncasecmp(ptr, "A NAME=", 7))
+ else
{
+ char *idptr; /* Pointer to ID */
+
+ if (!_cups_strncasecmp(ptr, "A NAME=", 7))
+ ptr += 7;
+ else if ((idptr = strstr(ptr, " ID=")) != NULL)
+ ptr = idptr + 4;
+ else if ((idptr = strstr(ptr, " id=")) != NULL)
+ ptr = idptr + 4;
+ else
+ continue;
+
/*
* Found an anchor...
*/
- ptr += 7;
-
if (*ptr == '\"' || *ptr == '\'')
{
/*
for (ptr = anchor; *ptr && *ptr != '>' && !isspace(*ptr & 255); ptr ++);
- if (*ptr)
+ if (*ptr != '>')
*ptr++ = '\0';
else
break;
if (*ptr != '>')
break;
- ptr ++;
+ *ptr++ = '\0';
}
- else
- continue;
/*
* Now collect text for the link...
/*
* Help index test program for CUPS.
*
- * Copyright 2007-2011 by Apple Inc.
+ * Copyright 2007-2017 by Apple Inc.
* Copyright 1997-2007 by Easy Software Products.
*
* Licensed under Apache License v2.0. See the file "LICENSE" for more information.
*/
static void list_nodes(const char *title, cups_array_t *nodes);
+static int usage(void);
/*
main(int argc, /* I - Number of command-line arguments */
char *argv[]) /* I - Command-line arguments */
{
+ int i; /* Looping var */
help_index_t *hi, /* Help index */
*search; /* Search index */
+ const char *opt, /* Current option character */
+ *dir = ".", /* Directory to index */
+ *q = NULL, /* Query string */
+ *section = NULL, /* Section string */
+ *filename = NULL; /* Filename string */
+
+
+ /*
+ * Parse the command-line...
+ */
+ for (i = 1; i < argc; i ++)
+ {
+ if (argv[i][0] == '-')
+ {
+ if (!strcmp(argv[i], "--help"))
+ {
+ usage();
+ return (0);
+ }
+
+ for (opt = argv[i] + 1; *opt; opt ++)
+ {
+ switch (*opt)
+ {
+ case 'd' : /* -d directory */
+ i ++;
+ if (i < argc)
+ {
+ dir = argv[i];
+ }
+ else
+ {
+ fputs("testhi: Missing directory for \"-d\" option.\n", stderr);
+ return (usage());
+ }
+ break;
+
+ case 's' : /* -s section */
+ i ++;
+ if (i < argc)
+ {
+ section = argv[i];
+ }
+ else
+ {
+ fputs("testhi: Missing section name for \"-s\" option.\n", stderr);
+ return (usage());
+ }
+ break;
+
+ default :
+ fprintf(stderr, "testhi: Unknown option \"-%c\".\n", *opt);
+ return (usage());
+ }
+ }
+ }
+ else if (!q)
+ q = argv[i];
+ else if (!filename)
+ filename = argv[i];
+ else
+ {
+ fprintf(stderr, "testhi: Unknown argument \"%s\".\n", argv[i]);
+ return (usage());
+ }
+ }
/*
* Load the help index...
*/
- hi = helpLoadIndex("testhi.index", ".");
+ hi = helpLoadIndex("testhi.index", dir);
list_nodes("nodes", hi->nodes);
list_nodes("sorted", hi->sorted);
* Do any searches...
*/
- if (argc > 1)
+ if (q)
{
- search = helpSearchIndex(hi, argv[1], NULL, argv[2]);
+ search = helpSearchIndex(hi, q, section, filename);
if (search)
{
helpDeleteIndex(search);
}
else
- printf("%s (0 nodes)\n", argv[1]);
+ printf("%s (0 nodes)\n", q);
}
helpDeleteIndex(hi);
printf(" (%d words)\n", cupsArrayCount(node->words));
}
}
+
+
+/*
+ * 'usage()' - Show program usage.
+ */
+
+static int /* O - Exit status */
+usage(void)
+{
+ puts("Usage: ./testhi [options] [\"query\"] [filename]");
+ puts("Options:");
+ puts("-d directory Specify index directory.");
+ puts("-s section Specify search section.");
+
+ return (1);
+}
<p>CUPS supports self-signed, CA-signed, and enterprise certificates, with configurable certificate validation, cipher suite, and SSL/TLS version policies.</p>
<p>Out of the box, CUPS uses a Trust On First Use ("TOFU") certificate validation policy like the popular Secure Shell (ssh) software, requires TLS/1.0 or higher, only allows secure cipher suites, and automatically creates a "self-signed" certificate and private key for the scheduler so that remote administration operations and printer sharing are encrypted by default.</p>
- <h2>Configuring Client TLS Policies</h2>
+ <h2 class="title" id="CLIENT">Configuring Client TLS Policies</h2>
<p>The <a href="man-client.conf.html"><var>client.conf</var></a> file controls the client TLS policies. The default policy is:</p>
<pre class="command">
AllowAnyRoot Yes
SSLOptions AllowRC4 AllowSSL3
</pre>
- <h2>Configuring Server TLS Policies</h2>
+ <h2 class="title" id="SERVER">Configuring Server TLS Policies</h2>
<p>Two directives in the <a href="man-cups-files.conf.html"><var>cups-files.conf</var></a> file control the server (scheduler) TLS policies - <a href="man-cups-files.conf.html#CreateSelfSignedCerts"><code>CreateSelfSignedCerts</code></a> and <a href="man-cups-files.conf.html#ServerKeychain"><code>ServerKeychain</code></a>. The default policy creates self-signed certificates as needed.</p>
<p>The <a href="man-cupsd.conf.html#DefaultEncryption"><code>DefaultEncryption</code></a> and <a href="man-cupsd.conf.html#Encryption"><code>Encryption</code></a> directives in the <a href="man-cupsd.conf.html"><var>cupsd.conf</var></a> file control whether encryption is used. The default configuration requires encryption for remote access whenever authentication is required.</p>
- <h2><a name="PLATFORM">Platform Differences</a></h2>
+ <h2 class="title" id="PLATFORM">Platform Differences</h2>
<h3>macOS<sup>®</sup></h3>
<p>On macOS, client configuration settings for ordinary users are stored in the <var>~/Library/Preferences/org.cups.PrintingPrefs.plist</var> file. System-wide and user certificates are stored in the system and login keychains, with private CUPS keychains being used for self-signed and CUPS-managed certificates.</p>
<h3>Windows<sup>®</sup></h3>
<p>This help document describes the ports that CUPS uses so that firewall administrators can allow traffic used for printing.</p>
- <h2 class="title">Ports Used for Printer Sharing</h2>
+ <h2 class="title" id="SHARING">Ports Used for Printer Sharing</h2>
<p>Table 1 lists the ports that are used for IPP printer sharing via CUPS.</p>
</table></div>
- <h2 class="title">Ports Used for Network Printers</h2>
+ <h2 class="title" id="PRINTERS">Ports Used for Network Printers</h2>
<p>Table 3 lists the outgoing ports that are used for network printers.</p>