-CHANGES.txt - 05/15/2002
+CHANGES.txt - 05/16/2002
------------------------
CHANGES IN CUPS V1.1.15
- Updated the CUPS license agreement for the new MacOS
and OpenSSL license exceptions.
+ - Now use strlcat() and strlcpy() (or emulation
+ functions) for easier string/buffer protection.
- The auto-generated printcap/printers.conf files now
have a small comment header explaining where the file
comes from...
/*
- * "$Id: ieee1394-linux.c,v 1.1 2002/05/04 16:58:23 mike Exp $"
+ * "$Id: ieee1394-linux.c,v 1.2 2002/05/16 13:44:50 mike Exp $"
*
* Linux IEEE-1394 glue for the Common UNIX Printing System (CUPS).
*
* Use the description directly...
*/
- strncpy(nodes[num_nodes].make_model, idptr,
- sizeof(nodes[num_nodes].make_model) - 1);
+ strlcpy(nodes[num_nodes].make_model, idptr,
+ sizeof(nodes[num_nodes].make_model));
}
else
{
/*
- * End of "$Id: ieee1394-linux.c,v 1.1 2002/05/04 16:58:23 mike Exp $".
+ * End of "$Id: ieee1394-linux.c,v 1.2 2002/05/16 13:44:50 mike Exp $".
*/
/*
- * "$Id: ipp.c,v 1.61 2002/04/24 19:54:24 mike Exp $"
+ * "$Id: ipp.c,v 1.62 2002/05/16 13:44:50 mike Exp $"
*
* IPP backend for the Common UNIX Printing System (CUPS).
*
close(fd);
}
else
- {
- strncpy(filename, argv[6], sizeof(filename) - 1);
- filename[sizeof(filename) - 1] = '\0';
- }
+ strlcpy(filename, argv[6], sizeof(filename));
/*
* Extract the hostname and printer name from the URI...
/*
- * End of "$Id: ipp.c,v 1.61 2002/04/24 19:54:24 mike Exp $".
+ * End of "$Id: ipp.c,v 1.62 2002/05/16 13:44:50 mike Exp $".
*/
/*
- * "$Id: lpd.c,v 1.35 2002/03/25 17:13:55 mike Exp $"
+ * "$Id: lpd.c,v 1.36 2002/05/16 13:44:50 mike Exp $"
*
* Line Printer Daemon backend for the Common UNIX Printing System (CUPS).
*
close(fd);
}
else
- {
- strncpy(filename, argv[6], sizeof(filename) - 1);
- filename[sizeof(filename) - 1] = '\0';
- }
+ strlcpy(filename, argv[6], sizeof(filename));
/*
* Extract the hostname and printer name from the URI...
* Sanitize the document title...
*/
- strncpy(title, argv[3], sizeof(title) - 1);
- title[sizeof(title) - 1] = '\0';
+ strlcpy(title, argv[3], sizeof(title));
for (ptr = title; *ptr; ptr ++)
if (!isalnum(*ptr) && !isspace(*ptr))
#endif /* !HAVE_RRESVPORT */
/*
- * End of "$Id: lpd.c,v 1.35 2002/03/25 17:13:55 mike Exp $".
+ * End of "$Id: lpd.c,v 1.36 2002/05/16 13:44:50 mike Exp $".
*/
/*
- * "$Id: parallel.c,v 1.42 2002/03/25 18:10:08 mike Exp $"
+ * "$Id: parallel.c,v 1.43 2002/05/16 13:44:50 mike Exp $"
*
* Parallel port backend for the Common UNIX Printing System (CUPS).
*
if (strncmp(line, "MODEL:", 6) == 0 &&
strncmp(line, "MODEL:Unknown", 13) != 0)
- strncpy(model, line + 6, sizeof(model) - 1);
+ strlcpy(model, line + 6, sizeof(model));
else if (strncmp(line, "MANUFACTURER:", 13) == 0 &&
strncmp(line, "MANUFACTURER:Unknown", 20) != 0)
- strncpy(make, line + 13, sizeof(make) - 1);
+ strlcpy(make, line + 13, sizeof(make));
}
fclose(probe);
/*
- * End of "$Id: parallel.c,v 1.42 2002/03/25 18:10:08 mike Exp $".
+ * End of "$Id: parallel.c,v 1.43 2002/05/16 13:44:50 mike Exp $".
*/
/*
- * "$Id: usb.c,v 1.29 2002/03/25 18:10:08 mike Exp $"
+ * "$Id: usb.c,v 1.30 2002/05/16 13:44:50 mike Exp $"
*
* USB port backend for the Common UNIX Printing System (CUPS).
*
if (strncmp(line, "S: Manufacturer=", 17) == 0)
{
- strncpy(make, line + 17, sizeof(make) - 1);
+ strlcpy(make, line + 17, sizeof(make));
if (strcmp(make, "Hewlett-Packard") == 0)
strcpy(make, "HP");
}
else if (strncmp(line, "S: Product=", 12) == 0)
- strncpy(model, line + 12, sizeof(model) - 1);
+ strlcpy(model, line + 12, sizeof(model));
}
else if (strncmp(line, "I:", 2) == 0 &&
(strstr(line, "Driver=printer") != NULL ||
/*
- * End of "$Id: usb.c,v 1.29 2002/03/25 18:10:08 mike Exp $".
+ * End of "$Id: usb.c,v 1.30 2002/05/16 13:44:50 mike Exp $".
*/
lpc.o: ../cups/cups.h ../cups/ipp.h ../cups/http.h ../cups/md5.h
lpc.o: ../cups/ppd.h ../cups/language.h ../cups/debug.h
-lpq.o: ../config.h ../cups/cups.h ../cups/ipp.h ../cups/http.h ../cups/md5.h
-lpq.o: ../cups/ppd.h ../cups/language.h ../cups/debug.h
+lpq.o: ../cups/string.h ../config.h ../cups/cups.h ../cups/ipp.h
+lpq.o: ../cups/http.h ../cups/md5.h ../cups/ppd.h ../cups/language.h
+lpq.o: ../cups/debug.h
lpr.o: ../config.h ../cups/cups.h ../cups/ipp.h ../cups/http.h ../cups/md5.h
lpr.o: ../cups/ppd.h
lprm.o: ../cups/cups.h ../cups/ipp.h ../cups/http.h ../cups/md5.h
/*
- * "$Id: lpq.c,v 1.20 2002/01/02 17:58:35 mike Exp $"
+ * "$Id: lpq.c,v 1.21 2002/05/16 13:44:51 mike Exp $"
*
* "lpq" command for the Common UNIX Printing System (CUPS).
*
#include <stdio.h>
#include <stdlib.h>
-#include <ctype.h>
-#include <config.h>
+#include <cups/string.h>
#include <cups/cups.h>
#include <cups/language.h>
#include <cups/debug.h>
snprintf(namestr, sizeof(namestr), "%d copies of %s", jobcopies,
jobname);
else
- {
- strncpy(namestr, jobname, sizeof(namestr) - 1);
- namestr[sizeof(namestr) - 1] = '\0';
- }
+ strlcpy(namestr, jobname, sizeof(namestr));
printf("%s: %-34.34s[job %d localhost]\n", jobuser, rankstr, jobid);
printf(" %-40.40s%d bytes\n", namestr, jobsize);
/*
- * End of "$Id: lpq.c,v 1.20 2002/01/02 17:58:35 mike Exp $".
+ * End of "$Id: lpq.c,v 1.21 2002/05/16 13:44:51 mike Exp $".
*/
# DO NOT DELETE
-html.o: cgi.h
+html.o: cgi.h ../cups/string.h ../config.h
ipp-var.o: ipp-var.h ../cups/cups.h ../cups/ipp.h ../cups/http.h
ipp-var.o: ../cups/md5.h ../cups/ppd.h ../cups/debug.h ../cups/language.h
ipp-var.o: ../cups/string.h ../config.h cgi.h
-template.o: cgi.h
-var.o: cgi.h
+template.o: cgi.h ../cups/string.h ../config.h
+var.o: cgi.h ../cups/string.h ../config.h
admin.o: ipp-var.h ../cups/cups.h ../cups/ipp.h ../cups/http.h ../cups/md5.h
admin.o: ../cups/ppd.h ../cups/debug.h ../cups/language.h ../cups/string.h
admin.o: ../config.h cgi.h
/*
- * "$Id: admin.c,v 1.26 2002/03/25 17:51:17 mike Exp $"
+ * "$Id: admin.c,v 1.27 2002/05/16 13:44:51 mike Exp $"
*
* Administration CGI for the Common UNIX Printing System (CUPS).
*
if (oldinfo &&
(attr = ippFindAttribute(oldinfo, "device-uri", IPP_TAG_URI)) != NULL)
{
- strncpy(uri, attr->values[0].string.text, sizeof(uri) - 1);
- uri[sizeof(uri) - 1] = '\0';
+ strlcpy(uri, attr->values[0].string.text, sizeof(uri));
if ((uriptr = strchr(uri, ':')) != NULL && strncmp(uriptr, "://", 3) == 0)
*uriptr = '\0';
* Let the user choose a model...
*/
- strncpy(make, var, sizeof(make) - 1);
- make[sizeof(make) - 1] = '\0';
+ strlcpy(make, var, sizeof(make));
ippSetCGIVars(response, "ppd-make", make);
cgiCopyTemplateLang(stdout, TEMPLATES, "choose-model.tmpl",
ippAddString(request, IPP_TAG_PRINTER, IPP_TAG_NAME, "ppd-name",
NULL, cgiGetVariable("PPD_NAME"));
- strncpy(uri, cgiGetVariable("DEVICE_URI"), sizeof(uri) - 1);
- uri[sizeof(uri) - 1] = '\0';
+ strlcpy(uri, cgiGetVariable("DEVICE_URI"), sizeof(uri));
if (strncmp(uri, "serial:", 7) == 0)
{
/*
* Get default option name...
*/
- strncpy(keyword, line + 8, sizeof(keyword) - 1);
- keyword[sizeof(keyword) - 1] = '\0';
+ strlcpy(keyword, line + 8, sizeof(keyword));
for (keyptr = keyword; *keyptr; keyptr ++)
if (*keyptr == ':' || isspace(*keyptr))
/*
- * End of "$Id: admin.c,v 1.26 2002/03/25 17:51:17 mike Exp $".
+ * End of "$Id: admin.c,v 1.27 2002/05/16 13:44:51 mike Exp $".
*/
/*
- * "$Id: cgi.h,v 1.14 2002/01/27 21:16:09 mike Exp $"
+ * "$Id: cgi.h,v 1.15 2002/05/16 13:44:52 mike Exp $"
*
* CGI support library definitions.
*
# include <stdio.h>
# include <stdlib.h>
-# include <string.h>
-# include <ctype.h>
# include <time.h>
+# include <cups/string.h>
+
# ifdef WIN32
# include <direct.h>
# include <io.h>
# endif /* WIN32 */
-/*
- * Stuff for WIN32 and OS/2...
- */
-
-# if defined(WIN32) || defined(__EMX__)
-# define strcasecmp stricmp
-# define strncasecmp strnicmp
-# endif /* WIN32 || __EMX__ */
-
-
/*
* Prototypes...
*/
#endif /* !_CGI_H_ */
/*
- * End of "$Id: cgi.h,v 1.14 2002/01/27 21:16:09 mike Exp $".
+ * End of "$Id: cgi.h,v 1.15 2002/05/16 13:44:52 mike Exp $".
*/
/*
- * "$Id: ipp-var.c,v 1.27 2002/04/08 16:28:31 mike Exp $"
+ * "$Id: ipp-var.c,v 1.28 2002/05/16 13:44:52 mike Exp $"
*
* IPP variable routines for the Common UNIX Printing System (CUPS).
*
* Copy values...
*/
- value[0] = '\0'; /* Initially an empty string */
- value[sizeof(value) - 1] = '\0'; /* In case string gets full */
- valptr = value; /* Start at the beginning */
+ value[0] = '\0'; /* Initially an empty string */
+ valptr = value; /* Start at the beginning */
for (i = 0; i < attr->num_values; i ++)
{
if (i)
- strncat(valptr, ",", sizeof(value) - (valptr - value) - 1);
+ strlcat(valptr, ",", sizeof(value) - (valptr - value));
valptr += strlen(valptr);
break;
case IPP_TAG_NOVALUE :
- strncat(valptr, "novalue", sizeof(value) - (valptr - value) - 1);
+ strlcat(valptr, "novalue", sizeof(value) - (valptr - value));
break;
case IPP_TAG_RANGE :
* Make URI relative to the current server...
*/
- strncpy(uri, resource, sizeof(uri) - 1);
- uri[sizeof(uri) - 1] = '\0';
+ strlcpy(uri, resource, sizeof(uri));
}
else
{
hostname, port, resource);
}
- strncat(valptr, uri, sizeof(value) - (valptr - value) - 1);
+ strlcat(valptr, uri, sizeof(value) - (valptr - value));
break;
}
}
case IPP_TAG_KEYWORD :
case IPP_TAG_CHARSET :
case IPP_TAG_LANGUAGE :
- strncat(valptr, attr->values[i].string.text,
- sizeof(value) - (valptr - value) - 1);
+ strlcat(valptr, attr->values[i].string.text,
+ sizeof(value) - (valptr - value));
break;
default :
/*
- * End of "$Id: ipp-var.c,v 1.27 2002/04/08 16:28:31 mike Exp $".
+ * End of "$Id: ipp-var.c,v 1.28 2002/05/16 13:44:52 mike Exp $".
*/
/*
- * "$Id: template.c,v 1.25 2002/01/02 17:58:37 mike Exp $"
+ * "$Id: template.c,v 1.26 2002/05/16 13:44:52 mike Exp $"
*
* CGI template function.
*
if ((innerval = cgiGetArray(innername, atoi(innerptr) - 1)) == NULL)
*s = '\0';
else
- {
- strncpy(s, innerval, sizeof(compare) - (s - compare) - 1);
- compare[sizeof(compare) - 1] = '\0';
- }
+ strlcpy(s, innerval, sizeof(compare) - (s - compare));
}
else if (innername[0] == '?')
{
if ((innerval = cgiGetArray(innername + 1, element)) == NULL)
*s = '\0';
else
- {
- strncpy(s, innerval, sizeof(compare) - (s - compare) - 1);
- compare[sizeof(compare) - 1] = '\0';
- }
+ strlcpy(s, innerval, sizeof(compare) - (s - compare));
}
else if ((innerval = cgiGetArray(innername, element)) == NULL)
snprintf(s, sizeof(s), "{%s}", innername);
else
- {
- strncpy(s, innerval, sizeof(compare) - (s - compare) - 1);
- compare[sizeof(compare) - 1] = '\0';
- }
+ strlcpy(s, innerval, sizeof(compare) - (s - compare));
s += strlen(s);
}
/*
- * End of "$Id: template.c,v 1.25 2002/01/02 17:58:37 mike Exp $".
+ * End of "$Id: template.c,v 1.26 2002/05/16 13:44:52 mike Exp $".
*/
dnl
-dnl "$Id: cups-common.m4,v 1.16 2002/03/08 19:48:58 mike Exp $"
+dnl "$Id: cups-common.m4,v 1.17 2002/05/16 13:44:53 mike Exp $"
dnl
dnl Common configuration stuff for the Common UNIX Printing System (CUPS).
dnl
AC_CHECK_HEADER(sys/ioctl.h,AC_DEFINE(HAVE_SYS_IOCTL_H))
dnl Checks for string functions.
-AC_CHECK_FUNCS(strdup strcasecmp strncasecmp)
+AC_CHECK_FUNCS(strdup strcasecmp strncasecmp strlcat strlcpy)
if test "$uname" = "HP-UX" -a "$uversion" = "1020"; then
echo Forcing snprintf emulation for HP-UX.
else
AC_SUBST(ARFLAGS)
dnl
-dnl End of "$Id: cups-common.m4,v 1.16 2002/03/08 19:48:58 mike Exp $".
+dnl End of "$Id: cups-common.m4,v 1.17 2002/05/16 13:44:53 mike Exp $".
dnl
/*
- * "$Id: config.h.in,v 1.56 2002/03/28 21:48:43 mike Exp $"
+ * "$Id: config.h.in,v 1.57 2002/05/16 13:44:49 mike Exp $"
*
* Configuration file for the Common UNIX Printing System (CUPS).
*
#undef HAVE_STRDUP
#undef HAVE_STRCASECMP
#undef HAVE_STRNCASECMP
+#undef HAVE_STRLCAT
+#undef HAVE_STRLCPY
/*
/*
- * End of "$Id: config.h.in,v 1.56 2002/03/28 21:48:43 mike Exp $".
+ * End of "$Id: config.h.in,v 1.57 2002/05/16 13:44:49 mike Exp $".
*/
/*
- * "$Id: dest.c,v 1.30 2002/03/22 14:21:42 mike Exp $"
+ * "$Id: dest.c,v 1.31 2002/05/16 13:44:53 mike Exp $"
*
* User-defined destination (and option) support for the Common UNIX
* Printing System (CUPS).
* Grab printer and instance name...
*/
- strncpy(name, defprinter, sizeof(name) - 1);
- name[sizeof(name) - 1] = '\0';
+ strlcpy(name, defprinter, sizeof(name));
if ((instance = strchr(name, '/')) != NULL)
*instance++ = '\0';
/*
- * End of "$Id: dest.c,v 1.30 2002/03/22 14:21:42 mike Exp $".
+ * End of "$Id: dest.c,v 1.31 2002/05/16 13:44:53 mike Exp $".
*/
/*
- * "$Id: http.c,v 1.96 2002/04/09 19:27:06 mike Exp $"
+ * "$Id: http.c,v 1.97 2002/05/16 13:44:53 mike Exp $"
*
* HTTP routines for the Common UNIX Printing System (CUPS) scheduler.
*
* Copy the hostname and port and then "reconnect"...
*/
- strncpy(http->hostname, host, sizeof(http->hostname) - 1);
+ strlcpy(http->hostname, host, sizeof(http->hostname));
http->hostaddr.sin_family = hostaddr->h_addrtype;
#ifdef WIN32
http->hostaddr.sin_port = htons((u_short)port);
* Loop through the addresses we have until one of them connects...
*/
- strncpy(http->hostname, host, sizeof(http->hostname) - 1);
+ strlcpy(http->hostname, host, sizeof(http->hostname));
for (i = 0; hostaddr->h_addr_list[i]; i ++)
{
* longer than HTTP_MAX_URI characters long...
*/
- strncpy(safeuri, uri, sizeof(safeuri));
- safeuri[sizeof(safeuri) - 1] = '\0';
+ strlcpy(safeuri, uri, sizeof(safeuri));
uri = safeuri;
{
if ((ptr = strchr(host, '/')) != NULL)
{
- strncpy(resource, ptr, HTTP_MAX_URI);
- resource[HTTP_MAX_URI - 1] = '\0';
+ strlcpy(resource, ptr, HTTP_MAX_URI);
*ptr = '\0';
}
else
*port = strtol(uri, (char **)&uri, 10);
if (*uri == '/')
- {
- strncpy(resource, uri, HTTP_MAX_URI);
- resource[HTTP_MAX_URI - 1] = '\0';
- }
+ strlcpy(resource, uri, HTTP_MAX_URI);
}
else
*port = 631;
return;
}
else
- {
- strncpy(method, host, 31);
- method[31] = '\0';
- }
+ strlcpy(method, host, 32);
}
/*
if (strncmp(uri, "//", 2) != 0)
{
- strncpy(resource, uri, 1023);
- resource[1023] = '\0';
+ strlcpy(resource, uri, HTTP_MAX_URI);
username[0] = '\0';
host[0] = '\0';
* The remaining portion is the resource string...
*/
- strncpy(resource, uri, HTTP_MAX_URI);
- resource[HTTP_MAX_URI - 1] = '\0';
+ strlcpy(resource, uri, HTTP_MAX_URI);
}
value == NULL)
return;
- strncpy(http->fields[field], value, HTTP_MAX_VALUE - 1);
- http->fields[field][HTTP_MAX_VALUE - 1] = '\0';
+ strlcpy(http->fields[field], value, HTTP_MAX_VALUE);
}
/*
- * End of "$Id: http.c,v 1.96 2002/04/09 19:27:06 mike Exp $".
+ * End of "$Id: http.c,v 1.97 2002/05/16 13:44:53 mike Exp $".
*/
/*
- * "$Id: language.c,v 1.26 2002/03/01 19:53:29 mike Exp $"
+ * "$Id: language.c,v 1.27 2002/05/16 13:44:54 mike Exp $"
*
* I18N/language support for the Common UNIX Printing System (CUPS).
*
* Copy the locale string over safely...
*/
- strncpy(langname, language, sizeof(langname) - 1);
- langname[sizeof(langname) - 1] = '\0';
+ strlcpy(langname, language, sizeof(langname));
}
if (strlen(langname) < 2)
* Add charset...
*/
- strncpy(real + count, langname + count, sizeof(real) - count - 1);
- langname[count] = '\0';
+ strlcpy(real + count, langname + count, sizeof(real) - count);
count += strlen(real + count);
/*
*/
if (fp == NULL)
- {
- strncpy(line, lang_default[0], sizeof(line) - 1);
- line[sizeof(line) - 1] = '\0';
- }
+ strlcpy(line, lang_default[0], sizeof(line));
else if (fgets(line, sizeof(line), fp) == NULL)
{
/*
*/
lang->used ++;
- strncpy(lang->language, langname, sizeof(lang->language) - 1);
- lang->language[sizeof(lang->language) - 1] = '\0';
+ strlcpy(lang->language, langname, sizeof(lang->language));
for (i = 0; i < (sizeof(lang_encodings) / sizeof(lang_encodings[0])); i ++)
if (strcmp(lang_encodings[i], line) == 0)
if (lang_default[count] == NULL)
break;
- strncpy(line, lang_default[count], sizeof(line) - 1);
- /* Already set last byte to 0 above... */
+ strlcpy(line, lang_default[count], sizeof(line));
}
else if (fgets(line, sizeof(line), fp) == NULL)
break;
/*
- * End of "$Id: language.c,v 1.26 2002/03/01 19:53:29 mike Exp $".
+ * End of "$Id: language.c,v 1.27 2002/05/16 13:44:54 mike Exp $".
*/
/*
- * "$Id: ppd.c,v 1.67 2002/05/14 16:13:48 mike Exp $"
+ * "$Id: ppd.c,v 1.68 2002/05/16 13:44:54 mike Exp $"
*
* PPD file routines for the Common UNIX Printing System (CUPS).
*
ppd->num_groups ++;
memset(group, 0, sizeof(ppd_group_t));
- strncpy(group->text, name, sizeof(group->text) - 1);
+ strlcpy(group->text, name, sizeof(group->text));
}
return (group);
group->num_options ++;
memset(option, 0, sizeof(ppd_option_t));
- strncpy(option->keyword, name, sizeof(option->keyword) - 1);
+ strlcpy(option->keyword, name, sizeof(option->keyword));
}
return (option);
option->num_choices ++;
memset(choice, 0, sizeof(ppd_choice_t));
- strncpy(choice->choice, name, sizeof(choice->choice) - 1);
+ strlcpy(choice->choice, name, sizeof(choice->choice));
return (choice);
}
ppd->num_sizes ++;
memset(size, 0, sizeof(ppd_size_t));
- strncpy(size->name, name, sizeof(size->name) - 1);
+ strlcpy(size->name, name, sizeof(size->name));
return (size);
}
ppd->num_profiles ++;
memset(profile, 0, sizeof(ppd_profile_t));
- strncpy(profile->resolution, name, sizeof(profile->resolution) - 1);
- strncpy(profile->media_type, text, sizeof(profile->media_type) - 1);
+ strlcpy(profile->resolution, name, sizeof(profile->resolution));
+ strlcpy(profile->media_type, text, sizeof(profile->media_type));
sscanf(string, "%f%f%f%f%f%f%f%f%f%f%f", &(profile->density),
&(profile->gamma),
profile->matrix[0] + 0, profile->matrix[0] + 1,
return (NULL);
}
- strncpy(choice->text, cupsLangString(language, CUPS_MSG_VARIABLE),
- sizeof(choice->text) - 1);
+ strlcpy(choice->text, cupsLangString(language, CUPS_MSG_VARIABLE),
+ sizeof(choice->text));
option = NULL;
}
else if (strcmp(keyword, "MaxMediaWidth") == 0)
return (NULL);
}
- strncpy(choice->text, cupsLangString(language, CUPS_MSG_VARIABLE),
- sizeof(choice->text) - 1);
+ strlcpy(choice->text, cupsLangString(language, CUPS_MSG_VARIABLE),
+ sizeof(choice->text));
option = NULL;
}
if (text[0])
{
- strncpy(option->text, text, sizeof(option->text) - 1);
+ strlcpy(option->text, text, sizeof(option->text));
ppd_fix(option->text);
}
else
{
if (strcmp(name, "PageSize") == 0)
- strncpy(option->text, cupsLangString(language, CUPS_MSG_MEDIA_SIZE),
- sizeof(option->text) - 1);
+ strlcpy(option->text, cupsLangString(language, CUPS_MSG_MEDIA_SIZE),
+ sizeof(option->text));
else if (strcmp(name, "MediaType") == 0)
- strncpy(option->text, cupsLangString(language, CUPS_MSG_MEDIA_TYPE),
- sizeof(option->text) - 1);
+ strlcpy(option->text, cupsLangString(language, CUPS_MSG_MEDIA_TYPE),
+ sizeof(option->text));
else if (strcmp(name, "InputSlot") == 0)
- strncpy(option->text, cupsLangString(language, CUPS_MSG_MEDIA_SOURCE),
- sizeof(option->text) - 1);
+ strlcpy(option->text, cupsLangString(language, CUPS_MSG_MEDIA_SOURCE),
+ sizeof(option->text));
else if (strcmp(name, "ColorModel") == 0)
- strncpy(option->text, cupsLangString(language, CUPS_MSG_OUTPUT_MODE),
- sizeof(option->text) - 1);
+ strlcpy(option->text, cupsLangString(language, CUPS_MSG_OUTPUT_MODE),
+ sizeof(option->text));
else if (strcmp(name, "Resolution") == 0)
- strncpy(option->text, cupsLangString(language, CUPS_MSG_RESOLUTION),
- sizeof(option->text) - 1);
+ strlcpy(option->text, cupsLangString(language, CUPS_MSG_RESOLUTION),
+ sizeof(option->text));
else
- strncpy(option->text, name, sizeof(option->text) - 1);
+ strlcpy(option->text, name, sizeof(option->text));
}
option->section = PPD_ORDER_ANY;
else
option->ui = PPD_UI_PICKONE;
- strncpy(option->text, text, sizeof(option->text) - 1);
+ strlcpy(option->text, text, sizeof(option->text));
option->section = PPD_ORDER_JCL;
group = NULL;
for (i = 0; i < temp->num_options; i ++)
if (strcmp(keyword, temp->options[i].keyword) == 0)
{
- strncpy(temp->options[i].defchoice, string,
- sizeof(temp->options[i].defchoice) - 1);
+ strlcpy(temp->options[i].defchoice, string,
+ sizeof(temp->options[i].defchoice));
break;
}
}
else
- strncpy(option->defchoice, string, sizeof(option->defchoice) - 1);
+ strlcpy(option->defchoice, string, sizeof(option->defchoice));
}
else if (strcmp(keyword, "UIConstraints") == 0 ||
strcmp(keyword, "NonUIConstraints") == 0)
if (mask & PPD_TEXT)
{
- strncpy(choice->text, text, sizeof(choice->text) - 1);
+ strlcpy(choice->text, text, sizeof(choice->text));
ppd_fix(choice->text);
}
else if (strcmp(name, "True") == 0)
else if (strcmp(name, "False") == 0)
strcpy(choice->text, "No");
else
- strncpy(choice->text, name, sizeof(choice->text) - 1);
+ strlcpy(choice->text, name, sizeof(choice->text));
if (option->section == PPD_ORDER_JCL)
ppd_decode(string); /* Decode quoted string */
/*
- * End of "$Id: ppd.c,v 1.67 2002/05/14 16:13:48 mike Exp $".
+ * End of "$Id: ppd.c,v 1.68 2002/05/16 13:44:54 mike Exp $".
*/
/*
- * "$Id: snprintf.c,v 1.6 2002/03/01 19:53:30 mike Exp $"
+ * "$Id: snprintf.c,v 1.7 2002/05/16 13:44:54 mike Exp $"
*
* snprintf functions for the Common UNIX Printing System (CUPS).
*
*
* Contents:
*
- * vsnprintf() - Format a string into a fixed size buffer.
- * snprintf() - Format a string into a fixed size buffer.
+ * cups_vsnprintf() - Format a string into a fixed size buffer.
+ * cups_snprintf() - Format a string into a fixed size buffer.
*/
/*
#ifndef HAVE_VSNPRINTF
/*
- * 'vsnprintf()' - Format a string into a fixed size buffer.
+ * 'cups_vsnprintf()' - Format a string into a fixed size buffer.
*/
-int /* O - Number of bytes formatted */
-vsnprintf(char *buffer, /* O - Output buffer */
- size_t bufsize, /* O - Size of output buffer */
- const char *format, /* I - printf-style format string */
- va_list ap) /* I - Pointer to additional arguments */
+int /* O - Number of bytes formatted */
+cups_vsnprintf(char *buffer, /* O - Output buffer */
+ size_t bufsize, /* O - Size of output buffer */
+ const char *format, /* I - printf-style format string */
+ va_list ap) /* I - Pointer to additional arguments */
{
- char *bufptr, /* Pointer to position in buffer */
- *bufend, /* Pointer to end of buffer */
- sign, /* Sign of format width */
- size, /* Size character (h, l, L) */
- type; /* Format type character */
- const char *bufformat; /* Start of format */
- int width, /* Width of field */
- prec; /* Number of characters of precision */
- char tformat[100], /* Temporary format string for sprintf() */
- temp[1024]; /* Buffer for formatted numbers */
- int *chars; /* Pointer to integer for %p */
- char *s; /* Pointer to string */
- int slen; /* Length of string */
+ char *bufptr, /* Pointer to position in buffer */
+ *bufend, /* Pointer to end of buffer */
+ sign, /* Sign of format width */
+ size, /* Size character (h, l, L) */
+ type; /* Format type character */
+ const char *bufformat; /* Start of format */
+ int width, /* Width of field */
+ prec; /* Number of characters of precision */
+ char tformat[100], /* Temporary format string for sprintf() */
+ temp[1024]; /* Buffer for formatted numbers */
+ int *chars; /* Pointer to integer for %p */
+ char *s; /* Pointer to string */
+ int slen; /* Length of string */
/*
#ifndef HAVE_SNPRINTF
/*
- * 'snprintf()' - Format a string into a fixed size buffer.
+ * 'cups_snprintf()' - Format a string into a fixed size buffer.
*/
-int /* O - Number of bytes formatted */
-snprintf(char *buffer, /* O - Output buffer */
- size_t bufsize, /* O - Size of output buffer */
- const char *format, /* I - printf-style format string */
- ...) /* I - Additional arguments as needed */
+int /* O - Number of bytes formatted */
+cups_snprintf(char *buffer, /* O - Output buffer */
+ size_t bufsize, /* O - Size of output buffer */
+ const char *format, /* I - printf-style format string */
+ ...) /* I - Additional arguments as needed */
{
- int bytes; /* Number of bytes formatted */
- va_list ap; /* Pointer to additional arguments */
+ int bytes; /* Number of bytes formatted */
+ va_list ap; /* Pointer to additional arguments */
va_start(ap, format);
/*
- * End of "$Id: snprintf.c,v 1.6 2002/03/01 19:53:30 mike Exp $".
+ * End of "$Id: snprintf.c,v 1.7 2002/05/16 13:44:54 mike Exp $".
*/
/*
- * "$Id: string.c,v 1.7 2002/03/01 19:53:30 mike Exp $"
+ * "$Id: string.c,v 1.8 2002/05/16 13:44:54 mike Exp $"
*
* String functions for the Common UNIX Printing System (CUPS).
*
*
* Contents:
*
- * strdup() - Duplicate a string.
- * strcasecmp() - Do a case-insensitive comparison.
- * strncasecmp() - Do a case-insensitive comparison on up to N chars.
+ * cups_strdup() - Duplicate a string.
+ * cups_strcasecmp() - Do a case-insensitive comparison.
+ * cups_strncasecmp() - Do a case-insensitive comparison on up to N chars.
+ * cups_strlcat() - Safely concatenate two strings.
+ * cups_strlcpy() - Safely copy two strings.
*/
/*
/*
- * 'strdup()' - Duplicate a string.
+ * 'cups_strdup()' - Duplicate a string.
*/
-# ifndef HAVE_STRDUP
-char * /* O - New string pointer */
-strdup(const char *s) /* I - String to duplicate */
+#ifndef HAVE_STRDUP
+char * /* O - New string pointer */
+cups_strdup(const char *s) /* I - String to duplicate */
{
- char *t; /* New string pointer */
+ char *t; /* New string pointer */
if (s == NULL)
return (strcpy(t, s));
}
-# endif /* !HAVE_STRDUP */
+#endif /* !HAVE_STRDUP */
/*
- * 'strcasecmp()' - Do a case-insensitive comparison.
+ * 'cups_strcasecmp()' - Do a case-insensitive comparison.
*/
-# ifndef HAVE_STRCASECMP
+#ifndef HAVE_STRCASECMP
int /* O - Result of comparison (-1, 0, or 1) */
-strcasecmp(const char *s, /* I - First string */
- const char *t) /* I - Second string */
+cups_strcasecmp(const char *s, /* I - First string */
+ const char *t) /* I - Second string */
{
while (*s != '\0' && *t != '\0')
{
else
return (-1);
}
-# endif /* !HAVE_STRCASECMP */
+#endif /* !HAVE_STRCASECMP */
/*
- * 'strncasecmp()' - Do a case-insensitive comparison on up to N chars.
+ * 'cups_strncasecmp()' - Do a case-insensitive comparison on up to N chars.
*/
-# ifndef HAVE_STRNCASECMP
+#ifndef HAVE_STRNCASECMP
int /* O - Result of comparison (-1, 0, or 1) */
-strncasecmp(const char *s, /* I - First string */
- const char *t, /* I - Second string */
- size_t n) /* I - Maximum number of characters to compare */
+cups_strncasecmp(const char *s, /* I - First string */
+ const char *t, /* I - Second string */
+ size_t n) /* I - Maximum number of characters to compare */
{
while (*s != '\0' && *t != '\0' && n > 0)
{
else
return (-1);
}
-# endif /* !HAVE_STRNCASECMP */
+#endif /* !HAVE_STRNCASECMP */
+#ifndef HAVE_STRLCAT
/*
- * End of "$Id: string.c,v 1.7 2002/03/01 19:53:30 mike Exp $".
+ * 'cups_strlcat()' - Safely concatenate two strings.
+ */
+
+size_t /* O - Length of string */
+cups_strlcat(char *dst, /* O - Destination string */
+ const char *src, /* I - Source string */
+ size_t size) /* I - Size of destination string buffer */
+{
+ size_t srclen; /* Length of source string */
+ size_t dstlen; /* Length of destination string */
+
+
+ /*
+ * Figure out how much room is left...
+ */
+
+ dstlen = strlen(dst);
+ size -= dstlen + 1;
+
+ if (!size)
+ return (dstlen); /* No room, return immediately... */
+
+ /*
+ * Figure out how much room is needed...
+ */
+
+ srclen = strlen(src);
+
+ /*
+ * Copy the appropriate amount...
+ */
+
+ if (srclen > size)
+ srclen = size;
+
+ memcpy(dst + dstlen, src, srclen);
+ dst[dstlen + srclen] = '\0';
+
+ return (dstlen + srclen);
+}
+#endif /* !HAVE_STRLCAT */
+
+
+#ifndef HAVE_STRLCPY
+/*
+ * 'cups_strlcpy()' - Safely copy two strings.
+ */
+
+size_t /* O - Length of string */
+cups_strlcpy(char *dst, /* O - Destination string */
+ const char *src, /* I - Source string */
+ size_t size) /* I - Size of destination string buffer */
+{
+ size_t srclen; /* Length of source string */
+
+
+ /*
+ * Figure out how much room is needed...
+ */
+
+ size --;
+
+ srclen = strlen(src);
+
+ /*
+ * Copy the appropriate amount...
+ */
+
+ if (srclen > size)
+ srclen = size;
+
+ memcpy(dst, src, srclen);
+ dst[srclen] = '\0';
+
+ return (srclen);
+}
+#endif /* !HAVE_STRLCPY */
+
+
+/*
+ * End of "$Id: string.c,v 1.8 2002/05/16 13:44:54 mike Exp $".
*/
/*
- * "$Id: string.h,v 1.12 2002/05/15 01:52:16 mike Exp $"
+ * "$Id: string.h,v 1.13 2002/05/16 13:44:54 mike Exp $"
*
* String definitions for the Common UNIX Printing System (CUPS).
*
*/
# ifndef HAVE_STRDUP
-extern char *strdup(const char *);
+extern char *cups_strdup(const char *);
+# define strdup cups_strdup
# endif /* !HAVE_STRDUP */
# ifndef HAVE_STRCASECMP
-extern int strcasecmp(const char *, const char *);
+extern int cups_strcasecmp(const char *, const char *);
+# define strcasecmp cups_strcasecmp
# endif /* !HAVE_STRCASECMP */
# ifndef HAVE_STRNCASECMP
-extern int strncasecmp(const char *, const char *, size_t n);
+extern int cups_strncasecmp(const char *, const char *, size_t n);
+# define strncasecmp cups_strncasecmp
# endif /* !HAVE_STRNCASECMP */
+# ifndef HAVE_STRLCAT
+extern size_t cups_strlcat(char *, const char *, size_t);
+# define strlcat cups_strlcat
+# endif /* !HAVE_STRLCAT */
+
+# ifndef HAVE_STRLCPY
+extern size_t cups_strlcpy(char *, const char *, size_t);
+# define strlcpy cups_strlcpy
+# endif /* !HAVE_STRLCPY */
+
# ifndef HAVE_SNPRINTF
-extern int snprintf(char *, size_t, const char *, ...)
+extern int cups_snprintf(char *, size_t, const char *, ...)
# ifdef __GNUC__
__attribute__ ((__format__ (__printf__, 3, 4)))
# endif /* __GNUC__ */
;
+# define snprintf cups_snprintf
# endif /* !HAVE_SNPRINTF */
# ifndef HAVE_VSNPRINTF
-extern int vsnprintf(char *, size_t, const char *, va_list);
+extern int cups_vsnprintf(char *, size_t, const char *, va_list);
+# define vsnprintf cups_vsnprintf
# endif /* !HAVE_VSNPRINTF */
#endif /* !_CUPS_STRING_H_ */
/*
- * End of "$Id: string.h,v 1.12 2002/05/15 01:52:16 mike Exp $".
+ * End of "$Id: string.h,v 1.13 2002/05/16 13:44:54 mike Exp $".
*/
/*
- * "$Id: usersys.c,v 1.16 2002/03/01 19:53:30 mike Exp $"
+ * "$Id: usersys.c,v 1.17 2002/05/16 13:44:54 mike Exp $"
*
* User, system, and password routines for the Common UNIX Printing
* System (CUPS).
* Copy the server name over...
*/
- strncpy(cups_server, server, sizeof(cups_server) - 1);
- cups_server[sizeof(cups_server) - 1] = '\0';
+ strlcpy(cups_server, server, sizeof(cups_server));
}
return (cups_server);
cupsSetServer(const char *server) /* I - Server name */
{
if (server)
- {
- strncpy(cups_server, server, sizeof(cups_server) - 1);
- cups_server[sizeof(cups_server) - 1] = '\0';
- }
+ strlcpy(cups_server, server, sizeof(cups_server));
else
cups_server[0] = '\0';
}
cupsSetUser(const char *user) /* I - User name */
{
if (user)
- {
- strncpy(cups_user, user, sizeof(cups_user) - 1);
- cups_user[sizeof(cups_user) - 1] = '\0';
- }
+ strlcpy(cups_user, user, sizeof(cups_user));
else
cups_user[0] = '\0';
}
setpwent();
- strncpy(cups_user, pwd->pw_name, sizeof(cups_user) - 1);
- cups_user[sizeof(cups_user) - 1] = '\0';
+ strlcpy(cups_user, pwd->pw_name, sizeof(cups_user));
}
/*
/*
- * End of "$Id: usersys.c,v 1.16 2002/03/01 19:53:30 mike Exp $".
+ * End of "$Id: usersys.c,v 1.17 2002/05/16 13:44:54 mike Exp $".
*/
/*
- * "$Id: util.c,v 1.93 2002/03/01 19:53:30 mike Exp $"
+ * "$Id: util.c,v 1.94 2002/05/16 13:44:55 mike Exp $"
*
* Printing utilities for the Common UNIX Printing System (CUPS).
*
if (!password[0])
break;
- strncpy(pwdstring, password, sizeof(pwdstring) - 1);
- pwdstring[sizeof(pwdstring) - 1] = '\0';
+ strlcpy(pwdstring, password, sizeof(pwdstring));
digest_tries = 0;
}
if ((attr = ippFindAttribute(response, "printer-name", IPP_TAG_NAME)) != NULL)
{
- strncpy(def_printer, attr->values[0].string.text, sizeof(def_printer) - 1);
- def_printer[sizeof(def_printer) - 1] = '\0';
+ strlcpy(def_printer, attr->values[0].string.text, sizeof(def_printer));
ippDelete(response);
return (def_printer);
}
* Found a printer!
*/
- strncpy(printer, resource + 10, sizeof(printer) - 1);
- printer[sizeof(printer) - 1] = '\0';
+ strlcpy(printer, resource + 10, sizeof(printer));
break;
}
}
httpSeparate(attr->values[0].string.text, method, username, hostname,
&port, resource);
- strncpy(printer, strrchr(resource, '/') + 1, sizeof(printer) - 1);
- printer[sizeof(printer) - 1] = '\0';
+ strlcpy(printer, strrchr(resource, '/') + 1, sizeof(printer));
}
ippDelete(response);
if (!password[0])
break;
- strncpy(pwdstring, password, sizeof(pwdstring) - 1);
- pwdstring[sizeof(pwdstring) - 1] = '\0';
+ strlcpy(pwdstring, password, sizeof(pwdstring));
digest_tries = 0;
}
}
if (sscanf(name, "%1023[^@]@%1023s", printerbuf, hostbuf) == 1)
- {
- strncpy(hostbuf, cupsServer(), sizeof(hostbuf) - 1);
- hostbuf[sizeof(hostbuf) - 1] = '\0';
- }
+ strlcpy(hostbuf, cupsServer(), sizeof(hostbuf));
if (hostname != NULL)
- {
- strncpy(hostname, hostbuf, HTTP_MAX_URI - 1);
- hostname[HTTP_MAX_URI - 1] = '\0';
- }
+ strlcpy(hostname, hostbuf, HTTP_MAX_URI);
else
hostname = hostbuf;
if (printer != NULL)
- {
- strncpy(printer, printerbuf, HTTP_MAX_URI - 1);
- printer[HTTP_MAX_URI - 1] = '\0';
- }
+ strlcpy(printer, printerbuf, HTTP_MAX_URI);
else
printer = printerbuf;
/*
- * End of "$Id: util.c,v 1.93 2002/03/01 19:53:30 mike Exp $".
+ * End of "$Id: util.c,v 1.94 2002/05/16 13:44:55 mike Exp $".
*/
hpgl-vector.o: hpgltops.h common.h ../cups/cups.h ../cups/ipp.h
hpgl-vector.o: ../cups/http.h ../cups/md5.h ../cups/ppd.h ../cups/language.h
hpgl-vector.o: ../cups/string.h ../config.h
-image-bmp.o: image.h ../config.h
-image-colorspace.o: image.h ../config.h
-image-gif.o: image.h ../config.h
-image-jpeg.o: image.h ../config.h
-image-photocd.o: image.h ../config.h
-image-pix.o: image.h ../config.h
-image-png.o: image.h ../config.h
-image-pnm.o: image.h ../config.h
-image-sgi.o: image.h ../config.h image-sgi.h
+image-bmp.o: image.h ../config.h raster.h
+image-colorspace.o: image.h ../config.h raster.h
+image-gif.o: image.h ../config.h raster.h
+image-jpeg.o: image.h ../config.h raster.h
+image-photocd.o: image.h ../config.h raster.h
+image-pix.o: image.h ../config.h raster.h
+image-png.o: image.h ../config.h raster.h
+image-pnm.o: image.h ../config.h raster.h
+image-sgi.o: image.h ../config.h raster.h image-sgi.h
image-sgilib.o: image-sgi.h
-image-sun.o: image.h ../config.h
-image-tiff.o: image.h ../config.h
-image-zoom.o: image.h ../config.h
-image.o: image.h ../config.h ../cups/cups.h ../cups/ipp.h ../cups/http.h
-image.o: ../cups/md5.h ../cups/ppd.h
+image-sun.o: image.h ../config.h raster.h
+image-tiff.o: image.h ../config.h raster.h
+image-zoom.o: image.h ../config.h raster.h
+image.o: image.h ../config.h raster.h ../cups/cups.h ../cups/ipp.h
+image.o: ../cups/http.h ../cups/md5.h ../cups/ppd.h
raster.o: raster.h
form-main.o: form.h common.h ../cups/cups.h ../cups/ipp.h ../cups/http.h
form-main.o: ../cups/md5.h ../cups/ppd.h ../cups/language.h ../cups/string.h
form-tree.o: ../config.h
imagetops.o: common.h ../cups/cups.h ../cups/ipp.h ../cups/http.h
imagetops.o: ../cups/md5.h ../cups/ppd.h ../cups/language.h ../cups/string.h
-imagetops.o: ../config.h image.h
+imagetops.o: ../config.h image.h raster.h
imagetoraster.o: common.h ../cups/cups.h ../cups/ipp.h ../cups/http.h
imagetoraster.o: ../cups/md5.h ../cups/ppd.h ../cups/language.h
imagetoraster.o: ../cups/string.h ../config.h image.h raster.h
/*
- * "$Id: imagetops.c,v 1.45 2002/04/19 16:17:28 mike Exp $"
+ * "$Id: imagetops.c,v 1.46 2002/05/16 13:44:55 mike Exp $"
*
* Image file to PostScript filter for the Common UNIX Printing System (CUPS).
*
close(fd);
}
else
- {
- strncpy(filename, argv[6], sizeof(filename) - 1);
- filename[sizeof(filename) - 1] = '\0';
- }
+ strlcpy(filename, argv[6], sizeof(filename));
/*
* Process command-line options and write the prolog...
/*
- * End of "$Id: imagetops.c,v 1.45 2002/04/19 16:17:28 mike Exp $".
+ * End of "$Id: imagetops.c,v 1.46 2002/05/16 13:44:55 mike Exp $".
*/
/*
- * "$Id: imagetoraster.c,v 1.64 2002/04/29 15:56:59 mike Exp $"
+ * "$Id: imagetoraster.c,v 1.65 2002/05/16 13:44:56 mike Exp $"
*
* Image file to raster filter for the Common UNIX Printing System (CUPS).
*
close(fd);
}
else
- {
- strncpy(filename, argv[6], sizeof(filename) - 1);
- filename[sizeof(filename) - 1] = '\0';
- }
+ strlcpy(filename, argv[6], sizeof(filename));
/*
* Process command-line options and write the prolog...
strcmp(name, "MediaPosition") == 0)
header->MediaPosition = atoi(value);
else if (strcmp(name, "MediaClass") == 0)
- strncpy(header->MediaClass, value, sizeof(header->MediaClass) - 1);
+ strlcpy(header->MediaClass, value, sizeof(header->MediaClass));
else if (strcmp(name, "MediaColor") == 0)
- strncpy(header->MediaColor, value, sizeof(header->MediaColor) - 1);
+ strlcpy(header->MediaColor, value, sizeof(header->MediaColor));
else if (strcmp(name, "MediaType") == 0)
- strncpy(header->MediaType, value, sizeof(header->MediaType) - 1);
+ strlcpy(header->MediaType, value, sizeof(header->MediaType));
else if (strcmp(name, "OutputType") == 0)
- strncpy(header->OutputType, value, sizeof(header->OutputType) - 1);
+ strlcpy(header->OutputType, value, sizeof(header->OutputType));
}
}
/*
- * End of "$Id: imagetoraster.c,v 1.64 2002/04/29 15:56:59 mike Exp $".
+ * End of "$Id: imagetoraster.c,v 1.65 2002/05/16 13:44:56 mike Exp $".
*/
/*
- * "$Id: gdevcups.c,v 1.51 2002/04/23 17:28:59 mike Exp $"
+ * "$Id: gdevcups.c,v 1.52 2002/05/16 13:44:57 mike Exp $"
*
* GNU Ghostscript raster output driver for the Common UNIX Printing
* System (CUPS).
} \
else if (code == 0) \
{ \
- strncpy(cups->header.name, (const char *)stringval.data, \
- stringval.size); \
- cups->header.name[stringval.size] = '\0'; \
+ strlcpy(cups->header.name, (const char *)stringval.data, 64); \
}
#define intoption(name, sname, type) \
/*
- * End of "$Id: gdevcups.c,v 1.51 2002/04/23 17:28:59 mike Exp $".
+ * End of "$Id: gdevcups.c,v 1.52 2002/05/16 13:44:57 mike Exp $".
*/
# DO NOT DELETE
auth.o: cupsd.h ../cups/cups.h ../cups/ipp.h ../cups/http.h ../cups/md5.h
-auth.o: ../cups/ppd.h ../cups/string.h ../config.h mime.h ../cups/http.h
-auth.o: ../cups/ipp.h ../cups/language.h ../cups/debug.h cert.h client.h
+auth.o: ../cups/ppd.h ../cups/string.h ../config.h mime.h ../cups/ipp.h
+auth.o: ../cups/http.h ../cups/language.h ../cups/debug.h cert.h client.h
auth.o: auth.h printers.h classes.h job.h conf.h banners.h dirsvc.h network.h
auth.o: ../cups/md5.h
banners.o: cupsd.h ../cups/cups.h ../cups/ipp.h ../cups/http.h ../cups/md5.h
-banners.o: ../cups/ppd.h ../cups/string.h ../config.h mime.h ../cups/http.h
-banners.o: ../cups/ipp.h ../cups/language.h ../cups/debug.h cert.h client.h
+banners.o: ../cups/ppd.h ../cups/string.h ../config.h mime.h ../cups/ipp.h
+banners.o: ../cups/http.h ../cups/language.h ../cups/debug.h cert.h client.h
banners.o: auth.h printers.h classes.h job.h conf.h banners.h dirsvc.h
banners.o: network.h
cert.o: cupsd.h ../cups/cups.h ../cups/ipp.h ../cups/http.h ../cups/md5.h
-cert.o: ../cups/ppd.h ../cups/string.h ../config.h mime.h ../cups/http.h
-cert.o: ../cups/ipp.h ../cups/language.h ../cups/debug.h cert.h client.h
+cert.o: ../cups/ppd.h ../cups/string.h ../config.h mime.h ../cups/ipp.h
+cert.o: ../cups/http.h ../cups/language.h ../cups/debug.h cert.h client.h
cert.o: auth.h printers.h classes.h job.h conf.h banners.h dirsvc.h network.h
classes.o: cupsd.h ../cups/cups.h ../cups/ipp.h ../cups/http.h ../cups/md5.h
-classes.o: ../cups/ppd.h ../cups/string.h ../config.h mime.h ../cups/http.h
-classes.o: ../cups/ipp.h ../cups/language.h ../cups/debug.h cert.h client.h
+classes.o: ../cups/ppd.h ../cups/string.h ../config.h mime.h ../cups/ipp.h
+classes.o: ../cups/http.h ../cups/language.h ../cups/debug.h cert.h client.h
classes.o: auth.h printers.h classes.h job.h conf.h banners.h dirsvc.h
classes.o: network.h
client.o: cupsd.h ../cups/cups.h ../cups/ipp.h ../cups/http.h ../cups/md5.h
-client.o: ../cups/ppd.h ../cups/string.h ../config.h mime.h ../cups/http.h
-client.o: ../cups/ipp.h ../cups/language.h ../cups/debug.h cert.h client.h
+client.o: ../cups/ppd.h ../cups/string.h ../config.h mime.h ../cups/ipp.h
+client.o: ../cups/http.h ../cups/language.h ../cups/debug.h cert.h client.h
client.o: auth.h printers.h classes.h job.h conf.h banners.h dirsvc.h
client.o: network.h
conf.o: cupsd.h ../cups/cups.h ../cups/ipp.h ../cups/http.h ../cups/md5.h
-conf.o: ../cups/ppd.h ../cups/string.h ../config.h mime.h ../cups/http.h
-conf.o: ../cups/ipp.h ../cups/language.h ../cups/debug.h cert.h client.h
+conf.o: ../cups/ppd.h ../cups/string.h ../config.h mime.h ../cups/ipp.h
+conf.o: ../cups/http.h ../cups/language.h ../cups/debug.h cert.h client.h
conf.o: auth.h printers.h classes.h job.h conf.h banners.h dirsvc.h network.h
devices.o: cupsd.h ../cups/cups.h ../cups/ipp.h ../cups/http.h ../cups/md5.h
-devices.o: ../cups/ppd.h ../cups/string.h ../config.h mime.h ../cups/http.h
-devices.o: ../cups/ipp.h ../cups/language.h ../cups/debug.h cert.h client.h
+devices.o: ../cups/ppd.h ../cups/string.h ../config.h mime.h ../cups/ipp.h
+devices.o: ../cups/http.h ../cups/language.h ../cups/debug.h cert.h client.h
devices.o: auth.h printers.h classes.h job.h conf.h banners.h dirsvc.h
devices.o: network.h
dirsvc.o: cupsd.h ../cups/cups.h ../cups/ipp.h ../cups/http.h ../cups/md5.h
-dirsvc.o: ../cups/ppd.h ../cups/string.h ../config.h mime.h ../cups/http.h
-dirsvc.o: ../cups/ipp.h ../cups/language.h ../cups/debug.h cert.h client.h
+dirsvc.o: ../cups/ppd.h ../cups/string.h ../config.h mime.h ../cups/ipp.h
+dirsvc.o: ../cups/http.h ../cups/language.h ../cups/debug.h cert.h client.h
dirsvc.o: auth.h printers.h classes.h job.h conf.h banners.h dirsvc.h
dirsvc.o: network.h
main.o: cupsd.h ../cups/cups.h ../cups/ipp.h ../cups/http.h ../cups/md5.h
-main.o: ../cups/ppd.h ../cups/string.h ../config.h mime.h ../cups/http.h
-main.o: ../cups/ipp.h ../cups/language.h ../cups/debug.h cert.h client.h
+main.o: ../cups/ppd.h ../cups/string.h ../config.h mime.h ../cups/ipp.h
+main.o: ../cups/http.h ../cups/language.h ../cups/debug.h cert.h client.h
main.o: auth.h printers.h classes.h job.h conf.h banners.h dirsvc.h network.h
ipp.o: cupsd.h ../cups/cups.h ../cups/ipp.h ../cups/http.h ../cups/md5.h
-ipp.o: ../cups/ppd.h ../cups/string.h ../config.h mime.h ../cups/http.h
-ipp.o: ../cups/ipp.h ../cups/language.h ../cups/debug.h cert.h client.h
+ipp.o: ../cups/ppd.h ../cups/string.h ../config.h mime.h ../cups/ipp.h
+ipp.o: ../cups/http.h ../cups/language.h ../cups/debug.h cert.h client.h
ipp.o: auth.h printers.h classes.h job.h conf.h banners.h dirsvc.h network.h
listen.o: cupsd.h ../cups/cups.h ../cups/ipp.h ../cups/http.h ../cups/md5.h
-listen.o: ../cups/ppd.h ../cups/string.h ../config.h mime.h ../cups/http.h
-listen.o: ../cups/ipp.h ../cups/language.h ../cups/debug.h cert.h client.h
+listen.o: ../cups/ppd.h ../cups/string.h ../config.h mime.h ../cups/ipp.h
+listen.o: ../cups/http.h ../cups/language.h ../cups/debug.h cert.h client.h
listen.o: auth.h printers.h classes.h job.h conf.h banners.h dirsvc.h
listen.o: network.h
job.o: cupsd.h ../cups/cups.h ../cups/ipp.h ../cups/http.h ../cups/md5.h
-job.o: ../cups/ppd.h ../cups/string.h ../config.h mime.h ../cups/http.h
-job.o: ../cups/ipp.h ../cups/language.h ../cups/debug.h cert.h client.h
+job.o: ../cups/ppd.h ../cups/string.h ../config.h mime.h ../cups/ipp.h
+job.o: ../cups/http.h ../cups/language.h ../cups/debug.h cert.h client.h
job.o: auth.h printers.h classes.h job.h conf.h banners.h dirsvc.h network.h
log.o: cupsd.h ../cups/cups.h ../cups/ipp.h ../cups/http.h ../cups/md5.h
-log.o: ../cups/ppd.h ../cups/string.h ../config.h mime.h ../cups/http.h
-log.o: ../cups/ipp.h ../cups/language.h ../cups/debug.h cert.h client.h
+log.o: ../cups/ppd.h ../cups/string.h ../config.h mime.h ../cups/ipp.h
+log.o: ../cups/http.h ../cups/language.h ../cups/debug.h cert.h client.h
log.o: auth.h printers.h classes.h job.h conf.h banners.h dirsvc.h network.h
network.o: cupsd.h ../cups/cups.h ../cups/ipp.h ../cups/http.h ../cups/md5.h
-network.o: ../cups/ppd.h ../cups/string.h ../config.h mime.h ../cups/http.h
-network.o: ../cups/ipp.h ../cups/language.h ../cups/debug.h cert.h client.h
+network.o: ../cups/ppd.h ../cups/string.h ../config.h mime.h ../cups/ipp.h
+network.o: ../cups/http.h ../cups/language.h ../cups/debug.h cert.h client.h
network.o: auth.h printers.h classes.h job.h conf.h banners.h dirsvc.h
network.o: network.h
ppds.o: cupsd.h ../cups/cups.h ../cups/ipp.h ../cups/http.h ../cups/md5.h
-ppds.o: ../cups/ppd.h ../cups/string.h ../config.h mime.h ../cups/http.h
-ppds.o: ../cups/ipp.h ../cups/language.h ../cups/debug.h cert.h client.h
+ppds.o: ../cups/ppd.h ../cups/string.h ../config.h mime.h ../cups/ipp.h
+ppds.o: ../cups/http.h ../cups/language.h ../cups/debug.h cert.h client.h
ppds.o: auth.h printers.h classes.h job.h conf.h banners.h dirsvc.h network.h
printers.o: cupsd.h ../cups/cups.h ../cups/ipp.h ../cups/http.h ../cups/md5.h
-printers.o: ../cups/ppd.h ../cups/string.h ../config.h mime.h ../cups/http.h
-printers.o: ../cups/ipp.h ../cups/language.h ../cups/debug.h cert.h client.h
+printers.o: ../cups/ppd.h ../cups/string.h ../config.h mime.h ../cups/ipp.h
+printers.o: ../cups/http.h ../cups/language.h ../cups/debug.h cert.h client.h
printers.o: auth.h printers.h classes.h job.h conf.h banners.h dirsvc.h
printers.o: network.h
quotas.o: cupsd.h ../cups/cups.h ../cups/ipp.h ../cups/http.h ../cups/md5.h
-quotas.o: ../cups/ppd.h ../cups/string.h ../config.h mime.h ../cups/http.h
-quotas.o: ../cups/ipp.h ../cups/language.h ../cups/debug.h cert.h client.h
+quotas.o: ../cups/ppd.h ../cups/string.h ../config.h mime.h ../cups/ipp.h
+quotas.o: ../cups/http.h ../cups/language.h ../cups/debug.h cert.h client.h
quotas.o: auth.h printers.h classes.h job.h conf.h banners.h dirsvc.h
quotas.o: network.h
server.o: cupsd.h ../cups/cups.h ../cups/ipp.h ../cups/http.h ../cups/md5.h
-server.o: ../cups/ppd.h ../cups/string.h ../config.h mime.h ../cups/http.h
-server.o: ../cups/ipp.h ../cups/language.h ../cups/debug.h cert.h client.h
+server.o: ../cups/ppd.h ../cups/string.h ../config.h mime.h ../cups/ipp.h
+server.o: ../cups/http.h ../cups/language.h ../cups/debug.h cert.h client.h
server.o: auth.h printers.h classes.h job.h conf.h banners.h dirsvc.h
server.o: network.h
-filter.o: ../cups/string.h ../config.h mime.h
-mime.o: ../cups/string.h ../config.h mime.h
-type.o: ../cups/string.h ../config.h mime.h ../cups/debug.h
+filter.o: ../cups/string.h ../config.h mime.h ../cups/ipp.h
+mime.o: ../cups/string.h ../config.h mime.h ../cups/ipp.h
+type.o: ../cups/string.h ../config.h mime.h ../cups/ipp.h ../cups/debug.h
cups-lpd.o: ../cups/cups.h ../cups/ipp.h ../cups/http.h ../cups/md5.h
cups-lpd.o: ../cups/ppd.h ../cups/string.h ../config.h ../cups/language.h
cups-polld.o: ../cups/cups.h ../cups/ipp.h ../cups/http.h ../cups/md5.h
cups-polld.o: ../cups/ppd.h ../cups/language.h ../cups/string.h ../config.h
-testmime.o: mime.h
+testmime.o: ../cups/string.h ../config.h mime.h ../cups/ipp.h
testspeed.o: ../cups/cups.h ../cups/ipp.h ../cups/http.h ../cups/md5.h
testspeed.o: ../cups/ppd.h ../cups/language.h ../cups/debug.h
/*
- * "$Id: auth.c,v 1.57 2002/03/27 19:59:49 mike Exp $"
+ * "$Id: auth.c,v 1.58 2002/05/16 13:44:58 mike Exp $"
*
* Authorization routines for the Common UNIX Printing System (CUPS).
*
*/
memset(temp, 0, sizeof(location_t));
- strncpy(temp->location, location, sizeof(temp->location) - 1);
+ strlcpy(temp->location, location, sizeof(temp->location));
temp->length = strlen(temp->location);
LogMessage(L_DEBUG, "AddLocation: added location \'%s\'", location);
* Allow *interface*...
*/
- strncpy(ifname, name + 4, sizeof(ifname) - 1);
- ifname[sizeof(ifname) - 1] = '\0';
+ strlcpy(ifname, name + 4, sizeof(ifname));
ifptr = ifname + strlen(ifname);
* Deny *interface*...
*/
- strncpy(ifname, name + 4, sizeof(ifname) - 1);
- ifname[sizeof(ifname) - 1] = '\0';
+ strlcpy(ifname, name + 4, sizeof(ifname));
ifptr = ifname + strlen(ifname);
* URIs...
*/
- strncpy(uri, path, sizeof(uri) - 1);
- uri[sizeof(uri) - 1] = '\0';
+ strlcpy(uri, path, sizeof(uri));
if (strncmp(uri, "/printers/", 10) == 0 ||
strncmp(uri, "/classes/", 9) == 0)
/*
- * End of "$Id: auth.c,v 1.57 2002/03/27 19:59:49 mike Exp $".
+ * End of "$Id: auth.c,v 1.58 2002/05/16 13:44:58 mike Exp $".
*/
/*
- * "$Id: banners.c,v 1.7 2002/01/02 17:59:13 mike Exp $"
+ * "$Id: banners.c,v 1.8 2002/05/16 13:44:58 mike Exp $"
*
* Banner routines for the Common UNIX Printing System (CUPS).
*
NumBanners ++;
memset(temp, 0, sizeof(banner_t));
- strncpy(temp->name, name, sizeof(temp->name) - 1);
+ strlcpy(temp->name, name, sizeof(temp->name));
temp->filetype = filetype;
}
banner_t key; /* Search key */
- strncpy(key.name, name, sizeof(key.name) - 1);
- key.name[sizeof(key.name) - 1] = '\0';
+ strlcpy(key.name, name, sizeof(key.name));
return ((banner_t *)bsearch(&key, Banners, NumBanners, sizeof(banner_t),
(int (*)(const void *, const void *))compare));
/*
- * End of "$Id: banners.c,v 1.7 2002/01/02 17:59:13 mike Exp $".
+ * End of "$Id: banners.c,v 1.8 2002/05/16 13:44:58 mike Exp $".
*/
/*
- * "$Id: cert.c,v 1.10 2002/01/02 17:59:13 mike Exp $"
+ * "$Id: cert.c,v 1.11 2002/05/16 13:44:58 mike Exp $"
*
* Authentication certificate routines for the Common UNIX
* Printing System (CUPS).
*/
cert->pid = pid;
- strncpy(cert->username, username, sizeof(cert->username) - 1);
+ strlcpy(cert->username, username, sizeof(cert->username));
for (i = 0; i < 32; i ++)
cert->certificate[i] = hex[random() & 15];
/*
- * End of "$Id: cert.c,v 1.10 2002/01/02 17:59:13 mike Exp $".
+ * End of "$Id: cert.c,v 1.11 2002/05/16 13:44:58 mike Exp $".
*/
/*
- * "$Id: classes.c,v 1.41 2002/01/02 17:59:14 mike Exp $"
+ * "$Id: classes.c,v 1.42 2002/05/16 13:44:58 mike Exp $"
*
* Printer class routines for the Common UNIX Printing System (CUPS).
*
}
else if (strcmp(name, "Info") == 0)
- strncpy(p->info, value, sizeof(p->info) - 1);
+ strlcpy(p->info, value, sizeof(p->info));
else if (strcmp(name, "Location") == 0)
- strncpy(p->location, value, sizeof(p->location) - 1);
+ strlcpy(p->location, value, sizeof(p->location));
else if (strcmp(name, "Printer") == 0)
{
if ((temp = FindPrinter(value)) == NULL)
while (isspace(*value))
value ++;
- strncpy(p->state_message, value, sizeof(p->state_message) - 1);
+ strlcpy(p->state_message, value, sizeof(p->state_message));
}
else if (strcmp(name, "Accepting") == 0)
{
if (*valueptr)
*valueptr++ = '\0';
- strncpy(p->job_sheets[0], value, sizeof(p->job_sheets[0]) - 1);
+ strlcpy(p->job_sheets[0], value, sizeof(p->job_sheets[0]));
while (isspace(*valueptr))
valueptr ++;
if (*valueptr)
*valueptr++ = '\0';
- strncpy(p->job_sheets[1], value, sizeof(p->job_sheets[1]) - 1);
+ strlcpy(p->job_sheets[1], value, sizeof(p->job_sheets[1]));
}
}
else if (strcmp(name, "AllowUser") == 0)
/*
- * End of "$Id: classes.c,v 1.41 2002/01/02 17:59:14 mike Exp $".
+ * End of "$Id: classes.c,v 1.42 2002/05/16 13:44:58 mike Exp $".
*/
/*
- * "$Id: client.c,v 1.111 2002/05/15 01:52:17 mike Exp $"
+ * "$Id: client.c,v 1.112 2002/05/16 13:44:59 mike Exp $"
*
* Client routines for the Common UNIX Printing System (CUPS) scheduler.
*
* Map accesses from the same host to the server name.
*/
- strncpy(con->http.hostname, ServerName, sizeof(con->http.hostname) - 1);
+ strlcpy(con->http.hostname, ServerName, sizeof(con->http.hostname));
}
else if (host == NULL)
{
}
}
else
- strncpy(con->http.hostname, host->h_name, sizeof(con->http.hostname) - 1);
+ strlcpy(con->http.hostname, host->h_name, sizeof(con->http.hostname));
if (HostNameLookups == 2)
{
*s++ = '\0';
- strncpy(con->username, value, sizeof(con->username) - 1);
- con->username[sizeof(con->username) - 1] = '\0';
-
- strncpy(con->password, s, sizeof(con->password) - 1);
- con->password[sizeof(con->password) - 1] = '\0';
+ strlcpy(con->username, value, sizeof(con->username));
+ strlcpy(con->password, s, sizeof(con->password));
}
else if (strncmp(s, "Local", 5) == 0)
{
s ++;
if ((username = FindCert(s)) != NULL)
- {
- strncpy(con->username, username, sizeof(con->username) - 1);
- con->username[sizeof(con->username) - 1] = '\0';
- }
+ strlcpy(con->username, username, sizeof(con->username));
}
else if (strncmp(s, "Digest", 5) == 0)
{
if (httpGetSubField(&(con->http), HTTP_FIELD_AUTHORIZATION, "username",
value))
- {
- strncpy(con->username, value, sizeof(con->username) - 1);
- con->username[sizeof(con->username) - 1] = '\0';
- }
+ strlcpy(con->username, value, sizeof(con->username));
if (httpGetSubField(&(con->http), HTTP_FIELD_AUTHORIZATION, "response",
value))
- {
- strncpy(con->password, value, sizeof(con->password) - 1);
- con->password[sizeof(con->password) - 1] = '\0';
- }
+ strlcpy(con->password, value, sizeof(con->password));
}
LogMessage(L_DEBUG2, "decode_auth() %d username=\"%s\"",
if (!status && S_ISDIR(filestats->st_mode))
{
if (filename[strlen(filename) - 1] == '/')
- strncat(filename, "index.html", sizeof(filename));
+ strlcat(filename, "index.html", sizeof(filename));
else
- strncat(filename, "/index.html", sizeof(filename));
-
- filename[sizeof(filename) - 1] = '\0';
+ strlcat(filename, "/index.html", sizeof(filename));
status = stat(filename, filestats);
}
* Copy the command string...
*/
- strncpy(argbuf, options, sizeof(argbuf) - 1);
- argbuf[sizeof(argbuf) - 1] = '\0';
+ strlcpy(argbuf, options, sizeof(argbuf));
/*
* Parse the string; arguments can be separated by + and are terminated
/*
- * End of "$Id: client.c,v 1.111 2002/05/15 01:52:17 mike Exp $".
+ * End of "$Id: client.c,v 1.112 2002/05/16 13:44:59 mike Exp $".
*/
/*
- * "$Id: conf.c,v 1.102 2002/05/15 01:52:17 mike Exp $"
+ * "$Id: conf.c,v 1.103 2002/05/16 13:44:59 mike Exp $"
*
* Configuration routines for the Common UNIX Printing System (CUPS).
*
else if (strcmp(language, "C") == 0 || strcmp(language, "POSIX") == 0)
language = "en";
- strncpy(DefaultLanguage, language, sizeof(DefaultLanguage) - 1);
- DefaultLanguage[sizeof(DefaultLanguage) - 1] = '\0';
+ strlcpy(DefaultLanguage, language, sizeof(DefaultLanguage));
strcpy(DefaultCharset, DEFAULT_CHARSET);
if (getenv("TMPDIR") == NULL)
strcpy(TempDir, CUPS_REQUESTS "/tmp");
else
- {
- strncpy(TempDir, getenv("TMPDIR"), sizeof(TempDir) - 1);
- TempDir[sizeof(TempDir) - 1] = '\0';
- }
+ strlcpy(TempDir, getenv("TMPDIR"), sizeof(TempDir));
/*
* Find the default system group: "sys", "system", or "root"...
if (DocumentRoot[0] != '/')
{
snprintf(directory, sizeof(directory), "%s/%s", ServerRoot, DocumentRoot);
- strncpy(DocumentRoot, directory, sizeof(DocumentRoot) - 1);
- DocumentRoot[sizeof(DocumentRoot) - 1] = '\0';
+ strlcpy(DocumentRoot, directory, sizeof(DocumentRoot));
}
if (RequestRoot[0] != '/')
{
snprintf(directory, sizeof(directory), "%s/%s", ServerRoot, RequestRoot);
- strncpy(RequestRoot, directory, sizeof(RequestRoot) - 1);
- RequestRoot[sizeof(RequestRoot) - 1] = '\0';
+ strlcpy(RequestRoot, directory, sizeof(RequestRoot));
}
if (ServerBin[0] != '/')
{
snprintf(directory, sizeof(directory), "%s/%s", ServerRoot, ServerBin);
- strncpy(ServerBin, directory, sizeof(ServerBin) - 1);
- ServerBin[sizeof(ServerBin) - 1] = '\0';
+ strlcpy(ServerBin, directory, sizeof(ServerBin));
}
#ifdef HAVE_LIBSSL
if (ServerCertificate[0] != '/')
{
snprintf(directory, sizeof(directory), "%s/%s", ServerRoot, ServerCertificate);
- strncpy(ServerCertificate, directory, sizeof(ServerCertificate) - 1);
- ServerCertificate[sizeof(ServerCertificate) - 1] = '\0';
+ strlcpy(ServerCertificate, directory, sizeof(ServerCertificate));
}
chown(ServerCertificate, User, Group);
if (ServerKey[0] != '/')
{
snprintf(directory, sizeof(directory), "%s/%s", ServerRoot, ServerKey);
- strncpy(ServerKey, directory, sizeof(ServerKey) - 1);
- ServerKey[sizeof(ServerKey) - 1] = '\0';
+ strlcpy(ServerKey, directory, sizeof(ServerKey));
}
chown(ServerKey, User, Group);
*/
if (value[0] == '/')
- {
- strncpy(incname, value, sizeof(incname) - 1);
- incname[sizeof(incname) - 1] = '\0';
- }
+ strlcpy(incname, value, sizeof(incname));
else
snprintf(incname, sizeof(incname), "%s/%s", ServerRoot, value);
* Send browse data to the named interface...
*/
- strncpy(Browsers[NumBrowsers].iface, value + 4,
- sizeof(Browsers[0].iface) - 1);
+ strlcpy(Browsers[NumBrowsers].iface, value + 4,
+ sizeof(Browsers[0].iface));
nameptr = Browsers[NumBrowsers].iface +
strlen(Browsers[NumBrowsers].iface) - 1;
if (*valueptr)
*valueptr++ = '\0';
- strncpy(SystemGroups[i], value, sizeof(SystemGroups[0]));
- SystemGroups[i][sizeof(SystemGroups[0]) - 1] = '\0';
+ strlcpy(SystemGroups[i], value, sizeof(SystemGroups[0]));
while (*value == ',' || isspace(*value))
value ++;
break;
case VAR_STRING :
- strncpy((char *)var->ptr, value, var->size - 1);
- value[var->size - 1] = '\0';
+ strlcpy((char *)var->ptr, value, var->size);
break;
}
}
* Hostname is a port number...
*/
- strncpy(portname, hostname, sizeof(portname) - 1);
- portname[sizeof(portname) - 1] = '\0';
+ strlcpy(portname, hostname, sizeof(portname));
hostname[0] = '\0';
}
else
/*
- * End of "$Id: conf.c,v 1.102 2002/05/15 01:52:17 mike Exp $".
+ * End of "$Id: conf.c,v 1.103 2002/05/16 13:44:59 mike Exp $".
*/
/*
- * "$Id: cups-lpd.c,v 1.32 2002/04/29 17:25:26 mike Exp $"
+ * "$Id: cups-lpd.c,v 1.33 2002/05/16 13:44:59 mike Exp $"
*
* Line Printer Daemon interface for the Common UNIX Printing System (CUPS).
*
hostent = gethostbyaddr((void *)&(hostaddr.sin_addr), hostlen, AF_INET);
if (hostent)
- {
- strncpy(hostname, hostent->h_name, sizeof(hostname) - 1);
- hostname[sizeof(hostname) - 1] = '\0';
- }
+ strlcpy(hostname, hostent->h_name, sizeof(hostname));
else
{
snprintf(hostname, sizeof(hostname), "%d.%d.%d.%d",
control[0] = '\0';
- strncpy(queue, dest, sizeof(queue) - 1);
- queue[sizeof(queue) - 1] = '\0';
+ strlcpy(queue, dest, sizeof(queue));
if ((instance = strrchr(queue, '/')) != NULL)
*instance++ = '\0';
break;
}
- strncpy(data[num_data], name, sizeof(data[0]) - 1);
- data[num_data][sizeof(data[0]) - 1] = '\0';
+ strlcpy(data[num_data], name, sizeof(data[0]));
if ((fd = cupsTempFd(temp[num_data], sizeof(temp[0]))) < 0)
{
switch (line[0])
{
case 'J' : /* Job name */
- strncpy(title, line + 1, sizeof(title) - 1);
- title[sizeof(title) - 1] = '\0';
+ strlcpy(title, line + 1, sizeof(title));
break;
case 'N' : /* Document name */
- strncpy(docname, line + 1, sizeof(docname) - 1);
- docname[sizeof(docname) - 1] = '\0';
+ strlcpy(docname, line + 1, sizeof(docname));
break;
case 'P' : /* User identification */
- strncpy(user, line + 1, sizeof(user) - 1);
- user[sizeof(user) - 1] = '\0';
+ strlcpy(user, line + 1, sizeof(user));
break;
case 'L' : /* Print banner page */
banner = 1;
* Remove instance from destination, if any...
*/
- strncpy(queue, dest, sizeof(queue) - 1);
- queue[sizeof(queue) - 1] = '\0';
+ strlcpy(queue, dest, sizeof(queue));
if ((instance = strrchr(queue, '/')) != NULL)
*instance++ = '\0';
snprintf(namestr, sizeof(namestr), "%d copies of %s", jobcopies,
jobname);
else
- {
- strncpy(namestr, jobname, sizeof(namestr) - 1);
- namestr[sizeof(namestr) - 1] = '\0';
- }
+ strlcpy(namestr, jobname, sizeof(namestr));
printf("%s: %-34.34s[job %d localhost]\n", jobuser, rankstr, jobid);
printf(" %-40.40s%d bytes\n", namestr, jobsize);
/*
- * End of "$Id: cups-lpd.c,v 1.32 2002/04/29 17:25:26 mike Exp $".
+ * End of "$Id: cups-lpd.c,v 1.33 2002/05/16 13:44:59 mike Exp $".
*/
/*
- * "$Id: devices.c,v 1.16 2002/01/02 17:59:15 mike Exp $"
+ * "$Id: devices.c,v 1.17 2002/05/16 13:45:00 mike Exp $"
*
* Device scanning routines for the Common UNIX Printing System (CUPS).
*
num_devs ++;
memset(dev, 0, sizeof(dev_info_t));
- strncpy(dev->device_class, dclass, sizeof(dev->device_class) - 1);
- strncpy(dev->device_info, info, sizeof(dev->device_info) - 1);
- strncpy(dev->device_make_and_model, make_model,
- sizeof(dev->device_make_and_model) - 1);
- strncpy(dev->device_uri, uri, sizeof(dev->device_uri) - 1);
+ strlcpy(dev->device_class, dclass, sizeof(dev->device_class));
+ strlcpy(dev->device_info, info, sizeof(dev->device_info));
+ strlcpy(dev->device_make_and_model, make_model,
+ sizeof(dev->device_make_and_model));
+ strlcpy(dev->device_uri, uri, sizeof(dev->device_uri));
LogMessage(L_DEBUG, "LoadDevices: Added device \"%s\"...", uri);
count ++;
snprintf(dev->device_info, sizeof(dev->device_info),
"Unknown Network Device (%s)", dent->d_name);
strcpy(dev->device_make_and_model, "Unknown");
- strncpy(dev->device_uri, dent->d_name, sizeof(dev->device_uri) - 1);
+ strlcpy(dev->device_uri, dent->d_name, sizeof(dev->device_uri));
LogMessage(L_DEBUG, "LoadDevices: Compatibility device \"%s\"...",
dent->d_name);
/*
- * End of "$Id: devices.c,v 1.16 2002/01/02 17:59:15 mike Exp $".
+ * End of "$Id: devices.c,v 1.17 2002/05/16 13:45:00 mike Exp $".
*/
/*
- * "$Id: dirsvc.c,v 1.94 2002/05/12 11:49:29 mike Exp $"
+ * "$Id: dirsvc.c,v 1.95 2002/05/16 13:45:00 mike Exp $"
*
* Directory services routines for the Common UNIX Printing System (CUPS).
*
if (p->type & CUPS_PRINTER_REMOTE)
{
- /* No "p->var[sizeof(p->var) - 1] = '\0';" because p is zeroed */
- strncat(p->name, "@", sizeof(p->name) - 1);
- strncat(p->name, p->hostname, sizeof(p->name) - 1);
+ strlcat(p->name, "@", sizeof(p->name));
+ strlcat(p->name, p->hostname, sizeof(p->name));
SetPrinterAttrs(p);
SortPrinters();
}
}
else if (!p->hostname[0])
{
- /* No "p->var[sizeof(p->var) - 1] = '\0';" because p is zeroed */
- strncpy(p->hostname, host, sizeof(p->hostname) - 1);
- strncpy(p->uri, uri, sizeof(p->uri) - 1);
- strncpy(p->device_uri, uri, sizeof(p->device_uri) - 1);
+ strlcpy(p->hostname, host, sizeof(p->hostname));
+ strlcpy(p->uri, uri, sizeof(p->uri));
+ strlcpy(p->device_uri, uri, sizeof(p->device_uri));
update = 1;
}
}
else
- {
- strncpy(name, resource + 9, sizeof(name) - 1);
- name[sizeof(name) - 1] = '\0';
- }
+ strlcpy(name, resource + 9, sizeof(name));
}
else if (p != NULL && !p->hostname[0])
{
- /* No "p->var[sizeof(p->var) - 1] = '\0';" because p is zeroed */
- strncpy(p->hostname, host, sizeof(p->hostname) - 1);
- strncpy(p->uri, uri, sizeof(p->uri) - 1);
- strncpy(p->device_uri, uri, sizeof(p->device_uri) - 1);
+ strlcpy(p->hostname, host, sizeof(p->hostname));
+ strlcpy(p->uri, uri, sizeof(p->uri));
+ strlcpy(p->device_uri, uri, sizeof(p->device_uri));
update = 1;
}
*/
p->type = type;
- /* No "p->var[sizeof(p->var) - 1] = '\0';" because p is zeroed */
- strncpy(p->uri, uri, sizeof(p->uri) - 1);
- strncpy(p->device_uri, uri, sizeof(p->device_uri) - 1);
- strncpy(p->hostname, host, sizeof(p->hostname) - 1);
+ strlcpy(p->uri, uri, sizeof(p->uri));
+ strlcpy(p->device_uri, uri, sizeof(p->device_uri));
+ strlcpy(p->hostname, host, sizeof(p->hostname));
update = 1;
}
if (p->type & CUPS_PRINTER_REMOTE)
{
- /* No "p->var[sizeof(p->var) - 1] = '\0';" because p is zeroed */
- strncat(p->name, "@", sizeof(p->name) - 1);
- strncat(p->name, p->hostname, sizeof(p->name) - 1);
+ strlcat(p->name, "@", sizeof(p->name));
+ strlcat(p->name, p->hostname, sizeof(p->name));
SetPrinterAttrs(p);
SortPrinters();
}
}
else if (!p->hostname[0])
{
- /* No "p->var[sizeof(p->var) - 1] = '\0';" because p is zeroed */
- strncpy(p->hostname, host, sizeof(p->hostname) - 1);
- strncpy(p->uri, uri, sizeof(p->uri) - 1);
- strncpy(p->device_uri, uri, sizeof(p->device_uri) - 1);
+ strlcpy(p->hostname, host, sizeof(p->hostname));
+ strlcpy(p->uri, uri, sizeof(p->uri));
+ strlcpy(p->device_uri, uri, sizeof(p->device_uri));
update = 1;
}
}
else
- {
- strncpy(name, resource + 10, sizeof(name) - 1);
- name[sizeof(name) - 1] = '\0';
- }
+ strlcpy(name, resource + 10, sizeof(name));
}
else if (p != NULL && !p->hostname[0])
{
- /* No "p->var[sizeof(p->var) - 1] = '\0';" because p is zeroed */
- strncpy(p->hostname, host, sizeof(p->hostname) - 1);
- strncpy(p->uri, uri, sizeof(p->uri) - 1);
- strncpy(p->device_uri, uri, sizeof(p->device_uri) - 1);
+ strlcpy(p->hostname, host, sizeof(p->hostname));
+ strlcpy(p->uri, uri, sizeof(p->uri));
+ strlcpy(p->device_uri, uri, sizeof(p->device_uri));
update = 1;
}
*/
p->type = type;
- /* No "p->var[sizeof(p->var) - 1] = '\0';" because p is zeroed */
- strncpy(p->hostname, host, sizeof(p->hostname) - 1);
- strncpy(p->uri, uri, sizeof(p->uri) - 1);
- strncpy(p->device_uri, uri, sizeof(p->device_uri) - 1);
+ strlcpy(p->hostname, host, sizeof(p->hostname));
+ strlcpy(p->uri, uri, sizeof(p->uri));
+ strlcpy(p->device_uri, uri, sizeof(p->device_uri));
update = 1;
}
if (strcmp(p->location, location))
{
- /* No "p->var[sizeof(p->var) - 1] = '\0';" because p is zeroed */
- strncpy(p->location, location, sizeof(p->location) - 1);
+ strlcpy(p->location, location, sizeof(p->location));
update = 1;
}
if (strcmp(p->info, info))
{
- /* No "p->var[sizeof(p->var) - 1] = '\0';" because p is zeroed */
- strncpy(p->info, info, sizeof(p->info) - 1);
+ strlcpy(p->info, info, sizeof(p->info));
update = 1;
}
if (strcmp(p->make_model, local_make_model))
{
- /* No "p->var[sizeof(p->var) - 1] = '\0';" because p is zeroed */
- strncpy(p->make_model, local_make_model, sizeof(p->make_model) - 1);
+ strlcpy(p->make_model, local_make_model, sizeof(p->make_model));
update = 1;
}
sprintf(srcname, "%d.%d.%d.%d", address >> 24, (address >> 16) & 255,
(address >> 8) & 255, address & 255);
else
- {
- strncpy(srcname, srchost->h_name, sizeof(srcname) - 1);
- srcname[sizeof(srcname) - 1] = '\0';
- }
+ strlcpy(srcname, srchost->h_name, sizeof(srcname));
len = strlen(srcname);
if (p->type & CUPS_PRINTER_BIND)
{
if (finishings[0])
- strncat(finishings, ",bind", sizeof(finishings) - 1);
+ strlcat(finishings, ",bind", sizeof(finishings));
else
strcpy(finishings, "bind");
}
if (p->type & CUPS_PRINTER_PUNCH)
{
if (finishings[0])
- strncat(finishings, ",punch", sizeof(finishings) - 1);
+ strlcat(finishings, ",punch", sizeof(finishings));
else
strcpy(finishings, "punch");
}
if (p->type & CUPS_PRINTER_COVER)
{
if (finishings[0])
- strncat(finishings, ",cover", sizeof(finishings) - 1);
+ strlcat(finishings, ",cover", sizeof(finishings));
else
strcpy(finishings, "cover");
}
if (p->type & CUPS_PRINTER_SORT)
{
if (finishings[0])
- strncat(finishings, ",sort", sizeof(finishings) - 1);
+ strlcat(finishings, ",sort", sizeof(finishings));
else
strcpy(finishings, "sort");
}
if (!finishings[0])
strcpy(finishings, "none");
- finishings[sizeof(finishings) - 1] = '\0';
-
/*
* Quote any commas in the make and model, location, and info strings
* (local strings are twice the size of the ones in the printer_t
* Copy the SLP service URL...
*/
- strncpy(s->url, srvurl, sizeof(s->url));
+ strlcpy(s->url, srvurl, sizeof(s->url));
/*
* Link the SLP service URL into the head of the list
/*
- * End of "$Id: dirsvc.c,v 1.94 2002/05/12 11:49:29 mike Exp $".
+ * End of "$Id: dirsvc.c,v 1.95 2002/05/16 13:45:00 mike Exp $".
*/
/*
- * "$Id: filter.c,v 1.4 2002/01/02 17:59:15 mike Exp $"
+ * "$Id: filter.c,v 1.5 2002/05/16 13:45:00 mike Exp $"
*
* File type conversion routines for the Common UNIX Printing System (CUPS).
*
if (temp->cost > cost)
{
temp->cost = cost;
- strncpy(temp->filter, filter, sizeof(temp->filter) - 1);
- temp->filter[sizeof(temp->filter) - 1] = '\0';
+ strlcpy(temp->filter, filter, sizeof(temp->filter));
}
}
else
temp->src = src;
temp->dst = dst;
temp->cost = cost;
- strncpy(temp->filter, filter, sizeof(temp->filter) - 1);
- temp->filter[sizeof(temp->filter) - 1] = '\0';
+ strlcpy(temp->filter, filter, sizeof(temp->filter));
if (mime->num_filters > 1)
qsort(mime->filters, mime->num_filters, sizeof(mime_filter_t),
/*
- * End of "$Id: filter.c,v 1.4 2002/01/02 17:59:15 mike Exp $".
+ * End of "$Id: filter.c,v 1.5 2002/05/16 13:45:00 mike Exp $".
*/
/*
- * "$Id: ipp.c,v 1.158 2002/05/15 01:52:17 mike Exp $"
+ * "$Id: ipp.c,v 1.159 2002/05/16 13:45:01 mike Exp $"
*
* IPP routines for the Common UNIX Printing System (CUPS) scheduler.
*
*/
if ((attr = ippFindAttribute(con->request, "printer-location", IPP_TAG_TEXT)) != NULL)
- {
- strncpy(pclass->location, attr->values[0].string.text, sizeof(pclass->location) - 1);
- pclass->location[sizeof(pclass->location) - 1] = '\0';
- }
+ strlcpy(pclass->location, attr->values[0].string.text, sizeof(pclass->location));
if ((attr = ippFindAttribute(con->request, "printer-info", IPP_TAG_TEXT)) != NULL)
- {
- strncpy(pclass->info, attr->values[0].string.text, sizeof(pclass->info) - 1);
- pclass->info[sizeof(pclass->info) - 1] = '\0';
- }
+ strlcpy(pclass->info, attr->values[0].string.text, sizeof(pclass->info));
if ((attr = ippFindAttribute(con->request, "printer-is-accepting-jobs", IPP_TAG_BOOLEAN)) != NULL)
{
pclass->browse_time = 0;
}
if ((attr = ippFindAttribute(con->request, "printer-state-message", IPP_TAG_TEXT)) != NULL)
- {
- strncpy(pclass->state_message, attr->values[0].string.text,
- sizeof(pclass->state_message) - 1);
- pclass->state_message[sizeof(pclass->state_message) - 1] = '\0';
- }
+ strlcpy(pclass->state_message, attr->values[0].string.text,
+ sizeof(pclass->state_message));
if ((attr = ippFindAttribute(con->request, "job-sheets-default", IPP_TAG_ZERO)) != NULL &&
!Classification[0])
{
- strncpy(pclass->job_sheets[0], attr->values[0].string.text,
- sizeof(pclass->job_sheets[0]) - 1);
+ strlcpy(pclass->job_sheets[0], attr->values[0].string.text,
+ sizeof(pclass->job_sheets[0]));
if (attr->num_values > 1)
- strncpy(pclass->job_sheets[1], attr->values[1].string.text,
- sizeof(pclass->job_sheets[1]) - 1);
+ strlcpy(pclass->job_sheets[1], attr->values[1].string.text,
+ sizeof(pclass->job_sheets[1]));
else
strcpy(pclass->job_sheets[1], "none");
}
*/
if ((attr = ippFindAttribute(con->request, "printer-location", IPP_TAG_TEXT)) != NULL)
- {
- strncpy(printer->location, attr->values[0].string.text, sizeof(printer->location) - 1);
- printer->location[sizeof(printer->location) - 1] = '\0';
- }
+ strlcpy(printer->location, attr->values[0].string.text,
+ sizeof(printer->location));
if ((attr = ippFindAttribute(con->request, "printer-info", IPP_TAG_TEXT)) != NULL)
- {
- strncpy(printer->info, attr->values[0].string.text, sizeof(printer->info) - 1);
- printer->info[sizeof(printer->info) - 1] = '\0';
- }
+ strlcpy(printer->info, attr->values[0].string.text,
+ sizeof(printer->info));
if ((attr = ippFindAttribute(con->request, "device-uri", IPP_TAG_URI)) != NULL)
{
LogMessage(L_INFO, "Setting %s device-uri to \"%s\" (was \"%s\".)",
printer->name, attr->values[0].string.text, printer->device_uri);
- strncpy(printer->device_uri, attr->values[0].string.text,
- sizeof(printer->device_uri) - 1);
- printer->device_uri[sizeof(printer->device_uri) - 1] = '\0';
+ strlcpy(printer->device_uri, attr->values[0].string.text,
+ sizeof(printer->device_uri));
}
if ((attr = ippFindAttribute(con->request, "printer-is-accepting-jobs", IPP_TAG_BOOLEAN)) != NULL)
printer->browse_time = 0;
}
if ((attr = ippFindAttribute(con->request, "printer-state-message", IPP_TAG_TEXT)) != NULL)
- {
- strncpy(printer->state_message, attr->values[0].string.text,
- sizeof(printer->state_message) - 1);
- printer->state_message[sizeof(printer->state_message) - 1] = '\0';
- }
+ strlcpy(printer->state_message, attr->values[0].string.text,
+ sizeof(printer->state_message));
if ((attr = ippFindAttribute(con->request, "job-sheets-default", IPP_TAG_ZERO)) != NULL &&
!Classification[0])
{
- strncpy(printer->job_sheets[0], attr->values[0].string.text,
- sizeof(printer->job_sheets[0]) - 1);
+ strlcpy(printer->job_sheets[0], attr->values[0].string.text,
+ sizeof(printer->job_sheets[0]));
if (attr->num_values > 1)
- strncpy(printer->job_sheets[1], attr->values[1].string.text,
- sizeof(printer->job_sheets[1]) - 1);
+ strlcpy(printer->job_sheets[1], attr->values[1].string.text,
+ sizeof(printer->job_sheets[1]));
else
strcpy(printer->job_sheets[1], "none");
}
*/
if (con->filename[0])
- {
- strncpy(srcfile, con->filename, sizeof(srcfile) - 1);
- srcfile[sizeof(srcfile) - 1] = '\0';
- }
+ strlcpy(srcfile, con->filename, sizeof(srcfile));
else if ((attr = ippFindAttribute(con->request, "ppd-name", IPP_TAG_NAME)) != NULL)
{
if (strcmp(attr->values[0].string.text, "raw") == 0)
attr = ippFindAttribute(con->request, "requesting-user-name", IPP_TAG_NAME);
if (con->username[0])
- {
- strncpy(username, con->username, sizeof(username) - 1);
- username[sizeof(username) - 1] = '\0';
- }
+ strlcpy(username, con->username, sizeof(username));
else if (attr != NULL)
{
LogMessage(L_DEBUG, "check_quotas: requesting-user-name = \'%s\'",
attr->values[0].string.text);
- strncpy(username, attr->values[0].string.text, sizeof(username) - 1);
- username[sizeof(username) - 1] = '\0';
+ strlcpy(username, attr->values[0].string.text, sizeof(username));
}
else
strcpy(username, "anonymous");
job->attrs = con->request;
con->request = NULL;
- strncpy(job->title, title, sizeof(job->title) - 1);
+ strlcpy(job->title, title, sizeof(job->title));
attr = ippFindAttribute(job->attrs, "requesting-user-name", IPP_TAG_NAME);
if (con->username[0])
- {
- strncpy(job->username, con->username, sizeof(job->username) - 1);
- job->username[sizeof(job->username) - 1] = '\0';
- }
+ strlcpy(job->username, con->username, sizeof(job->username));
else if (attr != NULL)
{
LogMessage(L_DEBUG, "create_job: requesting-user-name = \'%s\'",
attr->values[0].string.text);
- strncpy(job->username, attr->values[0].string.text,
- sizeof(job->username) - 1);
- job->username[sizeof(job->username) - 1] = '\0';
+ strlcpy(job->username, attr->values[0].string.text,
+ sizeof(job->username));
}
else
strcpy(job->username, "anonymous");
attr->values[0].boolean)
{
if (con->username[0])
- {
- strncpy(username, con->username, sizeof(username) - 1);
- username[sizeof(username) - 1] = '\0';
- }
+ strlcpy(username, con->username, sizeof(username));
else if ((attr = ippFindAttribute(con->request, "requesting-user-name", IPP_TAG_NAME)) != NULL)
- {
- strncpy(username, attr->values[0].string.text, sizeof(username) - 1);
- username[sizeof(username) - 1] = '\0';
- }
+ strlcpy(username, attr->values[0].string.text, sizeof(username));
else
strcpy(username, "anonymous");
}
* Copy the rest of the job info...
*/
- strncpy(job->title, title, sizeof(job->title) - 1);
+ strlcpy(job->title, title, sizeof(job->title));
attr = ippFindAttribute(job->attrs, "requesting-user-name", IPP_TAG_NAME);
if (con->username[0])
- {
- strncpy(job->username, con->username, sizeof(job->username) - 1);
- job->username[sizeof(job->username) - 1] = '\0';
- }
+ strlcpy(job->username, con->username, sizeof(job->username));
else if (attr != NULL)
{
LogMessage(L_DEBUG, "print_job: requesting-user-name = \'%s\'",
attr->values[0].string.text);
- strncpy(job->username, attr->values[0].string.text, sizeof(job->username) - 1);
- job->username[sizeof(job->username) - 1] = '\0';
+ strlcpy(job->username, attr->values[0].string.text, sizeof(job->username));
}
else
strcpy(job->username, "anonymous");
IPP_TAG_TEXT)) == NULL)
strcpy(printer->state_message, "Rejecting Jobs");
else
- {
- strncpy(printer->state_message, attr->values[0].string.text,
- sizeof(printer->state_message) - 1);
- printer->state_message[sizeof(printer->state_message) - 1] = '\0';
- }
+ strlcpy(printer->state_message, attr->values[0].string.text,
+ sizeof(printer->state_message));
if (dtype == CUPS_PRINTER_CLASS)
SaveAllClasses();
*/
if (strcmp(attr->name, "job-name") == 0)
- strncpy(job->title, attr->values[0].string.text, sizeof(job->title) - 1);
+ strlcpy(job->title, attr->values[0].string.text, sizeof(job->title));
else if (strcmp(attr->name, "job-hold-until") == 0)
{
SetJobHoldUntil(job->id, attr->values[0].string.text);
strcpy(printer->state_message, "Paused");
else
{
- strncpy(printer->state_message, attr->values[0].string.text,
- sizeof(printer->state_message) - 1);
- printer->state_message[sizeof(printer->state_message) - 1] = '\0';
+ strlcpy(printer->state_message, attr->values[0].string.text,
+ sizeof(printer->state_message));
}
if (dtype == CUPS_PRINTER_CLASS)
*/
if (con->username[0])
- strncpy(username, con->username, userlen - 1);
+ strlcpy(username, con->username, userlen);
else if ((attr = ippFindAttribute(con->request, "requesting-user-name", IPP_TAG_NAME)) != NULL)
- strncpy(username, attr->values[0].string.text, userlen - 1);
+ strlcpy(username, attr->values[0].string.text, userlen);
else
- strncpy(username, "anonymous", userlen - 1);
-
- username[userlen - 1] = '\0';
+ strlcpy(username, "anonymous", userlen);
/*
* Check the username against the owner...
/*
- * End of "$Id: ipp.c,v 1.158 2002/05/15 01:52:17 mike Exp $".
+ * End of "$Id: ipp.c,v 1.159 2002/05/16 13:45:01 mike Exp $".
*/
/*
- * "$Id: job.c,v 1.153 2002/05/15 01:52:18 mike Exp $"
+ * "$Id: job.c,v 1.154 2002/05/16 13:45:01 mike Exp $"
*
* Job management routines for the Common UNIX Printing System (CUPS).
*
job->id = NextJobId ++;
job->priority = priority;
- strncpy(job->dest, dest, sizeof(job->dest) - 1);
+ strlcpy(job->dest, dest, sizeof(job->dest));
NumJobs ++;
continue;
}
- strncpy(job->dest, dest, sizeof(job->dest) - 1);
+ strlcpy(job->dest, dest, sizeof(job->dest));
job->sheets = ippFindAttribute(job->attrs, "job-media-sheets-completed",
IPP_TAG_INTEGER);
job->priority = attr->values[0].integer;
attr = ippFindAttribute(job->attrs, "job-name", IPP_TAG_NAME);
- strncpy(job->title, attr->values[0].string.text,
- sizeof(job->title) - 1);
+ strlcpy(job->title, attr->values[0].string.text,
+ sizeof(job->title));
attr = ippFindAttribute(job->attrs, "job-originating-user-name", IPP_TAG_NAME);
- strncpy(job->username, attr->values[0].string.text,
- sizeof(job->username) - 1);
+ strlcpy(job->username, attr->values[0].string.text,
+ sizeof(job->username));
if (job->state->values[0].integer == IPP_JOB_HELD)
{
if (current->state->values[0].integer >= IPP_JOB_PROCESSING)
break;
- strncpy(current->dest, dest, sizeof(current->dest) - 1);
+ strlcpy(current->dest, dest, sizeof(current->dest));
current->dtype = p->type & (CUPS_PRINTER_CLASS | CUPS_PRINTER_REMOTE);
if ((attr = ippFindAttribute(current->attrs, "job-printer-uri", IPP_TAG_URI)) != NULL)
else if (strcmp(attr->name, "job-name") == 0 &&
(attr->value_tag == IPP_TAG_NAME ||
attr->value_tag == IPP_TAG_NAMELANG))
- {
- strncpy(title, attr->values[0].string.text, sizeof(title) - 1);
- title[sizeof(title) - 1] = '\0';
- }
+ strlcpy(title, attr->values[0].string.text, sizeof(title));
else if (attr->group_tag == IPP_TAG_JOB)
{
/*
*/
if (optptr > options)
- strncat(optptr, " ", sizeof(options) - (optptr - options) - 1);
+ strlcat(optptr, " ", sizeof(options) - (optptr - options));
if (attr->value_tag != IPP_TAG_BOOLEAN)
{
- strncat(optptr, attr->name, sizeof(options) - (optptr - options) - 1);
- strncat(optptr, "=", sizeof(options) - (optptr - options) - 1);
+ strlcat(optptr, attr->name, sizeof(options) - (optptr - options));
+ strlcat(optptr, "=", sizeof(options) - (optptr - options));
}
for (i = 0; i < attr->num_values; i ++)
{
if (i)
- strncat(optptr, ",", sizeof(options) - (optptr - options) - 1);
+ strlcat(optptr, ",", sizeof(options) - (optptr - options));
optptr += strlen(optptr);
{
case IPP_TAG_INTEGER :
case IPP_TAG_ENUM :
- snprintf(optptr, sizeof(options) - (optptr - options) - 1,
+ snprintf(optptr, sizeof(options) - (optptr - options),
"%d", attr->values[i].integer);
break;
case IPP_TAG_BOOLEAN :
if (!attr->values[i].boolean)
- strncat(optptr, "no", sizeof(options) - (optptr - options) - 1);
+ strlcat(optptr, "no", sizeof(options) - (optptr - options));
case IPP_TAG_NOVALUE :
- strncat(optptr, attr->name,
- sizeof(options) - (optptr - options) - 1);
+ strlcat(optptr, attr->name,
+ sizeof(options) - (optptr - options));
break;
case IPP_TAG_RANGE :
strchr(attr->values[i].string.text, '\t') != NULL ||
strchr(attr->values[i].string.text, '\n') != NULL)
{
- strncat(optptr, "\'", sizeof(options) - (optptr - options) - 1);
- strncat(optptr, attr->values[i].string.text,
- sizeof(options) - (optptr - options) - 1);
- strncat(optptr, "\'", sizeof(options) - (optptr - options) - 1);
+ strlcat(optptr, "\'", sizeof(options) - (optptr - options));
+ strlcat(optptr, attr->values[i].string.text,
+ sizeof(options) - (optptr - options));
+ strlcat(optptr, "\'", sizeof(options) - (optptr - options));
}
else
- strncat(optptr, attr->values[i].string.text,
- sizeof(options) - (optptr - options) - 1);
+ strlcat(optptr, attr->values[i].string.text,
+ sizeof(options) - (optptr - options));
break;
default :
snprintf(command, sizeof(command), "%s/filter/%s", ServerBin,
filters[i].filter);
else
- {
- strncpy(command, filters[i].filter, sizeof(command) - 1);
- command[sizeof(command) - 1] = '\0';
- }
+ strlcpy(command, filters[i].filter, sizeof(command));
if (i < (num_filters - 1) ||
strncmp(printer->device_uri, "file:", 5) != 0)
if ((loglevel == L_INFO && !job->status) ||
loglevel < L_INFO)
- strncpy(job->printer->state_message, message,
- sizeof(job->printer->state_message) - 1);
+ strlcpy(job->printer->state_message, message,
+ sizeof(job->printer->state_message));
}
/*
/*
- * End of "$Id: job.c,v 1.153 2002/05/15 01:52:18 mike Exp $".
+ * End of "$Id: job.c,v 1.154 2002/05/16 13:45:01 mike Exp $".
*/
/*
- * "$Id: log.c,v 1.25 2002/05/14 01:14:29 mike Exp $"
+ * "$Id: log.c,v 1.26 2002/05/16 13:45:02 mike Exp $"
*
* Log file routines for the Common UNIX Printing System (CUPS).
*
if (logname[0] != '/')
{
- strncpy(filename, ServerRoot, sizeof(filename) - 1);
- strncat(filename, "/", sizeof(filename) - 1);
+ strlcpy(filename, ServerRoot, sizeof(filename));
+ strlcat(filename, "/", sizeof(filename));
}
else
filename[0] = '\0';
* Insert the server name...
*/
- strncpy(ptr, ServerName, sizeof(filename) - (ptr - filename) - 1);
+ strlcpy(ptr, ServerName, sizeof(filename) - (ptr - filename));
ptr += strlen(ptr);
}
else
fclose(*log);
strcpy(backname, filename);
- strncat(backname, ".O", sizeof(backname) - 1);
- backname[sizeof(backname) - 1] = '\0';
+ strlcat(backname, ".O", sizeof(backname));
unlink(backname);
rename(filename, backname);
/*
- * End of "$Id: log.c,v 1.25 2002/05/14 01:14:29 mike Exp $".
+ * End of "$Id: log.c,v 1.26 2002/05/16 13:45:02 mike Exp $".
*/
/*
- * "$Id: main.c,v 1.71 2002/05/12 11:49:29 mike Exp $"
+ * "$Id: main.c,v 1.72 2002/05/16 13:45:02 mike Exp $"
*
* Scheduler main loop for the Common UNIX Printing System (CUPS).
*
* Absolute directory...
*/
- strncpy(ConfigurationFile, argv[i], sizeof(ConfigurationFile) - 1);
- ConfigurationFile[sizeof(ConfigurationFile) - 1] = '\0';
+ strlcpy(ConfigurationFile, argv[i], sizeof(ConfigurationFile));
}
else
{
*/
getcwd(ConfigurationFile, sizeof(ConfigurationFile));
- strncat(ConfigurationFile, "/", sizeof(ConfigurationFile) - 1);
- strncat(ConfigurationFile, argv[i], sizeof(ConfigurationFile) - 1);
- ConfigurationFile[sizeof(ConfigurationFile) - 1] = '\0';
+ strlcat(ConfigurationFile, "/", sizeof(ConfigurationFile));
+ strlcat(ConfigurationFile, argv[i], sizeof(ConfigurationFile));
}
break;
/*
- * End of "$Id: main.c,v 1.71 2002/05/12 11:49:29 mike Exp $".
+ * End of "$Id: main.c,v 1.72 2002/05/16 13:45:02 mike Exp $".
*/
/*
- * "$Id: mime.c,v 1.11 2002/05/14 01:14:30 mike Exp $"
+ * "$Id: mime.c,v 1.12 2002/05/16 13:45:02 mike Exp $"
*
* MIME database file routines for the Common UNIX Printing System (CUPS).
*
if (pathname == NULL)
return (NULL);
- strncpy(filename, pathname, sizeof(filename) - 1);
- filename[sizeof(filename) - 1] = '\0';
+ strlcpy(filename, pathname, sizeof(filename));
pathsep = filename + strlen(filename);
if ((pathsep - filename + 9) > sizeof(filename))
*/
if (filter[0] == '/')
- {
- strncpy(filterprog, filter, sizeof(filterprog) - 1);
- filterprog[sizeof(filterprog) - 1] = '\0';
- }
+ strlcpy(filterprog, filter, sizeof(filterprog));
else
snprintf(filterprog, sizeof(filterprog), "%s/%s", filterpath, filter);
/*
- * End of "$Id: mime.c,v 1.11 2002/05/14 01:14:30 mike Exp $".
+ * End of "$Id: mime.c,v 1.12 2002/05/16 13:45:02 mike Exp $".
*/
/*
- * "$Id: network.c,v 1.8 2002/04/02 18:58:53 mike Exp $"
+ * "$Id: network.c,v 1.9 2002/05/16 13:45:02 mike Exp $"
*
* Network interface functions for the Common UNIX Printing System
* (CUPS) scheduler.
* Then copy all of the information...
*/
- strncpy(temp->name, addr->ifa_name, sizeof(temp->name) - 1);
+ strlcpy(temp->name, addr->ifa_name, sizeof(temp->name));
memcpy(&(temp->address), addr->ifa_addr, sizeof(temp->address));
memcpy(&(temp->mask), addr->ifa_netmask, sizeof(temp->mask));
*/
if (host != NULL)
- strncpy(temp->hostname, host->h_name, sizeof(temp->hostname) - 1);
+ strlcpy(temp->hostname, host->h_name, sizeof(temp->hostname));
else if (ntohl(temp->address.sin_addr.s_addr) == 0x7f000001)
strcpy(temp->hostname, "localhost");
else if (temp->address.sin_addr.s_addr == ServerAddr.sin_addr.s_addr)
- strncpy(temp->hostname, ServerName, sizeof(temp->hostname) - 1);
+ strlcpy(temp->hostname, ServerName, sizeof(temp->hostname));
else
{
unsigned ip = ntohl(temp->address.sin_addr.s_addr);
/*
- * End of "$Id: network.c,v 1.8 2002/04/02 18:58:53 mike Exp $".
+ * End of "$Id: network.c,v 1.9 2002/05/16 13:45:02 mike Exp $".
*/
/*
- * "$Id: ppds.c,v 1.22 2002/01/02 17:59:17 mike Exp $"
+ * "$Id: ppds.c,v 1.23 2002/05/16 13:45:03 mike Exp $"
*
* PPD scanning routines for the Common UNIX Printing System (CUPS).
*
if (p[0])
snprintf(name, sizeof(name), "%s/%s", p, dent->d_name);
else
- {
- strncpy(name, dent->d_name, sizeof(name) - 1);
- name[sizeof(name) - 1] = '\0';
- }
+ strlcpy(name, dent->d_name, sizeof(name));
if (stat(filename, &fileinfo))
continue;
* Nope, copy the first part of the make and model then...
*/
- strncpy(manufacturer, make_model, sizeof(manufacturer) - 1);
+ strlcpy(manufacturer, make_model, sizeof(manufacturer));
/*
* Truncate at the first space, dash, or slash, or make the
ppd->record.ppd_mtime = fileinfo.st_mtime;
ppd->record.ppd_size = fileinfo.st_size;
- strncpy(ppd->record.ppd_name, name,
- sizeof(ppd->record.ppd_name) - 1);
- strncpy(ppd->record.ppd_make, manufacturer,
- sizeof(ppd->record.ppd_make) - 1);
- strncpy(ppd->record.ppd_make_and_model, make_model,
- sizeof(ppd->record.ppd_make_and_model) - 1);
- strncpy(ppd->record.ppd_natural_language, language,
- sizeof(ppd->record.ppd_natural_language) - 1);
+ strlcpy(ppd->record.ppd_name, name,
+ sizeof(ppd->record.ppd_name));
+ strlcpy(ppd->record.ppd_make, manufacturer,
+ sizeof(ppd->record.ppd_make));
+ strlcpy(ppd->record.ppd_make_and_model, make_model,
+ sizeof(ppd->record.ppd_make_and_model));
+ strlcpy(ppd->record.ppd_natural_language, language,
+ sizeof(ppd->record.ppd_natural_language));
changed_ppd = 1;
/*
- * End of "$Id: ppds.c,v 1.22 2002/01/02 17:59:17 mike Exp $".
+ * End of "$Id: ppds.c,v 1.23 2002/05/16 13:45:03 mike Exp $".
*/
/*
- * "$Id: printers.c,v 1.121 2002/05/15 21:00:00 mike Exp $"
+ * "$Id: printers.c,v 1.122 2002/05/16 13:45:03 mike Exp $"
*
* Printer routines for the Common UNIX Printing System (CUPS).
*
if ((p = calloc(1, sizeof(printer_t))) == NULL)
return (NULL);
- strncpy(p->name, name, sizeof(p->name) - 1);
- strncpy(p->hostname, ServerName, sizeof(p->hostname) - 1);
+ strlcpy(p->name, name, sizeof(p->name));
+ strlcpy(p->hostname, ServerName, sizeof(p->hostname));
snprintf(p->uri, sizeof(p->uri), "ipp://%s:%d/printers/%s", ServerName,
ntohs(Listeners[0].address.sin_port), name);
return;
}
else if (strcmp(name, "Info") == 0)
- strncpy(p->info, value, sizeof(p->info) - 1);
+ strlcpy(p->info, value, sizeof(p->info));
else if (strcmp(name, "Location") == 0)
- strncpy(p->location, value, sizeof(p->location) - 1);
+ strlcpy(p->location, value, sizeof(p->location));
else if (strcmp(name, "DeviceURI") == 0)
- strncpy(p->device_uri, value, sizeof(p->device_uri) - 1);
+ strlcpy(p->device_uri, value, sizeof(p->device_uri));
else if (strcmp(name, "State") == 0)
{
/*
while (isspace(*value))
value ++;
- strncpy(p->state_message, value, sizeof(p->state_message) - 1);
+ strlcpy(p->state_message, value, sizeof(p->state_message));
}
else if (strcmp(name, "Accepting") == 0)
{
if (*valueptr)
*valueptr++ = '\0';
- strncpy(p->job_sheets[0], value, sizeof(p->job_sheets[0]) - 1);
+ strlcpy(p->job_sheets[0], value, sizeof(p->job_sheets[0]));
while (isspace(*valueptr))
valueptr ++;
if (*valueptr)
*valueptr++ = '\0';
- strncpy(p->job_sheets[1], value, sizeof(p->job_sheets[1]) - 1);
+ strlcpy(p->job_sheets[1], value, sizeof(p->job_sheets[1]));
}
}
else if (strcmp(name, "AllowUser") == 0)
"pages-per-minute", ppd->throughput);
if (ppd->nickname)
- strncpy(p->make_model, ppd->nickname, sizeof(p->make_model) - 1);
+ strlcpy(p->make_model, ppd->nickname, sizeof(p->make_model));
else if (ppd->modelname)
- strncpy(p->make_model, ppd->modelname, sizeof(p->make_model) - 1);
+ strlcpy(p->make_model, ppd->modelname, sizeof(p->make_model));
else
strcpy(p->make_model, "Bad PPD File");
if (strcasecmp(hostname, "localhost") == 0)
hostname = ServerName;
- strncpy(localname, hostname, sizeof(localname) - 1);
- localname[sizeof(localname) - 1] = '\0';
+ strlcpy(localname, hostname, sizeof(localname));
if (strcasecmp(hostname, ServerName) != 0)
{
/*
- * End of "$Id: printers.c,v 1.121 2002/05/15 21:00:00 mike Exp $".
+ * End of "$Id: printers.c,v 1.122 2002/05/16 13:45:03 mike Exp $".
*/
/*
- * "$Id: quotas.c,v 1.6 2002/01/02 17:59:18 mike Exp $"
+ * "$Id: quotas.c,v 1.7 2002/05/16 13:45:03 mike Exp $"
*
* Quota routines for the Common UNIX Printing System (CUPS).
*
p->num_quotas ++;
memset(q, 0, sizeof(quota_t));
- strncpy(q->username, username, sizeof(q->username) - 1);
+ strlcpy(q->username, username, sizeof(q->username));
if (p->num_quotas > 1)
qsort(p->quotas, p->num_quotas, sizeof(quota_t),
q = NULL;
else
{
- strncpy(match.username, username, sizeof(match.username) - 1);
- match.username[sizeof(match.username) - 1] = '\0';
+ strlcpy(match.username, username, sizeof(match.username));
q = bsearch(&match, p->quotas, p->num_quotas, sizeof(quota_t),
(int(*)(const void *, const void *))compare);
/*
- * End of "$Id: quotas.c,v 1.6 2002/01/02 17:59:18 mike Exp $".
+ * End of "$Id: quotas.c,v 1.7 2002/05/16 13:45:03 mike Exp $".
*/
/*
- * "$Id: type.c,v 1.15 2002/05/14 01:14:30 mike Exp $"
+ * "$Id: type.c,v 1.16 2002/05/16 13:45:03 mike Exp $"
*
* MIME typing routines for the Common UNIX Printing System (CUPS).
*
mime->num_types ++;
*types = temp;
- strncpy(temp->super, super, sizeof(temp->super) - 1);
+ strlcpy(temp->super, super, sizeof(temp->super));
if ((temp->type = strdup(type)) == NULL)
{
mime->num_types --;
* Lookup the type in the array...
*/
- strncpy(key.super, super, sizeof(key.super) - 1);
- key.super[sizeof(key.super) - 1] = '\0';
+ strlcpy(key.super, super, sizeof(key.super));
key.type = (char *)type;
keyptr = &key;
/*
- * End of "$Id: type.c,v 1.15 2002/05/14 01:14:30 mike Exp $".
+ * End of "$Id: type.c,v 1.16 2002/05/16 13:45:03 mike Exp $".
*/
/*
- * "$Id: accept.c,v 1.15 2002/01/02 17:59:19 mike Exp $"
+ * "$Id: accept.c,v 1.16 2002/05/16 13:45:04 mike Exp $"
*
* "accept", "disable", "enable", and "reject" commands for the Common
* UNIX Printing System (CUPS).
*/
if (sscanf(argv[i], "%1023[^@]@%1023s", printer, hostname) == 1)
- {
- strncpy(hostname, server, sizeof(hostname) - 1);
- hostname[sizeof(hostname) - 1] = '\0';
- }
+ strlcpy(hostname, server, sizeof(hostname));
if (http != NULL && strcasecmp(http->hostname, hostname) != 0)
{
/*
- * End of "$Id: accept.c,v 1.15 2002/01/02 17:59:19 mike Exp $".
+ * End of "$Id: accept.c,v 1.16 2002/05/16 13:45:04 mike Exp $".
*/
/*
- * "$Id: cancel.c,v 1.22 2002/01/02 17:59:19 mike Exp $"
+ * "$Id: cancel.c,v 1.23 2002/05/16 13:45:04 mike Exp $"
*
* "cancel" command for the Common UNIX Printing System (CUPS).
*
}
else
{
- strncpy(name, argv[i], sizeof(name) - 1);
- name[sizeof(name) - 1] = '\0';
+ strlcpy(name, argv[i], sizeof(name));
dest = name;
job_id = 0;
/*
- * End of "$Id: cancel.c,v 1.22 2002/01/02 17:59:19 mike Exp $".
+ * End of "$Id: cancel.c,v 1.23 2002/05/16 13:45:04 mike Exp $".
*/
/*
- * "$Id: cupsaddsmb.c,v 1.7 2002/04/05 15:37:19 mike Exp $"
+ * "$Id: cupsaddsmb.c,v 1.8 2002/05/16 13:45:04 mike Exp $"
*
* "cupsaddsmb" command for the Common UNIX Printing System (CUPS).
*
if (Verbosity)
printf("Running command: %s\n", temp);
else
- {
- strncat(temp, " </dev/null >/dev/null 2>/dev/null", sizeof(temp) - 1);
- temp[sizeof(temp) - 1] = '\0';
- }
+ strlcat(temp, " </dev/null >/dev/null 2>/dev/null", sizeof(temp));
if ((status = system(temp)) != 0)
{
/*
- * End of "$Id: cupsaddsmb.c,v 1.7 2002/04/05 15:37:19 mike Exp $".
+ * End of "$Id: cupsaddsmb.c,v 1.8 2002/05/16 13:45:04 mike Exp $".
*/
/*
- * "$Id: lpadmin.c,v 1.29 2002/03/14 19:11:12 mike Exp $"
+ * "$Id: lpadmin.c,v 1.30 2002/05/16 13:45:04 mike Exp $"
*
* "lpadmin" command for the Common UNIX Printing System (CUPS).
*
* Get default option name...
*/
- strncpy(keyword, line + 8, sizeof(keyword) - 1);
- keyword[sizeof(keyword) - 1] = '\0';
+ strlcpy(keyword, line + 8, sizeof(keyword));
for (keyptr = keyword; *keyptr; keyptr ++)
if (*keyptr == ':' || isspace(*keyptr))
/*
- * End of "$Id: lpadmin.c,v 1.29 2002/03/14 19:11:12 mike Exp $".
+ * End of "$Id: lpadmin.c,v 1.30 2002/05/16 13:45:04 mike Exp $".
*/
/*
- * "$Id: ipptest.c,v 1.14 2002/04/09 19:27:07 mike Exp $"
+ * "$Id: ipptest.c,v 1.15 2002/05/16 13:45:05 mike Exp $"
*
* IPP test command for the Common UNIX Printing System (CUPS).
*
if (strncasecmp(tempptr + 1, "uri", 3) == 0)
{
- strncpy(tokenptr, uri, sizeof(token) - 1 - (tokenptr - token));
+ strlcpy(tokenptr, uri, sizeof(token) - (tokenptr - token));
tempptr += 4;
}
else if (strncasecmp(tempptr + 1, "method", 6) == 0)
{
- strncpy(tokenptr, method, sizeof(token) - 1 - (tokenptr - token));
+ strlcpy(tokenptr, method, sizeof(token) - (tokenptr - token));
tempptr += 7;
}
else if (strncasecmp(tempptr + 1, "username", 8) == 0)
{
- strncpy(tokenptr, userpass, sizeof(token) - 1 - (tokenptr - token));
+ strlcpy(tokenptr, userpass, sizeof(token) - (tokenptr - token));
tempptr += 9;
}
else if (strncasecmp(tempptr + 1, "hostname", 8) == 0)
{
- strncpy(tokenptr, server, sizeof(token) - 1 - (tokenptr - token));
+ strlcpy(tokenptr, server, sizeof(token) - (tokenptr - token));
tempptr += 9;
}
else if (strncasecmp(tempptr + 1, "port", 4) == 0)
{
- snprintf(tokenptr, sizeof(token) - 1 - (tokenptr - token),
+ snprintf(tokenptr, sizeof(token) - (tokenptr - token),
"%d", port);
tempptr += 5;
}
else if (strncasecmp(tempptr + 1, "resource", 8) == 0)
{
- strncpy(tokenptr, resource, sizeof(token) - 1 - (tokenptr - token));
+ strlcpy(tokenptr, resource, sizeof(token) - (tokenptr - token));
tempptr += 9;
}
else if (strncasecmp(tempptr + 1, "job-id", 6) == 0)
{
- snprintf(tokenptr, sizeof(token) - 1 - (tokenptr - token),
+ snprintf(tokenptr, sizeof(token) - (tokenptr - token),
"%d", job_id);
tempptr += 7;
}
else if (strncasecmp(tempptr + 1, "user", 4) == 0)
{
- strncpy(tokenptr, cupsUser(), sizeof(token) - 1 - (tokenptr - token));
+ strlcpy(tokenptr, cupsUser(), sizeof(token) - (tokenptr - token));
tempptr += 5;
}
else
/*
- * End of "$Id: ipptest.c,v 1.14 2002/04/09 19:27:07 mike Exp $".
+ * End of "$Id: ipptest.c,v 1.15 2002/05/16 13:45:05 mike Exp $".
*/