summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--deleted_files/usr/src/lib/print/libprint/common/job.c (renamed from usr/src/lib/print/libprint/common/job.c)0
-rw-r--r--deleted_files/usr/src/lib/print/libprint/common/job.h (renamed from usr/src/lib/print/libprint/common/job.h)0
-rw-r--r--deleted_files/usr/src/lib/print/libprint/common/misc.c (renamed from usr/src/lib/print/libprint/common/misc.c)0
-rw-r--r--deleted_files/usr/src/lib/print/libprint/common/misc.h (renamed from usr/src/lib/print/libprint/common/misc.h)0
-rw-r--r--deleted_files/usr/src/lib/print/libprint/common/network.c (renamed from usr/src/lib/print/libprint/common/network.c)0
-rw-r--r--deleted_files/usr/src/lib/print/libprint/common/network.h (renamed from usr/src/lib/print/libprint/common/network.h)0
-rw-r--r--usr/src/cmd/lp/lib/papi/job.c14
-rw-r--r--usr/src/cmd/lp/model/netpr/Makefile15
-rw-r--r--usr/src/cmd/lp/model/netpr/netpr.c118
-rw-r--r--usr/src/cmd/print/bsd-sysv-commands/common.c36
-rw-r--r--usr/src/cmd/print/bsd-sysv-commands/common.h4
-rw-r--r--usr/src/cmd/print/bsd-sysv-commands/lp.c9
-rw-r--r--usr/src/cmd/print/bsd-sysv-commands/lpr.c8
-rw-r--r--usr/src/cmd/print/lpget/lpget.c3
-rw-r--r--usr/src/cmd/print/lpset/lpset.c3
-rwxr-xr-xusr/src/cmd/print/selector/print-service2
-rw-r--r--usr/src/lib/print/libpapi-common/common/uri.c10
-rw-r--r--usr/src/lib/print/libpapi-dynamic/common/nss.c9
-rw-r--r--usr/src/lib/print/libpapi-lpd/common/lpd-job.c8
-rw-r--r--usr/src/lib/print/libpapi-lpd/common/lpd-port.c3
-rw-r--r--usr/src/lib/print/libprint/Makefile.com2
-rw-r--r--usr/src/lib/print/libprint/common/llib-lprint63
-rw-r--r--usr/src/lib/print/libprint/common/mapfile-vers32
-rw-r--r--usr/src/lib/print/libprint/common/ns.c3
-rw-r--r--usr/src/lib/print/libprint/common/ns_bsd_addr.c17
-rw-r--r--usr/src/lib/print/libprint/common/nss_convert.c3
-rw-r--r--usr/src/lib/print/libprint/common/nss_ldap.c3
-rw-r--r--usr/src/lib/print/libprint/common/nss_write.c3
-rw-r--r--usr/src/tools/pmodes/exceptions.h12
29 files changed, 227 insertions, 153 deletions
diff --git a/usr/src/lib/print/libprint/common/job.c b/deleted_files/usr/src/lib/print/libprint/common/job.c
index b379648d26..b379648d26 100644
--- a/usr/src/lib/print/libprint/common/job.c
+++ b/deleted_files/usr/src/lib/print/libprint/common/job.c
diff --git a/usr/src/lib/print/libprint/common/job.h b/deleted_files/usr/src/lib/print/libprint/common/job.h
index 932d993a16..932d993a16 100644
--- a/usr/src/lib/print/libprint/common/job.h
+++ b/deleted_files/usr/src/lib/print/libprint/common/job.h
diff --git a/usr/src/lib/print/libprint/common/misc.c b/deleted_files/usr/src/lib/print/libprint/common/misc.c
index f9d7e4e966..f9d7e4e966 100644
--- a/usr/src/lib/print/libprint/common/misc.c
+++ b/deleted_files/usr/src/lib/print/libprint/common/misc.c
diff --git a/usr/src/lib/print/libprint/common/misc.h b/deleted_files/usr/src/lib/print/libprint/common/misc.h
index 5821794557..5821794557 100644
--- a/usr/src/lib/print/libprint/common/misc.h
+++ b/deleted_files/usr/src/lib/print/libprint/common/misc.h
diff --git a/usr/src/lib/print/libprint/common/network.c b/deleted_files/usr/src/lib/print/libprint/common/network.c
index 3b064b69c8..3b064b69c8 100644
--- a/usr/src/lib/print/libprint/common/network.c
+++ b/deleted_files/usr/src/lib/print/libprint/common/network.c
diff --git a/usr/src/lib/print/libprint/common/network.h b/deleted_files/usr/src/lib/print/libprint/common/network.h
index ee88e421d0..ee88e421d0 100644
--- a/usr/src/lib/print/libprint/common/network.h
+++ b/deleted_files/usr/src/lib/print/libprint/common/network.h
diff --git a/usr/src/cmd/lp/lib/papi/job.c b/usr/src/cmd/lp/lib/papi/job.c
index 4ee09858ce..dd46165bde 100644
--- a/usr/src/cmd/lp/lib/papi/job.c
+++ b/usr/src/cmd/lp/lib/papi/job.c
@@ -118,14 +118,15 @@ papiJobGetId(papi_job_t job)
static REQUEST *
create_request(papi_service_t svc, char *printer, papi_attribute_t **attributes)
{
- static REQUEST r;
+ REQUEST *r;
- memset(&r, 0, sizeof (r));
- r.priority = -1;
- r.destination = printer_name_from_uri_id(printer, -1);
- job_attributes_to_lpsched_request(svc, &r, attributes);
+ if ((r = calloc(1, sizeof (*r))) != NULL) {
+ r->priority = -1;
+ r->destination = printer_name_from_uri_id(printer, -1);
+ job_attributes_to_lpsched_request(svc, r, attributes);
+ }
- return (&r);
+ return (r);
}
static papi_status_t
@@ -756,6 +757,7 @@ papiJobStreamClose(papi_service_t handle,
"job-uri", tmp);
free(s->meta_data_file);
}
+ freerequest(s->request);
free(s);
return (PAPI_OK);
diff --git a/usr/src/cmd/lp/model/netpr/Makefile b/usr/src/cmd/lp/model/netpr/Makefile
index f9c5455147..e5e1c1394d 100644
--- a/usr/src/cmd/lp/model/netpr/Makefile
+++ b/usr/src/cmd/lp/model/netpr/Makefile
@@ -2,9 +2,8 @@
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
@@ -22,7 +21,7 @@
#
# ident "%Z%%M% %I% %E% SMI"
#
-# Copyright 1995-2002 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
# cmd/lp/model/netpr
@@ -35,9 +34,6 @@ include ../../Makefile.lp
PURIFYOPTS = -logfile=/tmp/errs.%p
PURIFY = purify $(PURIFYOPTS)
-LIBNPRT = -L$(ROOT)/usr/lib -lprint $(LIBINTL)
-
-
CPPFLAGS = -I. -I$(LPINC) \
$(CPPFLAGS.master)
@@ -67,8 +63,7 @@ LPLIBS = \
$(LIBOAM) \
$(LIBLP) \
$(LIBSEC) \
- $(LIBSYS) \
- $(LIBNPRT)
+ $(LIBSYS)
SYSLIBS= -lnsl -lsocket
@@ -116,7 +111,7 @@ strip:
cstyle:
cstyle $(SRCS)
-LINTFLAGS += -L ../../../../lib/print -lprint -lnsl -lsocket
+LINTFLAGS += -lnsl -lsocket
lint:
$(LINT.c) $(SRCS) $(LDLIBS)
diff --git a/usr/src/cmd/lp/model/netpr/netpr.c b/usr/src/cmd/lp/model/netpr/netpr.c
index ee2614b8f6..bdce543aa5 100644
--- a/usr/src/cmd/lp/model/netpr/netpr.c
+++ b/usr/src/cmd/lp/model/netpr/netpr.c
@@ -2,9 +2,8 @@
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
@@ -20,7 +19,7 @@
* CDDL HEADER END
*/
/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -36,15 +35,126 @@
#include <unistd.h>
#include <sys/mman.h>
#include <sys/socket.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <netdb.h>
#include <fcntl.h>
#include <syslog.h>
+#include <sys/utsname.h>
#include "netpr.h"
+
static void usage_exit();
static void pipehandler(int);
char data_file_type = 0;
+/*
+ * null() is to be used as a signal handler that does nothing. It is used in
+ * place of SIG_IGN, because we want the signal to be delivered and
+ * interupt the current system call.
+ */
+static void
+null(int i)
+{
+ syslog(LOG_DEBUG, "null(%d)", i);
+}
+
+/*
+ * net_open() opens a tcp connection to the printer port on the host specified
+ * in the arguments passed in. If the connection is not made in the
+ * timeout (in seconds) passed in, an error it returned. If the host is
+ * unknown, an error is returned. If all is well, a file descriptor is
+ * returned to be used for future communications.
+ */
+int
+net_open(char *host, int timeout)
+{
+ struct hostent *hp;
+ struct servent *sp;
+ struct sockaddr_in6 sin;
+ void (*old_handler)();
+ static struct utsname uts;
+
+ int s,
+ lport,
+ err,
+ error_num;
+ unsigned timo = 1;
+
+ syslog(LOG_DEBUG, "net_open(%s, %d)", (host != NULL ? host : "NULL"),
+ timeout);
+ /*
+ * Get the host address and port number to connect to.
+ */
+ if (host == NULL) {
+ return (-1);
+ }
+
+ (void) memset((char *)&sin, NULL, sizeof (sin));
+ if ((hp = getipnodebyname(host, AF_INET6, AI_DEFAULT,
+ &error_num)) == NULL) {
+ syslog(LOG_DEBUG|LOG_ERR, "unknown host %s "
+ "getipnodebyname() returned %d", host, error_num);
+ return (NETWORK_ERROR_HOST);
+ }
+ (void) memcpy((caddr_t)&sin.sin6_addr, hp->h_addr, hp->h_length);
+ sin.sin6_family = hp->h_addrtype;
+ freehostent(hp);
+
+ if ((sp = getservbyname("printer", "tcp")) == NULL) {
+ syslog(LOG_DEBUG|LOG_ERR, "printer/tcp: unknown service");
+ return (NETWORK_ERROR_SERVICE);
+ }
+ sin.sin6_port = sp->s_port;
+
+retry:
+ /*
+ * Try connecting to the server.
+ *
+ * Use 0 as lport means that rresvport_af() will bind to a port in
+ * the anonymous privileged port range.
+ */
+ lport = 0;
+ s = rresvport_af(&lport, AF_INET6);
+ if (s < 0)
+ return (NETWORK_ERROR_PORT);
+
+ old_handler = signal(SIGALRM, null);
+ (void) alarm(timeout);
+ if (connect(s, (struct sockaddr *)&sin, sizeof (sin)) < 0) {
+ (void) alarm(0);
+ (void) signal(SIGALRM, old_handler);
+ err = errno;
+ (void) close(s);
+ errno = err;
+ if (errno == EADDRINUSE) {
+ goto retry;
+ }
+ /*
+ * If connecting to the local system fails, try
+ * again with "localhost" address instead.
+ */
+ if (uts.nodename[0] == '\0')
+ (void) uname(&uts);
+ if (strcmp(host, uts.nodename) == 0) {
+ IN6_IPADDR_TO_V4MAPPED(htonl(INADDR_LOOPBACK),
+ &sin.sin6_addr);
+ sin.sin6_family = AF_INET6;
+ goto retry;
+ }
+ if (errno == ECONNREFUSED && timo <= 16) {
+ (void) sleep(timo);
+ timo *= 2;
+ goto retry;
+ }
+ return (NETWORK_ERROR_UNKNOWN);
+ }
+ (void) alarm(0);
+ (void) signal(SIGALRM, old_handler);
+ return (s);
+}
+
int
main(int argc, char *argv[])
{
diff --git a/usr/src/cmd/print/bsd-sysv-commands/common.c b/usr/src/cmd/print/bsd-sysv-commands/common.c
index fbc68459f8..92a629f776 100644
--- a/usr/src/cmd/print/bsd-sysv-commands/common.c
+++ b/usr/src/cmd/print/bsd-sysv-commands/common.c
@@ -400,8 +400,8 @@ strsplit(char *string, const char *seperators)
}
papi_status_t
-jobSubmitSTDIN(papi_service_t svc, char *printer, papi_attribute_t **list,
- papi_job_t *job)
+jobSubmitSTDIN(papi_service_t svc, char *printer, char *prefetch, int len,
+ papi_attribute_t **list, papi_job_t *job)
{
papi_status_t status;
papi_stream_t stream = NULL;
@@ -409,6 +409,10 @@ jobSubmitSTDIN(papi_service_t svc, char *printer, papi_attribute_t **list,
char buf[BUFSIZ];
status = papiJobStreamOpen(svc, printer, list, NULL, &stream);
+
+ if (len > 0)
+ status = papiJobStreamWrite(svc, stream, prefetch, len);
+
while ((status == PAPI_OK) && ((rc = read(0, buf, sizeof (buf))) > 0))
status = papiJobStreamWrite(svc, stream, buf, rc);
@@ -426,19 +430,12 @@ jobSubmitSTDIN(papi_service_t svc, char *printer, papi_attribute_t **list,
#define PS_MAGIC "%!"
#define PC_PS_MAGIC "^D%!"
int
-is_postscript(const char *file)
+is_postscript_stream(int fd, char *buf, int *len)
{
- char buf[3];
- int fd;
-
- if ((fd = open(file, O_RDONLY)) < 0)
- return (-1);
-
- if (read(fd, buf, sizeof (buf)) < 0) {
+ if ((*len = read(fd, buf, *len)) < 0) {
close(fd);
return (-1);
}
- close(fd);
if ((strncmp(buf, PS_MAGIC, sizeof (PS_MAGIC) - 1) == 0) ||
(strncmp(buf, PC_PS_MAGIC, sizeof (PC_PS_MAGIC) - 1) == 0))
@@ -447,6 +444,23 @@ is_postscript(const char *file)
return (0);
}
+int
+is_postscript(const char *file)
+{
+ int rc = -1;
+ int fd;
+
+ if ((fd = open(file, O_RDONLY)) >= 0) {
+ char buf[3];
+ int len = sizeof (buf);
+
+ rc = is_postscript_stream(fd, buf, &len);
+ close(fd);
+ }
+
+ return (rc);
+}
+
static char **
all_list(papi_service_t svc)
{
diff --git a/usr/src/cmd/print/bsd-sysv-commands/common.h b/usr/src/cmd/print/bsd-sysv-commands/common.h
index e8169ed0da..4a74be0abf 100644
--- a/usr/src/cmd/print/bsd-sysv-commands/common.h
+++ b/usr/src/cmd/print/bsd-sysv-commands/common.h
@@ -20,7 +20,7 @@
*/
/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*
*/
@@ -52,12 +52,14 @@ extern int berkeley_queue_report(papi_service_t svc, FILE *fp, char *dest,
int fmt, int ac, char *av[]);
extern papi_status_t jobSubmitSTDIN(papi_service_t svc, char *printer,
+ char *prefetch, int len,
papi_attribute_t **list, papi_job_t *job);
extern char **interest_list(papi_service_t svc);
extern char *localhostname();
extern char *lp_type_to_mime_type(char *lp_type);
extern int is_postscript(const char *file);
+extern int is_postscript_stream(int fd, char *buf, int *len);
extern int cli_auth_callback(papi_service_t svc, void *app_data);
diff --git a/usr/src/cmd/print/bsd-sysv-commands/lp.c b/usr/src/cmd/print/bsd-sysv-commands/lp.c
index aeec532e54..c7f6b1d4a9 100644
--- a/usr/src/cmd/print/bsd-sysv-commands/lp.c
+++ b/usr/src/cmd/print/bsd-sysv-commands/lp.c
@@ -70,6 +70,8 @@ main(int ac, char *av[])
papi_attribute_t **list = NULL;
papi_encryption_t encryption = PAPI_ENCRYPT_NEVER;
papi_job_t job = NULL;
+ char prefetch[3];
+ int prefetch_len = sizeof (prefetch);
char *printer = NULL;
char b = PAPI_TRUE;
int copy = 0;
@@ -230,6 +232,10 @@ main(int ac, char *av[])
if (is_postscript(av[optind]) == 1)
document_format = "application/postscript";
#endif
+ } else {
+ if (is_postscript_stream(0, prefetch, &prefetch_len)
+ == 1)
+ document_format = "application/postscript";
}
papiAttributeListAddInteger(&list, PAPI_ATTR_EXCL, "copies", 1);
@@ -257,7 +263,8 @@ main(int ac, char *av[])
if (modify != -1)
status = papiJobModify(svc, printer, modify, list, &job);
else if (optind == ac) /* no file list, use stdin */
- status = jobSubmitSTDIN(svc, printer, list, &job);
+ status = jobSubmitSTDIN(svc, printer, prefetch, prefetch_len,
+ list, &job);
else if (validate == 1) /* validate the request can be processed */
status = papiJobValidate(svc, printer, list,
NULL, &av[optind], &job);
diff --git a/usr/src/cmd/print/bsd-sysv-commands/lpr.c b/usr/src/cmd/print/bsd-sysv-commands/lpr.c
index fe6c24a8bc..547e0df36f 100644
--- a/usr/src/cmd/print/bsd-sysv-commands/lpr.c
+++ b/usr/src/cmd/print/bsd-sysv-commands/lpr.c
@@ -70,6 +70,8 @@ main(int ac, char *av[])
papi_job_t job = NULL;
int exit_code = 0;
char *printer = NULL;
+ char prefetch[3];
+ int prefetch_len = sizeof (prefetch);
papi_encryption_t encryption = PAPI_ENCRYPT_NEVER;
int dump = 0;
int validate = 0;
@@ -217,6 +219,9 @@ main(int ac, char *av[])
if (is_postscript(av[optind]) == 1)
document_format = "application/postscript";
#endif
+ } else {
+ if (is_postscript_stream(0, prefetch, &prefetch_len) == 1)
+ document_format = "application/postscript";
}
papiAttributeListAddInteger(&list, PAPI_ATTR_EXCL, "copies", 1);
@@ -238,7 +243,8 @@ main(int ac, char *av[])
status = papiJobValidate(svc, printer, list,
NULL, &av[optind], &job);
else if (optind == ac) /* no file list, use stdin */
- status = jobSubmitSTDIN(svc, printer, list, &job);
+ status = jobSubmitSTDIN(svc, printer, prefetch, prefetch_len,
+ list, &job);
else if (copy == 0) /* reference the files in the job, default */
status = papiJobSubmitByReference(svc, printer, list,
NULL, &av[optind], &job);
diff --git a/usr/src/cmd/print/lpget/lpget.c b/usr/src/cmd/print/lpget/lpget.c
index 9e6b0e3f00..5c19480ae1 100644
--- a/usr/src/cmd/print/lpget/lpget.c
+++ b/usr/src/cmd/print/lpget/lpget.c
@@ -19,7 +19,7 @@
* CDDL HEADER END
*/
/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -38,7 +38,6 @@
#endif
#include <ns.h>
-#include <misc.h>
#include <list.h>
extern char *optarg;
diff --git a/usr/src/cmd/print/lpset/lpset.c b/usr/src/cmd/print/lpset/lpset.c
index 308c82cd58..d0a765caea 100644
--- a/usr/src/cmd/print/lpset/lpset.c
+++ b/usr/src/cmd/print/lpset/lpset.c
@@ -19,7 +19,7 @@
* CDDL HEADER END
*/
/*
- * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -41,7 +41,6 @@
#include <pwd.h>
#include <ns.h>
-#include <misc.h>
#include <list.h>
extern char *optarg;
diff --git a/usr/src/cmd/print/selector/print-service b/usr/src/cmd/print/selector/print-service
index f78a4d89dd..9fd672f565 100755
--- a/usr/src/cmd/print/selector/print-service
+++ b/usr/src/cmd/print/selector/print-service
@@ -64,6 +64,8 @@ my $SVC_CUPS_SCHEDULER = 'cups/scheduler';
my $SVC_CUPS_LPD = 'cups/in-lpd';
sub fatal {
+ ($ENV{"DESKTOP_LAUNCHED"}) &&
+ exec("/bin/zenity", "--error", "--text=@_");
print STDERR @_;
exit(1);
}
diff --git a/usr/src/lib/print/libpapi-common/common/uri.c b/usr/src/lib/print/libpapi-common/common/uri.c
index 9cc6f59006..ee45af9592 100644
--- a/usr/src/lib/print/libpapi-common/common/uri.c
+++ b/usr/src/lib/print/libpapi-common/common/uri.c
@@ -20,7 +20,7 @@
*/
/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*
*/
@@ -165,6 +165,14 @@ uri_from_string(char *string, uri_t **uri)
u->scheme_part = strdup(&ptr[1]);
}
+ if ((u->host_part == NULL) && (u->path_part == NULL) &&
+ (u->scheme_part == NULL)) {
+ errno = EINVAL;
+ uri_free(u);
+ *uri = NULL;
+ return (-1);
+ }
+
return (0);
}
diff --git a/usr/src/lib/print/libpapi-dynamic/common/nss.c b/usr/src/lib/print/libpapi-dynamic/common/nss.c
index c20b33daf8..dbb2c87e78 100644
--- a/usr/src/lib/print/libpapi-dynamic/common/nss.c
+++ b/usr/src/lib/print/libpapi-dynamic/common/nss.c
@@ -100,9 +100,16 @@ solaris_lpsched_shortcircuit_hack(papi_attribute_t ***list)
papiAttributeListGetString(*list, NULL,
"printer-uri-supported", &printer);
- if (uri_from_string(printer, &uri) < 0)
+ /* if there is no printer-uri-supported, there is nothing to do */
+ if (printer == NULL)
return;
+ if (uri_from_string(printer, &uri) < 0) {
+ papiAttributeListFree(*list);
+ *list = NULL;
+ return;
+ }
+
/* already an lpsched URI ? */
if (strcasecmp(uri->scheme, "lpsched") == 0)
return;
diff --git a/usr/src/lib/print/libpapi-lpd/common/lpd-job.c b/usr/src/lib/print/libpapi-lpd/common/lpd-job.c
index 5a2cb26fa6..52dc69d6c4 100644
--- a/usr/src/lib/print/libpapi-lpd/common/lpd-job.c
+++ b/usr/src/lib/print/libpapi-lpd/common/lpd-job.c
@@ -94,10 +94,12 @@ add_lpd_control_line(char **metadata, char code, char *value)
*metadata = (char *)calloc(1, size);
} else {
void *tmp;
- tmp = realloc(*metadata, size);
- if (tmp)
+ tmp = calloc(1, size);
+ if (tmp) {
+ strlcpy(tmp, *metadata, size);
+ free(*metadata);
*metadata = (char *)tmp;
- else
+ } else
return (PAPI_TEMPORARY_ERROR);
}
diff --git a/usr/src/lib/print/libpapi-lpd/common/lpd-port.c b/usr/src/lib/print/libpapi-lpd/common/lpd-port.c
index 64cea8dd0a..9c536d886d 100644
--- a/usr/src/lib/print/libpapi-lpd/common/lpd-port.c
+++ b/usr/src/lib/print/libpapi-lpd/common/lpd-port.c
@@ -20,7 +20,7 @@
*/
/*
- * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*
*/
@@ -232,6 +232,7 @@ next_job_id()
(ftruncate(fd, 0) == 0))
write(fd, buf, strlen(buf));
}
+ close(fd);
}
syslog(LOG_DEBUG, "next_job_id() is %d", result);
diff --git a/usr/src/lib/print/libprint/Makefile.com b/usr/src/lib/print/libprint/Makefile.com
index 8d885ada45..88fbb532b0 100644
--- a/usr/src/lib/print/libprint/Makefile.com
+++ b/usr/src/lib/print/libprint/Makefile.com
@@ -28,7 +28,7 @@
LIBRARY = libprint.a
VERS = .2
OBJECTS = \
- job.o list.o misc.o network.o ns.o ns_bsd_addr.o ns_cmn_kvp.o \
+ list.o ns.o ns_bsd_addr.o ns_cmn_kvp.o \
ns_cmn_printer.o nss_convert.o nss_ldap.o nss_printer.o nss_write.o
include ../../../Makefile.lib
diff --git a/usr/src/lib/print/libprint/common/llib-lprint b/usr/src/lib/print/libprint/common/llib-lprint
index 6d89824e36..c52143e527 100644
--- a/usr/src/lib/print/libprint/common/llib-lprint
+++ b/usr/src/lib/print/libprint/common/llib-lprint
@@ -19,7 +19,7 @@
* CDDL HEADER END
*/
/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -53,75 +53,14 @@
#include <syslog.h>
#include <unistd.h>
-typedef struct _jobfile jobfile_t;
-typedef struct _job job_t;
-
-struct _jobfile {
- char *jf_spl_path; /* df file */
- char *jf_src_path; /* source file */
- char *jf_name; /* title/name */
- char *jf_data; /* ptr to mmapped file */
- long jf_size; /* size of data */
- char jf_mmapped; /* is this mmapped or malloced */
-};
-
-struct _job {
- int job_id;
- char *job_printer;
- char *job_server;
- char *job_user;
- char *job_host;
- char *job_spool_dir;
- jobfile_t *job_cf;
- char job_df_next;
- jobfile_t **job_df_list;
-};
-
-int job_store(job_t *job);
-void job_free(job_t *job);
-void job_destroy(job_t *job);
-job_t *job_create(char *printer, char *server, char *spool);
-job_t *job_retrieve(char *xfer_file, char *spool);
-job_t **job_list_append(job_t **list, char *printer, char *spool);
-#ifndef SUNOS_4
-int vjob_match_attribute(char *attribute, __va_list ap);
-int vjob_cancel(job_t *job, __va_list ap);
-#endif
-
-
void **list_append(void **, void *);
void **list_append_unique(void **, void *, int (*)(void *, void*));
void **list_concatenate(void **, void **);
void * list_locate(void **, int (*)(void *, void *), void *);
int list_iterate(void **, int (*)(void *, __va_list), ...);
-char * get_user_name(void);
-int check_client_spool(char *printer);
-int get_lock(char *name, int write_pid);
-uid_t get_user_id(void);
-char *strcdup(char *, char);
-char *strndup(char *, int);
-char **strsplit(char *, char *);
-int file_size(char *);
-int copy_file(char *src, char *dst);
-int map_in_file(const char *name, char **buf);
-int write_buffer(char *name, char *buf, int len);
-void start_daemon(int do_fork);
-int kill_process(char *file);
void *dynamic_function(const char *, const char *);
-int net_open(char *host, int timeout);
-int net_close(int nd);
-int net_read(int nd, char *buf, int len);
-int net_write(int nd, char *buf, int len);
-int net_printf(int nd, char *fmt, ...);
-char *net_gets(char *buf, int size, int nd);
-int net_send_message(int nd, char *fmt, ...);
-int net_response(int nd);
-int net_send_file(int nd, char *name, char *data, int data_len,
- int type);
-
-
struct ns_bsd_addr {
char *server; /* server name */
char *printer; /* printer name or NULL */
diff --git a/usr/src/lib/print/libprint/common/mapfile-vers b/usr/src/lib/print/libprint/common/mapfile-vers
index 8cf667fb92..de93e22eee 100644
--- a/usr/src/lib/print/libprint/common/mapfile-vers
+++ b/usr/src/lib/print/libprint/common/mapfile-vers
@@ -19,7 +19,7 @@
# CDDL HEADER END
#
#
-# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
#ident "%Z%%M% %I% %E% SMI"
@@ -72,36 +72,6 @@ SUNWprivate_2.1 {
list_locate;
list_iterate;
- job_free; # job support
- job_destroy;
- job_retrieve;
- job_list_append;
- vjob_match_attribute;
- vjob_cancel;
-
- net_open; # net support
- net_close;
- net_read;
- net_write;
- net_printf;
- net_gets;
- net_send_message;
- net_response;
- net_send_file;
-
- check_client_spool; # misc support
- get_lock;
- get_user_id;
- get_user_name;
- strcdup;
- strndup;
- strsplit;
- file_size;
- copy_file;
- map_in_file;
- write_buffer;
- start_daemon;
-
files_put_printer; # required for ns_put_printer()
nis_put_printer;
nisplus_put_printer;
diff --git a/usr/src/lib/print/libprint/common/ns.c b/usr/src/lib/print/libprint/common/ns.c
index fd0a54bd33..baf514c9fd 100644
--- a/usr/src/lib/print/libprint/common/ns.c
+++ b/usr/src/lib/print/libprint/common/ns.c
@@ -19,7 +19,7 @@
* CDDL HEADER END
*/
/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -39,7 +39,6 @@
#include <ns.h>
#include <list.h>
-#include <misc.h>
/*
diff --git a/usr/src/lib/print/libprint/common/ns_bsd_addr.c b/usr/src/lib/print/libprint/common/ns_bsd_addr.c
index c908d4375c..ba142bb8a1 100644
--- a/usr/src/lib/print/libprint/common/ns_bsd_addr.c
+++ b/usr/src/lib/print/libprint/common/ns_bsd_addr.c
@@ -19,7 +19,7 @@
* CDDL HEADER END
*/
/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -37,7 +37,20 @@
#include <ns.h>
#include <list.h>
-#include <misc.h>
+
+static char **
+strsplit(char *string, char *seperators)
+{
+ char **list = NULL;
+ char *where = NULL;
+ char *element;
+
+ for (element = strtok_r(string, seperators, &where); element != NULL;
+ element = strtok_r(NULL, seperators, &where))
+ list = (char **)list_append((void **)list, element);
+
+ return (list);
+}
/*
* Manipulate bsd_addr structures
diff --git a/usr/src/lib/print/libprint/common/nss_convert.c b/usr/src/lib/print/libprint/common/nss_convert.c
index fae5610b98..eaee6df5b2 100644
--- a/usr/src/lib/print/libprint/common/nss_convert.c
+++ b/usr/src/lib/print/libprint/common/nss_convert.c
@@ -19,7 +19,7 @@
* CDDL HEADER END
*/
/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -40,7 +40,6 @@
#include <ns.h>
#include <list.h>
-#include <misc.h>
#define ESCAPE_CHARS "\\\n=:" /* \, \n, =, : */
diff --git a/usr/src/lib/print/libprint/common/nss_ldap.c b/usr/src/lib/print/libprint/common/nss_ldap.c
index 887babc740..c2140d5048 100644
--- a/usr/src/lib/print/libprint/common/nss_ldap.c
+++ b/usr/src/lib/print/libprint/common/nss_ldap.c
@@ -19,7 +19,7 @@
* CDDL HEADER END
*/
/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -41,7 +41,6 @@
#include <ns.h>
#include <list.h>
-#include <misc.h>
#define LDAP_REFERRALS
#include <lber.h>
diff --git a/usr/src/lib/print/libprint/common/nss_write.c b/usr/src/lib/print/libprint/common/nss_write.c
index 77f894be5a..c30c1274b4 100644
--- a/usr/src/lib/print/libprint/common/nss_write.c
+++ b/usr/src/lib/print/libprint/common/nss_write.c
@@ -19,7 +19,7 @@
* CDDL HEADER END
*/
/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -41,7 +41,6 @@
#include <ns.h>
#include <list.h>
-#include <misc.h>
/* escaped chars include delimiters and shell meta characters */
#define ESCAPE_CHARS "\\\n=: `&;|>^$()<*?["
diff --git a/usr/src/tools/pmodes/exceptions.h b/usr/src/tools/pmodes/exceptions.h
index bdb1222080..2ddc3a5de9 100644
--- a/usr/src/tools/pmodes/exceptions.h
+++ b/usr/src/tools/pmodes/exceptions.h
@@ -2,9 +2,8 @@
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
@@ -20,8 +19,8 @@
* CDDL HEADER END
*/
/*
- * Copyright (c) 1999-2001 by Sun Microsystems, Inc.
- * All rights reserved.
+ * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
*
* $Id: exceptions.h,v 1.11 2000/01/13 14:12:58 casper Exp $
*
@@ -57,6 +56,9 @@
"/var/spool/lp/requests",
"/var/spool/lp/system",
+ /* CUPS */
+ "/var/cache/cups",
+
/* another strange logfile */
"/usr/oasys/tmp/TERRLOG",