diff options
author | jlovell <jlovell@a1ca3aef-8c08-0410-bb20-df032aa958be> | 2006-04-24 18:03:36 +0000 |
---|---|---|
committer | jlovell <jlovell@a1ca3aef-8c08-0410-bb20-df032aa958be> | 2006-04-24 18:03:36 +0000 |
commit | 89d46774ee527faaaf27d1b696554f4508bf105b (patch) | |
tree | 27ae92ec2e5df36836fc505515ab45f9a06cebc1 /scheduler | |
parent | e53920b9224e07b7d5f3e5a3ffea1f64ded479d2 (diff) | |
download | cups-89d46774ee527faaaf27d1b696554f4508bf105b.tar.gz |
Load cups into easysw/current.
git-svn-id: svn+ssh://src.apple.com/svn/cups/easysw/current@136 a1ca3aef-8c08-0410-bb20-df032aa958be
Diffstat (limited to 'scheduler')
-rw-r--r-- | scheduler/auth.c | 20 | ||||
-rw-r--r-- | scheduler/client.c | 94 | ||||
-rw-r--r-- | scheduler/cups-driverd.c | 10 | ||||
-rw-r--r-- | scheduler/cups-lpd.c | 70 | ||||
-rw-r--r-- | scheduler/dirsvc.c | 16 | ||||
-rw-r--r-- | scheduler/ipp.c | 170 | ||||
-rw-r--r-- | scheduler/job.c | 174 | ||||
-rw-r--r-- | scheduler/job.h | 9 | ||||
-rw-r--r-- | scheduler/main.c | 9 | ||||
-rw-r--r-- | scheduler/mime.c | 22 | ||||
-rw-r--r-- | scheduler/network.c | 282 | ||||
-rw-r--r-- | scheduler/statbuf.c | 6 |
12 files changed, 325 insertions, 557 deletions
diff --git a/scheduler/auth.c b/scheduler/auth.c index 6ece0cd51..e87f201e0 100644 --- a/scheduler/auth.c +++ b/scheduler/auth.c @@ -1,5 +1,5 @@ /* - * "$Id: auth.c 5336 2006-03-24 16:37:29Z mike $" + * "$Id: auth.c 5442 2006-04-20 14:00:02Z mike $" * * Authorization routines for the Common UNIX Printing System (CUPS). * @@ -27,17 +27,19 @@ * cupsdAddName() - Add a name to a location... * cupsdAllowHost() - Add a host name that is allowed to access the * location. - * cupsdAllowIP() - Add an IP address or network that is allowed to - * access the location. + * cupsdAllowIP() - Add an IP address or network that is allowed + * to access the location. + * cupsdAuthorize() - Validate any authorization credentials. * cupsdCheckAuth() - Check authorization masks. * cupsdCheckGroup() - Check for a user's group membership. * cupsdCopyLocation() - Make a copy of a location... - * cupsdDeleteAllLocations() - Free all memory used for location authorization. + * cupsdDeleteAllLocations() - Free all memory used for location + * authorization. * cupsdDeleteLocation() - Free all memory used by a location. - * cupsdDenyHost() - Add a host name that is not allowed to access the - * location. - * cupsdDenyIP() - Add an IP address or network that is not allowed - * to access the location. + * cupsdDenyHost() - Add a host name that is not allowed to access + * the location. + * cupsdDenyIP() - Add an IP address or network that is not + * allowed to access the location. * cupsdFindBest() - Find the location entry that best matches the * resource. * cupsdFindLocation() - Find the named location. @@ -2164,5 +2166,5 @@ to64(char *s, /* O - Output string */ /* - * End of "$Id: auth.c 5336 2006-03-24 16:37:29Z mike $". + * End of "$Id: auth.c 5442 2006-04-20 14:00:02Z mike $". */ diff --git a/scheduler/client.c b/scheduler/client.c index 06ee39340..ffd3e8f61 100644 --- a/scheduler/client.c +++ b/scheduler/client.c @@ -1,5 +1,5 @@ /* - * "$Id: client.c 5373 2006-04-06 20:03:32Z mike $" + * "$Id: client.c 5416 2006-04-17 21:24:17Z mike $" * * Client routines for the Common UNIX Printing System (CUPS) scheduler. * @@ -458,10 +458,12 @@ cupsdCloseClient(cupsd_client_t *con) /* I - Client to close */ SSL *conn; /* Connection for encryption */ unsigned long error; /* Error code */ #elif defined(HAVE_GNUTLS) - http_tls_t *conn; /* TLS connection information */ - int error; /* Error code */ + http_tls_t *conn; /* TLS connection information */ + int error; /* Error code */ gnutls_certificate_server_credentials *credentials; /* TLS credentials */ +# elif defined(HAVE_CDSASSL) + http_tls_t *conn; /* CDSA connection information */ #endif /* HAVE_LIBSSL */ @@ -530,10 +532,17 @@ cupsdCloseClient(cupsd_client_t *con) /* I - Client to close */ free(conn); # elif defined(HAVE_CDSASSL) - while (SSLClose((SSLContextRef)con->http.tls) == errSSLWouldBlock) + conn = (http_tls_t *)(con->http.tls); + + while (SSLClose(conn->session) == errSSLWouldBlock) usleep(1000); - SSLDisposeContext((SSLContextRef)con->http.tls); + SSLDisposeContext(conn->session); + + if (conn->certsArray) + CFRelease(conn->certsArray); + + free(conn); # endif /* HAVE_LIBSSL */ con->http.tls = NULL; @@ -892,8 +901,8 @@ cupsdReadClient(cupsd_client_t *con) /* I - Client to read from */ con->start = time(NULL); con->operation = con->http.state; - cupsdLogMessage(CUPSD_LOG_DEBUG, "cupsdReadClient: %d %s %s HTTP/%d.%d", con->http.fd, - operation, con->uri, + cupsdLogMessage(CUPSD_LOG_DEBUG, "cupsdReadClient: %d %s %s HTTP/%d.%d", + con->http.fd, operation, con->uri, con->http.version / 100, con->http.version % 100); con->http.status = HTTP_OK; @@ -958,6 +967,10 @@ cupsdReadClient(cupsd_client_t *con) /* I - Client to read from */ snprintf(locale, sizeof(locale), "%s.%s", con->http.fields[HTTP_FIELD_ACCEPT_LANGUAGE], DefaultCharset); + cupsdLogMessage(CUPSD_LOG_DEBUG, + "cupsdReadClient: %d Browser asked for language \"%s\"...", + con->http.fd, locale); + con->language = cupsLangGet(locale); } else @@ -2564,7 +2577,7 @@ encrypt_client(cupsd_client_t *con) /* I - Client to encrypt */ * Create the SSL object and perform the SSL handshake... */ - conn = (http_tls_t *)malloc(sizeof(gnutls_session)); + conn = (http_tls_t *)malloc(sizeof(http_tls_t)); if (conn == NULL) return (0); @@ -2618,23 +2631,19 @@ encrypt_client(cupsd_client_t *con) /* I - Client to encrypt */ return (1); # elif defined(HAVE_CDSASSL) - OSStatus error; /* Error info */ - SSLContextRef conn; /* New connection */ - CFArrayRef certificatesArray; - /* Array containing certificates */ - int allowExpired; /* Allow expired certificates? */ - int allowAnyRoot; /* Allow any root certificate? */ - cdsa_conn_ref_t u; /* Connection reference union */ + OSStatus error; /* Error code */ + http_tls_t *conn; /* CDSA connection information */ + cdsa_conn_ref_t u; /* Connection reference union */ - conn = NULL; - error = SSLNewContext(true, &conn); - allowExpired = 1; - allowAnyRoot = 1; + if ((conn = (http_tls_t *)malloc(sizeof(http_tls_t))) == NULL) + return (0); - certificatesArray = get_cdsa_server_certs(); + error = 0; + conn->session = NULL; + conn->certsArray = get_cdsa_server_certs(); - if (!certificatesArray) + if (!conn->certsArray) { cupsdLogMessage(CUPSD_LOG_ERROR, "EncryptClient: Could not find signing key in keychain " @@ -2643,10 +2652,13 @@ encrypt_client(cupsd_client_t *con) /* I - Client to encrypt */ } if (!error) - error = SSLSetIOFuncs(conn, _httpReadCDSA, _httpWriteCDSA); + error = SSLNewContext(true, &conn->session); if (!error) - error = SSLSetProtocolVersion(conn, kSSLProtocol3); + error = SSLSetIOFuncs(conn->session, _httpReadCDSA, _httpWriteCDSA); + + if (!error) + error = SSLSetProtocolVersion(conn->session, kSSLProtocol3); if (!error) { @@ -2656,30 +2668,17 @@ encrypt_client(cupsd_client_t *con) /* I - Client to encrypt */ u.connection = NULL; u.sock = con->http.fd; - error = SSLSetConnection(conn, u.connection); + error = SSLSetConnection(conn->session, u.connection); } if (!error) - error = SSLSetPeerDomainName(conn, ServerName, strlen(ServerName) + 1); - - /* - * Have to set these options before setting server certs... - */ - - if (!error && allowExpired) - error = SSLSetAllowsExpiredCerts(conn, true); - - if (!error && allowAnyRoot) - error = SSLSetAllowsAnyRoot(conn, true); + error = SSLSetAllowsExpiredCerts(conn->session, true); if (!error) - error = SSLSetCertificate(conn, certificatesArray); + error = SSLSetAllowsAnyRoot(conn->session, true); - if (certificatesArray) - { - CFRelease(certificatesArray); - certificatesArray = NULL; - } + if (!error) + error = SSLSetCertificate(conn->session, conn->certsArray); if (!error) { @@ -2687,7 +2686,7 @@ encrypt_client(cupsd_client_t *con) /* I - Client to encrypt */ * Perform SSL/TLS handshake */ - while ((error = SSLHandshake(conn)) == errSSLWouldBlock) + while ((error = SSLHandshake(conn->session)) == errSSLWouldBlock) usleep(1000); } @@ -2703,8 +2702,13 @@ encrypt_client(cupsd_client_t *con) /* I - Client to encrypt */ con->http.error = error; con->http.status = HTTP_ERROR; - if (conn != NULL) - SSLDisposeContext(conn); + if (conn->session) + SSLDisposeContext(conn->session); + + if (conn->certsArray) + CFRelease(conn->certsArray); + + free(conn); return (0); } @@ -3820,5 +3824,5 @@ send_file(cupsd_client_t *con, /* I - Client connection */ /* - * End of "$Id: client.c 5373 2006-04-06 20:03:32Z mike $". + * End of "$Id: client.c 5416 2006-04-17 21:24:17Z mike $". */ diff --git a/scheduler/cups-driverd.c b/scheduler/cups-driverd.c index fd662551d..1e0b1e45b 100644 --- a/scheduler/cups-driverd.c +++ b/scheduler/cups-driverd.c @@ -1,5 +1,5 @@ /* - * "$Id: cups-driverd.c 5333 2006-03-24 00:52:21Z mike $" + * "$Id: cups-driverd.c 5422 2006-04-18 15:16:00Z mike $" * * PPD/driver support for the Common UNIX Printing System (CUPS). * @@ -142,7 +142,7 @@ add_ppd(const char *name, /* I - PPD name */ const char *natural_language, /* I - Language(s) */ const char *make, /* I - Manufacturer */ const char *make_and_model, /* I - NickName */ - const char *device_id, /* I - 1284DeviceId */ + const char *device_id, /* I - 1284DeviceID */ time_t mtime, /* I - Modification time */ size_t size) /* I - File size */ { @@ -656,7 +656,7 @@ load_ppds(const char *d, /* I - Actual directory */ make_model[256], /* Make and Model */ model_name[256], /* ModelName */ nick_name[256], /* NickName */ - device_id[256]; /* 1284DeviceId */ + device_id[256]; /* 1284DeviceID */ ppd_info_t *ppd, /* New PPD file */ key; /* Search key */ int new_ppd; /* Is this a new PPD? */ @@ -799,7 +799,7 @@ load_ppds(const char *d, /* I - Actual directory */ sscanf(line, "%*[^:]:%63s", lang_version); else if (!strncmp(line, "*NickName:", 10)) sscanf(line, "%*[^\"]\"%255[^\"]", nick_name); - else if (!strncmp(line, "*1284DeviceId:", 14)) + else if (!strncasecmp(line, "*1284DeviceID:", 14)) sscanf(line, "%*[^\"]\"%255[^\"]", device_id); else if (!strncmp(line, "*OpenUI", 7)) { @@ -1113,5 +1113,5 @@ load_drivers(void) /* - * End of "$Id: cups-driverd.c 5333 2006-03-24 00:52:21Z mike $". + * End of "$Id: cups-driverd.c 5422 2006-04-18 15:16:00Z mike $". */ diff --git a/scheduler/cups-lpd.c b/scheduler/cups-lpd.c index e5b546050..60b68090f 100644 --- a/scheduler/cups-lpd.c +++ b/scheduler/cups-lpd.c @@ -1,5 +1,5 @@ /* - * "$Id: cups-lpd.c 5204 2006-02-28 20:32:43Z mike $" + * "$Id: cups-lpd.c 5455 2006-04-24 13:49:59Z mike $" * * Line Printer Daemon interface for the Common UNIX Printing System (CUPS). * @@ -128,6 +128,7 @@ main(int argc, /* I - Number of command-line arguments */ char hostname[256], /* Name of client */ hostip[256], /* IP address */ *hostfamily; /* Address family */ + int hostlookups; /* Do hostname lookups? */ /* @@ -143,39 +144,12 @@ main(int argc, /* I - Number of command-line arguments */ openlog("cups-lpd", LOG_PID, LOG_LPR); /* - * Get the address of the client... - */ - - hostlen = sizeof(hostaddr); - - if (getpeername(0, (struct sockaddr *)&hostaddr, &hostlen)) - { - syslog(LOG_WARNING, "Unable to get client address - %s", strerror(errno)); - strcpy(hostname, "unknown"); - } - else - { - httpAddrLookup(&hostaddr, hostname, sizeof(hostname)); - httpAddrString(&hostaddr, hostip, sizeof(hostip)); - -#ifdef AF_INET6 - if (hostaddr.addr.sa_family == AF_INET6) - hostfamily = "IPv6"; - else -#endif /* AF_INET6 */ - hostfamily = "IPv4"; - - syslog(LOG_INFO, "Connection from %s (%s %s)", hostname, hostfamily, - hostip); - } - - /* * Scan the command-line for options... */ num_defaults = 0; defaults = NULL; - + hostlookups = 1; num_defaults = cupsAddOption("job-originating-host-name", hostname, num_defaults, &defaults); @@ -198,6 +172,11 @@ main(int argc, /* I - Number of command-line arguments */ syslog(LOG_WARNING, "Expected option string after -o option!"); } break; + + case 'n' : /* Don't do hostname lookups */ + hostlookups = 0; + break; + default : syslog(LOG_WARNING, "Unknown option \"%c\" ignored!", argv[i][1]); break; @@ -208,6 +187,37 @@ main(int argc, /* I - Number of command-line arguments */ argv[i]); /* + * Get the address of the client... + */ + + hostlen = sizeof(hostaddr); + + if (getpeername(0, (struct sockaddr *)&hostaddr, &hostlen)) + { + syslog(LOG_WARNING, "Unable to get client address - %s", strerror(errno)); + strcpy(hostname, "unknown"); + } + else + { + httpAddrString(&hostaddr, hostip, sizeof(hostip)); + + if (hostlookups) + httpAddrLookup(&hostaddr, hostname, sizeof(hostname)); + else + strlcpy(hostname, hostip, sizeof(hostname)); + +#ifdef AF_INET6 + if (hostaddr.addr.sa_family == AF_INET6) + hostfamily = "IPv6"; + else +#endif /* AF_INET6 */ + hostfamily = "IPv4"; + + syslog(LOG_INFO, "Connection from %s (%s %s)", hostname, hostfamily, + hostip); + } + + /* * RFC1179 specifies that only 1 daemon command can be received for * every connection. */ @@ -1706,5 +1716,5 @@ smart_gets(char *s, /* I - Pointer to line buffer */ /* - * End of "$Id: cups-lpd.c 5204 2006-02-28 20:32:43Z mike $". + * End of "$Id: cups-lpd.c 5455 2006-04-24 13:49:59Z mike $". */ diff --git a/scheduler/dirsvc.c b/scheduler/dirsvc.c index 72fef6351..e1fd525c0 100644 --- a/scheduler/dirsvc.c +++ b/scheduler/dirsvc.c @@ -1,5 +1,5 @@ /* - * "$Id: dirsvc.c 5349 2006-03-29 15:22:10Z mike $" + * "$Id: dirsvc.c 5448 2006-04-22 03:57:26Z mike $" * * Directory services routines for the Common UNIX Printing System (CUPS). * @@ -799,7 +799,7 @@ cupsdSendBrowseList(void) (p->type & CUPS_PRINTER_CLASS) ? "Class" : "Printer", p->name); - cupsdLogMessage(CUPSD_LOG_INFO, + cupsdLogMessage(CUPSD_LOG_DEBUG, "Remote destination \"%s\" has timed out; " "deleting it...", p->name); @@ -1907,7 +1907,7 @@ process_browse_data( if (p->type & CUPS_PRINTER_REMOTE) { - cupsdLogMessage(CUPSD_LOG_INFO, + cupsdLogMessage(CUPSD_LOG_DEBUG, "Renamed remote class \"%s\" to \"%s@%s\"...", p->name, p->name, p->hostname); cupsdAddEvent(CUPSD_EVENT_PRINTER_DELETED, p, NULL, @@ -1967,7 +1967,7 @@ process_browse_data( p = cupsdAddClass(name); - cupsdLogMessage(CUPSD_LOG_INFO, "Added remote class \"%s\"...", name); + cupsdLogMessage(CUPSD_LOG_DEBUG, "Added remote class \"%s\"...", name); cupsdAddEvent(CUPSD_EVENT_PRINTER_ADDED, p, NULL, "Class \'%s\' added by directory services.", name); @@ -2010,7 +2010,7 @@ process_browse_data( if (p->type & CUPS_PRINTER_REMOTE) { - cupsdLogMessage(CUPSD_LOG_INFO, + cupsdLogMessage(CUPSD_LOG_DEBUG, "Renamed remote printer \"%s\" to \"%s@%s\"...", p->name, p->name, p->hostname); cupsdAddEvent(CUPSD_EVENT_PRINTER_DELETED, p, NULL, @@ -2073,7 +2073,7 @@ process_browse_data( cupsdAddEvent(CUPSD_EVENT_PRINTER_ADDED, p, NULL, "Printer \'%s\' added by directory services.", name); - cupsdLogMessage(CUPSD_LOG_INFO, "Added remote printer \"%s\"...", name); + cupsdLogMessage(CUPSD_LOG_DEBUG, "Added remote printer \"%s\"...", name); /* * Force the URI to point to the real server... @@ -2334,7 +2334,7 @@ process_implicit_classes(void) update = 1; - cupsdLogMessage(CUPSD_LOG_INFO, "Added implicit class \"%s\"...", + cupsdLogMessage(CUPSD_LOG_DEBUG, "Added implicit class \"%s\"...", name); cupsdAddEvent(CUPSD_EVENT_PRINTER_ADDED, p, NULL, "Implicit class \'%s\' added by directory services.", @@ -3128,5 +3128,5 @@ slp_url_callback( /* - * End of "$Id: dirsvc.c 5349 2006-03-29 15:22:10Z mike $". + * End of "$Id: dirsvc.c 5448 2006-04-22 03:57:26Z mike $". */ diff --git a/scheduler/ipp.c b/scheduler/ipp.c index e94c7310a..b3a5f58eb 100644 --- a/scheduler/ipp.c +++ b/scheduler/ipp.c @@ -1,5 +1,5 @@ /* - * "$Id: ipp.c 5383 2006-04-07 15:36:10Z mike $" + * "$Id: ipp.c 5438 2006-04-19 21:21:05Z mike $" * * IPP routines for the Common UNIX Printing System (CUPS) scheduler. * @@ -88,6 +88,7 @@ * set_printer_defaults() - Set printer default options from a request. * start_printer() - Start a printer. * stop_printer() - Stop a printer. + * url_encode_attr() - URL-encode a string attribute. * user_allowed() - See if a user is allowed to print to a queue. * validate_job() - Validate printer options and destination. * validate_name() - Make sure the printer name only contains @@ -202,6 +203,8 @@ static void set_printer_defaults(cupsd_client_t *con, cupsd_printer_t *printer); static void start_printer(cupsd_client_t *con, ipp_attribute_t *uri); static void stop_printer(cupsd_client_t *con, ipp_attribute_t *uri); +static void url_encode_attr(ipp_attribute_t *attr, char *buffer, + int bufsize); static int user_allowed(cupsd_printer_t *p, const char *username); static void validate_job(cupsd_client_t *con, ipp_attribute_t *uri); static int validate_name(const char *name); @@ -5091,14 +5094,12 @@ static void get_devices(cupsd_client_t *con) /* I - Client connection */ { http_status_t status; /* Policy status */ - int i; /* Looping var */ ipp_attribute_t *limit, /* Limit attribute */ *requested; /* requested-attributes attribute */ char command[1024], /* cups-deviced command */ options[1024], /* Options to pass to command */ - attrs[1024], /* String for requested attributes */ - *aptr; /* Pointer into string */ - int alen; /* Length of attribute value */ + requested_str[256]; + /* String for requested attributes */ cupsdLogMessage(CUPSD_LOG_DEBUG2, "get_devices(%p[%d])", con, con->http.fd); @@ -5122,48 +5123,16 @@ get_devices(cupsd_client_t *con) /* I - Client connection */ IPP_TAG_KEYWORD); if (requested) - { - for (i = 0, aptr = attrs; i < requested->num_values; i ++) - { - /* - * Check that we have enough room... - */ - - alen = strlen(requested->values[i].string.text); - if (alen > (sizeof(attrs) - (aptr - attrs) - 2)) - break; - - /* - * Put commas between values... - */ - - if (i) - *aptr++ = ','; - - /* - * Add the value to the end of the string... - */ - - strcpy(aptr, requested->values[i].string.text); - aptr += alen; - } - - /* - * If we have more attribute names than will fit, default to "all"... - */ - - if (i < requested->num_values) - strcpy(attrs, "all"); - } + url_encode_attr(requested, requested_str, sizeof(requested_str)); else - strcpy(attrs, "all"); + strlcpy(requested_str, "requested-attributes=all", sizeof(requested_str)); snprintf(command, sizeof(command), "%s/daemon/cups-deviced", ServerBin); snprintf(options, sizeof(options), - "%d+%d+%d+requested-attributes=%s", + "%d+%d+%d+%s", con->request->request.op.request_id, limit ? limit->values[0].integer : 0, (int)User, - attrs); + requested_str); if (cupsdSendCommand(con, command, options, 1)) { @@ -5631,15 +5600,14 @@ static void get_ppds(cupsd_client_t *con) /* I - Client connection */ { http_status_t status; /* Policy status */ - int i; /* Looping var */ ipp_attribute_t *limit, /* Limit attribute */ *make, /* ppd-make attribute */ *requested; /* requested-attributes attribute */ char command[1024], /* cups-deviced command */ options[1024], /* Options to pass to command */ - attrs[1024], /* String for requested attributes */ - *aptr; /* Pointer into string */ - int alen; /* Length of attribute value */ + requested_str[256], + /* String for requested attributes */ + make_str[256]; /* Escaped ppd-make string */ cupsdLogMessage(CUPSD_LOG_DEBUG2, "get_ppds(%p[%d])", con, con->http.fd); @@ -5664,50 +5632,20 @@ get_ppds(cupsd_client_t *con) /* I - Client connection */ IPP_TAG_KEYWORD); if (requested) - { - for (i = 0, aptr = attrs; i < requested->num_values; i ++) - { - /* - * Check that we have enough room... - */ - - alen = strlen(requested->values[i].string.text); - if (alen > (sizeof(attrs) - (aptr - attrs) - 2)) - break; - - /* - * Put commas between values... - */ - - if (i) - *aptr++ = ','; - - /* - * Add the value to the end of the string... - */ - - strcpy(aptr, requested->values[i].string.text); - aptr += alen; - } - - /* - * If we have more attribute names than will fit, default to "all"... - */ + url_encode_attr(requested, requested_str, sizeof(requested_str)); + else + strlcpy(requested_str, "requested-attributes=all", sizeof(requested_str)); - if (i < requested->num_values) - strcpy(attrs, "all"); - } + if (make) + url_encode_attr(make, make_str, sizeof(make_str)); else - strcpy(attrs, "all"); + make_str[0] = '\0'; snprintf(command, sizeof(command), "%s/daemon/cups-driverd", ServerBin); - snprintf(options, sizeof(options), - "list+%d+%d+requested-attributes=%s%s%s", + snprintf(options, sizeof(options), "list+%d+%d+%s%s%s", con->request->request.op.request_id, limit ? limit->values[0].integer : 0, - attrs, - make ? "%20ppd-make=" : "", - make ? make->values[0].string.text : ""); + requested_str, make ? "%20" : "", make_str); if (cupsdSendCommand(con, command, options, 0)) { @@ -8933,6 +8871,70 @@ stop_printer(cupsd_client_t *con, /* I - Client connection */ /* + * 'url_encode_attr()' - URL-encode a string attribute. + */ + +static void +url_encode_attr(ipp_attribute_t *attr, /* I - Attribute */ + char *buffer,/* I - String buffer */ + int bufsize)/* I - Size of buffer */ +{ + int i; /* Looping var */ + char *bufptr, /* Pointer into buffer */ + *bufend, /* End of buffer */ + *valptr; /* Pointer into value */ + + + strlcpy(buffer, attr->name, bufsize); + bufptr = buffer + strlen(buffer); + bufend = buffer + bufsize - 1; + + for (i = 0; i < attr->num_values; i ++) + { + if (bufptr >= bufend) + break; + + if (i) + *bufptr++ = ','; + else + *bufptr++ = '='; + + if (bufptr >= bufend) + break; + + *bufptr++ = '\''; + + for (valptr = attr->values[i].string.text; + *valptr && bufptr < bufend; + valptr ++) + if (*valptr == ' ') + { + if (bufptr >= (bufend - 2)) + break; + + *bufptr++ = '%'; + *bufptr++ = '2'; + *bufptr++ = '0'; + } + else if (*valptr == '\'' || *valptr == '\\') + { + *bufptr++ = '\\'; + *bufptr++ = *valptr; + } + else + *bufptr++ = *valptr; + + if (bufptr >= bufend) + break; + + *bufptr++ = '\''; + } + + *bufptr = '\0'; +} + + +/* * 'user_allowed()' - See if a user is allowed to print to a queue. */ @@ -9156,5 +9158,5 @@ validate_user(cupsd_job_t *job, /* I - Job */ /* - * End of "$Id: ipp.c 5383 2006-04-07 15:36:10Z mike $". + * End of "$Id: ipp.c 5438 2006-04-19 21:21:05Z mike $". */ diff --git a/scheduler/job.c b/scheduler/job.c index d2b1f13af..2f3f5bc54 100644 --- a/scheduler/job.c +++ b/scheduler/job.c @@ -1,5 +1,5 @@ /* - * "$Id: job.c 5383 2006-04-07 15:36:10Z mike $" + * "$Id: job.c 5452 2006-04-22 22:17:32Z mike $" * * Job management routines for the Common UNIX Printing System (CUPS). * @@ -121,12 +121,14 @@ cupsdAddJob(int priority, /* I - Job priority */ job = calloc(sizeof(cupsd_job_t), 1); - job->id = NextJobId ++; - job->priority = priority; - job->back_pipes[0] = -1; - job->back_pipes[1] = -1; - job->print_pipes[0] = -1; - job->print_pipes[1] = -1; + job->id = NextJobId ++; + job->priority = priority; + job->back_pipes[0] = -1; + job->back_pipes[1] = -1; + job->print_pipes[0] = -1; + job->print_pipes[1] = -1; + job->status_pipes[0] = -1; + job->status_pipes[1] = -1; cupsdSetString(&job->dest, dest); @@ -448,9 +450,10 @@ cupsdFinishJob(cupsd_job_t *job) /* I - Job */ FD_CLR(job->status_buffer->fd, InputSet); cupsdLogMessage(CUPSD_LOG_DEBUG2, - "cupsdFinishJob: Closing status input pipe %d...", - job->status_buffer->fd); + "cupsdFinishJob: Closing status pipes [ %d %d ]...", + job->status_pipes[0], job->status_pipes[1]); + cupsdClosePipe(job->status_pipes); cupsdStatBufDelete(job->status_buffer); job->status_buffer = NULL; @@ -1314,7 +1317,7 @@ cupsdSetJobHoldUntil(cupsd_job_t *job, /* I - Job */ ((29 - curdate->tm_hour) * 60 + 59 - curdate->tm_min) * 60 + 60 - curdate->tm_sec; } - else if (!strcmp(when, "evening") || strcmp(when, "night")) + else if (!strcmp(when, "evening") || !strcmp(when, "night")) { /* * Hold to 6pm unless local time is > 6pm or < 6am. @@ -1545,9 +1548,10 @@ cupsdStopJob(cupsd_job_t *job, /* I - Job */ FD_CLR(job->status_buffer->fd, InputSet); cupsdLogMessage(CUPSD_LOG_DEBUG2, - "cupsdStopJob: Closing status input pipe %d...", - job->status_buffer->fd); + "cupsdStopJob: Closing status pipes [ %d %d ]...", + job->status_pipes[0], job->status_pipes[1]); + cupsdClosePipe(job->status_pipes); cupsdStatBufDelete(job->status_buffer); job->status_buffer = NULL; @@ -1974,11 +1978,13 @@ load_job_cache(const char *filename) /* I - job.cache filename */ break; } - job->id = jobid; - job->back_pipes[0] = -1; - job->back_pipes[1] = -1; - job->print_pipes[0] = -1; - job->print_pipes[1] = -1; + job->id = jobid; + job->back_pipes[0] = -1; + job->back_pipes[1] = -1; + job->print_pipes[0] = -1; + job->print_pipes[1] = -1; + job->status_pipes[0] = -1; + job->status_pipes[1] = -1; cupsdLogMessage(CUPSD_LOG_DEBUG, "Loading job %d from cache...", job->id); } @@ -2137,6 +2143,7 @@ load_next_job_id(const char *filename) /* I - job.cache filename */ char line[1024], /* Line buffer */ *value; /* Value on line */ int linenum; /* Line number in file */ + int next_job_id; /* NextJobId value from line */ /* @@ -2164,8 +2171,12 @@ load_next_job_id(const char *filename) /* I - job.cache filename */ if (!strcasecmp(line, "NextJobId")) { if (value) - NextJobId = atoi(value); + { + next_job_id = atoi(value); + if (next_job_id > NextJobId) + NextJobId = next_job_id; + } break; } } @@ -2222,11 +2233,13 @@ load_request_root(void) * Assign the job ID... */ - job->id = atoi(dent->filename + 1); - job->back_pipes[0] = -1; - job->back_pipes[1] = -1; - job->print_pipes[0] = -1; - job->print_pipes[1] = -1; + job->id = atoi(dent->filename + 1); + job->back_pipes[0] = -1; + job->back_pipes[1] = -1; + job->print_pipes[0] = -1; + job->print_pipes[1] = -1; + job->status_pipes[0] = -1; + job->status_pipes[1] = -1; if (job->id >= NextJobId) NextJobId = job->id + 1; @@ -2344,8 +2357,7 @@ start_job(cupsd_job_t *job, /* I - Job ID */ int backroot; /* Run backend as root? */ int pid; /* Process ID of new filter process */ int banner_page; /* 1 if banner page, 0 otherwise */ - int statusfds[2], /* Pipes used with the scheduler */ - filterfds[2][2];/* Pipes used between filters */ + int filterfds[2][2];/* Pipes used between filters */ int envc; /* Number of environment variables */ char **argv, /* Filter command-line arguments */ sani_uri[1024], /* Sanitized DEVICE_URI env var */ @@ -2393,6 +2405,20 @@ start_job(cupsd_job_t *job, /* I - Job ID */ return; } + if (printer->raw && !strncmp(printer->device_uri, "file:", 5)) + { + cupsdLogMessage(CUPSD_LOG_ERROR, + "Job ID %d cannot be printed to raw queue pointing to " + "a file!", + job->id); + + strlcpy(printer->state_message, "Raw printers cannot use file: devices!", + sizeof(printer->state_message)); + cupsdStopPrinter(printer, 1); + cupsdAddPrinterHistory(printer); + return; + } + /* * Figure out what filters are required to convert from * the source to the destination type... @@ -2992,33 +3018,32 @@ start_job(cupsd_job_t *job, /* I - Job ID */ filterfds[1][0] = -1; filterfds[1][1] = -1; - if (cupsdOpenPipe(statusfds)) + if (!job->status_buffer) { - cupsdLogMessage(CUPSD_LOG_ERROR, "Unable to create job status pipes - %s.", - strerror(errno)); - snprintf(printer->state_message, sizeof(printer->state_message), - "Unable to create status pipes - %s.", strerror(errno)); - - cupsdAddPrinterHistory(printer); - - cupsdAddEvent(CUPSD_EVENT_JOB_COMPLETED, job->printer, job, - "Job canceled because the server could not create the job " - "status pipes."); - - goto abort_job; + if (cupsdOpenPipe(job->status_pipes)) + { + cupsdLogMessage(CUPSD_LOG_ERROR, "Unable to create job status pipes - %s.", + strerror(errno)); + snprintf(printer->state_message, sizeof(printer->state_message), + "Unable to create status pipes - %s.", strerror(errno)); + + cupsdAddPrinterHistory(printer); + + cupsdAddEvent(CUPSD_EVENT_JOB_COMPLETED, job->printer, job, + "Job canceled because the server could not create the job " + "status pipes."); + + goto abort_job; + } + + cupsdLogMessage(CUPSD_LOG_DEBUG2, "start_job: status_pipes = [ %d %d ]", + job->status_pipes[0], job->status_pipes[1]); + + job->status_buffer = cupsdStatBufNew(job->status_pipes[0], "[Job %d]", + job->id); } - cupsdLogMessage(CUPSD_LOG_DEBUG2, "start_job: statusfds = [ %d %d ]", - statusfds[0], statusfds[1]); - -#ifdef FD_CLOEXEC - fcntl(statusfds[0], F_SETFD, FD_CLOEXEC); - fcntl(statusfds[1], F_SETFD, FD_CLOEXEC); -#endif /* FD_CLOEXEC */ - - job->status_buffer = cupsdStatBufNew(statusfds[0], "[Job %d]", - job->id); - job->status = 0; + job->status = 0; memset(job->filters, 0, sizeof(job->filters)); filterfds[1][0] = open("/dev/null", O_RDONLY); @@ -3144,7 +3169,7 @@ start_job(cupsd_job_t *job, /* I - Job ID */ slot, filterfds[slot][0], filterfds[slot][1]); pid = cupsdStartProcess(command, argv, envp, filterfds[!slot][0], - filterfds[slot][1], statusfds[1], + filterfds[slot][1], job->status_pipes[1], job->back_pipes[0], 0, job->filters + i); cupsdLogMessage(CUPSD_LOG_DEBUG2, @@ -3232,7 +3257,7 @@ start_job(cupsd_job_t *job, /* I - Job ID */ slot, filterfds[slot][0], filterfds[slot][1]); pid = cupsdStartProcess(command, argv, envp, filterfds[!slot][0], - filterfds[slot][1], statusfds[1], + filterfds[slot][1], job->status_pipes[1], job->back_pipes[1], backroot, &(job->backend)); @@ -3271,6 +3296,13 @@ start_job(cupsd_job_t *job, /* I - Job ID */ job->back_pipes[0], job->back_pipes[1]); cupsdClosePipe(job->back_pipes); + + cupsdLogMessage(CUPSD_LOG_DEBUG2, + "start_job: Closing status output pipe %d...", + job->status_pipes[1]); + + close(job->status_pipes[1]); + job->status_pipes[1] = -1; } } else @@ -3278,13 +3310,6 @@ start_job(cupsd_job_t *job, /* I - Job ID */ filterfds[slot][0] = -1; filterfds[slot][1] = -1; - cupsdLogMessage(CUPSD_LOG_DEBUG2, - "start_job: Closing filter pipes for slot %d " - "[ %d %d ]...", - !slot, filterfds[!slot][0], filterfds[!slot][1]); - - cupsdClosePipe(filterfds[!slot]); - if (job->current_file == job->num_files) { cupsdLogMessage(CUPSD_LOG_DEBUG2, @@ -3292,17 +3317,21 @@ start_job(cupsd_job_t *job, /* I - Job ID */ job->print_pipes[0], job->print_pipes[1]); cupsdClosePipe(job->print_pipes); + + cupsdLogMessage(CUPSD_LOG_DEBUG2, + "start_job: Closing status output pipe %d...", + job->status_pipes[1]); + + close(job->status_pipes[1]); + job->status_pipes[1] = -1; } } - for (slot = 0; slot < 2; slot ++) - { - cupsdLogMessage(CUPSD_LOG_DEBUG2, - "start_job: Closing filter pipes for slot %d " - "[ %d %d ]...", - slot, filterfds[slot][0], filterfds[slot][1]); - cupsdClosePipe(filterfds[slot]); - } + cupsdLogMessage(CUPSD_LOG_DEBUG2, + "start_job: Closing filter pipes for slot %d " + "[ %d %d ]...", + slot, filterfds[slot][0], filterfds[slot][1]); + cupsdClosePipe(filterfds[slot]); if (remote_job) { @@ -3313,12 +3342,6 @@ start_job(cupsd_job_t *job, /* I - Job ID */ free(argv); cupsdLogMessage(CUPSD_LOG_DEBUG2, - "start_job: Closing status output pipe %d...", - statusfds[1]); - - close(statusfds[1]); - - cupsdLogMessage(CUPSD_LOG_DEBUG2, "start_job: Adding fd %d to InputSet...", job->status_buffer->fd); @@ -3348,8 +3371,9 @@ start_job(cupsd_job_t *job, /* I - Job ID */ cupsdLogMessage(CUPSD_LOG_DEBUG2, "start_job: Closing status pipes [ %d %d ]...", - statusfds[0], statusfds[1]); - cupsdClosePipe(statusfds); + job->status_pipes[0], job->status_pipes[1]); + cupsdClosePipe(job->status_pipes); + cupsdStatBufDelete(job->status_buffer); cupsArrayDelete(filters); @@ -3387,5 +3411,5 @@ unload_job(cupsd_job_t *job) /* I - Job */ /* - * End of "$Id: job.c 5383 2006-04-07 15:36:10Z mike $". + * End of "$Id: job.c 5452 2006-04-22 22:17:32Z mike $". */ diff --git a/scheduler/job.h b/scheduler/job.h index 31dba60d3..93bb774b2 100644 --- a/scheduler/job.h +++ b/scheduler/job.h @@ -1,5 +1,5 @@ /* - * "$Id: job.h 5383 2006-04-07 15:36:10Z mike $" + * "$Id: job.h 5393 2006-04-14 18:17:18Z mike $" * * Print job definitions for the Common UNIX Printing System (CUPS) scheduler. * @@ -44,9 +44,10 @@ typedef struct cupsd_job_s ipp_attribute_t *job_sheets; /* Job sheets (NULL if none) */ int current_file; /* Current file in job */ ipp_t *attrs; /* Job attributes */ - cupsd_statbuf_t *status_buffer; /* Status buffer for this job */ int print_pipes[2], /* Print data pipes */ - back_pipes[2]; /* Backchannel pipes */ + back_pipes[2], /* Backchannel pipes */ + status_pipes[2];/* Status pipes */ + cupsd_statbuf_t *status_buffer; /* Status buffer for this job */ int cost; /* Filtering cost */ int filters[MAX_FILTERS + 1]; /* Filter process IDs, 0 terminated */ @@ -120,5 +121,5 @@ extern void cupsdUpdateJob(cupsd_job_t *job); /* - * End of "$Id: job.h 5383 2006-04-07 15:36:10Z mike $". + * End of "$Id: job.h 5393 2006-04-14 18:17:18Z mike $". */ diff --git a/scheduler/main.c b/scheduler/main.c index 97aa1a121..e9e1a1c23 100644 --- a/scheduler/main.c +++ b/scheduler/main.c @@ -1,5 +1,5 @@ /* - * "$Id: main.c 5383 2006-04-07 15:36:10Z mike $" + * "$Id: main.c 5448 2006-04-22 03:57:26Z mike $" * * Scheduler main loop for the Common UNIX Printing System (CUPS). * @@ -993,11 +993,12 @@ main(int argc, /* I - Number of command-line args */ } /* - * Update the root certificate once every 5 minutes... + * Update the root certificate once every 5 minutes if we have client + * connections... */ if ((current_time - RootCertTime) >= RootCertDuration && RootCertDuration && - !RunUser) + !RunUser && cupsArrayCount(Clients)) { /* * Update the root certificate... @@ -2246,5 +2247,5 @@ usage(int status) /* O - Exit status */ /* - * End of "$Id: main.c 5383 2006-04-07 15:36:10Z mike $". + * End of "$Id: main.c 5448 2006-04-22 03:57:26Z mike $". */ diff --git a/scheduler/mime.c b/scheduler/mime.c index 1de12fe34..9c298e6fc 100644 --- a/scheduler/mime.c +++ b/scheduler/mime.c @@ -1,5 +1,5 @@ /* - * "$Id: mime.c 5057 2006-02-02 20:38:29Z mike $" + * "$Id: mime.c 5394 2006-04-14 18:20:04Z mike $" * * MIME database file routines for the Common UNIX Printing System (CUPS). * @@ -97,15 +97,6 @@ mimeDelete(mime_t *mime) /* I - MIME database */ return; /* - * Loop through the file types and delete any rules... - */ - - for (type = (mime_type_t *)cupsArrayFirst(mime->types); - type; - type = (mime_type_t *)cupsArrayNext(mime->types)) - mimeDeleteType(mime, type); - - /* * Loop through filters and free them... */ @@ -115,6 +106,15 @@ mimeDelete(mime_t *mime) /* I - MIME database */ mimeDeleteFilter(mime, filter); /* + * Loop through the file types and delete any rules... + */ + + for (type = (mime_type_t *)cupsArrayFirst(mime->types); + type; + type = (mime_type_t *)cupsArrayNext(mime->types)) + mimeDeleteType(mime, type); + + /* * Free the types and filters arrays, and then the MIME database structure. */ @@ -711,5 +711,5 @@ load_types(mime_t *mime, /* I - MIME database */ /* - * End of "$Id: mime.c 5057 2006-02-02 20:38:29Z mike $". + * End of "$Id: mime.c 5394 2006-04-14 18:20:04Z mike $". */ diff --git a/scheduler/network.c b/scheduler/network.c index 46f3f2655..eb89b1217 100644 --- a/scheduler/network.c +++ b/scheduler/network.c @@ -1,5 +1,5 @@ /* - * "$Id: network.c 5069 2006-02-04 05:24:35Z mike $" + * "$Id: network.c 5428 2006-04-18 20:45:30Z mike $" * * Network interface functions for the Common UNIX Printing System * (CUPS) scheduler. @@ -28,18 +28,15 @@ * cupsdNetIFFree() - Free the current network interface list. * cupsdNetIFUpdate() - Update the network interface list as needed... * compare_netif() - Compare two network interfaces. - * getifaddrs() - Get a list of network interfaces on the system. - * freeifaddrs() - Free an interface list... */ /* * Include necessary headers. */ +#include <cups/http-private.h> #include "cupsd.h" -#include <net/if.h> - /* * Local functions... @@ -49,44 +46,6 @@ static void cupsdNetIFFree(void); static int compare_netif(cupsd_netif_t *a, cupsd_netif_t *b); -#ifdef HAVE_GETIFADDRS -/* - * Use native getifaddrs() function... - */ -# include <ifaddrs.h> -#else -/* - * Use getifaddrs() emulation... - */ - -# include <sys/ioctl.h> -# ifdef HAVE_SYS_SOCKIO_H -# include <sys/sockio.h> -# endif - -# ifdef ifa_dstaddr -# undef ifa_dstaddr -# endif /* ifa_dstaddr */ -# ifndef ifr_netmask -# define ifr_netmask ifr_addr -# endif /* !ifr_netmask */ - -struct ifaddrs /**** Interface Structure ****/ -{ - struct ifaddrs *ifa_next; /* Next interface in list */ - char *ifa_name; /* Name of interface */ - unsigned int ifa_flags; /* Flags (up, point-to-point, etc.) */ - struct sockaddr *ifa_addr, /* Network address */ - *ifa_netmask, /* Address mask */ - *ifa_dstaddr; /* Broadcast or destination address */ - void *ifa_data; /* Interface statistics */ -}; - -static int getifaddrs(struct ifaddrs **addrs); -static void freeifaddrs(struct ifaddrs *addrs); -#endif /* HAVE_GETIFADDRS */ - - /* * 'cupsdNetIFFind()' - Find a network interface. */ @@ -354,241 +313,6 @@ compare_netif(cupsd_netif_t *a, /* I - First network interface */ } -#ifndef HAVE_GETIFADDRS -/* - * 'getifaddrs()' - Get a list of network interfaces on the system. - */ - -static int /* O - 0 on success, -1 on error */ -getifaddrs(struct ifaddrs **addrs) /* O - List of interfaces */ -{ - int sock; /* Socket */ - char buffer[65536], /* Buffer for address info */ - *bufptr, /* Pointer into buffer */ - *bufend; /* End of buffer */ - struct ifconf conf; /* Interface configurations */ - struct sockaddr addr; /* Address data */ - struct ifreq *ifp; /* Interface data */ - int ifpsize; /* Size of interface data */ - struct ifaddrs *temp; /* Pointer to current interface */ - struct ifreq request; /* Interface request */ - - - /* - * Start with an empty list... - */ - - if (addrs == NULL) - return (-1); - - *addrs = NULL; - - /* - * Create a UDP socket to get the interface data... - */ - - memset (&addr, 0, sizeof(addr)); - if ((sock = socket(AF_INET, SOCK_DGRAM, 0)) < 0) - return (-1); - - /* - * Try to get the list of interfaces... - */ - - conf.ifc_len = sizeof(buffer); - conf.ifc_buf = buffer; - - if (ioctl(sock, SIOCGIFCONF, &conf) < 0) - { - /* - * Couldn't get the list of interfaces... - */ - - close(sock); - return (-1); - } - - /* - * OK, got the list of interfaces, now lets step through the - * buffer to pull them out... - */ - -# ifdef HAVE_STRUCT_SOCKADDR_SA_LEN -# define sockaddr_len(a) ((a)->sa_len) -# else -# define sockaddr_len(a) (sizeof(struct sockaddr)) -# endif /* HAVE_STRUCT_SOCKADDR_SA_LEN */ - - for (bufptr = buffer, bufend = buffer + conf.ifc_len; - bufptr < bufend; - bufptr += ifpsize) - { - /* - * Get the current interface information... - */ - - ifp = (struct ifreq *)bufptr; - ifpsize = sizeof(ifp->ifr_name) + sockaddr_len(&(ifp->ifr_addr)); - - if (ifpsize < sizeof(struct ifreq)) - ifpsize = sizeof(struct ifreq); - - memset(&request, 0, sizeof(request)); - memcpy(request.ifr_name, ifp->ifr_name, sizeof(ifp->ifr_name)); - - /* - * Check the status of the interface... - */ - - if (ioctl(sock, SIOCGIFFLAGS, &request) < 0) - continue; - - /* - * Allocate memory for a single interface record... - */ - - if ((temp = calloc(1, sizeof(struct ifaddrs))) == NULL) - { - /* - * Unable to allocate memory... - */ - - close(sock); - return (-1); - } - - /* - * Add this record to the front of the list and copy the name, flags, - * and network address... - */ - - temp->ifa_next = *addrs; - *addrs = temp; - temp->ifa_name = strdup(ifp->ifr_name); - temp->ifa_flags = request.ifr_flags; - if ((temp->ifa_addr = calloc(1, sockaddr_len(&(ifp->ifr_addr)))) != NULL) - memcpy(temp->ifa_addr, &(ifp->ifr_addr), sockaddr_len(&(ifp->ifr_addr))); - - /* - * Try to get the netmask for the interface... - */ - - if (!ioctl(sock, SIOCGIFNETMASK, &request)) - { - /* - * Got it, make a copy... - */ - - if ((temp->ifa_netmask = calloc(1, sizeof(request.ifr_netmask))) != NULL) - memcpy(temp->ifa_netmask, &(request.ifr_netmask), - sizeof(request.ifr_netmask)); - } - - /* - * Then get the broadcast or point-to-point (destination) address, - * if applicable... - */ - - if (temp->ifa_flags & IFF_BROADCAST) - { - /* - * Have a broadcast address, so get it! - */ - - if (!ioctl(sock, SIOCGIFBRDADDR, &request)) - { - /* - * Got it, make a copy... - */ - - if ((temp->ifa_dstaddr = calloc(1, sizeof(request.ifr_broadaddr))) != NULL) - memcpy(temp->ifa_dstaddr, &(request.ifr_broadaddr), - sizeof(request.ifr_broadaddr)); - } - } - else if (temp->ifa_flags & IFF_POINTOPOINT) - { - /* - * Point-to-point interface; grab the remote address... - */ - - if (!ioctl(sock, SIOCGIFDSTADDR, &request)) - { - temp->ifa_dstaddr = malloc(sizeof(request.ifr_dstaddr)); - memcpy(temp->ifa_dstaddr, &(request.ifr_dstaddr), - sizeof(request.ifr_dstaddr)); - } - } - } - - /* - * OK, we're done with the socket, close it and return 0... - */ - - close(sock); - - return (0); -} - - -/* - * 'freeifaddrs()' - Free an interface list... - */ - -static void -freeifaddrs(struct ifaddrs *addrs) /* I - Interface list to free */ -{ - struct ifaddrs *next; /* Next interface in list */ - - - while (addrs != NULL) - { - /* - * Make a copy of the next interface pointer... - */ - - next = addrs->ifa_next; - - /* - * Free data values as needed... - */ - - if (addrs->ifa_name) - { - free(addrs->ifa_name); - addrs->ifa_name = NULL; - } - - if (addrs->ifa_addr) - { - free(addrs->ifa_addr); - addrs->ifa_addr = NULL; - } - - if (addrs->ifa_netmask) - { - free(addrs->ifa_netmask); - addrs->ifa_netmask = NULL; - } - - if (addrs->ifa_dstaddr) - { - free(addrs->ifa_dstaddr); - addrs->ifa_dstaddr = NULL; - } - - /* - * Free this node and continue to the next... - */ - - free(addrs); - - addrs = next; - } -} -#endif /* !HAVE_GETIFADDRS */ - - /* - * End of "$Id: network.c 5069 2006-02-04 05:24:35Z mike $". + * End of "$Id: network.c 5428 2006-04-18 20:45:30Z mike $". */ diff --git a/scheduler/statbuf.c b/scheduler/statbuf.c index 120c08914..eb257d787 100644 --- a/scheduler/statbuf.c +++ b/scheduler/statbuf.c @@ -1,5 +1,5 @@ /* - * "$Id: statbuf.c 5373 2006-04-06 20:03:32Z mike $" + * "$Id: statbuf.c 5447 2006-04-21 20:07:51Z mike $" * * Status buffer routines for the Common UNIX Printing System (CUPS) * scheduler. @@ -277,7 +277,7 @@ cupsdStatBufUpdate(cupsd_statbuf_t *sb, /* I - Status buffer */ } else { - *loglevel = CUPSD_LOG_ERROR; + *loglevel = CUPSD_LOG_DEBUG; message = sb->buffer; } @@ -330,5 +330,5 @@ cupsdStatBufUpdate(cupsd_statbuf_t *sb, /* I - Status buffer */ /* - * End of "$Id: statbuf.c 5373 2006-04-06 20:03:32Z mike $". + * End of "$Id: statbuf.c 5447 2006-04-21 20:07:51Z mike $". */ |