/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (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 2004 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
*
* gsscred utility
* Manages mapping between a security principal name and unix uid
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <ctype.h>
#include "gsscred.h"
/* From g_glue.c */
extern int
get_der_length(unsigned char **, unsigned int, unsigned int *);
extern unsigned int
der_length_size(unsigned int);
extern int
put_der_length(unsigned int, unsigned char **, unsigned int);
/*
* GSS export name constants
*/
/*
* Internal utility routines.
*/
/*
* gsscred_read_config_file
*
* function to read the optional gsscred configuration file
* which specifies which backend to use to store the gsscred
* table.
*
* we now only support flat files (btw, this file for backend is Obsoleted
* by PSARC)
*/
int
gsscred_read_config_file(void)
{
return (GSSCRED_FLAT_FILE);
} /* gsscred_read_config_file */
/*
* gsscred_MakeName
*
* construct a principal name in the GSS_C_NT_EXPORT_NAME format.
*/
{
/* we need to import the name, then canonicalize it, then export it */
if (nameOidStr == NULL)
else {
gettext("\nInvalid name oid supplied [%s].\n"),
return (0);
}
}
/* first import the name */
if (nameOidStr != NULL) {
}
if (major != GSS_S_COMPLETE) {
gettext("\nInternal error importing name [%s].\n"),
name);
return (0);
}
/* now canonicalize the name */
!= GSS_S_COMPLETE) {
gettext("\nInternal error canonicalizing name"
" [%s].\n"),
name);
return (0);
}
/* now convert to export format */
gettext("\nInternal error exporting name [%s].\n"),
name);
return (0);
}
return (1);
} /* ******* makeName ****** */
/*
* Constructs a part of the GSS_NT_EXPORT_NAME
* Only the mechanism independent name part is created.
*/
int
{
/* determine the length of buffer needed */
outNameHdr->length = 0;
return (0);
}
/* start by putting the token id */
buf += expNameTokIdLen;
/*
* next 2 bytes contain the mech oid length (includes
* DER encoding)
*/
*buf++ = 0x06;
mechOidDERLength) != 0) {
/* free the buffer */
return (0);
}
/* now add the mechanism oid */
/* we stop here because the rest is mechanism specific */
return (1);
} /* gsscred_MakeNameHeader */
/*
* Converts the supplied string to HEX.
* The passed in buffer must be twice as long as the input buffer.
* Long form is used (i.e. '\0' will become '00'). This is needed
* to enable proper re-parsing of names.
*/
int
{
int i;
unsigned int tmp;
return (0);
out++;
out++;
}
*out = '\0';
return (1);
} /* ******* gsscred_AsHex ******* */
/*
* GSS entry point for retrieving user uid mappings.
* The name buffer contains a principal name in exported format.
*/
int
{
int tableSource;
unsigned char *buf;
unsigned int dummy;
int len;
/*
* for xfn (ldap?), we must first construct, a hex mechansim oid string
*/
return (0);
buf += expNameTokIdLen;
/* skip oid length - get to der */
buf++;
buf++;
/* skip oid tag */
buf++;
/* get oid length */
if (len == -1)
return (0);
else
+ dummy+ mechOidTagLen))
return (0);
/* convert the oid buffer to hex */
return (0);
/* also need to convert the name buffer into hex */
return (0);
if (tableSource == GSSCRED_FLAT_FILE)
return (0); /* XXX for new backends (ldap, dss), 0->1 probably */
} /* gss_getGssCredEntry */