docs: Improve inline GSS-API naming in code documentation
This commit is contained in:

committed by
Daniel Stenberg

parent
e38ba43014
commit
eed1c63c70
@@ -52,7 +52,7 @@
|
||||
static gss_ctx_id_t gss_context = GSS_C_NO_CONTEXT;
|
||||
|
||||
/*
|
||||
* Helper gssapi error functions.
|
||||
* Helper GSS-API error functions.
|
||||
*/
|
||||
static int check_gss_err(struct SessionHandle *data,
|
||||
OM_uint32 major_status,
|
||||
@@ -103,7 +103,7 @@ static int check_gss_err(struct SessionHandle *data,
|
||||
}
|
||||
gss_release_buffer(&min_stat, &status_string);
|
||||
}
|
||||
failf(data, "GSSAPI error: %s failed:\n%s", function, buf);
|
||||
failf(data, "GSS-API error: %s failed:\n%s", function, buf);
|
||||
return(1);
|
||||
}
|
||||
|
||||
@@ -131,10 +131,10 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(int sockindex,
|
||||
gss_name_t gss_client_name = GSS_C_NO_NAME;
|
||||
unsigned short us_length;
|
||||
char *user=NULL;
|
||||
unsigned char socksreq[4]; /* room for gssapi exchange header only */
|
||||
unsigned char socksreq[4]; /* room for GSS-API exchange header only */
|
||||
char *serviceptr = data->set.str[STRING_SOCKS5_GSSAPI_SERVICE];
|
||||
|
||||
/* GSSAPI request looks like
|
||||
/* GSS-API request looks like
|
||||
* +----+------+-----+----------------+
|
||||
* |VER | MTYP | LEN | TOKEN |
|
||||
* +----+------+----------------------+
|
||||
@@ -195,19 +195,19 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(int sockindex,
|
||||
gss_release_buffer(&gss_status, &gss_recv_token);
|
||||
gss_release_buffer(&gss_status, &gss_send_token);
|
||||
gss_delete_sec_context(&gss_status, &gss_context, NULL);
|
||||
failf(data, "Failed to initial GSSAPI token.");
|
||||
failf(data, "Failed to initial GSS-API token.");
|
||||
return CURLE_COULDNT_CONNECT;
|
||||
}
|
||||
|
||||
if(gss_send_token.length != 0) {
|
||||
socksreq[0] = 1; /* gssapi subnegotiation version */
|
||||
socksreq[0] = 1; /* GSS-API subnegotiation version */
|
||||
socksreq[1] = 1; /* authentication message type */
|
||||
us_length = htons((short)gss_send_token.length);
|
||||
memcpy(socksreq+2,&us_length,sizeof(short));
|
||||
|
||||
code = Curl_write_plain(conn, sock, (char *)socksreq, 4, &written);
|
||||
if((code != CURLE_OK) || (4 != written)) {
|
||||
failf(data, "Failed to send GSSAPI authentication request.");
|
||||
failf(data, "Failed to send GSS-API authentication request.");
|
||||
gss_release_name(&gss_status, &server);
|
||||
gss_release_buffer(&gss_status, &gss_recv_token);
|
||||
gss_release_buffer(&gss_status, &gss_send_token);
|
||||
@@ -219,7 +219,7 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(int sockindex,
|
||||
gss_send_token.length, &written);
|
||||
|
||||
if((code != CURLE_OK) || ((ssize_t)gss_send_token.length != written)) {
|
||||
failf(data, "Failed to send GSSAPI authentication token.");
|
||||
failf(data, "Failed to send GSS-API authentication token.");
|
||||
gss_release_name(&gss_status, &server);
|
||||
gss_release_buffer(&gss_status, &gss_recv_token);
|
||||
gss_release_buffer(&gss_status, &gss_send_token);
|
||||
@@ -235,7 +235,7 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(int sockindex,
|
||||
|
||||
/* analyse response */
|
||||
|
||||
/* GSSAPI response looks like
|
||||
/* GSS-API response looks like
|
||||
* +----+------+-----+----------------+
|
||||
* |VER | MTYP | LEN | TOKEN |
|
||||
* +----+------+----------------------+
|
||||
@@ -245,7 +245,7 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(int sockindex,
|
||||
|
||||
result=Curl_blockread_all(conn, sock, (char *)socksreq, 4, &actualread);
|
||||
if(result != CURLE_OK || actualread != 4) {
|
||||
failf(data, "Failed to receive GSSAPI authentication response.");
|
||||
failf(data, "Failed to receive GSS-API authentication response.");
|
||||
gss_release_name(&gss_status, &server);
|
||||
gss_delete_sec_context(&gss_status, &gss_context, NULL);
|
||||
return CURLE_COULDNT_CONNECT;
|
||||
@@ -261,7 +261,7 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(int sockindex,
|
||||
}
|
||||
|
||||
if(socksreq[1] != 1) { /* status / messgae type */
|
||||
failf(data, "Invalid GSSAPI authentication response type (%d %d).",
|
||||
failf(data, "Invalid GSS-API authentication response type (%d %d).",
|
||||
socksreq[0], socksreq[1]);
|
||||
gss_release_name(&gss_status, &server);
|
||||
gss_delete_sec_context(&gss_status, &gss_context, NULL);
|
||||
@@ -275,7 +275,7 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(int sockindex,
|
||||
gss_recv_token.value=malloc(us_length);
|
||||
if(!gss_recv_token.value) {
|
||||
failf(data,
|
||||
"Could not allocate memory for GSSAPI authentication "
|
||||
"Could not allocate memory for GSS-API authentication "
|
||||
"response token.");
|
||||
gss_release_name(&gss_status, &server);
|
||||
gss_delete_sec_context(&gss_status, &gss_context, NULL);
|
||||
@@ -286,7 +286,7 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(int sockindex,
|
||||
gss_recv_token.length, &actualread);
|
||||
|
||||
if(result != CURLE_OK || actualread != us_length) {
|
||||
failf(data, "Failed to receive GSSAPI authentication token.");
|
||||
failf(data, "Failed to receive GSS-API authentication token.");
|
||||
gss_release_name(&gss_status, &server);
|
||||
gss_release_buffer(&gss_status, &gss_recv_token);
|
||||
gss_delete_sec_context(&gss_status, &gss_context, NULL);
|
||||
@@ -331,12 +331,12 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(int sockindex,
|
||||
user[gss_send_token.length] = '\0';
|
||||
gss_release_name(&gss_status, &gss_client_name);
|
||||
gss_release_buffer(&gss_status, &gss_send_token);
|
||||
infof(data, "SOCKS5 server authencticated user %s with gssapi.\n",user);
|
||||
infof(data, "SOCKS5 server authencticated user %s with GSS-API.\n",user);
|
||||
free(user);
|
||||
user=NULL;
|
||||
|
||||
/* Do encryption */
|
||||
socksreq[0] = 1; /* gssapi subnegotiation version */
|
||||
socksreq[0] = 1; /* GSS-API subnegotiation version */
|
||||
socksreq[1] = 2; /* encryption message type */
|
||||
|
||||
gss_enc = 0; /* no data protection */
|
||||
@@ -347,7 +347,7 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(int sockindex,
|
||||
else if(gss_ret_flags & GSS_C_INTEG_FLAG)
|
||||
gss_enc = 1;
|
||||
|
||||
infof(data, "SOCKS5 server supports gssapi %s data protection.\n",
|
||||
infof(data, "SOCKS5 server supports GSS-API %s data protection.\n",
|
||||
(gss_enc==0)?"no":((gss_enc==1)?"integrity":"confidentiality"));
|
||||
/* force for the moment to no data protection */
|
||||
gss_enc = 0;
|
||||
@@ -402,7 +402,7 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(int sockindex,
|
||||
gss_release_buffer(&gss_status, &gss_send_token);
|
||||
gss_release_buffer(&gss_status, &gss_w_token);
|
||||
gss_delete_sec_context(&gss_status, &gss_context, NULL);
|
||||
failf(data, "Failed to wrap GSSAPI encryption value into token.");
|
||||
failf(data, "Failed to wrap GSS-API encryption value into token.");
|
||||
return CURLE_COULDNT_CONNECT;
|
||||
}
|
||||
gss_release_buffer(&gss_status, &gss_send_token);
|
||||
@@ -413,7 +413,7 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(int sockindex,
|
||||
|
||||
code = Curl_write_plain(conn, sock, (char *)socksreq, 4, &written);
|
||||
if((code != CURLE_OK) || (4 != written)) {
|
||||
failf(data, "Failed to send GSSAPI encryption request.");
|
||||
failf(data, "Failed to send GSS-API encryption request.");
|
||||
gss_release_buffer(&gss_status, &gss_w_token);
|
||||
gss_delete_sec_context(&gss_status, &gss_context, NULL);
|
||||
return CURLE_COULDNT_CONNECT;
|
||||
@@ -423,7 +423,7 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(int sockindex,
|
||||
memcpy(socksreq, &gss_enc, 1);
|
||||
code = Curl_write_plain(conn, sock, socksreq, 1, &written);
|
||||
if((code != CURLE_OK) || ( 1 != written)) {
|
||||
failf(data, "Failed to send GSSAPI encryption type.");
|
||||
failf(data, "Failed to send GSS-API encryption type.");
|
||||
gss_delete_sec_context(&gss_status, &gss_context, NULL);
|
||||
return CURLE_COULDNT_CONNECT;
|
||||
}
|
||||
@@ -432,7 +432,7 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(int sockindex,
|
||||
code = Curl_write_plain(conn, sock, (char *)gss_w_token.value,
|
||||
gss_w_token.length, &written);
|
||||
if((code != CURLE_OK) || ((ssize_t)gss_w_token.length != written)) {
|
||||
failf(data, "Failed to send GSSAPI encryption type.");
|
||||
failf(data, "Failed to send GSS-API encryption type.");
|
||||
gss_release_buffer(&gss_status, &gss_w_token);
|
||||
gss_delete_sec_context(&gss_status, &gss_context, NULL);
|
||||
return CURLE_COULDNT_CONNECT;
|
||||
@@ -442,7 +442,7 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(int sockindex,
|
||||
|
||||
result=Curl_blockread_all(conn, sock, (char *)socksreq, 4, &actualread);
|
||||
if(result != CURLE_OK || actualread != 4) {
|
||||
failf(data, "Failed to receive GSSAPI encryption response.");
|
||||
failf(data, "Failed to receive GSS-API encryption response.");
|
||||
gss_delete_sec_context(&gss_status, &gss_context, NULL);
|
||||
return CURLE_COULDNT_CONNECT;
|
||||
}
|
||||
@@ -456,7 +456,7 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(int sockindex,
|
||||
}
|
||||
|
||||
if(socksreq[1] != 2) { /* status / messgae type */
|
||||
failf(data, "Invalid GSSAPI encryption response type (%d %d).",
|
||||
failf(data, "Invalid GSS-API encryption response type (%d %d).",
|
||||
socksreq[0], socksreq[1]);
|
||||
gss_delete_sec_context(&gss_status, &gss_context, NULL);
|
||||
return CURLE_COULDNT_CONNECT;
|
||||
@@ -475,7 +475,7 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(int sockindex,
|
||||
gss_recv_token.length, &actualread);
|
||||
|
||||
if(result != CURLE_OK || actualread != us_length) {
|
||||
failf(data, "Failed to receive GSSAPI encryptrion type.");
|
||||
failf(data, "Failed to receive GSS-API encryptrion type.");
|
||||
gss_release_buffer(&gss_status, &gss_recv_token);
|
||||
gss_delete_sec_context(&gss_status, &gss_context, NULL);
|
||||
return CURLE_COULDNT_CONNECT;
|
||||
@@ -490,13 +490,13 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(int sockindex,
|
||||
gss_release_buffer(&gss_status, &gss_recv_token);
|
||||
gss_release_buffer(&gss_status, &gss_w_token);
|
||||
gss_delete_sec_context(&gss_status, &gss_context, NULL);
|
||||
failf(data, "Failed to unwrap GSSAPI encryption value into token.");
|
||||
failf(data, "Failed to unwrap GSS-API encryption value into token.");
|
||||
return CURLE_COULDNT_CONNECT;
|
||||
}
|
||||
gss_release_buffer(&gss_status, &gss_recv_token);
|
||||
|
||||
if(gss_w_token.length != 1) {
|
||||
failf(data, "Invalid GSSAPI encryption response length (%d).",
|
||||
failf(data, "Invalid GSS-API encryption response length (%d).",
|
||||
gss_w_token.length);
|
||||
gss_release_buffer(&gss_status, &gss_w_token);
|
||||
gss_delete_sec_context(&gss_status, &gss_context, NULL);
|
||||
@@ -508,7 +508,7 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(int sockindex,
|
||||
}
|
||||
else {
|
||||
if(gss_recv_token.length != 1) {
|
||||
failf(data, "Invalid GSSAPI encryption response length (%d).",
|
||||
failf(data, "Invalid GSS-API encryption response length (%d).",
|
||||
gss_recv_token.length);
|
||||
gss_release_buffer(&gss_status, &gss_recv_token);
|
||||
gss_delete_sec_context(&gss_status, &gss_context, NULL);
|
||||
@@ -520,8 +520,8 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(int sockindex,
|
||||
}
|
||||
|
||||
infof(data, "SOCKS5 access with%s protection granted.\n",
|
||||
(socksreq[0]==0)?"out gssapi data":
|
||||
((socksreq[0]==1)?" gssapi integrity":" gssapi confidentiality"));
|
||||
(socksreq[0]==0)?"out GSS-API data":
|
||||
((socksreq[0]==1)?" GSS-API integrity":" GSS-API confidentiality"));
|
||||
|
||||
conn->socks5_gssapi_enctype = socksreq[0];
|
||||
if(socksreq[0] == 0)
|
||||
|
Reference in New Issue
Block a user