/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* 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
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*
* DoPrinterNS class
* Worker class for updating name services.
* Interfaces to JNI code.
*/
public class DoPrinterNS
{
//
// JNI member functions
//
//
// Load JNI.
//
static
{
}
//
// main for testing
//
//
// Set attributes for testing.
//
try {
}
catch (Exception e) {
}
p.setPrinterName("javatest");
p.setPrintServer("zelkova");
p.setComment("This is a comment");
p.setIsDefaultPrinter(false);
try {
}
catch (Exception e) {
}
}
//
// Interface to DoPrinter[add|mod|delete]
//
public static void set(
Printer p,
{
return;
return;
}
return;
}
private static void setNIS(
Printer p,
{
boolean default_printer = p.getIsDefaultPrinter();
locale = "C";
int ret = 0;
int exitvalue = 0;
//
// If this is the nis master we only need to do the make
// locally.
//
p.setErrorLog(err);
throw new pmCmdFailedException(err);
} else {
// ignore touch warning
// p.setWarnLog(err);
}
return;
}
if (ret != 0) {
throw new pmAuthException(getstderr());
}
//
// Do we have lpset
//
if (ret != 0) {
throw new pmCmdFailedException(getstderr());
}
// Are we set up in rhosts?
cmd = "rsh ";
throw new pmAuthRhostException(err);
}
//
// We don't have lpset. Must be pre-2.6 master.
// We are set up in rhosts so use libprint
// to update it.
//
if (default_printer)
def = "true";
if (ret != 0) {
throw new pmCmdFailedException("libprint");
}
return;
}
//
// Add and modify are the same
//
boolean domake = false;
//
// If we are here from a modify and only need
// to change the default printer ...
//
if (extensions != null) {
}
}
if (ret != 0) {
p.setErrorLog(err);
throw new pmCmdFailedException(err);
}
p.setWarnLog(err);
}
domake = true;
}
if (default_printer) {
printername + " _default";
}
} else {
//
// It was the default but not any more.
//
}
}
if (ret != 0) {
p.setErrorLog(err);
throw new pmCmdFailedException(err);
}
p.setWarnLog(err);
}
domake = true;
}
} else {
// delete
if (ret != 0) {
p.setErrorLog(err);
throw new pmCmdFailedException(err);
}
p.setWarnLog(err);
}
domake = true;
}
if (ret != 0) {
p.setErrorLog(err);
throw new pmCmdFailedException(err);
}
p.setWarnLog(err);
}
domake = true;
}
}
if (!domake) {
return;
}
if (ret != 0) {
p.setErrorLog(err);
throw new pmCmdFailedException(err);
}
p.setWarnLog(err);
}
return;
}
private static void setNS(
Printer p,
{
boolean default_printer = p.getIsDefaultPrinter();
int exitvalue;
int index = 0;
/*
* Use jni to update ldap since the passwd is sensitive.
*/
throw new pmInternalErrorException(
"Missing LDAP host for ldap operation");
}
throw new pmInternalErrorException(
"Missing Binddn for ldap operation");
}
throw new pmInternalErrorException(
"Missing passwd for ldap operation");
}
p.setCmdLog("ldap ...");
if (default_printer)
def = "true";
def);
if (exitvalue != 0) {
throw new pmCmdFailedException("libprint");
}
return;
}
//
// Add and modify are the same
//
//
// If we are here for a modify and we're only setting
// the default printer ...
//
if (extensions != null) {
}
}
syscmd = new SysCommand();
p.setErrorLog(err);
throw new pmCmdFailedException(err);
} else {
p.setWarnLog(err);
}
}
if (default_printer) {
" _default";
}
} else {
//
// It was the default but not any more.
//
args = " -x _default";
}
}
syscmd = new SysCommand();
p.setErrorLog(err);
throw new pmCmdFailedException(err);
} else {
p.setWarnLog(err);
}
}
} else {
// delete
syscmd = new SysCommand();
p.setErrorLog(err);
throw new pmCmdFailedException(err);
} else {
p.setWarnLog(err);
}
}
syscmd = new SysCommand();
p.setErrorLog(err);
throw new pmCmdFailedException(err);
} else {
p.setWarnLog(err);
}
}
}
return;
}
{
if (!isRoot()) {
"SVR: User does not have root priveleges.");
throw new pmAuthException();
}
// Since we are on the NIS master the
// check is the same as for "system".
if (!isRoot()) {
"SVR: User does not have root access.");
throw new pmAuthException();
}
}
if (ret != 0) {
"SVR: User does not have NIS update access.");
throw new pmAuthException(getstderr());
}
if (ret != 0) {
"SVR: User does not have LDAP update priveleges.");
throw new pmAuthException();
}
} else {
throw new pmInternalErrorException(
"doAuth(): Invalid name service: " + nsname);
}
return (true);
}
throws Exception
{
if (ret != 0) {
throw new pmAuthException(getstderr());
}
return;
}
public static boolean isRoot()
throws Exception
{
if (o == null) {
}
return (false);
}
return (true);
}
}