From: Greg Hudson Date: Wed, 21 Sep 2011 22:29:25 +0000 (+0000) Subject: Whitespace X-Git-Tag: krb5-1.10-alpha1~151 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=9252a953a12aa6c508531de5ba0e1eb9dd1d8b83;p=krb5.git Whitespace git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@25224 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/lib/gssapi/generic/gssapi_ext.h b/src/lib/gssapi/generic/gssapi_ext.h index 07f0c688e..8fdb567fc 100644 --- a/src/lib/gssapi/generic/gssapi_ext.h +++ b/src/lib/gssapi/generic/gssapi_ext.h @@ -43,23 +43,24 @@ gss_pname_to_uid uid_t *uidOut); #endif - /** - * Provides a platform-specific name for a GSSAPI name as - * interpreted by a given mechanism - * @param name The gss name resulting from accept_sec_context - * @param mech_type The mechanism that will be asked to map @a name to a local name - * @param localname pointer to a buffer_desc allocated by the caller - * that will be filled in with the local name on successful completion. - */ +/** + * Provides a platform-specific name for a GSSAPI name as interpreted by a + * given mechanism. + * + * @param name The gss name resulting from accept_sec_context + * @param mech_type The mechanism that will be asked to map @a name to a + * local name + * @param localname Pointer to a buffer_desc allocated by the caller + * that will be filled in with the local name on successful + * completion. + */ OM_uint32 KRB5_CALLCONV gss_localname (OM_uint32 *minor, - const gss_name_t name, + const gss_name_t name, gss_const_OID mech_type, gss_buffer_t localname); - - /** Determine whether a mechanism name is authorized to act as a username. * * @param [in] name Mechanism name diff --git a/src/lib/gssapi/mechglue/gssd_pname_to_uid.c b/src/lib/gssapi/mechglue/gssd_pname_to_uid.c index 23e2cf931..eab6bd6f5 100644 --- a/src/lib/gssapi/mechglue/gssd_pname_to_uid.c +++ b/src/lib/gssapi/mechglue/gssd_pname_to_uid.c @@ -68,54 +68,56 @@ static OM_uint32 attr_localname(OM_uint32 *minor, - const gss_mechanism mech, - const gss_name_t mech_name, - gss_buffer_t localname) + const gss_mechanism mech, + const gss_name_t mech_name, + gss_buffer_t localname) { OM_uint32 major = GSS_S_UNAVAILABLE; OM_uint32 tmpMinor; int more = -1; gss_buffer_desc value; - gss_buffer_desc display_value; - int authenticated = 0, complete = 0; + gss_buffer_desc display_value; + int authenticated = 0, complete = 0; - value.value = NULL; - display_value.value = NULL; + value.value = NULL; + display_value.value = NULL; if (mech->gss_get_name_attribute == NULL) return GSS_S_UNAVAILABLE; - major = mech->gss_get_name_attribute(minor, - mech_name, - GSS_C_ATTR_LOCAL_LOGIN_USER, - &authenticated, - &complete, - &value, - &display_value, - &more); - if (GSS_ERROR(major)) { - map_error(minor, mech); - goto cleanup; - } + major = mech->gss_get_name_attribute(minor, + mech_name, + GSS_C_ATTR_LOCAL_LOGIN_USER, + &authenticated, + &complete, + &value, + &display_value, + &more); + if (GSS_ERROR(major)) { + map_error(minor, mech); + goto cleanup; + } + + if (!authenticated) + major = GSS_S_UNAVAILABLE; + else { + localname->value = value.value; + localname->length = value.length; + value.value = NULL; + } - if (!authenticated) - major = GSS_S_UNAVAILABLE; - else { - localname->value = value.value; - localname->length = value.length; - value.value = NULL; - } cleanup: - if (display_value.value) - gss_release_buffer(&tmpMinor, &display_value); - if (value.value) - gss_release_buffer(&tmpMinor, &value); + if (display_value.value) + gss_release_buffer(&tmpMinor, &display_value); + if (value.value) + gss_release_buffer(&tmpMinor, &value); return major; } + OM_uint32 KRB5_CALLCONV gss_localname(OM_uint32 *minor, - const gss_name_t pname, - gss_const_OID mech_type, - gss_buffer_t localname) + const gss_name_t pname, + gss_const_OID mech_type, + gss_buffer_t localname) { OM_uint32 major, tmpMinor; gss_mechanism mech; @@ -179,40 +181,40 @@ gss_localname(OM_uint32 *minor, #ifndef _WIN32 OM_uint32 KRB5_CALLCONV -gss_pname_to_uid - (OM_uint32 *minor, - const gss_name_t name, - const gss_OID mech_type, - uid_t *uidOut) +gss_pname_to_uid(OM_uint32 *minor, + const gss_name_t name, + const gss_OID mech_type, + uid_t *uidOut) { - OM_uint32 major = GSS_S_UNAVAILABLE, tmpminor; - #ifndef NO_PASSWORD + OM_uint32 major = GSS_S_UNAVAILABLE, tmpminor; +#ifndef NO_PASSWORD gss_buffer_desc localname; - char pwbuf[BUFSIZ]; - char *localuser = NULL; - struct passwd *pwd = NULL; - struct passwd pw; - int code = 0; - - localname.value = NULL; - major = gss_localname(minor, name, mech_type, &localname); - if (!GSS_ERROR(major) && localname.value) { - localuser = malloc(localname.length + 1); - if (localuser == NULL) - code = ENOMEM; - if (code == 0) { - memcpy(localuser, localname.value, localname.length); - localuser[localname.length] = '\0'; - code = k5_getpwnam_r(localuser, &pw, pwbuf, sizeof(pwbuf), &pwd); - } - if ((code == 0) && pwd) - *uidOut = pwd->pw_uid; - else major = GSS_S_FAILURE; - } - free(localuser); - if (localname.value) - gss_release_buffer(&tmpminor, &localname); + char pwbuf[BUFSIZ]; + char *localuser = NULL; + struct passwd *pwd = NULL; + struct passwd pw; + int code = 0; + + localname.value = NULL; + major = gss_localname(minor, name, mech_type, &localname); + if (!GSS_ERROR(major) && localname.value) { + localuser = malloc(localname.length + 1); + if (localuser == NULL) + code = ENOMEM; + if (code == 0) { + memcpy(localuser, localname.value, localname.length); + localuser[localname.length] = '\0'; + code = k5_getpwnam_r(localuser, &pw, pwbuf, sizeof(pwbuf), &pwd); + } + if ((code == 0) && pwd) + *uidOut = pwd->pw_uid; + else + major = GSS_S_FAILURE; + } + free(localuser); + if (localname.value) + gss_release_buffer(&tmpminor, &localname); #endif /*NO_PASSWORD*/ - return major; + return major; } #endif /*_WIN32*/ diff --git a/src/lib/gssapi/mechglue/mglueP.h b/src/lib/gssapi/mechglue/mglueP.h index 356dc6877..577f57308 100644 --- a/src/lib/gssapi/mechglue/mglueP.h +++ b/src/lib/gssapi/mechglue/mglueP.h @@ -323,7 +323,7 @@ typedef struct gss_config { OM_uint32, /* req_output_size */ OM_uint32 * /* max_input_size */ ); - OM_uint32 (* KRB5_CALLCONV gss_localname) + OM_uint32 (KRB5_CALLCONV *gss_localname) ( OM_uint32 *, /* minor */ const gss_name_t, /* name */