summaryrefslogtreecommitdiff
path: root/usr/src/lib/print
diff options
context:
space:
mode:
authorRaja Andra <Rajagopal.Andra@Sun.COM>2009-12-06 01:39:21 -0800
committerRaja Andra <Rajagopal.Andra@Sun.COM>2009-12-06 01:39:21 -0800
commit36e852a172cba914383d7341c988128b2c667fbd (patch)
tree6cf9fe61b54ffa5f49f74f8b3ee20249279d5efe /usr/src/lib/print
parent560e0ee2bb5791b5efe2cbdc74d0a76f06dbd84d (diff)
downloadillumos-gate-36e852a172cba914383d7341c988128b2c667fbd.tar.gz
6874309 Remove NIS+ from Solaris
Diffstat (limited to 'usr/src/lib/print')
-rw-r--r--usr/src/lib/print/libprint/common/mapfile-vers1
-rw-r--r--usr/src/lib/print/libprint/common/ns.c21
-rw-r--r--usr/src/lib/print/libprint/common/ns.h10
-rw-r--r--usr/src/lib/print/libprint/common/nss_write.c124
4 files changed, 35 insertions, 121 deletions
diff --git a/usr/src/lib/print/libprint/common/mapfile-vers b/usr/src/lib/print/libprint/common/mapfile-vers
index 640b7a0291..522583b98f 100644
--- a/usr/src/lib/print/libprint/common/mapfile-vers
+++ b/usr/src/lib/print/libprint/common/mapfile-vers
@@ -78,7 +78,6 @@ SUNWprivate_2.1 {
files_put_printer; # required for ns_put_printer()
nis_put_printer;
- nisplus_put_printer;
ldap_put_printer;
local:
diff --git a/usr/src/lib/print/libprint/common/ns.c b/usr/src/lib/print/libprint/common/ns.c
index baf514c9fd..943be31e95 100644
--- a/usr/src/lib/print/libprint/common/ns.c
+++ b/usr/src/lib/print/libprint/common/ns.c
@@ -19,12 +19,10 @@
* CDDL HEADER END
*/
/*
- * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
/*LINTLIBRARY*/
#include <stdio.h>
@@ -51,16 +49,13 @@ normalize_ns_name(char *ns)
if (ns == NULL)
return (NULL);
else if ((strcasecmp(ns, "files") == 0) ||
- (strcasecmp(ns, "system") == 0) ||
- (strcasecmp(ns, "etc") == 0))
+ (strcasecmp(ns, "system") == 0) ||
+ (strcasecmp(ns, "etc") == 0))
return ("files");
else if (strcasecmp(ns, "nis") == 0)
return ("nis");
else if (strcasecmp(ns, "ldap") == 0)
return ("ldap");
- else if ((strcasecmp(ns, "nisplus") == 0) ||
- (strcasecmp(ns, "nis+") == 0))
- return ("nisplus");
else
return (ns);
}
@@ -86,7 +81,7 @@ ns_printer_destroy(ns_printer_t *printer)
extern void ns_kvp_destroy(ns_kvp_t *);
list_iterate((void **)printer->attributes,
- (VFUNC_T)ns_kvp_destroy);
+ (VFUNC_T)ns_kvp_destroy);
free(printer->attributes);
}
if (printer->aliases != NULL) { /* aliases */
@@ -120,11 +115,11 @@ ns_printer_get_list(const char *ns)
ns = normalize_ns_name((char *)ns);
while (getprinterentry(buf, sizeof (buf), (char *)ns) == 0) {
ns_printer_t *printer =
- (ns_printer_t *)_cvt_nss_entry_to_printer(buf, NULL);
+ (ns_printer_t *)_cvt_nss_entry_to_printer(buf, NULL);
printer_list = (ns_printer_t **)list_append(
- (void **)printer_list,
- (void *)printer);
+ (void **)printer_list,
+ (void *)printer);
}
(void) endprinterentry();
@@ -180,7 +175,7 @@ ns_printer_put(const ns_printer_t *printer)
return (-1);
if (snprintf(func, sizeof (func), "%s_put_printer",
- normalize_ns_name(printer->source)) >= sizeof (func)) {
+ normalize_ns_name(printer->source)) >= sizeof (func)) {
syslog(LOG_ERR, "ns_printer_put: buffer overflow");
return (-1);
}
diff --git a/usr/src/lib/print/libprint/common/ns.h b/usr/src/lib/print/libprint/common/ns.h
index 6614e3fad2..84d16f7ceb 100644
--- a/usr/src/lib/print/libprint/common/ns.h
+++ b/usr/src/lib/print/libprint/common/ns.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,15 +19,13 @@
* CDDL HEADER END
*/
/*
- * Copyright 1998-2003 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _NS_H
#define _NS_H
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#ifdef __cplusplus
extern "C" {
#endif
@@ -58,7 +55,6 @@ extern "C" {
#define NS_SVC_PRINTCAP "printcap"
#define NS_SVC_ETC "etc"
#define NS_SVC_NIS "nis"
-#define NS_SVC_NISPLUS "nisplus"
#define NS_SVC_LDAP "ldap"
/*
diff --git a/usr/src/lib/print/libprint/common/nss_write.c b/usr/src/lib/print/libprint/common/nss_write.c
index c30c1274b4..c617f0d0a5 100644
--- a/usr/src/lib/print/libprint/common/nss_write.c
+++ b/usr/src/lib/print/libprint/common/nss_write.c
@@ -19,12 +19,10 @@
* CDDL HEADER END
*/
/*
- * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
@@ -93,7 +91,7 @@ static int
_file_put_printer(const char *file, const ns_printer_t *printer)
{
FILE *ifp,
- *ofp;
+ *ofp;
char *tmpfile;
int fd;
int exit_status = 0;
@@ -152,19 +150,19 @@ _file_put_printer(const char *file, const ns_printer_t *printer)
*/
if (!((strcmp(printer->name, "all") == 0) &&
- (printer->attributes == NULL))) {
+ (printer->attributes == NULL))) {
char *t, *entry, *pentry;
(void) _cvt_printer_to_entry((ns_printer_t *)printer,
- buf, sizeof (buf));
+ buf, sizeof (buf));
t = pentry = strdup(buf);
while (freadline(ifp, buf, sizeof (buf)) != NULL) {
ns_printer_t *tmp = (ns_printer_t *)
- _cvt_nss_entry_to_printer(buf, "");
+ _cvt_nss_entry_to_printer(buf, "");
if (ns_printer_match_name(tmp, printer->name)
- == 0) {
+ == 0) {
entry = pentry;
pentry = NULL;
} else
@@ -204,7 +202,6 @@ files_put_printer(const ns_printer_t *printer)
return (_file_put_printer(file, printer));
}
-
/*
* Support for writing a printer into the NIS printers.conf.byname
* map.
@@ -227,7 +224,7 @@ remote_command(char *command, char *host)
int fd;
if ((fd = rcmd_af(&host, htons(514), pw->pw_name, "root",
- command, NULL, AF_INET6)) < 0)
+ command, NULL, AF_INET6)) < 0)
return (-1);
(void) close(fd);
return (0);
@@ -264,12 +261,12 @@ nis_put_printer(const ns_printer_t *printer)
return (-1);
if (snprintf(lfile, sizeof (lfile), "/tmp/%s", map) >=
- sizeof (lfile)) {
+ sizeof (lfile)) {
syslog(LOG_ERR, "nis_put_printer:lfile buffer overflow");
return (-1);
}
if (snprintf(rfile, sizeof (rfile), "root@%s:/etc/%s", host, map) >=
- sizeof (rfile)) {
+ sizeof (rfile)) {
syslog(LOG_ERR, "nis_put_printer:rfile buffer overflow");
return (-1);
}
@@ -280,10 +277,10 @@ nis_put_printer(const ns_printer_t *printer)
/* copy it local */
if (snprintf(cmd, sizeof (cmd), "rcp %s %s >/dev/null 2>&1",
- rfile, lfile) >= sizeof (cmd)) {
- syslog(LOG_ERR,
- "nis_put_printer:buffer overflow building cmd");
- return (-1);
+ rfile, lfile) >= sizeof (cmd)) {
+ syslog(LOG_ERR,
+ "nis_put_printer:buffer overflow building cmd");
+ return (-1);
}
(void) system(cmd); /* could fail because it doesn't exist */
@@ -294,20 +291,20 @@ nis_put_printer(const ns_printer_t *printer)
/* copy it back */
if (snprintf(cmd, sizeof (cmd), "rcp %s %s >/dev/null 2>&1",
- lfile, rfile) >= sizeof (cmd)) {
- syslog(LOG_ERR,
- "nis_put_printer:buffer overflow building cmd");
- return (-1);
+ lfile, rfile) >= sizeof (cmd)) {
+ syslog(LOG_ERR,
+ "nis_put_printer:buffer overflow building cmd");
+ return (-1);
}
if (system(cmd) != 0)
return (-1);
/* copy the Makefile excerpt */
if (snprintf(cmd, sizeof (cmd),
- "rcp %s root@%s:%s.print >/dev/null 2>&1",
- MAKE_EXCERPT, host, NIS_MAKEFILE) >= sizeof (cmd)) {
+ "rcp %s root@%s:%s.print >/dev/null 2>&1",
+ MAKE_EXCERPT, host, NIS_MAKEFILE) >= sizeof (cmd)) {
syslog(LOG_ERR,
- "nis_put_printer:buffer overflow building cmd");
+ "nis_put_printer:buffer overflow building cmd");
return (-1);
}
@@ -316,86 +313,13 @@ nis_put_printer(const ns_printer_t *printer)
/* run the make */
if (snprintf(cmd, sizeof (cmd),
- "/bin/sh -c 'PATH=/usr/ccs/bin:/bin:/usr/bin:$PATH "
- "make -f %s -f %s.print printers.conf >/dev/null 2>&1'",
- NIS_MAKEFILE, NIS_MAKEFILE) >= sizeof (cmd)) {
+ "/bin/sh -c 'PATH=/usr/ccs/bin:/bin:/usr/bin:$PATH "
+ "make -f %s -f %s.print printers.conf >/dev/null 2>&1'",
+ NIS_MAKEFILE, NIS_MAKEFILE) >= sizeof (cmd)) {
syslog(LOG_ERR,
- "nis_put_printer:buffer overflow on make");
+ "nis_put_printer:buffer overflow on make");
return (-1);
}
return (remote_command(cmd, host));
}
-
-/*
- * Support for writing a printer into the NISPLUS org_dir.printers table
- * begins here. This support uses the nisplus(5) commands rather than the
- * nisplus API. This was done to remove the dependency in libprint on the
- * API, which is used for lookup in a configuration dependent manner.
- */
-#define NISPLUS_CREATE "/usr/bin/nistest -t T printers.org_dir || "\
- "( /usr/bin/nistbladm "\
- "-D access=og=rmcd,nw=r:group=admin."\
- "`/usr/bin/nisdefaults -d` "\
- "-c printers_tbl key=S,nogw= datum=,nogw= "\
- "printers.org_dir.`/usr/bin/nisdefaults -d` )"
-
-#define NISPLUS_REMOVE "/usr/bin/nistbladm -R key=%s printers.org_dir"
-#define NISPLUS_UPDATE "/usr/bin/nistbladm -A key=%s datum="
-
-int
-nisplus_put_printer(const ns_printer_t *printer)
-{
- int rc = 0;
- char cmd[BUFSIZ];
-
- if (printer == NULL)
- return (rc);
-
- /* create the table if it doesn't exist */
- (void) system(NISPLUS_CREATE);
-
- if (printer->attributes != NULL) {
- int len;
- ns_kvp_t **kvp;
-
- if (snprintf(cmd, sizeof (cmd), NISPLUS_UPDATE,
- printer->name) >= sizeof (cmd)) {
- syslog(LOG_ERR,
- "nisplus_put_printer:NISPLUS_UPDATE:buffer overflow");
- return (-1);
- }
-
- len = strlen(cmd);
-
- /* Append key/value pairs */
- for (kvp = printer->attributes; *kvp != NULL; kvp++)
- if (((*kvp)->key != NULL) && ((*kvp)->value != NULL)) {
- (void) strlcat(cmd, ":", sizeof (cmd));
- (void) strncat_escaped(cmd, (*kvp)->key, sizeof (cmd),
- ESCAPE_CHARS);
- (void) strlcat(cmd, "=", sizeof (cmd));
- (void) strncat_escaped(cmd, (*kvp)->value,
- sizeof (cmd), ESCAPE_CHARS);
- }
-
- if (len != strlen(cmd))
- (void) strlcat(cmd, " printers.org_dir", sizeof (cmd));
- else
- (void) snprintf(cmd, sizeof (cmd), NISPLUS_REMOVE,
- printer->name);
-
- } else
- (void) snprintf(cmd, sizeof (cmd), NISPLUS_REMOVE,
- printer->name);
-
- if (strlcat(cmd, " >/dev/null 2>&1", sizeof (cmd)) >= sizeof (cmd)) {
- syslog(LOG_ERR, "nisplus_put_printer: buffer overflow");
- return (-1);
- }
-
- /* add/modify/delete the entry */
- rc = system(cmd);
-
- return (rc);
-}