import_name.c revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* Copyright 2002 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* 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.
*/
/*
* $Id: import_name.c,v 1.17 1998/10/30 02:54:21 marc Exp $
*/
#include <gssapiP_krb5.h>
#include <gssapi_generic.h>
#ifndef NO_PASSWORD
#include <pwd.h>
#endif
#ifdef HAVE_STRING_H
#include <string.h>
#else
#include <strings.h>
#endif
/*
* errors:
* GSS_S_BAD_NAMETYPE if the type is bogus
* GSS_S_BAD_NAME if the type is good but the name is bogus
* GSS_S_FAILURE if memory allocation fails
*/
void *ctx;
{
#ifndef NO_PASSWORD
#endif
/* Solaris Kerberos: for MT safety, we avoid the use of a default
* context via kg_get_context() */
#if 0
return(GSS_S_FAILURE);
#endif
/* set up default returns */
*output_name = NULL;
*minor_status = 0;
/* Go find the appropriate string rep to pass into parse_name */
/* We support both nametypes: new and official nametype
* GSS_C_NT_HOSTBASED_SERVICE and
* old and unofficial nametype gss_nt_service_name
*/
if ((input_name_type != GSS_C_NULL_OID) &&
if ((tmp =
*minor_status = ENOMEM;
return(GSS_S_FAILURE);
}
*host = '\0';
host++;
}
&princ);
} else if ((input_name_type != GSS_C_NULL_OID) &&
return(GSS_S_BAD_NAME);
}
*minor_status = code;
return(GSS_S_FAILURE);
}
} else {
if ((tmp =
*minor_status = ENOMEM;
return(GSS_S_FAILURE);
}
tmp2 = 0;
if ((input_name_type == GSS_C_NULL_OID) ||
#ifndef NO_PASSWORD
else
else
#endif
if (*cp++ != 0x04)
goto fail_name;
if (*cp++ != 0x01)
goto fail_name;
if (*cp++ != 0x00)
goto fail_name;
goto fail_name;
if (*cp++ != 0x06)
goto fail_name;
goto fail_name;
goto fail_name;
*minor_status = ENOMEM;
return GSS_S_FAILURE;
}
} else {
return(GSS_S_BAD_NAMETYPE);
}
/* at this point, stringrep is set, or if not, *minor_status is. */
if (stringrep)
else {
if (tmp2)
return(GSS_S_BAD_NAME);
}
if (tmp2)
}
/* at this point, a krb5 function has been called to set princ. code
contains the return status */
if (code) {
return(GSS_S_BAD_NAME);
}
/* save the name in the validation database */
return(GSS_S_FAILURE);
}
/* return it */
return(GSS_S_COMPLETE);
}