/*
* 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.
*/
/*
* GSSAPI library stub module for gssd.
*/
#include <stdio.h>
#include <stdlib.h>
#include <mechglueP.h>
#include "gssd.h"
#ifdef _KERNEL
#ifdef DEBUG
#ifndef _SYS_CMN_ERR_H
#define _SYS_CMN_ERR_H
#endif
#endif /* DEBUG */
#else /* !_KERNEL */
#endif /* _KERNEL */
uid,
int cred_usage;
{
int i;
/* get the client handle to GSSD */
return (GSS_S_FAILURE);
}
/* convert the desired name from internal to external format */
&name_type) != GSS_S_COMPLETE) {
return ((OM_uint32) GSS_S_FAILURE);
}
/* copy the procedure arguments into the rpc arg parameter */
name_type == GSS_C_NULL_OID ?
name_type == GSS_C_NULL_OID ?
if (desired_mechs != GSS_C_NULL_OID_SET) {
for (i = 0; i < desired_mechs->count; i++) {
(char *)
}
} else
/* call the remote procedure */
/*
* if the RPC call times out, null out all return arguments,
* set minor_status to its maximum value, and return GSS_S_FAILURE
*/
if (minor_status != NULL)
if (output_cred_handle != NULL)
if (actual_mechs != NULL)
*actual_mechs = NULL;
*time_rec = 0;
return (GSS_S_FAILURE);
}
/* free the allocated memory for the flattened name and desire_mechs */
for (i = 0; i < desired_mechs->count; i++)
/* copy the rpc results into the return arguments */
if (minor_status != NULL)
if (output_cred_handle != NULL) {
/*LINTED*/
}
actual_mechs != NULL) {
(*actual_mechs)->count =
for (i = 0; i < (*actual_mechs)->count; i++) {
}
} else {
(*actual_mechs)->count = 0;
}
/*
* free the memory allocated for the results and return with the status
* received in the rpc call
*/
}
uid)
int cred_usage;
{
kcred = KGSS_CRED_ALLOC();
}
return (err);
}
uid)
int cred_usage;
int initiator_time_req;
int acceptor_time_req;
{
int i;
/* get the client handle to GSSD */
return (GSS_S_FAILURE);
}
/* convert the desired name from internal to external format */
&name_type) != GSS_S_COMPLETE) {
return ((OM_uint32) GSS_S_FAILURE);
}
/* copy the procedure arguments into the rpc arg parameter */
0 : (uint_t)sizeof (gssd_cred_id_t);
(char *)&input_cred_handle;
name_type == GSS_C_NULL_OID ?
name_type == GSS_C_NULL_OID ?
desired_mech_type->length : 0);
(char *)(desired_mech_type != GSS_C_NULL_OID ?
desired_mech_type->elements : 0);
/* call the remote procedure */
/*
* if the RPC call times out, null out all return arguments,
* set minor_status to its maximum value, and return
* GSS_S_FAILURE
*/
if (minor_status != NULL)
if (actual_mechs != NULL)
*actual_mechs = NULL;
if (initiator_time_rec != NULL)
*initiator_time_rec = 0;
if (acceptor_time_rec != NULL)
*acceptor_time_rec = 0;
return (GSS_S_FAILURE);
}
/* free the allocated memory for the flattened name */
/* copy the rpc results into the return arguments */
if (minor_status != NULL)
actual_mechs != NULL) {
(*actual_mechs)->count =
for (i = 0; i < (*actual_mechs)->count; i++) {
}
} else {
actual_mechs != NULL)
(*actual_mechs)->count = 0;
}
if (initiator_time_rec != NULL)
if (acceptor_time_rec != NULL)
/*
* free the memory allocated for the results and return with the status
* received in the rpc call
*/
}
uid)
int cred_usage;
int initiator_time_req;
int acceptor_time_req;
{
if (input_cred_handle != GSS_C_NO_CREDENTIAL) {
} else
return (err);
}
uid,
{
/* get the client handle to GSSD */
return (GSS_S_FAILURE);
}
/* copy the procedure arguments into the rpc arg parameter */
if (cred_handle != NULL) {
(uint_t)sizeof (gssd_cred_id_t);
} else
/* call the remote procedure */
/*
* if the RPC call times out, null out all return arguments,
* set minor_status to its max value, and return GSS_S_FAILURE
*/
if (minor_status != NULL)
if (cred_handle != NULL)
*cred_handle = NULL;
return (GSS_S_FAILURE);
}
/* if the release succeeded, null out the cred_handle */
*cred_handle = NULL;
/* copy the rpc results into the return arguments */
if (minor_status != NULL)
/* return with status returned in rpc call */
}
uid)
{
if (*cred_handle == GSS_C_NO_CREDENTIAL)
return (GSS_S_COMPLETE);
else
return (err);
}
uid)
int req_flags;
int *ret_flags;
{
/* get the client handle to GSSD */
return (GSS_S_FAILURE);
}
/* convert the target name from internal to external format */
return ((OM_uint32) GSS_S_FAILURE);
}
/* copy the procedure arguments into the rpc arg parameter */
0 : (uint_t)sizeof (gssd_cred_id_t);
(char *)&claimant_cred_handle;
name_type == GSS_C_NULL_OID ?
name_type == GSS_C_NULL_OID ?
if (input_chan_bindings != GSS_C_NO_CHANNEL_BINDINGS) {
} else {
}
/* initialize the output parameters to empty values */
if (minor_status != NULL)
if (actual_mech_type != NULL)
*actual_mech_type = NULL;
if (output_token != NULL)
output_token->length = 0;
*ret_flags = 0;
*time_rec = 0;
/* call the remote procedure */
/* free the allocated memory for the flattened name */
return (GSS_S_FAILURE);
}
/*
* We could return from a GSS error here and need to return both the
* minor_status and output_token, back to the caller if applicable.
*/
if (minor_status != NULL)
}
/* free the allocated memory for the flattened name */
/* if the call was successful, copy out the results */
/*
* copy the rpc results into the return argument
* on CONTINUE_NEEDED only ctx handle is ready.
*/
/*LINTED*/
*context_handle = *((OM_uint32 *)
/* the rest of the parameters is only ready on COMPLETE */
if (actual_mech_type != NULL) {
*actual_mech_type = (gss_OID)
MALLOC(sizeof (gss_OID_desc));
(*actual_mech_type)->elements = (void *)
(*actual_mech_type)->length);
}
}
}
/*
* free the memory allocated for the results and return with the
* status received in the rpc call.
*/
}
int req_flags,
int *ret_flags,
{
/*
* If this is an initial call, we'll need to create the
* wrapper struct that contains kernel state information, and
* a reference to the handle from gssd.
*/
if (*context_handle == GSS_C_NO_CONTEXT) {
kctx = KGSS_ALLOC();
} else
if (claimant_cred_handle != GSS_C_NO_CREDENTIAL) {
} else {
}
}
return (err);
}
uid)
int *ret_flags;
{
/* get the client handle to GSSD */
return (GSS_S_FAILURE);
}
/* copy the procedure arguments into the rpc arg parameter */
0 : (uint_t)sizeof (gssd_ctx_id_t);
0 : *gssd_context_verifier;
0 : (uint_t)sizeof (gssd_cred_id_t);
(char *)&verifier_cred_handle;
input_token->length : 0);
(char *)(input_token != GSS_C_NO_BUFFER ?
input_token->value : 0);
if (input_chan_bindings != GSS_C_NO_CHANNEL_BINDINGS) {
} else {
}
/* set the output parameters to empty values.... */
if (minor_status != NULL)
}
if (output_token != NULL)
output_token->length = 0;
*ret_flags = 0;
*time_rec = 0;
if (delegated_cred_handle != NULL)
/* call the remote procedure */
return (GSS_S_FAILURE);
}
/*
* We could return from a GSS error here and need to return both the
* minor_status and output_token, back to the caller if applicable.
*/
if (minor_status != NULL)
}
/*
* when gss returns CONTINUE_NEEDED we can only
* use the context parameter.
*/
/*LINTED*/
*context_handle = *((gssd_ctx_id_t *)
/* the other parameters are ready on for COMPLETE */
{
/*
* The src_name is in external format.
*/
}
/*
* move mech type returned to mech_type
* for gss_import_name_for_mech()
*/
*mech_type =
}
if ((delegated_cred_handle != NULL) &&
!= 0)) {
kcred = KGSS_CRED_ALLOC();
/*LINTED*/
}
} /* res.status == GSS_S_COMPLETE */
} /* res.status == GSS_S_COMPLETE or GSS_CONTINUE_NEEDED */
/*
* free the memory allocated for the results and return with the status
* received in the rpc call
*/
}
int *ret_flags,
{
if (*context_handle == GSS_C_NO_CONTEXT) {
kctx = KGSS_ALLOC();
} else
if (verifier_cred_handle != GSS_C_NO_CREDENTIAL) {
} else
}
return (err);
}
uid)
{
/* get the client handle to GSSD */
return (GSS_S_FAILURE);
}
/* copy the procedure arguments into the rpc arg parameter */
/* call the remote procedure */
/*
* if the RPC call times out, null out all return arguments,
* set minor_status to its maximum value, and return GSS_S_FAILURE
*/
if (minor_status != NULL)
return (GSS_S_FAILURE);
}
/* copy the rpc results into the return arguments */
if (minor_status != NULL)
/* return with status returned in rpc call */
}
{
/* get the client handle to GSSD */
return (GSS_S_FAILURE);
}
/* copy the procedure arguments into the rpc arg parameter */
/* call the remote procedure */
/*
* if the RPC call times out, null out all return arguments,
* set minor_status to its max value, and return GSS_S_FAILURE
*/
if (minor_status != NULL)
if (context_handle != NULL)
*context_handle = NULL;
if (output_token != NULL)
output_token->length = 0;
return (GSS_S_FAILURE);
}
/* copy the rpc results into the return arguments */
if (minor_status != NULL)
*context_handle = NULL;
else
/*LINTED*/
*context_handle = *((gssd_ctx_id_t *)
}
/*
* free the memory allocated for the results and return with the status
* received in the rpc call
*/
}
/*ARGSUSED*/
{
if (*context_handle == GSS_C_NO_CONTEXT) {
return (GSS_S_NO_CONTEXT);
} else
err = GSS_S_FAILURE;
else
return (err);
}
/*ARGSUSED*/
uid)
{
return (GSS_S_FAILURE);
}
int qop_req;
{
/* get the client handle to GSSD */
return (GSS_S_FAILURE);
}
/* copy the procedure arguments into the rpc arg parameter */
/* call the remote procedure */
/*
* if the RPC call times out, null out all return arguments,
* set minor_status to its maximum value, and return GSS_S_FAILURE
*/
if (minor_status != NULL)
return (GSS_S_FAILURE);
}
/* copy the rpc results into the return arguments */
if (minor_status != NULL)
}
/*
* free the memory allocated for the results and return with the status
* received in the rpc call
*/
}
int qop_req,
{
if (context_handle == GSS_C_NO_CONTEXT)
return (GSS_S_FAILURE);
return (KGSS_SIGN(minor_status,
msg_token));
}
int *qop_state;
{
/* get the client handle to GSSD */
return (GSS_S_FAILURE);
}
/* copy the procedure arguments into the rpc arg parameter */
/* call the remote procedure */
/*
* if the RPC call times out, null out all return arguments,
* set minor_status to its maximum value, and return GSS_S_FAILURE
*/
if (minor_status != NULL)
*qop_state = 0;
return (GSS_S_FAILURE);
}
/* copy the rpc results into the return arguments */
if (minor_status != NULL)
/* return with status returned in rpc call */
}
int *qop_state)
{
if (context_handle == GSS_C_NO_CONTEXT)
return (GSS_S_FAILURE);
}
int conf_req_flag;
int qop_req;
int *conf_state;
{
/* get the client handle to GSSD */
return (GSS_S_FAILURE);
}
/* copy the procedure arguments into the rpc arg parameter */
(char *)input_message_buffer->value;
/* call the remote procedure */
/*
* if the RPC call times out, null out all return arguments,
* set minor_status to its maximum value, and return GSS_S_FAILURE
*/
if (minor_status != NULL)
if (conf_state != NULL)
*conf_state = 0;
if (output_message_buffer != NULL)
output_message_buffer->length = 0;
return (GSS_S_FAILURE);
}
/* copy the rpc results into the return arguments */
if (minor_status != NULL)
if (conf_state != NULL)
if (output_message_buffer != NULL) {
}
/*
* free the memory allocated for the results and return with the status
* received in the rpc call
*/
}
int conf_req_flag,
int qop_req,
int *conf_state,
{
if (context_handle == GSS_C_NO_CONTEXT)
return (GSS_S_FAILURE);
}
int *conf_state;
int *qop_state;
{
/* get the client handle to GSSD */
return (GSS_S_FAILURE);
}
/* copy the procedure arguments into the rpc arg parameter */
(char *)input_message_buffer->value;
/* call the remote procedure */
/*
* if the RPC call times out, null out all return arguments,
* set minor_status to its maximum value, and return GSS_S_FAILURE
*/
if (minor_status != NULL)
if (output_message_buffer != NULL)
output_message_buffer->length = 0;
if (conf_state != NULL)
*conf_state = 0;
*qop_state = 0;
return (GSS_S_FAILURE);
}
/* copy the rpc results into the return arguments */
if (minor_status != NULL)
if (output_message_buffer != NULL) {
}
if (conf_state != NULL)
/*
* free the memory allocated for the results and return with the status
* received in the rpc call
*/
}
int *conf_state,
int *qop_state)
{
if (context_handle == GSS_C_NO_CONTEXT)
return (GSS_S_FAILURE);
conf_state, qop_state));
}
uid)
int status_type;
int *message_context;
{
/* get the client handle to GSSD */
return (GSS_S_FAILURE);
}
/* copy the procedure arguments into the rpc arg parameter */
/* call the remote procedure */
if (message_context != NULL)
*message_context = 0;
if (status_string != NULL) {
status_string->length = 0;
}
/*
* if the RPC call times out, null out all return arguments,
* set minor_status to its maximum value, and return GSS_S_FAILURE
*/
if (minor_status != NULL)
return (GSS_S_FAILURE);
}
if (minor_status != NULL)
/* now process the results and pass them back to the caller */
if (message_context != NULL)
if (status_string != NULL) {
}
}
}
/*ARGSUSED*/
uid)
{
void *arg;
int i;
/* get the client handle to GSSD */
return (GSS_S_FAILURE);
}
/*
* if the RPC call times out, null out all return arguments,
* set minor_status to its maximum value, and return GSS_S_FAILURE
*/
if (minor_status != NULL)
return (GSS_S_FAILURE);
}
/* copy the rpc results into the return arguments */
if (minor_status != NULL)
}
}
/*
* free the memory allocated for the results and return with the status
* received in the rpc call
*/
}
name,
uid)
int *cred_usage;
{
int i;
/* get the client handle to GSSD */
return (GSS_S_FAILURE);
}
/* copy the procedure arguments into the rpc arg parameter */
0 : (uint_t)sizeof (gssd_cred_id_t);
/* call the remote procedure */
/*
* if the RPC call times out, null out all return arguments,
* set minor_status to its maximum value, and return GSS_S_FAILURE
*/
if (minor_status != NULL)
*lifetime = 0;
if (cred_usage != NULL)
*cred_usage = 0;
if (mechanisms != NULL)
*mechanisms = NULL;
return (GSS_S_FAILURE);
}
/* copy the rpc results into the return arguments */
if (minor_status != NULL)
/* convert name from external to internal format */
/*
* we have to allocate a name_type descriptor and
* elements storage, since gss_import_name() only
* stores a pointer to the name_type info in the
* union_name struct
*/
return ((OM_uint32) GSS_S_FAILURE);
}
}
if (cred_usage != NULL)
if (mechanisms != NULL) {
*mechanisms =
(*mechanisms)->count =
for (i = 0; i < (*mechanisms)->count; i++) {
}
} else
(*mechanisms)->count = 0;
}
/*
* free the memory allocated for the results and return with the status
* received in the rpc call
*/
}
name,
uid)
int *cred_usage;
{
return (kgss_inquire_cred_wrapped(minor_status,
}
uid)
{
/* get the client handle to GSSD */
return (GSS_S_FAILURE);
}
/* copy the procedure arguments into the rpc arg parameter */
0 : (uint_t)sizeof (gssd_cred_id_t);
(char *)(mech_type != GSS_C_NULL_OID ?
/* call the remote procedure */
/*
* if the RPC call times out, null out all return arguments,
* set minor_status to its maximum value, and return GSS_S_FAILURE
*/
if (minor_status != NULL)
return (GSS_S_FAILURE);
}
/* copy the rpc results into the return arguments */
if (minor_status != NULL)
/* convert name from external to internal format */
/*
* free the memory allocated for the results and return with the status
* received in the rpc call
*/
}
uid)
{
}
const gss_buffer_t expName;
int *gidsLen;
{
return (GSS_S_CALL_INACCESSIBLE_READ);
return (GSS_S_CALL_INACCESSIBLE_WRITE);
/* NULL out output parameters */
*uidOut = 0;
if (gidsLen)
*gidsLen = 0;
if (gids)
/* get the client handle to gssd */
{
return (GSS_S_FAILURE);
}
/* copy the procedure arguments */
/* null out the return buffer and call the remote proc */
{
return (GSS_S_FAILURE);
}
/* copy the results into the result parameters */
{
if (gidOut)
{
}
}
/* free RPC results */
} /* kgsscred_expname_to_unix_cred */
const gss_name_t intName;
int *gidsLen;
{
return (GSS_S_CALL_INACCESSIBLE_READ);
return (GSS_S_CALL_INACCESSIBLE_WRITE);
/* NULL out the output parameters */
*uidOut = 0;
if (gids)
if (gidsLen)
*gidsLen = 0;
/* get the client handle to gssd */
{
return (GSS_S_FAILURE);
}
/* convert the name to flat representation */
!= GSS_S_COMPLETE)
{
return (major);
}
/* set the rpc parameters */
/* call the remote procedure */
{
return (GSS_S_FAILURE);
}
/* copy the output parameters on output */
{
if (gidOut)
{
}
}
/* delete RPC allocated memory */
} /* kgsscred_name_to_unix_cred */
int *gidsLen;
{
/* check the output parameters */
return (GSS_S_CALL_INACCESSIBLE_WRITE);
/* get the client GSSD handle */
{
return (GSS_S_FAILURE);
}
/* set the input parameters */
/* call the remote procedure */
{
return (GSS_S_FAILURE);
}
/* copy the results */
{
}
/* nothing to free */
} /* kgss_get_group_info */
{
/* get the client handle to GSSD */
return (GSS_S_FAILURE);
}
/* copy the procedure arguments into the rpc arg parameter */
/* call the remote procedure */
/*
* if the RPC call times out, null out all return arguments, set minor_status
* to its maximum value, and return GSS_S_FAILURE
*/
if (minor_status != NULL)
if (context_handle != NULL)
*context_handle = NULL;
if (output_token != NULL)
output_token->length = 0;
return (GSS_S_FAILURE);
}
/* copy the rpc results into the return arguments */
if (minor_status != NULL)
*context_handle = NULL;
else
}
/*
* free the memory allocated for the results and return with the status
* received in the rpc call
*/
}
{
if (*context_handle == GSS_C_NO_CONTEXT) {
return (GSS_S_NO_CONTEXT);
} else
return (err);
else {
return (err);
}
}
{
/* get the client handle to GSSD */
return (GSS_S_FAILURE);
}
/* copy the procedure arguments into the rpc arg parameter */
/* call the remote procedure */
/*
* if the RPC call times out, null out all return arguments, set minor_status
* to its maximum value, and return GSS_S_FAILURE
*/
if (minor_status != NULL)
if (context_handle != NULL)
*context_handle = NULL;
return (GSS_S_FAILURE);
}
/* copy the rpc results into the return arguments */
if (minor_status != NULL)
*context_handle = NULL;
else
/*
* free the memory allocated for the results and return with the status
* received in the rpc call
*/
}
{
if (*context_handle == GSS_C_NO_CONTEXT) {
kctx = KGSS_ALLOC();
} else
}
#ifdef _KERNEL
#ifdef DEBUG
typedef struct {
static void *gssd_state;
{
/* cmn_err(CE_NOTE, "In gssd_attach"); */
switch (cmd) {
case DDI_ATTACH:
== DDI_FAILURE) {
return (DDI_FAILURE);
}
return (DDI_SUCCESS);
default:
return (DDI_FAILURE);
}
}
{
int error;
/* cmn_err(CE_NOTE, "In gssd_getinfo"); */
switch (infocmd) {
case DDI_INFO_DEVT2INSTANCE:
error = DDI_SUCCESS;
break;
case DDI_INFO_DEVT2DEVINFO:
/* cmn_err(CE_NOTE, "getinfo wants devinfo"); */
default:
error = DDI_FAILURE;
break;
}
return (error);
}
{
/* cmn_err(CE_NOTE, "in gssd_identify"); */
return (DDI_IDENTIFIED);
else
return (DDI_NOT_IDENTIFIED);
}
{
/* cmn_err(CE_NOTE, "In gssd_probe"); */
return (DDI_PROBE_SUCCESS);
}
{
/* cmn_err (CE_NOTE, "In gssd_open"); */
return (EINVAL);
gss_clnt = getgssd_handle();
return (0);
}
{
/* cmn_err(CE_NOTE, "In gssd_close"); */
return (0);
}
{
int len;
/* cmn_err(CE_NOTE, "In gssd_write"); */
return (0);
}
gssd_open, /* cb_open */
gssd_close, /* cb_close */
nodev, /* cb_strategy */
nodev, /* cb_print */
nodev, /* cb_dump */
nulldev, /* cb_read */
gssd_write, /* cb_write */
nodev, /* cb_ioctl */
nodev, /* cb_devmap */
nodev, /* cb_mmap */
nodev, /* cb_segmap */
nochpoll, /* cb_chpoll */
ddi_prop_op, /* cb_prop_op */
NULL, /* cb_stream */
};
DEVO_REV, /* devo_rev */
0, /* devo_refcnt */
gssd_getinfo, /* devo_getinfo */
gssd_identify, /* devo_identify */
nulldev, /* devo_probe */
gssd_attach, /* devo_attach */
nulldev, /* devo_detach */
nodev, /* devo_reset */
&gssd_cb_ops, /* devo_cb_ops */
};
extern struct mod_ops mod_driverops;
"GSSD DRV Client Module",
#else /* !DEBUG */
"GSSD Client Module"
#endif /* DEBUG */
};
(void *)&modlmisc,
};
_init(void)
{
int status;
sizeof (gssd_devstate_t), 1)) != 0)
return (status);
return (status);
}
_fini()
{
int status;
return (status);
return (status);
}
{
}
#endif