/*
* 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.
*
* Host class
* Methods associated with a host.
*/
public class Host
{
{
try {
}
catch (Exception e) {
}
}
//
// Get the local hostname
// Return an empty string if we don't find one.
//
throws Exception
{
throw new pmCmdFailedException(err);
}
if (o == null)
return (new String(""));
return (new String(o));
}
//
// Get the domainname
// Return an empty string if we don't find one.
//
throws Exception
{
throw new pmCmdFailedException(err);
}
if (o == null)
return (new String(""));
return (new String(o));
}
throws Exception
{
int exitvalue;
if (exitvalue != 0) {
throw new pmHostNotPingableException(err);
}
}
throws Exception
{
return (getNisHost("master"));
}
//
// Look for the nis server.
// If we are looking for the master server first try
// the printers.conf.byname map. If that fails
// look for passwd.
//
throws Exception
{
int exitvalue = 0;
cmd = "/usr/bin/ypwhich -m printers.conf.byname";
} else {
}
syscmd = new SysCommand();
syscmd = new SysCommand();
}
if (exitvalue != 0) {
throw new pmNSNotConfiguredException(err);
}
if (o == null) {
}
o = o.trim();
return (new String(o));
}
/*
* Return the name of the first server listed by ldapclient
*/
throws Exception
{
int exitvalue = 0;
/* ldapclient will hang if we are not root. */
if (!DoPrinterNS.isRoot()) {
return null;
}
cmd = "/usr/sbin/ldapclient list";
syscmd = new SysCommand();
if (exitvalue != 0) {
return null;
}
return null;
}
/* Extract the first address from the NS_LDAP_SERVERS list */
break;
}
}
}
/*
* Get a default admin DN.
*/
throws Exception
{
int exitvalue = 0;
try {
" -b o=NetScapeRoot o=NetscapeRoot";
syscmd = new SysCommand();
if (exitvalue == 0) {
return ("cn=Directory Manager");
}
}
}
}
catch (Exception e) {
}
syscmd = new SysCommand();
if (exitvalue != 0) {
return null;
}
if (o == null) {
return null;
}
return null;
}
}
//
// Check to see if a name service is configured
//
throws Exception
{
int exitvalue;
return;
syscmd = new SysCommand();
if (exitvalue != 0) {
throw new pmNSNotConfiguredException(err);
}
syscmd = new SysCommand();
if (exitvalue == 0) {
"SVR: Unable to update this configuration.");
throw new pmNSNotConfiguredException();
}
/*
* Check if the ldap-client is configured by first checking
* if the config file exists and then invoking ldaplist
* Note: we need to check if the config file exists before
* invoking ldaplist so that we don't get its error message
*/
if (ldapConfig.isFile()) {
// Config file exists
syscmd = new SysCommand();
if (exitvalue != 0) {
throw new pmNSNotConfiguredException();
}
} else {
throw new pmNSNotConfiguredException();
}
} else {
throw new pmInternalErrorException(
"Unkown name service " + ns);
}
}
}