/*
*/
/*
*
* Copyright 1995 by the Massachusetts Institute of Technology.
* All Rights Reserved.
*
* Export of this software from the United States of America may
* require a specific license from the United States Government.
* It is the responsibility of any person or organization contemplating
* export to obtain such a license before exporting.
*
* WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
* distribute this software and its documentation for any purpose and
* without fee is hereby granted, provided that the above copyright
* notice appear in all copies and that both that copyright notice and
* this permission notice appear in supporting documentation, and that
* the name of M.I.T. not be used in advertising or publicity pertaining
* to distribution of the software without specific, written prior
* permission. M.I.T. makes no representations about the suitability of
* this software for any purpose. It is provided "as is" without express
* or implied warranty.
*
*/
/*
* oid_ops.c - GSS-API V2 interfaces to manipulate OIDs
*/
#include <mglueP.h>
#include <gssapi_generic.h>
#include <gssapiP_generic.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <errno.h>
#include <ctype.h>
{
if (minor_status)
*minor_status = 0;
return (GSS_S_COMPLETE);
/*
* The V2 API says the following!
*
* gss_release_oid[()] will recognize any of the GSSAPI's own OID
* values, and will silently ignore attempts to free these OIDs;
* for other OIDs it will call the C free() routine for both the OID
* data and the descriptor. This allows applications to freely mix
* their own heap allocated OID values with OIDs returned by GSS-API.
*/
/*
* We use the official OID definitions instead of the unofficial OID
* defintions. But we continue to support the unofficial OID
* gss_nt_service_name just in case if some gss applications use
* the old OID.
*/
if ((*oid != GSS_C_NT_USER_NAME) &&
(*oid != GSS_C_NT_MACHINE_UID_NAME) &&
(*oid != GSS_C_NT_STRING_UID_NAME) &&
(*oid != GSS_C_NT_HOSTBASED_SERVICE) &&
(*oid != GSS_C_NT_ANONYMOUS) &&
(*oid != GSS_C_NT_EXPORT_NAME) &&
(*oid != gss_nt_service_name)) {
}
*oid = GSS_C_NO_OID;
return (GSS_S_COMPLETE);
}
const gss_OID_desc * const oid;
{
gss_OID p;
if (minor_status)
*minor_status = 0;
return (GSS_S_CALL_INACCESSIBLE_WRITE);
if (oid == GSS_C_NO_OID)
return (GSS_S_CALL_INACCESSIBLE_READ);
if (!p) {
return (GSS_S_FAILURE);
}
if (!p->elements) {
free(p);
return (GSS_S_FAILURE);
}
*new_oid = p;
return (GSS_S_COMPLETE);
}
{
if (minor_status)
*minor_status = 0;
return (GSS_S_CALL_INACCESSIBLE_WRITE);
return (GSS_S_COMPLETE);
} else {
return (GSS_S_FAILURE);
}
}
const gss_OID_desc * const member_oid;
{
if (minor_status)
*minor_status = 0;
return (GSS_S_CALL_INACCESSIBLE_READ);
return (GSS_S_CALL_INACCESSIBLE_WRITE);
/* Get an enlarged copy of the array */
sizeof (gss_OID_desc)))) {
/* Copy in the old junk */
if (elist)
/* Duplicate the input element */
/* Success - copy elements */
member_oid->length);
/* Set length */
/* Update count */
if (elist)
return (GSS_S_COMPLETE);
} else
}
/* Failure - restore old contents of list */
return (GSS_S_FAILURE);
}
const gss_OID_desc * const member;
const gss_OID_set set;
int *present;
{
OM_uint32 i;
int result;
if (minor_status)
*minor_status = 0;
return (GSS_S_CALL_INACCESSIBLE_READ);
return (GSS_S_CALL_INACCESSIBLE_WRITE);
result = 0;
result = 1;
break;
}
}
return (GSS_S_COMPLETE);
}
/*
* OID<->string routines. These are uuuuugly.
*/
const gss_OID_desc * const oid;
{
int numshift;
OM_uint32 i;
unsigned char *cp;
char *bp;
if (minor_status != NULL)
*minor_status = 0;
if (oid_str != GSS_C_NO_BUFFER) {
}
return (GSS_S_CALL_INACCESSIBLE_READ);
if (oid_str == GSS_C_NO_BUFFER)
return (GSS_S_CALL_INACCESSIBLE_WRITE);
/* First determine the size of the string */
string_length = 0;
number = 0;
numshift = 0;
numshift += 7;
} else {
return (GSS_S_FAILURE);
}
if ((cp[i] & 0x80) == 0) {
number = 0;
numshift = 0;
}
}
/*
* If we get here, we've calculated the length of "n n n ... n ". Add 4
* here for "{ " and "}\0".
*/
string_length += 4;
number = 0;
if ((cp[i] & 0x80) == 0) {
number = 0;
}
}
return (GSS_S_COMPLETE);
}
return (GSS_S_FAILURE);
}
/*
* This routine will handle 2 types of oid string formats:
* 1 - { 1 2 3 4 } where the braces are optional
* 2 - 1.2.3.4 this is an alernative format
* The first format is mandated by the gss spec. The
* second format is popular outside of the gss community so
* has been added.
*/
const gss_buffer_t oid_str;
{
int brace;
int numbuf;
int onumbuf;
int index;
unsigned char *op;
if (minor_status != NULL)
*minor_status = 0;
*oid = GSS_C_NO_OID;
if (GSS_EMPTY_BUFFER(oid_str))
return (GSS_S_CALL_INACCESSIBLE_READ);
return (GSS_S_CALL_INACCESSIBLE_WRITE);
brace = 0;
/* Skip over leading space */
bp++;
if (*bp == '{') {
brace = 1;
bp++;
}
bp++;
nbytes = 0;
/*
* The first two numbers are chewed up by the first octet.
*/
return (GSS_S_FAILURE);
}
bp++;
bp++;
return (GSS_S_FAILURE);
}
bp++;
bp++;
nbytes++;
return (GSS_S_FAILURE);
}
while (numbuf) {
nbytes++;
numbuf >>= 7;
}
bp++;
bp++;
}
return (GSS_S_FAILURE);
}
/*
* Phew! We've come this far, so the syntax is good.
*/
bp++;
bp++;
op++;
bp++;
bp++;
nbytes = 0;
/* Have to fill in the bytes msb-first */
while (numbuf) {
nbytes++;
numbuf >>= 7;
}
index = -1;
while (numbuf) {
numbuf & 0x7f;
if (index != -1)
index--;
numbuf >>= 7;
}
bp++;
bp++;
}
return (GSS_S_COMPLETE);
} else {
*oid = GSS_C_NO_OID;
}
}
return (GSS_S_FAILURE);
}
/*
* Copyright 1993 by OpenVision Technologies, Inc.
*
* Permission to use, copy, modify, distribute, and sell this software
* and its documentation for any purpose is hereby granted without fee,
* provided that the above copyright notice appears in all copies and
* that both that copyright notice and this permission notice appear in
* supporting documentation, and that the name of OpenVision not be used
* in advertising or publicity pertaining to distribution of the software
* without specific, written prior permission. OpenVision makes no
* representations about the suitability of this software for any
* purpose. It is provided "as is" without express or implied warranty.
*
* OPENVISION DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL OPENVISION BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
* USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
const gss_OID_set_desc * const oidset,
)
{
if (minor_status != NULL)
*minor_status = 0;
if (new_oidset != NULL)
if (oidset == GSS_C_NO_OID_SET)
return (GSS_S_CALL_INACCESSIBLE_READ);
if (new_oidset == NULL)
return (GSS_S_CALL_INACCESSIBLE_WRITE);
goto done;
}
goto done;
}
goto done;
}
}
*new_oidset = copy;
done:
if (major != GSS_S_COMPLETE) {
}
return (major);
}