blob: 3745ed5a1af0ec0887226ef17a94f41a766c6c72 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
/*+*************************************************************************
**
** K5stream
**
** Emulates the kstream package in Kerberos 4
**
***************************************************************************/
#include <stdio.h>
#include <io.h>
#include <malloc.h>
#include "telnet.h"
#include "k5stream.h"
#include "auth.h"
int
kstream_destroy (kstream ks) {
if (ks != NULL) {
auth_destroy (ks); /* Destroy authorizing */
closesocket (ks->fd); /* Close the socket??? */
free (ks);
}
return 0;
}
void
kstream_set_buffer_mode (kstream ks, int mode) {
}
kstream
kstream_create_from_fd (int fd,
const struct kstream_crypt_ctl_block __far *ctl,
kstream_ptr data)
{
kstream ks;
int n;
ks = malloc (sizeof(kstream *));
if (ks == NULL)
return NULL;
ks->fd = fd;
n = auth_init (ks, data); /* Initialize authorizing */
if (n) {
free (ks);
return NULL;
}
return ks;
}
int
kstream_write (kstream ks, void __far *p_data, size_t p_len) {
int n;
n = send (ks->fd, p_data, p_len, 0); /* Write the data */
return n; /* higher layer does retries */
}
|