parent
8e9a8dd978
commit
af60bdf4ec
@ -42,6 +42,8 @@
|
||||
#include "curl_memory.h"
|
||||
#include "memdebug.h"
|
||||
|
||||
#define MAX_GSS_LEN 1024
|
||||
|
||||
static gss_ctx_id_t gss_context = GSS_C_NO_CONTEXT;
|
||||
|
||||
/*
|
||||
@ -56,10 +58,9 @@ static int check_gss_err(struct Curl_easy *data,
|
||||
OM_uint32 maj_stat, min_stat;
|
||||
OM_uint32 msg_ctx = 0;
|
||||
gss_buffer_desc status_string = GSS_C_EMPTY_BUFFER;
|
||||
char buf[1024];
|
||||
size_t len;
|
||||
struct dynbuf dbuf;
|
||||
|
||||
len = 0;
|
||||
Curl_dyn_init(&dbuf, MAX_GSS_LEN);
|
||||
msg_ctx = 0;
|
||||
while(!msg_ctx) {
|
||||
/* convert major status code (GSS-API error) to text */
|
||||
@ -68,19 +69,16 @@ static int check_gss_err(struct Curl_easy *data,
|
||||
GSS_C_NULL_OID,
|
||||
&msg_ctx, &status_string);
|
||||
if(maj_stat == GSS_S_COMPLETE) {
|
||||
if(sizeof(buf) > len + status_string.length + 1) {
|
||||
strcpy(buf + len, (char *) status_string.value);
|
||||
len += status_string.length;
|
||||
}
|
||||
if(Curl_dyn_addn(&dbuf, status_string.value,
|
||||
status_string.length))
|
||||
return 1; /* error */
|
||||
gss_release_buffer(&min_stat, &status_string);
|
||||
break;
|
||||
}
|
||||
gss_release_buffer(&min_stat, &status_string);
|
||||
}
|
||||
if(sizeof(buf) > len + 3) {
|
||||
strcpy(buf + len, ".\n");
|
||||
len += 2;
|
||||
}
|
||||
if(Curl_dyn_addn(&dbuf, ".\n", 2))
|
||||
return 1; /* error */
|
||||
msg_ctx = 0;
|
||||
while(!msg_ctx) {
|
||||
/* convert minor status code (underlying routine error) to text */
|
||||
@ -89,14 +87,16 @@ static int check_gss_err(struct Curl_easy *data,
|
||||
GSS_C_NULL_OID,
|
||||
&msg_ctx, &status_string);
|
||||
if(maj_stat == GSS_S_COMPLETE) {
|
||||
if(sizeof(buf) > len + status_string.length)
|
||||
strcpy(buf + len, (char *) status_string.value);
|
||||
if(Curl_dyn_addn(&dbuf, status_string.value,
|
||||
status_string.length))
|
||||
return 1; /* error */
|
||||
gss_release_buffer(&min_stat, &status_string);
|
||||
break;
|
||||
}
|
||||
gss_release_buffer(&min_stat, &status_string);
|
||||
}
|
||||
failf(data, "GSS-API error: %s failed: %s", function, buf);
|
||||
failf(data, "GSS-API error: %s failed: %s", function, Curl_dyn_ptr(&dbuf));
|
||||
Curl_dyn_free(&dbuf);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user