Solaris Naming Administration Guide

Chapter 26 Administering FNS Attributes

This chapter describes FNS attributes and how to administer them. .

Attributes Overview

Attributes may be applied to named objects. Attributes are optional. A named object can have no attributes, one attribute, or multiple attributes.

Each attribute has a unique attribute identifier, an attribute syntax, and a set of zero or more distinct attribute values.

XFN defines the base attribute interface for examining and modifying the values of attributes associated with existing named objects. These objects can be contexts or any other type of object. Associated with a context are syntax attributes that describe how the context parses compound names.

The extended attribute interface contains operations that search for specific attributes and that create objects and their associated attributes.

Examining Attributes

Search for attributes with the fnsearchcommand.

The syntax of the fnsearch command is


fnsearch [-ALlv] [-n max] [-s scope] name [-a ident]... [-O|-U] filter_expr [filter_arg]

Table 26-1 fnsearch Command Options

Option 

Description 

-n max

Display only max number of objects. 

-s scope

Set the scope of the search 

-a ident

Display only those attributes that match ident. 

name

Composite name 

filter_expr

Boolean, logical, grouping, relational, and comparison operators (see Table 26-2)

filter_arg

Arguments for filter expressions (see Table 26-2]

-A

Consult only the authoritative source. 

-L

Follow XFN links. 

-l

Display the object references for the matching objects. 

-v

Verbose. Display detailed object references for the matching objects. 

-O

Use an OSI OID as the identifier 

-U

Use a DCE UUID as the identifier 

Searching for Objects Associated With an Attribute

With the fnsearch command, you can search for objects that are associated with the attributes you choose.

For example, to find all the objects that are associated with the attribute for_sale in orgunit/sales/site/, you would enter the following command:


 % fnsearch orgunit/sales/site/ for_sale

Customizing Attribute Searches

You can also use all the following in filter expressions in your search patterns.

Table 26-2 fnsearch Filter Expression Operators

Filter Expression Operator 

Symbols and Forms 

Logical operators 

or, and, not

Parentheses for grouping 

( )

Relational operators: Compare an attribute to a supplied value 

== True if at least one attribute value is equal to the supplied value. != True if none of the attribute values are equal to the supplied value. < True if at least one attribute value is less than the supplied value. <= True if at least one attribute value is less than or equal to the supplied value. > True if at least one attribute value is greater than the supplied value. >= True if at least one attribute value is greater than or equal to the supplied value. ~= True if at least one attribute value matches the supplied value according to some context-specific approximate matching criterion. This criterion must subsume strict equality.

Example: 

% fnsearch name "not (make == 'olds' and year == 1983)"

Substitution tokens: 

Helpful when writing shell scripts; allow the use of OSI OIDs and DCE UUIDs when used with the -O and -U options

%a for attribute

%s for string

%i for identifier

%v for attribute value (only fn_attr_syntax_ascii is currently supported)

Example: 

The following three examples are equivalent. 

% fnsearch name "color == 'red'"

% fnsearch name "%a == 'red'" color

% fnsearch name "%a == %s" color red

Wild card strings 

*, *string, string*, str*ing, %s*

Extended operators 

'name'(wildcarded_string), 'reftype'(identifier), 'addrtype' (identifier)

Example: 

Search for objects with names starting with "Bill" and IQ attributes over 80. 

% fnsearch name "'name'('bill'*) and IQ > 80"

See the fnsearch man page for detailed information about creating search patterns.

Updating Attributes

The fnattr command lets you update and examine attributes associated with FNS named objects. You can perform four attribute operations with the fnattr command:


fnattr -a [-s] name [-O|-U] identifier values

fnattr -d name [[-O|-U] identifier [values]]

fnattr -m name [-O|-U identifier oldvalue newvalue

fnattr -l name [[-O|-U] identifier
Table 26-3 fnattr Command Options

Option 

Description 

name

Composite name. 

identifier

Attribute name. 

values

One or more attributes values 

oldvalue

The attribute value that you want to change. 

newvalue

The new attribute value. 

-aa

Add (create) a new attribute 

-d

Delete an attribute 

-m

Change (modify) an attribute 

-l

List attribute values 

-s

Add in "supersede" mode. Removes any existing values for the identifier attribute and creates new attribute values.

-l

List attributes and values. 

-O

Use an OSI OID as the identifier 

-U

Use a DCE UUID as the identifier 

In each of these cases, the identifier format is FN_ID_STRING, unless the option -O or -U is used.

Adding an Attribute

The -a option is for adding an attribute or adding a value to an attribute. Specify the composite name the attribute is associated with, the attribute identifier, and the values to add.


fnattr -a [-s] name [-O | -U] identifier value1 [value2+]

The following example adds the attribute identifier model and the value hplaser to thisorgunit/service/printer.


# fnattr -a thisorgunit/service/printer model hplaser

The -s option means "add in supersede" mode. If an attribute with the specified identifier already exists, -s removes all of its values and replaces them with the values added. If this option is omitted, the resulting values for the specified attribute includes the existing values and the new values added.


# fnattr -as thisorgunit/service/printer model hplaser

The example above will first remove any existing values associated with model and add hplaser as the value.

Deleting an Attribute

To delete an attribute associated with an FNS named object, use the -d option.


fnattr -d name [[-O | -U] identifier value1 [value2+]]]

You can control what to delete:

For example, to delete all the attributes associated with thisorgunit/service/printer.


# fnattr -d thisorgunit/service/printer

Listing an Attribute

The -l option is for listing attributes and their values.


fnattr -l name [[-O | -U] identifier]

For example to list the values of the model attribute of thisorgunit/service/printer.


# fnattr -l thisorgunit/service/printer model
laser
postscript

If an identifier is not specified, all the attributes associated with the named object are displayed.

Modifying an Attribute

The -m option lets you modify an attribute value.


fnattr -m name [-O | -U] identifier old_value new_value

For example, to replace the value postscript with laser you would enter:


# fnattr -m thisorgunit/service/printer model postscript laser

Only the specified values are affected. Other attributes and values associated with the name are not affected.

Other Options

The -O option assumes the format of the attribute identifier is an ASN.1 dot-separated integer string list (FN_ID_ISO_OID_STRING).

The -U option assumes the format of the attribute identifier is a DCE UUID string form (FN_ID_DCE_UUID).