2N/A# The contents of this file are subject to the terms of the 2N/A# Common Development and Distribution License (the "License"). 2N/A# You may not use this file except in compliance with the License. 2N/A# See the License for the specific language governing permissions 2N/A# and limitations under the License. 2N/A# When distributing Covered Code, include this CDDL HEADER in each 2N/A# If applicable, add the following below this CDDL HEADER, with the 2N/A# fields enclosed by brackets "[]" replaced with your own identifying 2N/A# information: Portions Copyright [yyyy] [name of copyright owner] 2N/A# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. 2N/A"""util - RAD connection oriented utilities 2N/AThis module facilitates communication with RAD instances via a number of 2N/Aalternative transports. 2N/A# Make pipes quack enough like a socket to satisfy RecordMarkingSocket 2N/A """ A class which implements a sufficient amount of the socket.socket 2N/A interface to allow a pipe to communicate like a 2N/A rad.recordmarking.RecordMarkingSocket. """ 2N/A # If the file is unbuffered, it reads one byte at a time. 2N/A # If the file is buffered, it waits until all n bytes are 2N/A # read before returning. 2N/A # Neither is acceptable, so we use os.read. 2N/A # We would prefer to simply close our end of the pipe 2N/A # and let rad die on its own, but reaching in and doing 2N/A # that to a pipe inside a subprocess might defy its 2N/A # expectations. Instead we terminate the subprocess. 2N/A# Make a zonesbridge.IO object quack enough like a socket to satisfy 2N/A# RecordMarkingSocket 2N/A """ A class which implements a sufficient amount of the socket.socket 2N/A interface to allow a zonesbridge.IO object communicate like a 2N/A rad.recordmarking.RecordMarkingSocket. """ 2N/A# Map a path given the specified root directory 2N/A# build the rad commandline command with the given options. 2N/A Get a List[string] suitable to use when spawning a RAD process 2N/A via subprocess.Popen(). 2N/A modules List[string], a list of modules to load 2N/A debug boolean, run the spawned RAD process in debug mode 2N/A root string, root directory to use for the spawned RAD 2N/A auxargs List[string], additional argument to supply to the 2N/A List[string]: A list containing a command plus arguments 2N/A# Connect to a privately spawned copy of rad 2N/A# Defaults to loading all system modules if a list of modules isn't provided 2N/A Get a transport suitable for connecting to a privately spawned 2N/A modules List[string], a list of modules to load 2N/A debug boolean, run the spawned RAD process in debug mode 2N/A env Dictionary[string, string], environment for the 2N/A root string, root directory to use for the spawned RAD 2N/A auxargs List[string], additional argument to supply to the 2N/A ProcessPseudoSocket: a "socket" for a spawned RAD process 2N/A# Use _get_private_transport() to return a RADConnection 2N/A Connect to a privately spawned instance of RAD using a pipe. 2N/A modules List[string], a list of modules to load 2N/A debug boolean, run the spawned RAD process in debug mode 2N/A env Dictionary[string, string], environment for the 2N/A root string, root directory to use for the spawned RAD 2N/A auxargs List[string], additional argument to supply to the 2N/A locale string, locale 2N/A rad.client.RadConnection: a connection to RAD 2N/A# Connect to the local rad daemon via the standard unix domain socket 2N/A Get a transport suitable for connecting to a local RAD instance. 2N/A path string, path to the socket 2N/A socket.socket: a Unix Domain(AF_UNIX) socket 2N/A# Use _get_unix_transport() to return a RADConnection 2N/A Connect to a RAD instance over a Unix Domain Socket. 2N/A path string, path to the socket 2N/A locale string, locale 2N/A rad.client.RadConnection: a connection to RAD 2N/A """ Get a UnixDomainSocket based RadConnection to RAD on 2N/A the local host at path. """ 2N/A# Connect to a remote rad daemon at the standard port 2N/A Get a TLS transport suitable for connecting to a remote host. 2N/A host string, target host 2N/A port int, target port 2N/A ssl.SSLSocket: a TLS based socket 2N/A# Use _get_tls_transport() to return a RADConnection 2N/A Connect to a RAD instance over TLS. 2N/A host string, target host 2N/A port int, target port 2N/A locale string, locale 2N/A rad.client.RadConnection: a connection to RAD 2N/A# Connect to a non-global zone's local (unix domain socket) rad daemon, through 2N/A# an established rad connection to its global zone. 2N/A Get a transport suitable for connecting to a local zone. 2N/A rc rad.client.RadConnection, Connection to a global zone 2N/A zone string, Name of a local zone 2N/A user string, user name 2N/A _ZonesBridgePseudoSocket: a "socket" for a local zone 2N/A # Retrieve the zonesbridge.IO object 2N/A # Get a native-looking python object that throws RAD exceptions 2N/A# Use _get_zone_transport() to return a RADConnection 2N/A Connect to a RAD instance in a local zone. 2N/A rc rad.client.RadConnection, Connection to a global zone 2N/A zone string, Name of a local zone 2N/A user string, user name 2N/A locale string, locale 2N/A rad.client.RadConnection: a connection to RAD 2N/A# Fetches and caches a handle to the authentication object. 2N/A# Supplies some convenience routines built on top of it. 2N/A """ Authentication utility class. """ 2N/A [(
"type",
"Authentication")])
2N/A # Perform a terminal-interactive PAM login 2N/A # Currently not recommended due to bug in Python's getpass.getpass() 2N/A Perform a terminal-interactive PAM login. 2N/A user string, user name