/*
*/
/*
* 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 18015 2006-05-17 05:26:12Z raeburn $
*/
#include "gssapiP_krb5.h"
#ifndef NO_PASSWORD
#include <pwd.h>
#include <stdio.h>
#endif
#ifdef HAVE_STRING_H
#include <string.h>
#else
#include <strings.h>
#endif
#include <locale.h>
/*
* 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
*/
{
#ifndef NO_PASSWORD
#endif
if (code) {
*minor_status = code;
return GSS_S_FAILURE;
}
/* set up default returns */
*output_name = NULL;
*minor_status = 0;
/* Go find the appropriate string rep to pass into parse_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) &&
/* Solaris Kerberos: spruce-up the err msg */
"The size of the specified principal is wrong"));
return(GSS_S_BAD_NAME);
}
*minor_status = code;
return(GSS_S_FAILURE);
}
} else {
#ifndef NO_PASSWORD
#endif
if ((tmp =
*minor_status = ENOMEM;
return(GSS_S_FAILURE);
}
tmp2 = 0;
if ((input_name_type == GSS_C_NULL_OID) ||
#ifndef NO_PASSWORD
else
goto do_getpwuid;
#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)
/* Solaris Kerberos: spruce-up (not much, sigh) the err msg */
"Failed to convert the specified principal to GSS-API internal format"));
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) {
/* Solaris Kerberos: spruce-up the err msg */
/* krb5_sname_to_principal() sets specific err msg for bad hostname. */
"Failed to convert the specified principal to GSS-API internal format: %s"),
return(GSS_S_BAD_NAME);
}
/* save the name in the validation database */
return(GSS_S_FAILURE);
}
/* return it */
return(GSS_S_COMPLETE);
}