From: msweet Date: Mon, 22 Oct 2007 20:33:34 +0000 (+0000) Subject: Import CUPS 1.4svn-r7041. X-Git-Tag: release-1.6.3~198 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2fb7629816992611a1358912ea8b67eebbf7743d;p=thirdparty%2Fcups.git Import CUPS 1.4svn-r7041. git-svn-id: svn+ssh://src.apple.com/svn/cups/easysw/current@520 a1ca3aef-8c08-0410-bb20-df032aa958be --- diff --git a/CHANGES-1.3.txt b/CHANGES-1.3.txt index c71003c664..a85d714221 100644 --- a/CHANGES-1.3.txt +++ b/CHANGES-1.3.txt @@ -3,6 +3,17 @@ CHANGES-1.3.txt CHANGES IN CUPS V1.3.4 + - Documentation updates (STR #2560, STR #2563) + - Multiple AuthTypes in cupsd.conf did not work (STR + #2545) + - The snmp.conf file referenced the wrong man page (STR + #2564) + - The cupsaddsmb program didn't handle domain sockets + properly (STR #2556) + - The scheduler now validates device URIs when adding + printers. + - Updated httpSeparateURI() to support hostnames with + the backslash character. - Updated the Japanese localization (STR #2546) - The parallel backend now gets the current IEEE-1284 device ID string on Linux (STR #2553) diff --git a/Makedefs.in b/Makedefs.in index 258d577b43..c48f013f71 100644 --- a/Makedefs.in +++ b/Makedefs.in @@ -113,11 +113,11 @@ ALL_CFLAGS = $(CFLAGS) $(SSLFLAGS) @LARGEFILE@ @PTHREAD_FLAGS@ \ ARCHFLAGS = @ARCHFLAGS@ ARFLAGS = @ARFLAGS@ BACKLIBS = @BACKLIBS@ -CFLAGS = -I.. @CPPFLAGS@ @CFLAGS@ \ +CFLAGS = -I.. -D_CUPS_SOURCE @CPPFLAGS@ @CFLAGS@ \ @LARGEFILE@ @PTHREAD_FLAGS@ $(OPTIONS) COMMONLIBS = @LIBS@ CUPSDLIBS = @CUPSDLIBS@ -CXXFLAGS = -I.. $(SSLFLAGS) @CPPFLAGS@ @CXXFLAGS@ \ +CXXFLAGS = -I.. -D_CUPS_SOURCE $(SSLFLAGS) @CPPFLAGS@ @CXXFLAGS@ \ @LARGEFILE@ @PTHREAD_FLAGS@ $(OPTIONS) CXXLIBS = @CXXLIBS@ DSOFLAGS = @DSOFLAGS@ diff --git a/conf/snmp.conf.in b/conf/snmp.conf.in index a85dbc7c84..af9aada8d9 100644 --- a/conf/snmp.conf.in +++ b/conf/snmp.conf.in @@ -1,7 +1,7 @@ # # "$Id$" # -# Sample SNMP configuration file for CUPS. See "man smnp.conf" for a +# Sample SNMP configuration file for CUPS. See "man cups-smnp.conf" for a # complete description of this file. # diff --git a/cups/adminutil.h b/cups/adminutil.h index 94484fcc88..8613a3be4a 100644 --- a/cups/adminutil.h +++ b/cups/adminutil.h @@ -58,16 +58,16 @@ extern int cupsAdminExportSamba(const char *dest, const char *ppd, const char *samba_server, const char *samba_user, const char *samba_password, - FILE *logfile); + FILE *logfile) _CUPS_API_1_2; extern char *cupsAdminCreateWindowsPPD(http_t *http, const char *dest, - char *buffer, int bufsize); + char *buffer, int bufsize) _CUPS_API_1_2; extern int cupsAdminGetServerSettings(http_t *http, int *num_settings, - cups_option_t **settings); + cups_option_t **settings) _CUPS_API_1_3; extern int cupsAdminSetServerSettings(http_t *http, int num_settings, - cups_option_t *settings); + cups_option_t *settings) _CUPS_API_1_3; # ifdef __cplusplus diff --git a/cups/array.h b/cups/array.h index 2d1b89f47f..74785a4c69 100644 --- a/cups/array.h +++ b/cups/array.h @@ -22,6 +22,7 @@ * Include necessary headers... */ +# include "versioning.h" # include @@ -50,28 +51,28 @@ typedef int (*cups_ahash_func_t)(void *element, void *data); * Functions... */ -extern int cupsArrayAdd(cups_array_t *a, void *e); -extern void cupsArrayClear(cups_array_t *a); -extern int cupsArrayCount(cups_array_t *a); -extern void *cupsArrayCurrent(cups_array_t *a); -extern void cupsArrayDelete(cups_array_t *a); -extern cups_array_t *cupsArrayDup(cups_array_t *a); -extern void *cupsArrayFind(cups_array_t *a, void *e); -extern void *cupsArrayFirst(cups_array_t *a); -extern int cupsArrayGetIndex(cups_array_t *a); -extern int cupsArrayGetInsert(cups_array_t *a); -extern void *cupsArrayIndex(cups_array_t *a, int n); -extern int cupsArrayInsert(cups_array_t *a, void *e); -extern void *cupsArrayLast(cups_array_t *a); -extern cups_array_t *cupsArrayNew(cups_array_func_t f, void *d); +extern int cupsArrayAdd(cups_array_t *a, void *e) _CUPS_API_1_2; +extern void cupsArrayClear(cups_array_t *a) _CUPS_API_1_2; +extern int cupsArrayCount(cups_array_t *a) _CUPS_API_1_2; +extern void *cupsArrayCurrent(cups_array_t *a) _CUPS_API_1_2; +extern void cupsArrayDelete(cups_array_t *a) _CUPS_API_1_2; +extern cups_array_t *cupsArrayDup(cups_array_t *a) _CUPS_API_1_2; +extern void *cupsArrayFind(cups_array_t *a, void *e) _CUPS_API_1_2; +extern void *cupsArrayFirst(cups_array_t *a) _CUPS_API_1_2; +extern int cupsArrayGetIndex(cups_array_t *a) _CUPS_API_1_3; +extern int cupsArrayGetInsert(cups_array_t *a) _CUPS_API_1_3; +extern void *cupsArrayIndex(cups_array_t *a, int n) _CUPS_API_1_2; +extern int cupsArrayInsert(cups_array_t *a, void *e) _CUPS_API_1_2; +extern void *cupsArrayLast(cups_array_t *a) _CUPS_API_1_2; +extern cups_array_t *cupsArrayNew(cups_array_func_t f, void *d) _CUPS_API_1_2; extern cups_array_t *cupsArrayNew2(cups_array_func_t f, void *d, - cups_ahash_func_t h, int hsize); -extern void *cupsArrayNext(cups_array_t *a); -extern void *cupsArrayPrev(cups_array_t *a); -extern int cupsArrayRemove(cups_array_t *a, void *e); -extern void *cupsArrayRestore(cups_array_t *a); -extern int cupsArraySave(cups_array_t *a); -extern void *cupsArrayUserData(cups_array_t *a); + cups_ahash_func_t h, int hsize) _CUPS_API_1_3; +extern void *cupsArrayNext(cups_array_t *a) _CUPS_API_1_2; +extern void *cupsArrayPrev(cups_array_t *a) _CUPS_API_1_2; +extern int cupsArrayRemove(cups_array_t *a, void *e) _CUPS_API_1_2; +extern void *cupsArrayRestore(cups_array_t *a) _CUPS_API_1_2; +extern int cupsArraySave(cups_array_t *a) _CUPS_API_1_2; +extern void *cupsArrayUserData(cups_array_t *a) _CUPS_API_1_2; # ifdef __cplusplus } diff --git a/cups/backend.h b/cups/backend.h index 78081d4e50..5057f086fb 100644 --- a/cups/backend.h +++ b/cups/backend.h @@ -19,6 +19,13 @@ # define _CUPS_BACKEND_H_ +/* + * Include necessary headers... + */ + +# include "versioning.h" + + /* * Constants... */ @@ -38,7 +45,7 @@ typedef enum cups_backend_e /**** Backend exit codes ****/ * Prototypes... */ -extern const char *cupsBackendDeviceURI(char **argv); +extern const char *cupsBackendDeviceURI(char **argv) _CUPS_API_1_2; #endif /* !_CUPS_BACKEND_H_ */ diff --git a/cups/cups.h b/cups/cups.h index 25807ab0ac..7e48ea3af7 100644 --- a/cups/cups.h +++ b/cups/cups.h @@ -194,64 +194,64 @@ extern const char *cupsUser(void); /**** New in CUPS 1.1.20 ****/ extern int cupsDoAuthentication(http_t *http, const char *method, - const char *resource); + const char *resource) _CUPS_API_1_1_20; extern http_status_t cupsGetFile(http_t *http, const char *resource, - const char *filename); + const char *filename) _CUPS_API_1_1_20; extern http_status_t cupsGetFd(http_t *http, const char *resource, int fd); extern http_status_t cupsPutFile(http_t *http, const char *resource, - const char *filename); -extern http_status_t cupsPutFd(http_t *http, const char *resource, int fd); + const char *filename) _CUPS_API_1_1_20; +extern http_status_t cupsPutFd(http_t *http, const char *resource, int fd) _CUPS_API_1_1_20; /**** New in CUPS 1.1.21 ****/ -extern const char *cupsGetDefault2(http_t *http); -extern int cupsGetDests2(http_t *http, cups_dest_t **dests); +extern const char *cupsGetDefault2(http_t *http) _CUPS_API_1_1_21; +extern int cupsGetDests2(http_t *http, cups_dest_t **dests) _CUPS_API_1_1_21; extern int cupsGetJobs2(http_t *http, cups_job_t **jobs, const char *dest, int myjobs, - int completed); -extern const char *cupsGetPPD2(http_t *http, const char *printer); + int completed) _CUPS_API_1_1_21; +extern const char *cupsGetPPD2(http_t *http, const char *printer) _CUPS_API_1_1_21; extern int cupsPrintFile2(http_t *http, const char *printer, const char *filename, const char *title, int num_options, - cups_option_t *options); + cups_option_t *options) _CUPS_API_1_1_21; extern int cupsPrintFiles2(http_t *http, const char *printer, int num_files, const char **files, const char *title, int num_options, - cups_option_t *options); + cups_option_t *options) _CUPS_API_1_1_21; extern int cupsSetDests2(http_t *http, int num_dests, - cups_dest_t *dests); + cups_dest_t *dests) _CUPS_API_1_1_21; /**** New in CUPS 1.2 ****/ extern ssize_t cupsBackChannelRead(char *buffer, size_t bytes, - double timeout); + double timeout) _CUPS_API_1_2; extern ssize_t cupsBackChannelWrite(const char *buffer, size_t bytes, - double timeout); + double timeout) _CUPS_API_1_2; extern void cupsEncodeOptions2(ipp_t *ipp, int num_options, cups_option_t *options, - ipp_tag_t group_tag); -extern const char *cupsLastErrorString(void); -extern char *cupsNotifySubject(cups_lang_t *lang, ipp_t *event); -extern char *cupsNotifyText(cups_lang_t *lang, ipp_t *event); + ipp_tag_t group_tag) _CUPS_API_1_2; +extern const char *cupsLastErrorString(void) _CUPS_API_1_2; +extern char *cupsNotifySubject(cups_lang_t *lang, ipp_t *event) _CUPS_API_1_2; +extern char *cupsNotifyText(cups_lang_t *lang, ipp_t *event) _CUPS_API_1_2; extern int cupsRemoveOption(const char *name, int num_options, - cups_option_t **options); -extern cups_file_t *cupsTempFile2(char *filename, int len); + cups_option_t **options) _CUPS_API_1_2; +extern cups_file_t *cupsTempFile2(char *filename, int len) _CUPS_API_1_2; /**** New in CUPS 1.3 ****/ extern ipp_t *cupsDoIORequest(http_t *http, ipp_t *request, const char *resource, int infile, - int outfile); -extern char *cupsGetServerPPD(http_t *http, const char *name); + int outfile) _CUPS_API_1_3; +extern char *cupsGetServerPPD(http_t *http, const char *name) _CUPS_API_1_3; extern int cupsRemoveDest(const char *name, const char *instance, - int num_dests, cups_dest_t **dests); + int num_dests, cups_dest_t **dests) _CUPS_API_1_3; extern void cupsSetDefaultDest(const char *name, const char *instance, int num_dests, - cups_dest_t *dests); + cups_dest_t *dests) _CUPS_API_1_3; /**** New in CUPS 1.4 ****/ extern http_status_t cupsGetPPD3(http_t *http, const char *name, time_t *modtime, char *buffer, - size_t bufsize); + size_t bufsize) _CUPS_API_1_4; # ifdef __cplusplus } diff --git a/cups/dir.h b/cups/dir.h index 9b5eb3ceff..5a4f8d6d00 100644 --- a/cups/dir.h +++ b/cups/dir.h @@ -23,6 +23,7 @@ * Include necessary headers... */ +# include "versioning.h" # include @@ -52,10 +53,10 @@ typedef struct cups_dentry_s /**** Directory entry type ****/ * Prototypes... */ -extern void cupsDirClose(cups_dir_t *dp); -extern cups_dir_t *cupsDirOpen(const char *directory); -extern cups_dentry_t *cupsDirRead(cups_dir_t *dp); -extern void cupsDirRewind(cups_dir_t *dp); +extern void cupsDirClose(cups_dir_t *dp) _CUPS_API_1_2; +extern cups_dir_t *cupsDirOpen(const char *directory) _CUPS_API_1_2; +extern cups_dentry_t *cupsDirRead(cups_dir_t *dp) _CUPS_API_1_2; +extern void cupsDirRewind(cups_dir_t *dp) _CUPS_API_1_2; # ifdef __cplusplus diff --git a/cups/file.h b/cups/file.h index 89b6c4079d..a73d8fa585 100644 --- a/cups/file.h +++ b/cups/file.h @@ -26,6 +26,7 @@ * Include necessary headers... */ +# include "versioning.h" # include # if defined(WIN32) && !defined(__CUPS_SSIZE_T_DEFINED) # define __CUPS_SSIZE_T_DEFINED @@ -62,36 +63,36 @@ typedef struct _cups_file_s cups_file_t;/**** CUPS file type ****/ * Prototypes... */ -extern int cupsFileClose(cups_file_t *fp); -extern int cupsFileCompression(cups_file_t *fp); -extern int cupsFileEOF(cups_file_t *fp); +extern int cupsFileClose(cups_file_t *fp) _CUPS_API_1_2; +extern int cupsFileCompression(cups_file_t *fp) _CUPS_API_1_2; +extern int cupsFileEOF(cups_file_t *fp) _CUPS_API_1_2; extern const char *cupsFileFind(const char *filename, const char *path, int executable, char *buffer, - int bufsize); -extern int cupsFileFlush(cups_file_t *fp); -extern int cupsFileGetChar(cups_file_t *fp); + int bufsize) _CUPS_API_1_2; +extern int cupsFileFlush(cups_file_t *fp) _CUPS_API_1_2; +extern int cupsFileGetChar(cups_file_t *fp) _CUPS_API_1_2; extern char *cupsFileGetConf(cups_file_t *fp, char *buf, size_t buflen, - char **value, int *linenum); + char **value, int *linenum) _CUPS_API_1_2; extern size_t cupsFileGetLine(cups_file_t *fp, char *buf, - size_t buflen); -extern char *cupsFileGets(cups_file_t *fp, char *buf, size_t buflen); -extern int cupsFileLock(cups_file_t *fp, int block); -extern int cupsFileNumber(cups_file_t *fp); -extern cups_file_t *cupsFileOpen(const char *filename, const char *mode); -extern cups_file_t *cupsFileOpenFd(int fd, const char *mode); -extern int cupsFilePeekChar(cups_file_t *fp); -extern int cupsFilePrintf(cups_file_t *fp, const char *format, ...); -extern int cupsFilePutChar(cups_file_t *fp, int c); -extern int cupsFilePuts(cups_file_t *fp, const char *s); -extern ssize_t cupsFileRead(cups_file_t *fp, char *buf, size_t bytes); -extern off_t cupsFileRewind(cups_file_t *fp); -extern off_t cupsFileSeek(cups_file_t *fp, off_t pos); -extern cups_file_t *cupsFileStderr(void); -extern cups_file_t *cupsFileStdin(void); -extern cups_file_t *cupsFileStdout(void); -extern off_t cupsFileTell(cups_file_t *fp); -extern int cupsFileUnlock(cups_file_t *fp); -extern ssize_t cupsFileWrite(cups_file_t *fp, const char *buf, size_t bytes); + size_t buflen) _CUPS_API_1_2; +extern char *cupsFileGets(cups_file_t *fp, char *buf, size_t buflen) _CUPS_API_1_2; +extern int cupsFileLock(cups_file_t *fp, int block) _CUPS_API_1_2; +extern int cupsFileNumber(cups_file_t *fp) _CUPS_API_1_2; +extern cups_file_t *cupsFileOpen(const char *filename, const char *mode) _CUPS_API_1_2; +extern cups_file_t *cupsFileOpenFd(int fd, const char *mode) _CUPS_API_1_2; +extern int cupsFilePeekChar(cups_file_t *fp) _CUPS_API_1_2; +extern int cupsFilePrintf(cups_file_t *fp, const char *format, ...) _CUPS_API_1_2; +extern int cupsFilePutChar(cups_file_t *fp, int c) _CUPS_API_1_2; +extern int cupsFilePuts(cups_file_t *fp, const char *s) _CUPS_API_1_2; +extern ssize_t cupsFileRead(cups_file_t *fp, char *buf, size_t bytes) _CUPS_API_1_2; +extern off_t cupsFileRewind(cups_file_t *fp) _CUPS_API_1_2; +extern off_t cupsFileSeek(cups_file_t *fp, off_t pos) _CUPS_API_1_2; +extern cups_file_t *cupsFileStderr(void) _CUPS_API_1_2; +extern cups_file_t *cupsFileStdin(void) _CUPS_API_1_2; +extern cups_file_t *cupsFileStdout(void) _CUPS_API_1_2; +extern off_t cupsFileTell(cups_file_t *fp) _CUPS_API_1_2; +extern int cupsFileUnlock(cups_file_t *fp) _CUPS_API_1_2; +extern ssize_t cupsFileWrite(cups_file_t *fp, const char *buf, size_t bytes) _CUPS_API_1_2; # ifdef __cplusplus diff --git a/cups/http-support.c b/cups/http-support.c index 3382d483d8..3a6aee4363 100644 --- a/cups/http-support.c +++ b/cups/http-support.c @@ -1016,7 +1016,7 @@ httpSeparateURI( "0123456789" "-._~" "%" - "!$&'()*+,;=", *ptr)) + "!$&'()*+,;=\\", *ptr)) { *host = '\0'; return (HTTP_URI_BAD_HOSTNAME); diff --git a/cups/http.h b/cups/http.h index 2e765c40e0..552bab98af 100644 --- a/cups/http.h +++ b/cups/http.h @@ -23,6 +23,7 @@ * Include necessary headers... */ +# include "versioning.h" # include # include # include @@ -60,17 +61,6 @@ typedef off_t ssize_t; /* @private@ */ # endif /* LOCAL_PEERCRED && !SO_PEERCRED */ # endif /* WIN32 */ -/* - * With GCC 3.0 and higher, we can mark old APIs "deprecated" so you get - * a warning at compile-time. - */ - -# if defined(__GNUC__) && __GNUC__ > 2 -# define _HTTP_DEPRECATED __attribute__ ((__deprecated__)) -# else -# define _HTTP_DEPRECATED -# endif /* __GNUC__ && __GNUC__ > 2 */ - /* * C++ magic... @@ -358,20 +348,20 @@ __attribute__ ((__format__ (__printf__, 2, 3))) # endif /* __GNUC__ */ ; extern int httpPut(http_t *http, const char *uri); -extern int httpRead(http_t *http, char *buffer, int length) _HTTP_DEPRECATED; +extern int httpRead(http_t *http, char *buffer, int length) _CUPS_DEPRECATED; extern int httpReconnect(http_t *http); extern void httpSeparate(const char *uri, char *method, char *username, char *host, int *port, - char *resource) _HTTP_DEPRECATED; + char *resource) _CUPS_DEPRECATED; extern void httpSetField(http_t *http, http_field_t field, const char *value); extern const char *httpStatus(http_status_t status); extern int httpTrace(http_t *http, const char *uri); extern http_status_t httpUpdate(http_t *http); -extern int httpWrite(http_t *http, const char *buffer, int length) _HTTP_DEPRECATED; -extern char *httpEncode64(char *out, const char *in) _HTTP_DEPRECATED; -extern char *httpDecode64(char *out, const char *in) _HTTP_DEPRECATED; -extern int httpGetLength(http_t *http) _HTTP_DEPRECATED; +extern int httpWrite(http_t *http, const char *buffer, int length) _CUPS_DEPRECATED; +extern char *httpEncode64(char *out, const char *in) _CUPS_DEPRECATED; +extern char *httpDecode64(char *out, const char *in) _CUPS_DEPRECATED; +extern int httpGetLength(http_t *http) _CUPS_DEPRECATED; extern char *httpMD5(const char *, const char *, const char *, char [33]); extern char *httpMD5Final(const char *, const char *, const char *, @@ -379,73 +369,73 @@ extern char *httpMD5Final(const char *, const char *, const char *, extern char *httpMD5String(const unsigned char *, char [33]); /**** New in CUPS 1.1.19 ****/ -extern void httpClearCookie(http_t *http); -extern const char *httpGetCookie(http_t *http); -extern void httpSetCookie(http_t *http, const char *cookie); -extern int httpWait(http_t *http, int msec); +extern void httpClearCookie(http_t *http) _CUPS_API_1_1_19; +extern const char *httpGetCookie(http_t *http) _CUPS_API_1_1_19; +extern void httpSetCookie(http_t *http, const char *cookie) _CUPS_API_1_1_19; +extern int httpWait(http_t *http, int msec) _CUPS_API_1_1_19; /**** New in CUPS 1.1.21 ****/ -extern char *httpDecode64_2(char *out, int *outlen, const char *in); +extern char *httpDecode64_2(char *out, int *outlen, const char *in) _CUPS_API_1_1_21; extern char *httpEncode64_2(char *out, int outlen, const char *in, - int inlen); + int inlen) _CUPS_API_1_1_21; extern void httpSeparate2(const char *uri, char *method, int methodlen, char *username, int usernamelen, char *host, int hostlen, int *port, - char *resource, int resourcelen) _HTTP_DEPRECATED; + char *resource, int resourcelen) _CUPS_DEPRECATED; /**** New in CUPS 1.2 ****/ -extern int httpAddrAny(const http_addr_t *addr); -extern http_addrlist_t *httpAddrConnect(http_addrlist_t *addrlist, int *sock); +extern int httpAddrAny(const http_addr_t *addr) _CUPS_API_1_2; +extern http_addrlist_t *httpAddrConnect(http_addrlist_t *addrlist, int *sock) _CUPS_API_1_2; extern int httpAddrEqual(const http_addr_t *addr1, - const http_addr_t *addr2); -extern void httpAddrFreeList(http_addrlist_t *addrlist); + const http_addr_t *addr2) _CUPS_API_1_2; +extern void httpAddrFreeList(http_addrlist_t *addrlist) _CUPS_API_1_2; extern http_addrlist_t *httpAddrGetList(const char *hostname, int family, - const char *service); -extern int httpAddrLength(const http_addr_t *addr); -extern int httpAddrLocalhost(const http_addr_t *addr); + const char *service) _CUPS_API_1_2; +extern int httpAddrLength(const http_addr_t *addr) _CUPS_API_1_2; +extern int httpAddrLocalhost(const http_addr_t *addr) _CUPS_API_1_2; extern char *httpAddrLookup(const http_addr_t *addr, - char *name, int namelen); + char *name, int namelen) _CUPS_API_1_2; extern char *httpAddrString(const http_addr_t *addr, - char *s, int slen); + char *s, int slen) _CUPS_API_1_2; extern http_uri_status_t httpAssembleURI(http_uri_coding_t encoding, char *uri, int urilen, const char *scheme, const char *username, const char *host, int port, - const char *resource); + const char *resource) _CUPS_API_1_2; extern http_uri_status_t httpAssembleURIf(http_uri_coding_t encoding, char *uri, int urilen, const char *scheme, const char *username, const char *host, int port, - const char *resourcef, ...); -extern int httpFlushWrite(http_t *http); -extern int httpGetBlocking(http_t *http); -extern const char *httpGetDateString2(time_t t, char *s, int slen); -extern int httpGetFd(http_t *http); -extern const char *httpGetHostname(http_t *http, char *s, int slen); -extern off_t httpGetLength2(http_t *http); -extern http_status_t httpGetStatus(http_t *http); + const char *resourcef, ...) _CUPS_API_1_2; +extern int httpFlushWrite(http_t *http) _CUPS_API_1_2; +extern int httpGetBlocking(http_t *http) _CUPS_API_1_2; +extern const char *httpGetDateString2(time_t t, char *s, int slen) _CUPS_API_1_2; +extern int httpGetFd(http_t *http) _CUPS_API_1_2; +extern const char *httpGetHostname(http_t *http, char *s, int slen) _CUPS_API_1_2; +extern off_t httpGetLength2(http_t *http) _CUPS_API_1_2; +extern http_status_t httpGetStatus(http_t *http) _CUPS_API_1_2; extern char *httpGetSubField2(http_t *http, http_field_t field, const char *name, char *value, - int valuelen); -extern ssize_t httpRead2(http_t *http, char *buffer, size_t length); + int valuelen) _CUPS_API_1_2; +extern ssize_t httpRead2(http_t *http, char *buffer, size_t length) _CUPS_API_1_2; extern http_uri_status_t httpSeparateURI(http_uri_coding_t decoding, const char *uri, char *scheme, int schemelen, char *username, int usernamelen, char *host, int hostlen, int *port, - char *resource, int resourcelen); -extern void httpSetExpect(http_t *http, http_status_t expect); -extern void httpSetLength(http_t *http, size_t length); + char *resource, int resourcelen) _CUPS_API_1_2; +extern void httpSetExpect(http_t *http, http_status_t expect) _CUPS_API_1_2; +extern void httpSetLength(http_t *http, size_t length) _CUPS_API_1_2; extern ssize_t httpWrite2(http_t *http, const char *buffer, - size_t length); + size_t length) _CUPS_API_1_2; /**** New in CUPS 1.3 ****/ -extern char *httpGetAuthString(http_t *http); +extern char *httpGetAuthString(http_t *http) _CUPS_API_1_3; extern void httpSetAuthString(http_t *http, const char *scheme, - const char *data); + const char *data) _CUPS_API_1_3; /* * C++ magic... diff --git a/cups/ipp.h b/cups/ipp.h index 804bc95669..04f689a914 100644 --- a/cups/ipp.h +++ b/cups/ipp.h @@ -461,26 +461,26 @@ extern void ippSetPort(int p); /**** New in CUPS 1.1.19 ****/ extern ipp_attribute_t *ippAddCollection(ipp_t *ipp, ipp_tag_t group, - const char *name, ipp_t *value); + const char *name, ipp_t *value) _CUPS_API_1_1_19; extern ipp_attribute_t *ippAddCollections(ipp_t *ipp, ipp_tag_t group, const char *name, int num_values, - const ipp_t **values); -extern void ippDeleteAttribute(ipp_t *ipp, ipp_attribute_t *attr); -extern ipp_state_t ippReadFile(int fd, ipp_t *ipp); -extern ipp_state_t ippWriteFile(int fd, ipp_t *ipp); + const ipp_t **values) _CUPS_API_1_1_19; +extern void ippDeleteAttribute(ipp_t *ipp, ipp_attribute_t *attr) _CUPS_API_1_1_19; +extern ipp_state_t ippReadFile(int fd, ipp_t *ipp) _CUPS_API_1_1_19; +extern ipp_state_t ippWriteFile(int fd, ipp_t *ipp) _CUPS_API_1_1_19; /**** New in CUPS 1.2 ****/ extern ipp_attribute_t *ippAddOctetString(ipp_t *ipp, ipp_tag_t group, const char *name, - const void *data, int datalen); -extern ipp_status_t ippErrorValue(const char *name); -extern ipp_t *ippNewRequest(ipp_op_t op); -extern const char *ippOpString(ipp_op_t op); -extern ipp_op_t ippOpValue(const char *name); + const void *data, int datalen) _CUPS_API_1_2; +extern ipp_status_t ippErrorValue(const char *name) _CUPS_API_1_2; +extern ipp_t *ippNewRequest(ipp_op_t op) _CUPS_API_1_2; +extern const char *ippOpString(ipp_op_t op) _CUPS_API_1_2; +extern ipp_op_t ippOpValue(const char *name) _CUPS_API_1_2; extern ipp_state_t ippReadIO(void *src, ipp_iocb_t cb, int blocking, - ipp_t *parent, ipp_t *ipp); + ipp_t *parent, ipp_t *ipp) _CUPS_API_1_2; extern ipp_state_t ippWriteIO(void *dst, ipp_iocb_t cb, int blocking, - ipp_t *parent, ipp_t *ipp); + ipp_t *parent, ipp_t *ipp) _CUPS_API_1_2; /* diff --git a/cups/ppd.h b/cups/ppd.h index cd67a51fc0..f154c6ba3f 100644 --- a/cups/ppd.h +++ b/cups/ppd.h @@ -358,41 +358,41 @@ extern ppd_size_t *ppdPageSize(ppd_file_t *ppd, const char *name); extern float ppdPageWidth(ppd_file_t *ppd, const char *name); /**** New in CUPS 1.1.19 ****/ -extern const char *ppdErrorString(ppd_status_t status); +extern const char *ppdErrorString(ppd_status_t status) _CUPS_API_1_1_19; extern ppd_attr_t *ppdFindAttr(ppd_file_t *ppd, const char *name, - const char *spec); + const char *spec) _CUPS_API_1_1_19; extern ppd_attr_t *ppdFindNextAttr(ppd_file_t *ppd, const char *name, - const char *spec); -extern ppd_status_t ppdLastError(int *line); + const char *spec) _CUPS_API_1_1_19; +extern ppd_status_t ppdLastError(int *line) _CUPS_API_1_1_19; /**** New in CUPS 1.1.20 ****/ -extern void ppdSetConformance(ppd_conform_t c); +extern void ppdSetConformance(ppd_conform_t c) _CUPS_API_1_1_20; /**** New in CUPS 1.2 ****/ extern int ppdCollect2(ppd_file_t *ppd, ppd_section_t section, - float min_order, ppd_choice_t ***choices); + float min_order, ppd_choice_t ***choices) _CUPS_API_1_2; extern int ppdEmitAfterOrder(ppd_file_t *ppd, FILE *fp, ppd_section_t section, int limit, - float min_order); -extern int ppdEmitJCLEnd(ppd_file_t *ppd, FILE *fp); + float min_order) _CUPS_API_1_2; +extern int ppdEmitJCLEnd(ppd_file_t *ppd, FILE *fp) _CUPS_API_1_2; extern char *ppdEmitString(ppd_file_t *ppd, ppd_section_t section, - float min_order); + float min_order) _CUPS_API_1_2; extern ppd_coption_t *ppdFindCustomOption(ppd_file_t *ppd, - const char *keyword); + const char *keyword) _CUPS_API_1_2; extern ppd_cparam_t *ppdFindCustomParam(ppd_coption_t *opt, - const char *name); -extern ppd_cparam_t *ppdFirstCustomParam(ppd_coption_t *opt); -extern ppd_option_t *ppdFirstOption(ppd_file_t *ppd); -extern ppd_cparam_t *ppdNextCustomParam(ppd_coption_t *opt); -extern ppd_option_t *ppdNextOption(ppd_file_t *ppd); -extern int ppdLocalize(ppd_file_t *ppd); -extern ppd_file_t *ppdOpen2(cups_file_t *fp); + const char *name) _CUPS_API_1_2; +extern ppd_cparam_t *ppdFirstCustomParam(ppd_coption_t *opt) _CUPS_API_1_2; +extern ppd_option_t *ppdFirstOption(ppd_file_t *ppd) _CUPS_API_1_2; +extern ppd_cparam_t *ppdNextCustomParam(ppd_coption_t *opt) _CUPS_API_1_2; +extern ppd_option_t *ppdNextOption(ppd_file_t *ppd) _CUPS_API_1_2; +extern int ppdLocalize(ppd_file_t *ppd) _CUPS_API_1_2; +extern ppd_file_t *ppdOpen2(cups_file_t *fp) _CUPS_API_1_2; /**** New in CUPS 1.3 ****/ extern const char *ppdLocalizeIPPReason(ppd_file_t *ppd, const char *reason, const char *scheme, - char *buffer, size_t bufsize); + char *buffer, size_t bufsize) _CUPS_API_1_3; /* diff --git a/cups/sidechannel.h b/cups/sidechannel.h index 35b0de9dc9..bfe3cc0d6f 100644 --- a/cups/sidechannel.h +++ b/cups/sidechannel.h @@ -18,6 +18,13 @@ #ifndef _CUPS_SIDECHANNEL_H_ # define _CUPS_SIDECHANNEL_H_ +/* + * Include necessary headers... + */ + +# include "versioning.h" + + /* * C++ magic... */ @@ -84,15 +91,15 @@ typedef enum /**** Response status codes ****/ extern cups_sc_status_t cupsSideChannelDoRequest(cups_sc_command_t command, char *data, int *datalen, - double timeout); + double timeout) _CUPS_API_1_3; extern int cupsSideChannelRead(cups_sc_command_t *command, cups_sc_status_t *status, char *data, int *datalen, - double timeout); + double timeout) _CUPS_API_1_3; extern int cupsSideChannelWrite(cups_sc_command_t command, cups_sc_status_t status, const char *data, int datalen, - double timeout); + double timeout) _CUPS_API_1_3; # ifdef __cplusplus diff --git a/cups/transcode.h b/cups/transcode.h index 9278268552..8c8cd50052 100644 --- a/cups/transcode.h +++ b/cups/transcode.h @@ -57,17 +57,17 @@ typedef unsigned long cups_vbcs_t; /* VBCS Legacy 32-bit unit */ extern int cupsCharsetToUTF8(cups_utf8_t *dest, const char *src, const int maxout, - const cups_encoding_t encoding); + const cups_encoding_t encoding) _CUPS_API_1_2; extern int cupsUTF8ToCharset(char *dest, const cups_utf8_t *src, const int maxout, - const cups_encoding_t encoding); + const cups_encoding_t encoding) _CUPS_API_1_2; extern int cupsUTF8ToUTF32(cups_utf32_t *dest, const cups_utf8_t *src, - const int maxout); + const int maxout) _CUPS_API_1_2; extern int cupsUTF32ToUTF8(cups_utf8_t *dest, const cups_utf32_t *src, - const int maxout); + const int maxout) _CUPS_API_1_2; # ifdef __cplusplus } diff --git a/doc/help/network.html b/doc/help/network.html index e2cc361839..0d1e1766eb 100644 --- a/doc/help/network.html +++ b/doc/help/network.html @@ -99,7 +99,7 @@ socket://ip-address-or-hostname:port-number?waiteof=false

