svn rev #23503: branches/anonymous/src/lib/gssapi/krb5/
hartmans@MIT.EDU
hartmans at MIT.EDU
Wed Dec 23 16:10:26 EST 2009
http://src.mit.edu/fisheye/changelog/krb5/?cs=23503
Commit By: hartmans
Log Message:
Implement support for the anonymous name type in GSS-API
* Import GSS_C_NT_ANONYMOUS as WELLKNOWN/ANONYMOUS at WELLKNOWN:ANONYMOUS
* the display text of the anonymous name is the krb5 principal, but the nametype is set to GSS_C_NT_ANONYMOUS
Changed Files:
U branches/anonymous/src/lib/gssapi/krb5/disp_name.c
U branches/anonymous/src/lib/gssapi/krb5/import_name.c
Modified: branches/anonymous/src/lib/gssapi/krb5/disp_name.c
===================================================================
--- branches/anonymous/src/lib/gssapi/krb5/disp_name.c 2009-12-23 21:10:23 UTC (rev 23502)
+++ branches/anonymous/src/lib/gssapi/krb5/disp_name.c 2009-12-23 21:10:26 UTC (rev 23503)
@@ -34,6 +34,8 @@
krb5_context context;
krb5_error_code code;
char *str;
+ krb5_gss_name_t k5name = (krb5_gss_name_t) input_name;
+ gss_OID nametype = (gss_OID) gss_nt_krb5_name;
code = krb5_gss_init_context(&context);
if (code) {
@@ -49,6 +51,11 @@
krb5_free_context(context);
return(GSS_S_CALL_BAD_STRUCTURE|GSS_S_BAD_NAME);
}
+ if (krb5_princ_type(context, k5name->princ) == KRB5_NT_WELLKNOWN) {
+ if (krb5_principal_compare(context, k5name->princ,
+ krb5_anonymous_principal()))
+ nametype = GSS_C_NT_ANONYMOUS;
+ }
if ((code = krb5_unparse_name(context,
((krb5_gss_name_t) input_name)->princ,
@@ -72,6 +79,6 @@
*minor_status = 0;
if (output_name_type)
- *output_name_type = (gss_OID) gss_nt_krb5_name;
+ *output_name_type = (gss_OID) nametype;
return(GSS_S_COMPLETE);
}
Modified: branches/anonymous/src/lib/gssapi/krb5/import_name.c
===================================================================
--- branches/anonymous/src/lib/gssapi/krb5/import_name.c 2009-12-23 21:10:23 UTC (rev 23502)
+++ branches/anonymous/src/lib/gssapi/krb5/import_name.c 2009-12-23 21:10:26 UTC (rev 23503)
@@ -154,7 +154,16 @@
krb5_free_context(context);
return(GSS_S_FAILURE);
}
- } else {
+ } else if ((input_name_type != NULL) &&
+ g_OID_equal(input_name_type, GSS_C_NT_ANONYMOUS)) {
+ code = krb5_copy_principal(context, krb5_anonymous_principal(), &princ);
+ if (code != 0) {
+ krb5_free_context(context);
+ *minor_status = code;
+ return GSS_S_FAILURE;
+ }
+ }
+ else {
#ifndef NO_PASSWORD
uid_t uid;
struct passwd pwx;
More information about the cvs-krb5
mailing list