mike [Fri, 23 Sep 2005 20:29:27 +0000 (20:29 +0000)]
Fix domain socket handling (STR #1277)
cups/http.h:
- Add httpAddrLength() function.
cups/http-addr.c:
- httpAddrLength(): Added.
scheduler/conf.c:
- get_address(): Return immediately if we have a domain
socket address.
- read_configuration(): Only default to IPv6 if the local
system supports it and we are not using OpenBSD.
scheduler/listen.c:
- StartListening(): Use httpAddrLength() for bind calls,
and revamp the logging to be more useful.
mike [Fri, 23 Sep 2005 20:04:07 +0000 (20:04 +0000)]
Don't set the default run group to the default system group, otherwise
the new web interface will always authenticate as root!
conf/cupsd.conf.in:
- Add DefaultAuthType line.
scheduler/cert.c:
- AddCert(): Use SystemGroupIDs[0] to initialize root
certificate.
scheduler/conf.c:
- ReadConfiguration(): Initialize SystemGroupIDs array, check
for identical SystemGroup and Group IDs.
- read_configuration(): Validate SystemGroups and set
SystemGroupIDs.
mike [Thu, 22 Sep 2005 20:56:46 +0000 (20:56 +0000)]
Update scheduler to use new environment variable API - this reduces code
size and will allow us to add the Apache PassEnv and SetEnv directives
without too much pain.
scheduler/client.c:
- pipe_command(): Use new cupsdLoadEnv() function.
scheduler/conf.c:
- ReadConfiguration(): Call cupsdInitEnv() after loading
cupsd.conf.
scheduler/cupsd.h:
- Drop TZ global.
- Add cupsdClearEnv(), cupsdInitEnv(), cupsdLoadEnv(),
cupsdSetEnv(), and cupsdSetEnvf() functions.
scheduler/dirsvc.c:
- StartPolling(): Use new cupsdLoadEnv() function.
scheduler/env.c:
- Added.
scheduler/job.c:
- StartJob(): Use new cupsdLoadEnv() function.
scheduler/listen.c:
- StartListening(): Set CUPS_SERVER, CUPS_ENCRYPTION, and
IPP_PORT environment variables.
scheduler/main.c:
- main(): Drop TZ environment variable stuff.
mike [Wed, 21 Sep 2005 09:32:25 +0000 (09:32 +0000)]
Fix up parsing of client.conf and ~/.cupsrc files.
cups/usersys.c:
- cupsEncryption(): Use cupsFileGetConf() to read config
lines, and strcasecmp() to look for Encryption option.
- cupsServer(): Use strcasecmp() to look for ServerName
option.
configure.in:
- Include config-scripts/cups-threads.m4.
cups/emit.c:
- Make PS code string a constant character array instead of a
string pointer.
cups/globals.c:
cups/globals.h:
- Added.
cups/http-addr.c:
- httpGetHostByName(): Use _cupsGlobals() to get thread-local
data.
cups/http.c:
- httpGetDateString(): Use _cupsGlobals() to get thread-local
data.
cups/ipp.c:
- General documentation cleanup.
- ippDateToTime(): Use _cupsGlobals() to get thread-local
data.
- ippDeleteAttribute(): Implemented.
cups/ipp-support.c:
- ippErrorString(), ippOpString(), ippPort(), ippSetPort():
Use _cupsGlobals() to get thread-local data.
cups/language.c:
- cupsLangFlush(), cupsLangGet(), appleLangDefault(): Use
_cupsGlobals() to get thread-local data.
cups/normalize.c:
- cupsNormalizeMapsGet(), cupsNormalizeMapsFree(),
cupsNormalizeMapsFlush(), cupsUTF32Normalize(),
cupsUTF32CaseFold(): Use _cupsGlobals() to get thread-local
data.
- get_general_category(), get_bidi_category(),
get_combining_class(), get_break_class(), get_normmap(),
get_foldmap(), get_propmap(), get_combmap(),
get_breakmap(): Use _cupsGlobals() to get thread-local
data, and use cups_file_t and associated functions instead
of stdio.
cups/ppd.c:
- ppdLastError(), ppdOpen2(), ppdOpenFd(),
ppdSetConformance(): Use _cupsGlobals() to get thread-local
data.
- ppdOpenFile(): Use _cupsGlobals() to get thread-local data,
and use cups_file_t and associated functions instead of
stdio.
- ppd_get_group(), ppd_read(): Add and use cups_globals_t
pointer argument for thread-local data.
cups/tempfile.c:
- cupsTempFd(): Drop allocation of static filename buffer.
- cupsTempFile(): Use _cupsGlobals() to get thread-local
filename buffer.
cups/transcode.c:
- cupsCharmapFree(), cupsCharmapFlush(): Use _cupsGlobals()
to get thread-local data.
- get_sbcs_charmap(), get_vbcs_charmap(): Use _cupsGlobals()
to get thread-local data, and use cups_file_t and
associated functions instead of stdio.
cups/usersys.c:
- cupsEncryption(), cupsServer(): Use _cupsGlobals() to get
thread-local data, and use cups_file_t and associated
functions instead of stdio.
- cupsSetEncryption(), cupsSetPasswordCB(), cupsSetServer(),
cupsSetUser(), cupsUser(): Use _cupsGlobals() to get
thread-local data.
cups/util.c:
- cupsCancelJob(), cupsDoFileRequest(), cupsGetClasses(),
cupsGetDefault(), cupsGetDefault2(), cupsGetJobs(),
cupsGetJobs2(), cupsGetPPD(), cupsGetPPD2(),
cupsGetPrinters(), cupsPrintFiles(), cupsPrintFiles2(),
cups_connect(): Use _cupsGlobals() to get thread-local
data.
filter/hpgl-prolog.c:
- OutputProlog(): Use "%c" instead of CUPS_STRFTIME_FORMAT.
filter/imagetops.c:
- main(): Use "%c" instead of CUPS_STRFTIME_FORMAT.
filter/texttops.c:
- WriteProlog(): Use "%c" instead of CUPS_STRFTIME_FORMAT.
scheduler/classes.c:
- SaveAllClasses(): Use "%c" instead of CUPS_STRFTIME_FORMAT.
scheduler/printers.c:
- SaveAllPrinters(): Use "%c" instead of CUPS_STRFTIME_FORMAT.
scheduler/subscriptions.c:
- SaveAllSubscriptions(): Use "%c" instead of CUPS_STRFTIME_FORMAT.
systemv/lpstat.c:
- show_jobs(): Use "%c" instead of CUPS_STRFTIME_FORMAT.
mike [Tue, 20 Sep 2005 16:02:54 +0000 (16:02 +0000)]
Update sample cupsd.conf file and web interface to use the correct policy
syntax, and fix some other bugs.
cgi-bin/admin.c:
- do_config_server(): Update policy generation code to use
new syntax, use "Listen *:631" instead of "Port 631", and
add indentation support to the output for nicer config
files.
conf/cupsd.conf.in:
templates/edit-config.tmpl.in:
- Add Location /, Location /admin, and the default policy
stuff to make setup easier and clearer.
scheduler/client.c:
- AcceptClient(): Always set hostname pointer after a lookup.
scheduler/conf.c:
- ReadConfiguration(): Change default policy to use "Order
deny,allow" so that the access control limits can be set
exclusively using the Location directive by default.
scheduler/listen.c:
- StartListening(): Move IPv4 fallback code to the socket
creation section - otherwise it doesn't actually get used
on a system that is not configured with IPv6 support.
mike [Mon, 19 Sep 2005 02:53:06 +0000 (02:53 +0000)]
Fix buffered write implementation...
cups/http.c:
- Sort functions by name...
- httpFlushWrite(): Return the number of bytes flushed.
- httpPrintf(): Do no cache printf's.
- http_write(), http_write_chunk(): Add
cups/http.h:
- Change httpFlushWrite() to return an int.
scheduler/client.c:
- WriteClient(): Increase write buffer to 16k, and don't
bother flushing the cache.
- get_file(): Set data_remaining to the file size.
mike [Sun, 18 Sep 2005 23:58:56 +0000 (23:58 +0000)]
Added write buffering to the HTTP code to improve performance
(STR #547)
The scheduler now uses the attributes-natural-language attribute
to localize banner pages (STR #386)
cups/http.c:
- httpFlushWrite(): Added.
- httpWrite(): Use write buffer for small writes.
- httpPrintf(): Use write buffer for small writes.
- httpUpdate(): Flush write buffer as needed.
cups/http.h:
- Change buffer size to 1024 bytes.
- Add wbuffer and wused fields to http_t structure.
- Add httpFlushWrite() function.
scheduler/client.c:
- CloseClient(): Flush write buffer as needed.
- WriteClient(): Flush write buffer as needed.
scheduler/ipp.c:
- copy_banner(): Use attributes-natural-language instead of
con->language to localize banners.
mike [Sun, 18 Sep 2005 00:40:01 +0000 (00:40 +0000)]
Added new BrowseLocalProtocols and BrowseRemoteProtocols
directives to cupsd.conf, allowing for different browse protocols
for local and remote printers (STR #877)
man/cupsd.conf.man:
- Add new directives.
scheduler/conf.c:
- ReadConfiguration(): Initialize BrowseLocalProtocols and
BrowseRemoteProtocols.
- read_configuration(): Add support for BrowseLocalProtocols
and BrowseRemoteProtocols.
scheduler/dirsvc.c:
- SendBrowseDelete(): Use BrowseLocalProtocols.
- SendBrowseList(): Use BrowseLocalProtocols.
- StartBrowsing(): Use BrowseLocalProtocols and
BrowseRemoteProtocols.
- StopBrowsing(): Use BrowseLocalProtocols and
BrowseRemoteProtocols.
scheduler/dirsvc.h:
- Add BrowseLocalProtocols and BrowseRemoteProtocols.
- Remove BrowseProtocols.
scheduler/main.c:
- main(): Use BrowseLocalProtocols and
BrowseRemoteProtocols.
- select_timeout(): Use BrowseLocalProtocols.
mike [Sat, 17 Sep 2005 16:00:23 +0000 (16:00 +0000)]
The pdftops filter now minimizes print processing of PDF files
when using the page-ranges option (STR #273)
pdftops/Gfx.cxx:
- Gfx::Gfx(): Add initialization of renderThisPage member.
pdftops/Gfx.h:
- Add renderThisPage member.
pdftops/OutputDev.h:
pdftops/SplashOutputDev.h:
- startPage(): Change to return GBool.
pdftops/pdftops.cxx
- main(): Pass page-ranges option to PSOutputDev.
pdftops/PSOutputDev.cxx
- PSOutputDev(), init(): Add pageRangesA argument.
- startPage(): Return gTrue or gFalse depending on whether
the page will be printed.
- checkRange(): Add.
mike [Sat, 17 Sep 2005 03:48:43 +0000 (03:48 +0000)]
Added new cupsBackchannelRead() and cupsBackchannelWrite()
functions, as well as backchannel support to the parallel,
serial, socket, and USB backends (STR #1252)
The parallel and USB backends now treat a "no space available"
error as an out-of-paper condition (STR #1225)
backend/ipp.c:
- report_printer_state(): Cleanup printer status handling.
backend/parallel.c:
- main(): Add backchannel support, and check for ENOSPC
error.
config-scripts/cups-network.m4:
- Add check for getaddrinfo.
- Replace check for rresvport with check for rresvport_af.
cups/http.c:
- httpConnect(): Change "encrypt" to "encryption".
- httpConnectEncrypt(): Change "encrypt" to "encryption".
cups/http.h:
- httpConnectEncrypt(): Change "encrypt" to "encryption".
cups/http-addr.c:
- httpAddrLocalhost(): Treat unspecified IPv6 address as
local.
- httpAddrString(): Change IPv6 address format to [x:x:x:x].
- httpAddrGetHostByName(): Support [x:x:x:x] format for IPv6
addresses and use getaddrinfo() if available.
cups/http-support.c:
- httpSeparate(): Change method to scheme.
- httpSeparate2(): Change method to scheme, methodlen to
schemelen, support IPv6 addresses using the [x:x:x:x]
format, and decode all resources for the shortcut forms.
pdftops/gfile.h:
- Remove DIRENT checks.
scheduler/auth.c:
- CheckAuth(): Make IPv6 variables conditional.
- cupsdIsAuthorized(): Load IPv4 address using 0:0:0 prefix.
scheduler/client.c:
- AcceptClient(): Only do lookup after checking localhost and
server address.
scheduler/conf.c:
- get_address(): Support [x:x:x:x] format for IPv6 addresses,
and load IPv4 addresses using 0:0:0 prefix.
- get_addr_and_mask(): Support [x:x:x:x] format for IPv6 addresses,
and load IPv4 addresses using 0:0:0 prefix.
- read_configuration(): Add experimental code to double up
IPv6 + IPv4 for wildcard address (commented, since it isn't
needed for Linux, but we need to test other OS's...)
scheduler/listen.c:
- StartListening(): Automatically try binding IPv4 versions
of IPv6 loopback and "any" addresses, in case the local
system does not have IPv6 enabled at run time.
mike [Fri, 16 Sep 2005 14:44:00 +0000 (14:44 +0000)]
ippReadIO() did not read collections properly (STR #1249)
cups/ipp.c:
- ippReadIO(): Decrement attr->num_values when handling an
IPP_TAG_MEMBERNAME attribute, since collection members are
encoded differently than regular attributes.
cups/testipp.c:
- main(): Add more tests to confirm that attributes are read
correctly, and separate file tests from memory tests.
mike [Thu, 15 Sep 2005 19:10:34 +0000 (19:10 +0000)]
Added new httpGetHostname() function to CUPS API, and use it
instead of gethostname() so that the web interface will work
correctly on systems whose hostname is not the FQDN (STR #1266)
mike [Thu, 15 Sep 2005 18:43:06 +0000 (18:43 +0000)]
The configure script now supports "--disable-library" to disable
particular image file format support libraries, even if they are
available on the build system (STR #1248)
Also fix spelling error for "Renew-Subscription" operation.
mike [Thu, 15 Sep 2005 16:01:32 +0000 (16:01 +0000)]
Fix inefficient class management issues.
scheduler/classes.c:
- AddPrinterToClass(): Don't call SetPrinterAttrs(), as it is called
elsewhere as needed.
scheduler/dirsvc.c:
- ProcessBrowseData(): Log printer/class renames, send the
appropriate events (delete old, add new), and track implicit
class updates so that we don't call SetPrinterAttrs() more
than once for the class.
scheduler/printers.c:
- SetPrinterAttrs(): Only add raw filter for real printers - classes
and remote printers just need the "raw" flag set on the queue.
mike [Thu, 15 Sep 2005 14:13:19 +0000 (14:13 +0000)]
Change CUPS_PRINTER_SHARED to CUPS_PRINTER_NOT_SHARED so that we are still
compatible with older CUPS servers. Also fix some logic problems with the
browse checks.
scheduler/cups-polld.c:
- poll_server(): Check for CUPS_PRINTER_NOT_SHARED set to 0.
scheduler/dirsvc.c:
- UpdateCUPSBrowse(): Use the BrowseOrder setting to determine the
default allowed/denied setting, and check both the hostname and
port when determining whether to ignore the browse packet (this
needs further updating to just use the Listen hosts and ports)
scheduler/printers.c:
- SetPrinterAttrs(): Invert handling for CUPS_PRINTER_NOT_SHARED
(set when printer-is-shared is false)
mike [Wed, 14 Sep 2005 19:26:44 +0000 (19:26 +0000)]
Add httpGetDateString2() API to replace httpGetDateString(). The new
API accepts a string buffer pointer and length instead of returning
a value from static storage.
mike [Wed, 14 Sep 2005 19:21:51 +0000 (19:21 +0000)]
Rewrite httpGetDateTime() to not use mktime(), since that function uses
the current timezone setting instead of UTC.
cups/http.c:
- Rename days[] and months[] to http_days[] and http_months[] to
avoid namespace issues.
- httpGetDateString(): Use new http_days[] and http_months[].
- httpGetDateTime(): Convert string to UTC using some
relatively simple math instead of mktime().
cups/testhttp.c:
- main(): Add tests for httpGetDateString() and
httpGetDateTime() to verify that the new implementation
works.
mike [Wed, 14 Sep 2005 14:50:49 +0000 (14:50 +0000)]
Drop CUPS-Add-Device and CUPS-Delete-Device, and clean up bad operation
name code.
cups/ipp.h:
- Remove CUPS_ADD_DEVICE and CUPS_DELETE_DEVICE enumerations.
cups/ipp-support.c:
- Remove CUPS-Add-Device and CUPS-Delete-Device operation strings.
- ippOpString(): Last CUPS operation is CUPS_MOVE_JOB now.
scheduler/auth.c:
- AddName(), AllowHost(), AllowIP(), DenyHost(), DenyIP():
New debug2 log message.
- AllowIP(), DenyIP(): Copy all of address and netmask, not just
the sizeof(pointer)...
- cupsdIsAuthorized(): Cleanup and add debug2 log messages with
constant names to simplify debugging.
- cupsdIsAuthorized(): Don't special-case "no allow/deny lines"
configuration - just use Order directive to allow/deny by
default.
- cupsdIsAuthorized(): Use DefaultAuthType when no AuthType is
specified for a location.
scheduler/auth.h:
- Add DefaultAuthType (again)
scheduler/client.c:
- SendHeader(): Use DefaultAuthType when best authentication
type is not available or undefined.
scheduler/conf.c:
- ReadConfiguration(): Set DefaultAuthType, remove
CUPS_ADD_DEVICE and CUPS_DELETE_DEVICE from default policy.
- read_configuration(): Add DefaultAuthType parsing code.
mike [Fri, 9 Sep 2005 15:48:34 +0000 (15:48 +0000)]
Only add certificates for authenticated users and only add root
certificate if running as root...
scheduler/cert.c:
- InitCerts(): Only add root certificate when running as root.
scheduler/client.c:
- pipe_command(): Only add certificate for authenticated users.
scheduler/main.c:
- main(): Only add root certificate when running as root.
- select_timeout(): Only schedule time for root cert update when running as root.
scheduler/auth.c:
- cupsdCheckGroup(): Added.
- IsAuthorized(): Use new cupsdCheckGroup(), support @SYSTEM
group name when doing lookups, and use case-insensitive
comparisons for user and group names.
scheduler/auth.h:
- Add cupsdCheckGroup() function and <pwd.h> include.
scheduler/client.c:
- pipe_command(): Add CUPS_CACHEDIR env var.
scheduler/conf.c:
- ReadConfiguration(): Add CacheDir support and use @SYSTEM
instead of listing every system group.
- read_configuration(): Add CacheDir support, and use @SYSTEM
instead of listing every system group.
scheduler/ipp.c:
- check_quotas(): Use cupsdCheckGroup() function.
- get_ppds(): ppd-make is a text attribute, not a keyword
attribute.
- get_ppds(): Use URI escaping for spaces.
- user_allowed(): Use cupsdCheckGroup() function.
scheduler/job.c:
- StartJob(): Add CUPS_CACHEDIR env var.
scheduler/policy.c:
- check_group(): Removed.
- check_ok(): Use cupsdCheckGroup() function.
scheduler/util.c:
- cupsdSendIPPHeader(): Status code is only 2 bytes, not 4.
test/run-stp-tests.sh:
- Add CacheDir to sample config file.
mike [Thu, 1 Sep 2005 18:41:18 +0000 (18:41 +0000)]
Update default security configuration in cupsd.conf, add new
DefaultAuthType directive for policy-based authentication, and
fix cups-deviced invocation to use the run/root user.
cgi-bin/admin.c:
- Check and write /admin/conf location as well as /admin.
conf/cupsd.conf.in:
templates/edit-config.tmpl.in:
- Add /admin/conf location which requires authentication and
membership in the system group.
scheduler/auth.c:
- IsAuthorized(): Add logging of group checking.
scheduler/auth.h:
- Add DefaultAuthType variable.
scheduler/client.c:
- ReadClient(): Add "root" argument to SendCommand() calls.
- SendCommand(): Add "root" argument to function and to
pipe_command() calls.
- SendHeader(): Use DefaultAuthType for authentication
failures that don't match a location.
- pipe_command(): Add "root" argument to function and to
cupsdStartProcess() calls.
scheduler/client.h:
- Add "root" argument to SendCommand() function.
scheduler/conf.c:
- ReadConfiguration(): Add initialization of DefaultAuthType.
- read_configuration(): Add support for DefaultAuthType
directive.
- read_location(): Use DefaultAuthType as needed.
scheduler/ipp.c:
- get_devices(): Add root argument to SendCommand() call.
- get_ppds(): Add root argument to SendCommand() call.
- send_ipp_error(): Always return HTTP authentication error,
regardless of whether we have successfully authenticated
before.
scheduler/statbuf.c:
- cupsdStatBufUpdate(): Don't add prefix if the message
starts with a left bracket.
systemv/lppasswd.c:
- Update root user checks to allow for non-setuid
installations.
cups/tempfile.c:
- Default to /tmp instead of /var/tmp, to conform with the
FHS.
filter/raster.c:
- cupsRasterReadPixels(): remove extra definition of "byte"
variable.
Makedefs.in:
- Add CUPS_CACHEDIR definition.
scheduler/conf.c:
- ReadConfiguration(): Clean out TempDir if it is a
subdirectory of RequestRoot.
- ReadConfiguration(): Log the new value of MaxClients when
limiting.
scheduler/cups-deviced.c:
- Add function list to header.
scheduler/cups-driverd.c:
- Finish up "list" implementation, including new dynamic
driver PPD interface.
scheduler/ipp.c:
- get_ppds(): default ppd-make to "" instead of "all".
cups/ppd.c:
cups/ppd.h:
- Add ppdOpen2() function using cups_file_t *.
- Comment out current (unused) extended option code.
scheduler/Makefile:
- Add cups-driverd to build, remove ppds.o.
scheduler/banners.c:
- Use new cupsDir*() functions.
scheduler/conf.c:
- Create subdirs of RequestRoot and StateDir as needed.
scheduler/cups-deviced.c:
- Use new cupsDir*() functions.
- Add options argument to support requested-attributes and
other future options.
- Honor requested-attributes keywords.
scheduler/cupsd.h:
- Remove directory includes and PPDs variable.
scheduler/cups-driverd.c:
- Add incomplete code.
scheduler/ipp.c:
- add_printer(): Remove unused variables.
- get_devices(): Add requested-attributes support.
- get_ppds(): Change to use cups-driverd subprocess.
scheduler/job.c:
- Use new cupsDir*() functions.
scheduler/log.c:
- check_log_file(): Change argument name from "log" to "lf"
to eliminate a compiler warning (name shadowed).
mike [Fri, 26 Aug 2005 14:59:30 +0000 (14:59 +0000)]
Implement index search using regular expressions.
cgi-bin/help-index.c:
- helpSearchIndex(): Implement
- help_compile_search(): Add
- help_insert_node(): Fix binary insertion for 1-node case
- help_load_file(): Add whitespace to text when continuing
lines, and close the file at the end.
cgi-bin/help-index.h:
- Add filename argument to helpSearchIndex()
cgi-bin/testhi.c:
- Add tests for helpSearchIndex()