Internet Printing Protocol (IPP)

-

IPP is the only protocol that CUPS supports natively, and is also supported by many network printers. We recommend using this protocol over others whenever the printer or server supports it. IPP printing normally happens over port 631 and uses the http and ipp URI schemes:

+

IPP is the only protocol that CUPS supports natively and is supported by some network printers and print servers. However, since many printers do not implement IPP properly, only use IPP when the vendor actually documents official support for it. IPP printing normally happens over port 631 and uses the http and ipp URI schemes:

 http://ip-address-or-hostname:port-number/resource
@@ -322,18 +322,11 @@ lpd://ip-address-or-hostname/queue?option=value&option=valueaddress/pr3
 
 
-	Hewlett Packard JetDirect w/o IPP
+	Hewlett Packard JetDirect
 	socket://address:9100
socket://address:9101
socket://address:9102 - - Hewlett Packard JetDirect w/IPP - ipp://address/ipp
- ipp://address/ipp/port1
- ipp://address/ipp/port2
- ipp://address/ipp/port3 - Intel® NetportExpress XL, PRO/100 lpd://address/LPT1_PASSTHRU
diff --git a/filter/image.h b/filter/image.h index e05694ce4b..6dcba98388 100644 --- a/filter/image.h +++ b/filter/image.h @@ -63,60 +63,60 @@ typedef struct cups_izoom_s cups_izoom_t; * Prototypes... */ -extern void cupsImageClose(cups_image_t *img); +extern void cupsImageClose(cups_image_t *img) _CUPS_API_1_2; extern void cupsImageCMYKToBlack(const cups_ib_t *in, - cups_ib_t *out, int count); + cups_ib_t *out, int count) _CUPS_API_1_2; extern void cupsImageCMYKToCMY(const cups_ib_t *in, - cups_ib_t *out, int count); + cups_ib_t *out, int count) _CUPS_API_1_2; extern void cupsImageCMYKToCMYK(const cups_ib_t *in, - cups_ib_t *out, int count); + cups_ib_t *out, int count) _CUPS_API_1_2; extern void cupsImageCMYKToRGB(const cups_ib_t *in, - cups_ib_t *out, int count); + cups_ib_t *out, int count) _CUPS_API_1_2; extern void cupsImageCMYKToWhite(const cups_ib_t *in, - cups_ib_t *out, int count); + cups_ib_t *out, int count) _CUPS_API_1_2; extern int cupsImageGetCol(cups_image_t *img, int x, int y, - int height, cups_ib_t *pixels); -extern cups_icspace_t cupsImageGetColorSpace(cups_image_t *img); -extern int cupsImageGetDepth(cups_image_t *img); -extern unsigned cupsImageGetHeight(cups_image_t *img); + int height, cups_ib_t *pixels) _CUPS_API_1_2; +extern cups_icspace_t cupsImageGetColorSpace(cups_image_t *img) _CUPS_API_1_2; +extern int cupsImageGetDepth(cups_image_t *img) _CUPS_API_1_2; +extern unsigned cupsImageGetHeight(cups_image_t *img) _CUPS_API_1_2; extern int cupsImageGetRow(cups_image_t *img, int x, int y, - int width, cups_ib_t *pixels); -extern unsigned cupsImageGetWidth(cups_image_t *img); -extern unsigned cupsImageGetXPPI(cups_image_t *img); -extern unsigned cupsImageGetYPPI(cups_image_t *img); + int width, cups_ib_t *pixels) _CUPS_API_1_2; +extern unsigned cupsImageGetWidth(cups_image_t *img) _CUPS_API_1_2; +extern unsigned cupsImageGetXPPI(cups_image_t *img) _CUPS_API_1_2; +extern unsigned cupsImageGetYPPI(cups_image_t *img) _CUPS_API_1_2; extern void cupsImageLut(cups_ib_t *pixels, int count, - const cups_ib_t *lut); + const cups_ib_t *lut) _CUPS_API_1_2; extern cups_image_t *cupsImageOpen(const char *filename, cups_icspace_t primary, cups_icspace_t secondary, int saturation, int hue, - const cups_ib_t *lut); + const cups_ib_t *lut) _CUPS_API_1_2; extern void cupsImageRGBAdjust(cups_ib_t *pixels, int count, - int saturation, int hue); + int saturation, int hue) _CUPS_API_1_2; extern void cupsImageRGBToBlack(const cups_ib_t *in, - cups_ib_t *out, int count); + cups_ib_t *out, int count) _CUPS_API_1_2; extern void cupsImageRGBToCMY(const cups_ib_t *in, - cups_ib_t *out, int count); + cups_ib_t *out, int count) _CUPS_API_1_2; extern void cupsImageRGBToCMYK(const cups_ib_t *in, - cups_ib_t *out, int count); + cups_ib_t *out, int count) _CUPS_API_1_2; extern void cupsImageRGBToRGB(const cups_ib_t *in, - cups_ib_t *out, int count); + cups_ib_t *out, int count) _CUPS_API_1_2; extern void cupsImageRGBToWhite(const cups_ib_t *in, - cups_ib_t *out, int count); -extern void cupsImageSetMaxTiles(cups_image_t *img, int max_tiles); + cups_ib_t *out, int count) _CUPS_API_1_2; +extern void cupsImageSetMaxTiles(cups_image_t *img, int max_tiles) _CUPS_API_1_2; extern void cupsImageSetProfile(float d, float g, - float matrix[3][3]); -extern void cupsImageSetRasterColorSpace(cups_cspace_t cs); + float matrix[3][3]) _CUPS_API_1_2; +extern void cupsImageSetRasterColorSpace(cups_cspace_t cs) _CUPS_API_1_2; extern void cupsImageWhiteToBlack(const cups_ib_t *in, - cups_ib_t *out, int count); + cups_ib_t *out, int count) _CUPS_API_1_2; extern void cupsImageWhiteToCMY(const cups_ib_t *in, - cups_ib_t *out, int count); + cups_ib_t *out, int count) _CUPS_API_1_2; extern void cupsImageWhiteToCMYK(const cups_ib_t *in, - cups_ib_t *out, int count); + cups_ib_t *out, int count) _CUPS_API_1_2; extern void cupsImageWhiteToRGB(const cups_ib_t *in, - cups_ib_t *out, int count); + cups_ib_t *out, int count) _CUPS_API_1_2; extern void cupsImageWhiteToWhite(const cups_ib_t *in, - cups_ib_t *out, int count); + cups_ib_t *out, int count) _CUPS_API_1_2; # ifdef __cplusplus diff --git a/filter/raster.h b/filter/raster.h index 0d408987f8..4092dfa0d8 100644 --- a/filter/raster.h +++ b/filter/raster.h @@ -317,14 +317,14 @@ extern int cupsRasterInterpretPPD(cups_page_header2_t *h, ppd_file_t *ppd, int num_options, cups_option_t *options, - cups_interpret_cb_t func); + cups_interpret_cb_t func) _CUPS_API_1_2; extern unsigned cupsRasterReadHeader2(cups_raster_t *r, - cups_page_header2_t *h); + cups_page_header2_t *h) _CUPS_API_1_2; extern unsigned cupsRasterWriteHeader2(cups_raster_t *r, - cups_page_header2_t *h); + cups_page_header2_t *h) _CUPS_API_1_2; /**** New in CUPS 1.3 ****/ -extern const char *cupsRasterErrorString(void); +extern const char *cupsRasterErrorString(void) _CUPS_API_1_3; # ifdef __cplusplus } diff --git a/man/cupsfilter.man b/man/cupsfilter.man index d13973c7b0..0ccddc88a1 100644 --- a/man/cupsfilter.man +++ b/man/cupsfilter.man @@ -11,7 +11,7 @@ .\" which should have been included with this file. If this file is .\" file is missing or damaged, see the license at "http://www.cups.org/". .\" -.TH cupsfilter 8 "Common UNIX Printing System" "29 August 2007" "Apple Inc." +.TH cupsfilter 8 "Common UNIX Printing System" "19 October 2007" "Apple Inc." .SH NAME cupsfilter \- convert a file to another format using cups filters .SH SYNOPSIS @@ -20,9 +20,9 @@ cupsfilter \- convert a file to another format using cups filters .I config-file ] -j .I job-id[,N] --m +[ -m .I mime/type -[ -n +] [ -n .I copies ] [ -o .I name=value @@ -35,7 +35,7 @@ cupsfilter \- convert a file to another format using cups filters .SH DESCRIPTION \fIcupsfilter\fR is a front-end to the CUPS filter subsystem which allows you to convert a file to a specific format, just as if you had printed the file -through CUPS. +through CUPS. By default, \fIcupsfilter\fR generates a PDF file. .SH OPTIONS .TP 5 -c config-file @@ -49,7 +49,7 @@ converted. .TP 5 -m mime/type .br -Specifies the destination file type. +Specifies the destination file type. The default file type is application/pdf. .TP 5 -n copies .br @@ -66,6 +66,9 @@ Specifies the PPD file to use. -t title .br Specifies the document title. +.SH KNOWN ISSUES +\fIcupsfilter\fR currently does not use the filters defined in the PPD file. +This will be addressed in a future CUPS release. .SH SEE ALSO \fIcupsd.conf(5)\fR .br diff --git a/scheduler/auth.c b/scheduler/auth.c index d77d075d61..3d487ab2e3 100644 --- a/scheduler/auth.c +++ b/scheduler/auth.c @@ -363,6 +363,7 @@ cupsdAuthorize(cupsd_client_t *con) /* I - Client connection */ */ con->best = cupsdFindBest(con->uri, con->http.state); + con->type = AUTH_NONE; cupsdLogMessage(CUPSD_LOG_DEBUG2, "cupsdAuthorize: con->uri=\"%s\", con->best=%p(%s)", @@ -398,17 +399,7 @@ cupsdAuthorize(cupsd_client_t *con) /* I - Client connection */ } #endif /* HAVE_AUTHORIZATION_H */ - if (type == AUTH_NONE) - { - /* - * No authorization required, return early... - */ - - cupsdLogMessage(CUPSD_LOG_DEBUG, - "cupsdAuthorize: No authentication required."); - return; - } - else if (!*authorization) + if (!*authorization) { /* * No authorization data provided, return early... @@ -471,6 +462,8 @@ cupsdAuthorize(cupsd_client_t *con) /* I - Client connection */ username); AuthorizationFreeItemSet(authinfo); + + con->type = AUTH_BASIC; } #endif /* HAVE_AUTHORIZATION_H */ #if defined(SO_PEERCRED) && defined(AF_LOCAL) @@ -526,6 +519,8 @@ cupsdAuthorize(cupsd_client_t *con) /* I - Client connection */ cupsdLogMessage(CUPSD_LOG_DEBUG, "cupsdAuthorize: Authorized as %s using PeerCred", username); + + con->type = AUTH_BASIC; } #endif /* SO_PEERCRED && AF_LOCAL */ else if (!strncmp(authorization, "Local", 5) && @@ -554,9 +549,10 @@ cupsdAuthorize(cupsd_client_t *con) /* I - Client connection */ "found!"); return; } + + con->type = AUTH_BASIC; } - else if (!strncmp(authorization, "Basic", 5) && - (type == AUTH_BASIC || type == AUTH_BASICDIGEST)) + else if (!strncmp(authorization, "Basic", 5)) { /* * Get the Basic authentication data... @@ -615,6 +611,7 @@ cupsdAuthorize(cupsd_client_t *con) /* I - Client connection */ switch (type) { + default : case AUTH_BASIC : { #if HAVE_LIBPAM @@ -842,8 +839,10 @@ cupsdAuthorize(cupsd_client_t *con) /* I - Client connection */ username); break; } + + con->type = type; } - else if (!strncmp(authorization, "Digest", 6) && type == AUTH_DIGEST) + else if (!strncmp(authorization, "Digest", 6)) { /* * Get the username, password, and nonce from the Digest attributes... @@ -915,6 +914,8 @@ cupsdAuthorize(cupsd_client_t *con) /* I - Client connection */ cupsdLogMessage(CUPSD_LOG_DEBUG, "cupsdAuthorize: Authorized as %s using Digest", username); + + con->type = AUTH_DIGEST; } #ifdef HAVE_GSSAPI else if (!strncmp(authorization, "Negotiate", 9)) @@ -1054,30 +1055,23 @@ cupsdAuthorize(cupsd_client_t *con) /* I - Client connection */ gss_delete_sec_context(&minor_status, &context, GSS_C_NO_BUFFER); con->gss_have_creds = 1; + + con->type = AUTH_NEGOTIATE; } else gss_release_name(&minor_status, &client_name); } #endif /* HAVE_GSSAPI */ - else if (type != AUTH_NONE) + else { char scheme[256]; /* Auth scheme... */ - static const char * const types[] = /* Auth types */ - { - "None", - "Basic", - "Digest", - "BasicDigest", - "Negotiate" - }; if (sscanf(authorization, "%255s", scheme) != 1) strcpy(scheme, "UNKNOWN"); - cupsdLogMessage(CUPSD_LOG_ERROR, - "Bad authentication data \"%s ...\", expected \"%s ...\"", - scheme, types[type]); + cupsdLogMessage(CUPSD_LOG_ERROR, "Bad authentication data \"%s ...\"", + scheme); return; } @@ -1793,7 +1787,8 @@ cupsdIsAuthorized(cupsd_client_t *con, /* I - Connection */ const char *owner)/* I - Owner of object */ { int i, j, /* Looping vars */ - auth; /* Authorization status */ + auth, /* Authorization status */ + type; /* Type of authentication */ unsigned address[4]; /* Authorization address */ cupsd_location_t *best; /* Best match for location so far */ int hostlen; /* Length of hostname */ @@ -1809,11 +1804,11 @@ cupsdIsAuthorized(cupsd_client_t *con, /* I - Connection */ }; static const char * const types[] = /* Auth types */ { - "NONE", - "BASIC", - "DIGEST", - "BASICDIGEST", - "KERBEROS" + "None", + "Basic", + "Digest", + "BasicDigest", + "Negotiate" }; @@ -1842,10 +1837,13 @@ cupsdIsAuthorized(cupsd_client_t *con, /* I - Connection */ best = con->best; + if ((type = best->type) == AUTH_DEFAULT) + type = DefaultAuthType; + cupsdLogMessage(CUPSD_LOG_DEBUG2, - "cupsdIsAuthorized: level=AUTH_%s, type=AUTH_%s, " + "cupsdIsAuthorized: level=AUTH_%s, type=%s, " "satisfy=AUTH_SATISFY_%s, num_names=%d", - levels[best->level], types[best->type], + levels[best->level], types[type], best->satisfy ? "ANY" : "ALL", best->num_names); if (best->limit == AUTH_LIMIT_IPP) @@ -1946,8 +1944,8 @@ cupsdIsAuthorized(cupsd_client_t *con, /* I - Connection */ if ((best->encryption >= HTTP_ENCRYPT_REQUIRED && !con->http.tls && strcasecmp(con->http.hostname, "localhost") && best->satisfy == AUTH_SATISFY_ALL) && - !(best->type == AUTH_NEGOTIATE || - (best->type == AUTH_NONE && DefaultAuthType == AUTH_NEGOTIATE))) + !(type == AUTH_NEGOTIATE || + (type == AUTH_NONE && DefaultAuthType == AUTH_NEGOTIATE))) { cupsdLogMessage(CUPSD_LOG_DEBUG, "cupsdIsAuthorized: Need upgrade to TLS..."); @@ -1960,10 +1958,10 @@ cupsdIsAuthorized(cupsd_client_t *con, /* I - Connection */ */ if (best->level == AUTH_ANON || /* Anonymous access - allow it */ - (best->type == AUTH_NONE && best->num_names == 0)) + (type == AUTH_NONE && best->num_names == 0)) return (HTTP_OK); - if (!con->username[0] && best->type == AUTH_NONE && + if (!con->username[0] && type == AUTH_NONE && best->limit == AUTH_LIMIT_IPP) { /* @@ -2003,6 +2001,15 @@ cupsdIsAuthorized(cupsd_client_t *con, /* I - Connection */ return (HTTP_OK); /* unless overridden with Satisfy */ } + if (con->type != type && type != AUTH_NONE && + (con->type != AUTH_BASIC || type != AUTH_BASICDIGEST)) + { + cupsdLogMessage(CUPSD_LOG_ERROR, "Authorized using %s, expected %s!", + types[con->type], types[type]); + + return (HTTP_UNAUTHORIZED); + } + strlcpy(username, con->username, sizeof(username)); } diff --git a/scheduler/client.h b/scheduler/client.h index c92a5f02cb..f185c1e919 100644 --- a/scheduler/client.h +++ b/scheduler/client.h @@ -30,6 +30,7 @@ struct cupsd_client_s time_t start; /* Request start time */ http_state_t operation; /* Request operation */ off_t bytes; /* Bytes transferred for this request */ + int type; /* AuthType for username */ char username[256], /* Username from Authorization: line */ password[33], /* Password from Authorization: line */ uri[HTTP_MAX_URI], diff --git a/scheduler/ipp.c b/scheduler/ipp.c index b5a839c077..9f50ef8124 100644 --- a/scheduler/ipp.c +++ b/scheduler/ipp.c @@ -964,7 +964,7 @@ add_class(cupsd_client_t *con, /* I - Client connection */ else if (pclass->type & CUPS_PRINTER_IMPLICIT) { /* - * Check the default policy, then tename the implicit class to "AnyClass" + * Check the default policy, then rename the implicit class to "AnyClass" * or remove it... */ @@ -1014,7 +1014,7 @@ add_class(cupsd_client_t *con, /* I - Client connection */ else if ((status = cupsdCheckPolicy(pclass->op_policy_ptr, con, NULL)) != HTTP_OK) { - send_http_error(con, status, NULL); + send_http_error(con, status, pclass); return; } else @@ -2303,7 +2303,7 @@ add_printer(cupsd_client_t *con, /* I - Client connection */ else if ((status = cupsdCheckPolicy(printer->op_policy_ptr, con, NULL)) != HTTP_OK) { - send_http_error(con, status, NULL); + send_http_error(con, status, printer); return; } else @@ -2332,11 +2332,26 @@ add_printer(cupsd_client_t *con, /* I - Client connection */ * Do we have a valid device URI? */ + http_uri_status_t uri_status; /* URI separation status */ + + need_restart_job = 1; - httpSeparateURI(HTTP_URI_CODING_ALL, attr->values[0].string.text, scheme, - sizeof(scheme), username, sizeof(username), host, - sizeof(host), &port, resource, sizeof(resource)); + uri_status = httpSeparateURI(HTTP_URI_CODING_ALL, + attr->values[0].string.text, + scheme, sizeof(scheme), + username, sizeof(username), + host, sizeof(host), &port, + resource, sizeof(resource)); + + if (uri_status < HTTP_URI_OK) + { + send_ipp_status(con, IPP_NOT_POSSIBLE, _("Bad device-uri \"%s\"!"), + attr->values[0].string.text); + cupsdLogMessage(CUPSD_LOG_DEBUG, + "add_printer: httpSeparateURI returned %d", uri_status); + return; + } if (!strcmp(scheme, "file")) { @@ -2953,7 +2968,7 @@ authenticate_job(cupsd_client_t *con, /* I - Client connection */ if (!validate_user(job, con, job->username, username, sizeof(username))) { - send_http_error(con, HTTP_UNAUTHORIZED, NULL); + send_http_error(con, HTTP_UNAUTHORIZED, cupsdFindDest(job->dest)); return; } @@ -3270,7 +3285,7 @@ cancel_job(cupsd_client_t *con, /* I - Client connection */ if (!validate_user(job, con, job->username, username, sizeof(username))) { - send_http_error(con, HTTP_UNAUTHORIZED, NULL); + send_http_error(con, HTTP_UNAUTHORIZED, cupsdFindDest(job->dest)); return; } @@ -6326,7 +6341,7 @@ get_ppd(cupsd_client_t *con, /* I - Client connection */ if ((status = cupsdCheckPolicy(dest->op_policy_ptr, con, NULL)) != HTTP_OK) { - send_http_error(con, status, NULL); + send_http_error(con, status, dest); return; } @@ -7063,7 +7078,7 @@ hold_job(cupsd_client_t *con, /* I - Client connection */ if (!validate_user(job, con, job->username, username, sizeof(username))) { - send_http_error(con, HTTP_UNAUTHORIZED, NULL); + send_http_error(con, HTTP_UNAUTHORIZED, cupsdFindDest(job->dest)); return; } @@ -7321,7 +7336,7 @@ move_job(cupsd_client_t *con, /* I - Client connection */ if (!validate_user(job, con, job->username, username, sizeof(username))) { - send_http_error(con, HTTP_UNAUTHORIZED, NULL); + send_http_error(con, HTTP_UNAUTHORIZED, cupsdFindDest(job->dest)); return; } @@ -8067,7 +8082,7 @@ release_job(cupsd_client_t *con, /* I - Client connection */ if (!validate_user(job, con, job->username, username, sizeof(username))) { - send_http_error(con, HTTP_UNAUTHORIZED, NULL); + send_http_error(con, HTTP_UNAUTHORIZED, cupsdFindDest(job->dest)); return; } @@ -8309,7 +8324,7 @@ restart_job(cupsd_client_t *con, /* I - Client connection */ if (!validate_user(job, con, job->username, username, sizeof(username))) { - send_http_error(con, HTTP_UNAUTHORIZED, NULL); + send_http_error(con, HTTP_UNAUTHORIZED, cupsdFindDest(job->dest)); return; } @@ -8681,7 +8696,7 @@ send_document(cupsd_client_t *con, /* I - Client connection */ if (!validate_user(job, con, job->username, username, sizeof(username))) { - send_http_error(con, HTTP_UNAUTHORIZED, NULL); + send_http_error(con, HTTP_UNAUTHORIZED, cupsdFindDest(job->dest)); return; } @@ -8973,6 +8988,23 @@ send_http_error( printer && printer->num_auth_info_required > 0 && !strcmp(printer->auth_info_required[0], "negotiate")) cupsdSendError(con, status, AUTH_NEGOTIATE); + else if (printer) + { + char resource[HTTP_MAX_URI]; /* Resource portion of URI */ + cupsd_location_t *auth; /* Pointer to authentication element */ + + + if (printer->type & CUPS_PRINTER_CLASS) + snprintf(resource, sizeof(resource), "/classes/%s", printer->name); + else + snprintf(resource, sizeof(resource), "/printers/%s", printer->name); + + if ((auth = cupsdFindBest(resource, HTTP_POST)) == NULL || + auth->type == AUTH_NONE) + auth = cupsdFindPolicyOp(printer->op_policy_ptr, IPP_PRINT_JOB); + + cupsdSendError(con, status, auth ? auth->type : AUTH_NONE); + } else cupsdSendError(con, status, AUTH_NONE); @@ -9200,7 +9232,7 @@ set_job_attrs(cupsd_client_t *con, /* I - Client connection */ if (!validate_user(job, con, job->username, username, sizeof(username))) { - send_http_error(con, HTTP_UNAUTHORIZED, NULL); + send_http_error(con, HTTP_UNAUTHORIZED, cupsdFindDest(job->dest)); return; } diff --git a/systemv/cupsaddsmb.c b/systemv/cupsaddsmb.c index 3e48e8fa0b..2ce5f84a1c 100644 --- a/systemv/cupsaddsmb.c +++ b/systemv/cupsaddsmb.c @@ -152,8 +152,13 @@ main(int argc, /* I - Number of command-line arguments */ } if (SAMBAServer == NULL) + { SAMBAServer = cupsServer(); + if (SAMBAServer[0] == '/') /* Use localhost instead of domain socket */ + SAMBAServer = "localhost"; + } + if ((status = export_dest(http, argv[i])) != 0) return (status); } @@ -182,8 +187,13 @@ main(int argc, /* I - Number of command-line arguments */ */ if (SAMBAServer == NULL) + { SAMBAServer = cupsServer(); + if (SAMBAServer[0] == '/') /* Use localhost instead of domain socket */ + SAMBAServer = "localhost"; + } + num_dests = cupsGetDests2(http, &dests); for (j = 0, status = 0; j < num_dests; j ++)