/*
* 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
*/
/*
*/
/*
* Abstracted contract private interfaces for configuring krb5.conf(4).
*/
#include <ctype.h>
#include "prof_int.h"
#include "k5-int.h"
char ***retvals)
{
return (code);
while (code == 0) {
if (code2 != 0) {
goto cleanup;
}
}
}
}
}
}
code = 0;
*retvals = ret_values;
return (code);
}
{
return (EINVAL);
domains));
}
{
return (EINVAL);
hierarchy[0] = "appdefaults";
/*
* Not fatal if this fails, continue on.
*/
if (code != 0)
return (code);
return (code);
}
{
return (EINVAL);
hierarchy[0] = "logging";
/*
* Not fatal if this fails, continue on.
*/
if (code != 0)
return (code);
if (code != 0)
return (code);
if (code != 0)
return (code);
return (code);
}
{
return (EINVAL);
hierarchy[0] = "libdefaults";
/*
* Not fatal if this fails, continue on.
*/
return (code);
}
{
return (EINVAL);
hierarchy[0] = "realms";
/*
* Not fatal if this fails, continue on.
*/
}
return (code);
}
/*
* errcode_t __profile_release(profile_t profile)
*
* where profile was the pointer passed back by __profile_init
* Note: used to commit the associated profile to the backing store
* (e.g. file) and free profile memory
* Note: that this function returns an error code which profile_release
* does not. With the error code, the application can determine if they
* need to free the resulting profile information in memory
*/
{
return (EINVAL);
if ((code = profile_close_file(p)) != 0)
return (code);
}
return (0);
}
/*
* void __profile_abandon(profile_t profile)
*
* where profile was the pointer passed back by __profile_init
* Note: used to free any profile information in memory. Typically can
* be used in conjunction with __profile_release upon error
*/
void
{
}
/*
* errcode_t __profile_add_domain_mapping(profile_t profile, char *domain,
* char *realm)
*
* where profile was the pointer passed back by __profile_init
* where domain is the domain name of the associated realm name
* where realm is the corresponding realm name for the domain
*/
{
return (EINVAL);
hierarchy[0] = "domain_realm";
/*
* Not fatal if relation can't be cleared, continue on.
*/
return (code);
}
/*
* errcode_t __profile_remove_domain_mapping(profile_t profile, char *realm)
*
* where profile was the pointer passed back by __profile_init
* where domain is the domain name of the associated realm name
* where realm is the corresponding realm name for the domain
* Note: for the remove function, all matching domain - realm mappings
* will be removed for realm
*/
{
return (EINVAL);
hierarchy[0] = "domain_realm";
if (code != 0)
goto error;
}
}
return (code);
}
/*
* errcode_t __profile_get_realm_entry(profile_t profile, char *realm,
* char *name, char ***ret_value)
*
* where profile was the pointer passed back by __profile_init
* where realm is the target realm for lookup
* where name is the name in the realm section requested
* where value is a string array of any matching values assigned to name.
* The array is terminated with a NULL pointer.
* Note: if no name has been configured and a profile does exist
* then value is set to NULL
*/
char ***ret_value)
{
return (EINVAL);
hierarchy[0] = "realms";
if (code == PROF_NO_RELATION)
code = 0;
return (code);
}
/*
* errcode_t __profile_add_realm_entry(profile_t profile, char *realm,
* char *name, char **value)
*
* where profile was the pointer passed back by __profile_init
* where realm is the target realm for the name-value pair
* where name is the name in the realm subsection to add
* where value is a string array values to assigned to name. The array is
* terminated with a NULL pointer.
* Note: if the realm subsection does no exist then an error is returned
* Note: if the name already exists the set is overwritten with the values
* passed
*/
char **values)
{
return (EINVAL);
hierarchy[0] = "realms";
/*
* Not fatal if this fails, continue on.
*/
if (code != 0)
return (code);
}
return (0);
}
/*
* errcode_t __profile_get_default_realm(profile_t profile, char **realm)
*
* where profile was the pointer passed back by __profile_init
* where realm is the default_realm configured for the system
* Note: if no default_realm has been configured and a profile does exist
* then realm is set to NULL
*/
{
return (EINVAL);
&value);
if (code == PROF_NO_RELATION)
code = 0;
return (code);
}
/*
* errcode_t __profile_get_realms(profile_t profile, char ***realms)
*
* where profile was the pointer passed back by __profile_init
* where realms is a string array of realm names currently configured.
* The array is terminated with a NULL pointer.
* Note: if no realms have been configured and a profile does exist then
* realms is set to NULL
*/
{
return (EINVAL);
}
/*
* errcode_t __profile_add_realm(profile_t profile, char *realm,
* char *master, char **kdcs, boolean_t set_change, boolean_t
* default_realm)
*
* where profile was the pointer passed back by __profile_init
* where realm is the realm name associated with the configuration
* where master is the server that is assigned to admin_server
* where kdcs is a string array of KDCs used to populate the kdc set.
* The array is terminated with a NULL pointer.
* where set_change, if set, will use the SET_CHANGE protocol for password
* modifications. RPCSEC_GSS is set by default
* where default_realm, if set, will assign the realm to default_realm
* Note: the ordering of kdcs is determined by the server's position in the
* array
* Note: kdcs must be assigned a value, even if it is the same value as the
* master.
*/
{
char **tkdcs;
return (EINVAL);
/*
* Sets the default realm to realm if default_realm flag is set.
*/
if (default_realm == TRUE) {
return (code);
}
hierarchy[0] = "realms";
/*
* Not fatal if this fails, therefore return code is not checked.
*/
return (code);
/*
* If not set then defaults to undefined, which defaults to RPCSEC_GSS.
*/
if (set_change == TRUE) {
if (code != 0)
return (code);
}
return (code);
}
if (code != 0)
return (code);
return (code);
}
/*
* errcode_t __profile_remove_xrealm_mapping(profile_t profile, char *realm)
*
* where profile was the pointer passed back by __profile_init
* where source is the source realm for the capath
* where target is the target realm for the capath
* where inter is the intermediate realm between the source and target
* realms. If the source and target share x-realm keys then this set to "."
* Note: for the remove function, all associated source, target, and
* intermediate entries will be removed matching the realm name
*/
{
return (EINVAL);
hierarchy[0] = "capaths";
/*
* Not fatal if this fails, continue on.
*/
while (code == 0) {
while (code2 == 0) {
&inter);
code3 =
if (code3 != 0) {
goto error;
}
}
}
}
}
}
}
}
}
}
code = 0;
return (code);
}
/*
* errcode_t __profile_remove_realm(profile_t profile, char *realm)
*
* where profile was the pointer passed back by __profile_init
* where realm is the target realm for removal
* Note: the function removes the matching realm in the realms section,
* the default_realm, relevant domain_realm mappings with the realm name,
* and matching capaths source realm subsection.
*/
{
return (EINVAL);
/*
* Remove the default realm.
*/
hierarchy[0] = "libdefaults";
if (code != 0)
return (code);
if (code != 0) {
return (code);
}
}
}
hierarchy[0] = "realms";
if (code != 0)
return (code);
if (code != 0)
return (code);
if (code != 0)
return (code);
/*
* Not fatal even if realm wasn't available to remove.
*/
return (0);
}
/*
* errcode_t __profile_add_xrealm_mapping(profile_t profile, char *source,
* char *target, char *inter)
*
* where profile was the pointer passed back by __profile_init
* where source is the source realm for the capath
* where target is the target realm for the capath
* where inter is the intermediate realm between the source and target
* realms. If the source and target share x-realm keys then this set to "."
* Note: if the section does not exist one will be created
*/
char *inter)
{
return (EINVAL);
hierarchy[0] = "capaths";
/*
* Not fatal if this fails, continue on.
*/
return (code);
}
/*
* errcode_t __profile_validate(profile_t profile, int *val_err, char **val)
*
* where profile was the pointer passed back by __profile_init
* where val_err is a function specific error code of the following values:
* 0 No errors detected in profile
* 1 default realm is in lower-case (val returns realm)
* 2 realm in realms section is in lower-case (val returns realm)
* 3 default realm is not found in realms section
* (val returns realm not found)
* 4 default realm does not exist
* 5 no realm found in realms section
* 6 no domain realm mapping entry found corresponding to a realm
* in the realms section (val returns realm name)
* 7 kdc relation-value does not exist in realm
* (val returns realm name)
* 8 admin_server relation-value does not exist in realm
* (val returns realm name)
* where val is the associated errant value, associated with val_err. This
* value is returned as is from the profile
* Note: function infers the following:
* 1. REALM should be in upper-case
* 2. all required entries are present
* 3. all relations are defined between default realm, realm, and
* domain - realm mappings
*
* Note: The return value of this function is based on the error code returned
* validation error code set to non-zero if the profile is invalid in any way.
*
* Caution: This function could return false positives on valid
* configurations and should only be used by the CIFS team for
* specific purposes.
*/
{
register int c;
return (EINVAL);
*val_err = 0;
tr = default_realm;
if (islower(c)) {
*val_err = 1;
goto cleanup;
}
}
*val_err = 4;
goto cleanup;
} else
goto cleanup;
if (islower(c)) {
*val_err = 2;
goto cleanup;
}
}
&domains);
*val_err = 6;
goto cleanup;
} else
goto cleanup;
"kdc", &ret_vals);
*val_err = 7;
goto cleanup;
} else
goto cleanup;
"admin_server", &ret_vals);
*val_err = 8;
goto cleanup;
} else
goto cleanup;
}
*val_err = 3;
goto cleanup;
}
*val_err = 5;
if (default_realm != NULL)
return (code);
}
/*
* errcode_t __profile_init(char *filename, profile_t *profile)
*
* where filename is the specified profile location. If filename is NULL
* where profile is pointer passed to caller upon success
* Note: if the file does not exist then one will be created
* Note: if the file does exist then any existing profile information will
* be in profile
* Note: profile_release() should be used by the caller to free profile
*/
{
return (EINVAL);
return (ENOMEM);
return (ENOMEM);
}
} else {
if (ret != 0)
return (ret);
}
/*
* If file does not exist then create said file.
*/
if (fd < 0) {
return (err);
} else
/*
* Specify non-null for specific file (to load any existing profile)
*/
return (code);
}