}
static int
-recv_token(int sock, void **token, size_t *token_length, struct timeval *to)
+recv_token(int sock, void **token, size_t *token_length, size_t max_length, struct timeval *to)
{
ssize_t count;
char buf[4098];
goto end;
break;
}
-
- count = read(sock, buf, sizeof(buf));
+
+ tl = (max_length > 0) ? MIN((sizeof(buf), max_length) : sizeof(buf);
+ count = read(sock, buf, tl));
if (count < 0) {
if (errno == EINTR)
continue;
goto end;
}
}
+ if (count==0)
+ return EDG_WLL_GSS_ERROR_EOF;
- if (count==0) {
- if (tl==0)
- return EDG_WLL_GSS_ERROR_EOF;
- else goto end;
- }
- tmp=realloc(t, tl + count);
+ tmp=malloc(count);
if (tmp == NULL) {
errno = ENOMEM;
return EDG_WLL_GSS_ERROR_ERRNO;
}
t = tmp;
- memcpy(t + tl, buf, count);
- tl += count;
+ memcpy(t, buf, count);
} while (count < 0); /* restart on EINTR */
if (ret == 0) {
*token = t;
- *token_length = tl;
+ *token_length = count;
} else
- free(t);
+ if (t) free(t);
return ret;
}
static int
+recv_gss_token(int sock, void **token, size_t *token_length, struct timeval *to){
+}
+
+static int
+send_gss_token(int sock, void *token, size_t token_length, struct timeval *to)
+{
+}
+
+static int
create_proxy(const char *cert_file, const char *key_file, char **proxy_file)
{
char buf[4096];
}
if (output_token.length != 0) {
- ret = send_token(sock, output_token.value, output_token.length, timeout);
+ ret = send_gss_token(sock, output_token.value, output_token.length, timeout);
gss_release_buffer(&min_stat2, &output_token);
if (ret)
goto end;
gss_delete_sec_context(&min_stat2, &context, &output_token);
context = GSS_C_NO_CONTEXT;
if (output_token.length) {
- send_token(sock, output_token.value, output_token.length, timeout);
+ send_gss_token(sock, output_token.value, output_token.length, timeout);
gss_release_buffer(&min_stat2, &output_token);
}
}
}
if(maj_stat & GSS_S_CONTINUE_NEEDED) {
- ret = recv_token(sock, &input_token.value, &input_token.length, timeout);
+ ret = recv_gss_token(sock, &input_token.value, &input_token.length, timeout);
if (ret)
goto end;
} else
ret_flags = GSS_C_GLOBUS_SSL_COMPATIBLE;
do {
- ret = recv_token(sock, &input_token.value, &input_token.length, timeout);
+ ret = recv_gss_token(sock, &input_token.value, &input_token.length, timeout);
if (ret)
goto end;
}
if (output_token.length) {
- ret = send_token(sock, output_token.value, output_token.length, timeout);
+ ret = send_gss_token(sock, output_token.value, output_token.length, timeout);
gss_release_buffer(&min_stat2, &output_token);
if (ret)
goto end;
gss_delete_sec_context(&min_stat2, &context, &output_token);
context = GSS_C_NO_CONTEXT;
if (output_token.length) {
- send_token(sock, output_token.value, output_token.length, timeout);
+ send_gss_token(sock, output_token.value, output_token.length, timeout);
gss_release_buffer(&min_stat2, &output_token);
}
}
return EDG_WLL_GSS_ERROR_GSS;
}
- ret = send_token(connection->sock, output_token.value, output_token.length,
+ ret = send_gss_token(connection->sock, output_token.value, output_token.length,
timeout);
gss_release_buffer(&min_stat, &output_token);
}
do {
- ret = recv_token(connection->sock, &input_token.value, &input_token.length,
+ ret = recv_gss_token(connection->sock, &input_token.value, &input_token.length,
timeout);
if (ret)
return ret;
/* send the buffer (if any) to the peer. GSSAPI specs doesn't
* recommend sending it, but we want SSL compatibility */
if (output_token.length && con->sock>=0) {
- send_token(con->sock, output_token.value, output_token.length,
+ send_gss_token(con->sock, output_token.value, output_token.length,
timeout ? timeout : &def_timeout);
}
#endif