* this permission notice appear in supporting documentation, and that
* the name of M.I.T. not be used in advertising or publicity pertaining
* to distribution of the software without specific, written prior
- * permission. M.I.T. makes no representations about the suitability of
+ * permission. Furthermore if you modify this software you must label
+ * your software as modified software and not distribute it in such a
+ * fashion that it might be confused with the original M.I.T. software.
+ * M.I.T. makes no representations about the suitability of
* this software for any purpose. It is provided "as is" without express
* or implied warranty.
*
static void usage
PROTOTYPE((void));
krb5_error_code open_connection
- PROTOTYPE((char *, int *, char *));
+ PROTOTYPE((char *, int *, char *, int));
void kerberos_authenticate
PROTOTYPE((krb5_context, krb5_auth_context *,
int, krb5_principal, krb5_creds **));
exit(1);
}
-void
+int
main(argc, argv)
int argc;
char **argv;
get_tickets(context);
database_fd = open_database(context, file, &database_size);
- if (retval = open_connection(slave_host, &fd, Errmsg)) {
+ if (retval = open_connection(slave_host, &fd, Errmsg, sizeof(Errmsg))) {
com_err(progname, retval, "%s while opening connection to %s",
Errmsg, slave_host);
exit(1);
}
krb5_error_code
-open_connection(host, fd, Errmsg)
+open_connection(host, fd, Errmsg, ErrmsgSz)
char *host;
int *fd;
char *Errmsg;
+ int ErrmsgSz;
{
int s;
krb5_error_code retval;
return(0);
}
sin.sin_family = hp->h_addrtype;
- memcpy((char *)&sin.sin_addr, hp->h_addr, hp->h_length);
+ memcpy((char *)&sin.sin_addr, hp->h_addr, sizeof(sin.sin_addr));
if(!port) {
sp = getservbyname(KPROP_SERVICE, "tcp");
if (sp == 0) {
- (void) strcpy(Errmsg, KPROP_SERVICE);
- (void) strcat(Errmsg, "/tcp: unknown service");
+ (void) strncpy(Errmsg, KPROP_SERVICE, ErrmsgSz - 1);
+ Errmsg[ErrmsgSz - 1] = '\0';
+ (void) strncat(Errmsg, "/tcp: unknown service", ErrmsgSz - 1 - strlen(Errmsg));
*fd = -1;
return(0);
}
com_err(progname, ENOMEM, "while trying to malloc data_ok_fn");
exit(1);
}
- strcat(strcpy(data_ok_fn, data_fn), ok);
+ strcpy(data_ok_fn, data_fn);
+ strcat(data_ok_fn, ok);
if (stat(data_ok_fn, &stbuf_ok)) {
com_err(progname, errno, "while trying to stat %s",
data_ok_fn);
exit(1);
}
if (retval = krb5_write_message(context, (void *) &fd, &outbuf)) {
- krb5_xfree(outbuf.data);
+ krb5_free_data_contents(context, &outbuf);
com_err(progname, retval, "while sending database size");
exit(1);
}
- krb5_xfree(outbuf.data);
+ krb5_free_data_contents(context, &outbuf);
/*
* Initialize the initial vector.
*/
exit(1);
}
if (retval = krb5_write_message(context, (void *)&fd,&outbuf)) {
- krb5_xfree(outbuf.data);
+ krb5_free_data_contents(context, &outbuf);
com_err(progname, retval,
"while sending database block starting at %d",
sent_size);
exit(1);
}
- krb5_xfree(outbuf.data);
+ krb5_free_data_contents(context, &outbuf);
sent_size += n;
if (debug)
printf("%d bytes sent.\n", sent_size);
strcpy(error.text.data, text);
if (!krb5_mk_error(context, &error, &outbuf)) {
(void) krb5_write_message(context, (void *)&fd,&outbuf);
- krb5_xfree(outbuf.data);
+ krb5_free_data_contents(context, &outbuf);
}
free(error.text.data);
}