#else
extern char *malloc();
#endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
/* for old Unixes and friends ... */
#ifndef MAXHOSTNAMELEN
#define MSG "hi there!" /* message text */
+void usage KRB5_PROTOTYPE((char *));
+
void
usage(name)
char *name;
char *argv[];
{
int sock, i;
+ unsigned int len;
int flags = 0; /* flags for sendto() */
struct servent *serv;
struct hostent *host;
krb5_context context;
krb5_auth_context auth_context = NULL;
- krb5_replay_data replaydata;
retval = krb5_init_context(&context);
if (retval) {
exit(1);
}
/* Send authentication info to server */
- if ((i = send(sock, (char *)packet.data, packet.length, flags)) < 0)
+ if ((i = send(sock, (char *)packet.data, (unsigned) packet.length,
+ flags)) < 0)
com_err(progname, errno, "while sending KRB_AP_REQ message");
printf("Sent authentication data: %d bytes\n", i);
krb5_free_data_contents(context, &packet);
/* Get my address */
memset((char *) &c_sock, 0, sizeof(c_sock));
- i = sizeof(c_sock);
- if (getsockname(sock, (struct sockaddr *)&c_sock, &i) < 0) {
+ len = sizeof(c_sock);
+ if (getsockname(sock, (struct sockaddr *)&c_sock, &len) < 0) {
com_err(progname, errno, "while getting socket name");
exit(1);
}
}
/* Send it */
- if ((i = send(sock, (char *)packet.data, packet.length, flags)) < 0)
+ if ((i = send(sock, (char *)packet.data, (unsigned) packet.length,
+ flags)) < 0)
com_err(progname, errno, "while sending SAFE message");
printf("Sent checksummed message: %d bytes\n", i);
krb5_free_data_contents(context, &packet);
}
/* Send it */
- if ((i = send(sock, (char *)packet.data, packet.length, flags)) < 0)
+ if ((i = send(sock, (char *)packet.data, (unsigned) packet.length,
+ flags)) < 0)
com_err(progname, errno, "while sending PRIV message");
printf("Sent encrypted message: %d bytes\n", i);
krb5_free_data_contents(context, &packet);
#define PROGNAME argv[0]
-void
+static void
usage(name)
char *name;
{
fprintf(stderr, "usage: %s [-p port] [-s service] [-S keytab]\n", name);
}
-void
+int
main(argc, argv)
int argc;
char *argv[];
{
int sock, i;
+ unsigned int len;
int flags = 0; /* for recvfrom() */
int on = 1;
struct servent *serv;
/* GET KRB_AP_REQ MESSAGE */
/* use "recvfrom" so we know client's address */
- i = sizeof(struct sockaddr_in);
+ len = sizeof(struct sockaddr_in);
if ((i = recvfrom(sock, (char *)pktbuf, sizeof(pktbuf), flags,
- (struct sockaddr *)&c_sock, &i)) < 0) {
+ (struct sockaddr *)&c_sock, &len)) < 0) {
perror("receiving datagram");
exit(1);
}
/* GET KRB_MK_SAFE MESSAGE */
/* use "recvfrom" so we know client's address */
- i = sizeof(struct sockaddr_in);
+ len = sizeof(struct sockaddr_in);
if ((i = recvfrom(sock, (char *)pktbuf, sizeof(pktbuf), flags,
- (struct sockaddr *)&c_sock, &i)) < 0) {
+ (struct sockaddr *)&c_sock, &len)) < 0) {
perror("receiving datagram");
exit(1);
}
/* NOW GET ENCRYPTED MESSAGE */
/* use "recvfrom" so we know client's address */
- i = sizeof(struct sockaddr_in);
+ len = sizeof(struct sockaddr_in);
if ((i = recvfrom(sock, (char *)pktbuf, sizeof(pktbuf), flags,
- (struct sockaddr *)&c_sock, &i)) < 0) {
+ (struct sockaddr *)&c_sock, &len)) < 0) {
perror("receiving datagram");
exit(1);
}