Files
heimdal/appl/test/gss_common.c
Assar Westerlund 2e3f7f8c4e new files
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@2292 ec53bebd-3082-4978-b11e-865c3cabbd6b
1997-07-14 12:22:07 +00:00

37 lines
658 B
C

#include "test_locl.h"
#include <gssapi.h>
RCSID("$Id$");
void
write_token (int sock, gss_buffer_t buf)
{
u_int32_t len, net_len;
OM_uint32 min_stat;
len = buf->length;
net_len = htonl(len);
if (write (sock, &net_len, 4) != 4)
err (1, "write");
if (write (sock, buf->value, len) != len)
err (1, "write");
gss_release_buffer (&min_stat, buf);
}
void
read_token (int sock, gss_buffer_t buf)
{
u_int32_t len, net_len;
if (read(sock, &net_len, 4) != 4)
err (1, "read");
len = ntohl(net_len);
buf->length = len;
buf->value = malloc(len);
if (read (sock, buf->value, len) != len)
err (1, "read");
}