/*
* 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 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <stdio.h>
#include <stdlib.h>
#include <strings.h>
#include <ctype.h>
#include <errno.h>
#include <gssapi/gssapi_ext.h>
#include <synch.h>
static int qop_num_pair_cnt;
static OM_uint32 __gss_read_qop_file(void);
/*
* There is a memory leak associated with rereading this file,
* because we can't free the qop_num_pairs array when we reread
* the file (some callers may have been given these pointers).
* In general, this memory leak should be a small one, because
* we don't expect the qop file to be changed and reread often.
*/
static OM_uint32
__gss_read_qop_file(void)
{
char *line;
static int last = 0;
(void) mutex_lock(&qopfile_lock);
if (!qop_num_pairs[0].qop) {
}
goto done;
}
goto done;
}
/*
* For each line in the file parse it appropriately.
* File format : qopname num(int)
* Note that we silently ignore corrupt entries.
*/
qop_num_pair_cnt = 0;
break;
/* Skip comments and blank lines */
continue;
/* Skip trailing comments */
if (next)
*next = '\0';
name++;
continue;
qopname++;
if (*qopname == '\0') {
continue;
}
continue;
name++;
continue;
}
num_str++;
name++;
continue;
}
num_str++;
*num_str = '\0';
continue;
}
if (qop_num_pair_cnt++ >= MAX_QOP_NUM_PAIRS)
break;
}
done:
(void) mutex_unlock(&qopfile_lock);
return (major);
}
char *qop,
char *mech,
)
{
int i;
if (!num)
return (GSS_S_CALL_INACCESSIBLE_WRITE);
*num = GSS_C_QOP_DEFAULT;
return (GSS_S_COMPLETE);
}
return (major);
for (i = 0; i < qop_num_pair_cnt; i++) {
return (GSS_S_COMPLETE);
}
}
return (GSS_S_FAILURE);
}
char *mech,
char **qop
)
{
int i;
if (!qop)
return (GSS_S_CALL_INACCESSIBLE_WRITE);
if (num == GSS_C_QOP_DEFAULT) {
return (GSS_S_COMPLETE);
}
return (GSS_S_CALL_INACCESSIBLE_READ);
return (major);
for (i = 0; i < qop_num_pair_cnt; i++) {
return (GSS_S_COMPLETE);
}
}
return (GSS_S_FAILURE);
}
/*
* For a given mechanism pass back qop information about it in a buffer
* of size MAX_QOPS_PER_MECH+1.
*/
char *mech,
char **qops
)
{
int i, cnt = 0;
if (!qops)
return (GSS_S_CALL_INACCESSIBLE_WRITE);
if (!mech)
return (GSS_S_CALL_INACCESSIBLE_READ);
return (major);
for (i = 0; i < qop_num_pair_cnt; i++) {
if (cnt >= MAX_QOPS_PER_MECH) {
return (GSS_S_FAILURE);
}
}
}
return (GSS_S_COMPLETE);
}
/*
* Copy the qop values and names for the mechanism back in a qop_num
* buffer of size MAX_QOPS_PER_MECH provided by the caller.
*/
char *mech,
int *numqop
)
{
int i;
int cnt = 0;
return (GSS_S_CALL_INACCESSIBLE_WRITE);
*numqop = 0;
if (!mech)
return (GSS_S_CALL_INACCESSIBLE_READ);
return (major);
for (i = 0; i < qop_num_pair_cnt; i++) {
if (cnt >= MAX_QOPS_PER_MECH) {
return (GSS_S_FAILURE);
}
}
}
return (GSS_S_COMPLETE);
}