parent
8e9a8dd978
commit
af60bdf4ec
@ -42,6 +42,8 @@
|
|||||||
#include "curl_memory.h"
|
#include "curl_memory.h"
|
||||||
#include "memdebug.h"
|
#include "memdebug.h"
|
||||||
|
|
||||||
|
#define MAX_GSS_LEN 1024
|
||||||
|
|
||||||
static gss_ctx_id_t gss_context = GSS_C_NO_CONTEXT;
|
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 maj_stat, min_stat;
|
||||||
OM_uint32 msg_ctx = 0;
|
OM_uint32 msg_ctx = 0;
|
||||||
gss_buffer_desc status_string = GSS_C_EMPTY_BUFFER;
|
gss_buffer_desc status_string = GSS_C_EMPTY_BUFFER;
|
||||||
char buf[1024];
|
struct dynbuf dbuf;
|
||||||
size_t len;
|
|
||||||
|
|
||||||
len = 0;
|
Curl_dyn_init(&dbuf, MAX_GSS_LEN);
|
||||||
msg_ctx = 0;
|
msg_ctx = 0;
|
||||||
while(!msg_ctx) {
|
while(!msg_ctx) {
|
||||||
/* convert major status code (GSS-API error) to text */
|
/* 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,
|
GSS_C_NULL_OID,
|
||||||
&msg_ctx, &status_string);
|
&msg_ctx, &status_string);
|
||||||
if(maj_stat == GSS_S_COMPLETE) {
|
if(maj_stat == GSS_S_COMPLETE) {
|
||||||
if(sizeof(buf) > len + status_string.length + 1) {
|
if(Curl_dyn_addn(&dbuf, status_string.value,
|
||||||
strcpy(buf + len, (char *) status_string.value);
|
status_string.length))
|
||||||
len += status_string.length;
|
return 1; /* error */
|
||||||
}
|
|
||||||
gss_release_buffer(&min_stat, &status_string);
|
gss_release_buffer(&min_stat, &status_string);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
gss_release_buffer(&min_stat, &status_string);
|
gss_release_buffer(&min_stat, &status_string);
|
||||||
}
|
}
|
||||||
if(sizeof(buf) > len + 3) {
|
if(Curl_dyn_addn(&dbuf, ".\n", 2))
|
||||||
strcpy(buf + len, ".\n");
|
return 1; /* error */
|
||||||
len += 2;
|
|
||||||
}
|
|
||||||
msg_ctx = 0;
|
msg_ctx = 0;
|
||||||
while(!msg_ctx) {
|
while(!msg_ctx) {
|
||||||
/* convert minor status code (underlying routine error) to text */
|
/* 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,
|
GSS_C_NULL_OID,
|
||||||
&msg_ctx, &status_string);
|
&msg_ctx, &status_string);
|
||||||
if(maj_stat == GSS_S_COMPLETE) {
|
if(maj_stat == GSS_S_COMPLETE) {
|
||||||
if(sizeof(buf) > len + status_string.length)
|
if(Curl_dyn_addn(&dbuf, status_string.value,
|
||||||
strcpy(buf + len, (char *) status_string.value);
|
status_string.length))
|
||||||
|
return 1; /* error */
|
||||||
gss_release_buffer(&min_stat, &status_string);
|
gss_release_buffer(&min_stat, &status_string);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
gss_release_buffer(&min_stat, &status_string);
|
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;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user