Loading lib/curl_gssapi.c +41 −0 Original line number Diff line number Diff line Loading @@ -72,4 +72,45 @@ OM_uint32 Curl_gss_init_sec_context( NULL /* time_rec */); } /* * Curl_gss_log_error() * * This is used to log a GSS-API error status. * * Parameters: * * data [in] - The session handle. * status [in] - The status code. * prefix [in] - The prefix of the log message. */ void Curl_gss_log_error(struct SessionHandle *data, OM_uint32 status, const char *prefix) { OM_uint32 maj_stat; OM_uint32 min_stat; OM_uint32 msg_ctx = 0; gss_buffer_desc status_string; char buf[1024]; size_t len; snprintf(buf, sizeof(buf), "%s", prefix); len = strlen(buf); do { maj_stat = gss_display_status(&min_stat, status, GSS_C_MECH_CODE, GSS_C_NO_OID, &msg_ctx, &status_string); if(sizeof(buf) > len + status_string.length + 1) { snprintf(buf + len, sizeof(buf) - len, ": %s", (char*)status_string.value); len += status_string.length; } gss_release_buffer(&min_stat, &status_string); } while(!GSS_ERROR(maj_stat) && msg_ctx != 0); infof(data, "%s\n", buf); } #endif /* HAVE_GSSAPI */ lib/curl_gssapi.h +5 −1 Original line number Diff line number Diff line Loading @@ -7,7 +7,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * * Copyright (C) 2011, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 2011 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms Loading Loading @@ -55,6 +55,10 @@ OM_uint32 Curl_gss_init_sec_context( gss_buffer_t output_token, OM_uint32 *ret_flags); /* Helper to log a GSS - API error status */ void Curl_gss_log_error(struct SessionHandle *data, OM_uint32 status, const char *prefix); #endif /* HAVE_GSSAPI */ #endif /* HEADER_CURL_GSSAPI_H */ lib/http_negotiate.c +2 −31 Original line number Diff line number Diff line Loading @@ -71,36 +71,6 @@ get_gss_name(struct connectdata *conn, bool proxy, gss_name_t *server) return GSS_ERROR(major_status) ? -1 : 0; } static void log_gss_error(struct connectdata *conn, OM_uint32 error_status, const char *prefix) { OM_uint32 maj_stat, min_stat; OM_uint32 msg_ctx = 0; gss_buffer_desc status_string; char buf[1024]; size_t len; snprintf(buf, sizeof(buf), "%s", prefix); len = strlen(buf); do { maj_stat = gss_display_status(&min_stat, error_status, GSS_C_MECH_CODE, GSS_C_NO_OID, &msg_ctx, &status_string); if(sizeof(buf) > len + status_string.length + 1) { snprintf(buf + len, sizeof(buf) - len, ": %s", (char*) status_string.value); len += status_string.length; } gss_release_buffer(&min_stat, &status_string); } while(!GSS_ERROR(maj_stat) && msg_ctx != 0); infof(conn->data, "%s\n", buf); } /* returning zero (0) means success, everything else is treated as "failure" with no care exactly what the failure was */ int Curl_input_negotiate(struct connectdata *conn, bool proxy, Loading Loading @@ -159,7 +129,8 @@ int Curl_input_negotiate(struct connectdata *conn, bool proxy, if(GSS_ERROR(major_status)) { if(output_token.value) gss_release_buffer(&discard_st, &output_token); log_gss_error(conn, minor_status, "gss_init_sec_context() failed: "); Curl_gss_log_error(conn->data, minor_status, "gss_init_sec_context() failed: "); return -1; } Loading Loading
lib/curl_gssapi.c +41 −0 Original line number Diff line number Diff line Loading @@ -72,4 +72,45 @@ OM_uint32 Curl_gss_init_sec_context( NULL /* time_rec */); } /* * Curl_gss_log_error() * * This is used to log a GSS-API error status. * * Parameters: * * data [in] - The session handle. * status [in] - The status code. * prefix [in] - The prefix of the log message. */ void Curl_gss_log_error(struct SessionHandle *data, OM_uint32 status, const char *prefix) { OM_uint32 maj_stat; OM_uint32 min_stat; OM_uint32 msg_ctx = 0; gss_buffer_desc status_string; char buf[1024]; size_t len; snprintf(buf, sizeof(buf), "%s", prefix); len = strlen(buf); do { maj_stat = gss_display_status(&min_stat, status, GSS_C_MECH_CODE, GSS_C_NO_OID, &msg_ctx, &status_string); if(sizeof(buf) > len + status_string.length + 1) { snprintf(buf + len, sizeof(buf) - len, ": %s", (char*)status_string.value); len += status_string.length; } gss_release_buffer(&min_stat, &status_string); } while(!GSS_ERROR(maj_stat) && msg_ctx != 0); infof(data, "%s\n", buf); } #endif /* HAVE_GSSAPI */
lib/curl_gssapi.h +5 −1 Original line number Diff line number Diff line Loading @@ -7,7 +7,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * * Copyright (C) 2011, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 2011 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms Loading Loading @@ -55,6 +55,10 @@ OM_uint32 Curl_gss_init_sec_context( gss_buffer_t output_token, OM_uint32 *ret_flags); /* Helper to log a GSS - API error status */ void Curl_gss_log_error(struct SessionHandle *data, OM_uint32 status, const char *prefix); #endif /* HAVE_GSSAPI */ #endif /* HEADER_CURL_GSSAPI_H */
lib/http_negotiate.c +2 −31 Original line number Diff line number Diff line Loading @@ -71,36 +71,6 @@ get_gss_name(struct connectdata *conn, bool proxy, gss_name_t *server) return GSS_ERROR(major_status) ? -1 : 0; } static void log_gss_error(struct connectdata *conn, OM_uint32 error_status, const char *prefix) { OM_uint32 maj_stat, min_stat; OM_uint32 msg_ctx = 0; gss_buffer_desc status_string; char buf[1024]; size_t len; snprintf(buf, sizeof(buf), "%s", prefix); len = strlen(buf); do { maj_stat = gss_display_status(&min_stat, error_status, GSS_C_MECH_CODE, GSS_C_NO_OID, &msg_ctx, &status_string); if(sizeof(buf) > len + status_string.length + 1) { snprintf(buf + len, sizeof(buf) - len, ": %s", (char*) status_string.value); len += status_string.length; } gss_release_buffer(&min_stat, &status_string); } while(!GSS_ERROR(maj_stat) && msg_ctx != 0); infof(conn->data, "%s\n", buf); } /* returning zero (0) means success, everything else is treated as "failure" with no care exactly what the failure was */ int Curl_input_negotiate(struct connectdata *conn, bool proxy, Loading Loading @@ -159,7 +129,8 @@ int Curl_input_negotiate(struct connectdata *conn, bool proxy, if(GSS_ERROR(major_status)) { if(output_token.value) gss_release_buffer(&discard_st, &output_token); log_gss_error(conn, minor_status, "gss_init_sec_context() failed: "); Curl_gss_log_error(conn->data, minor_status, "gss_init_sec_context() failed: "); return -1; } Loading