+2000-10-17 Ezra Peisach <epeisach@mit.edu>
+
+ * bld_pr_ext.c, bld_princ.c (krb5_build_principal_ext,
+ krb5_build_principal_va, krb5_build_principal): Take an unsigned
+ int realm length.
+
+ * get_in_tkt.c (krb5_get_init_creds): Use SALT_TYPE_AFS_LENGTH
+ instead of -1.
+
+ * gic_pwd.c (krb5_get_as_key_password): Use SALT_TYPE_AFS_LENGTH
+ instead of -1.
+
+ * in_tkt_pwd.c (pwd_keyproc): Argument to krb5_read_password is
+ unsigned int.
+
+ * pr_to_salt.c (krb5_principal2salt_internal): Declare as
+ static. Unsigned int fix.
+
+ * preauth.c (krb5_obtain_padata): Use SALT_TYPE_AFS_LENGTH instead
+ of -1.
+
+ * preauth2.c (pa_salt): Use SALT_TYPE_AFS_LENGTH instead of -1.
+
+ * conv_princ.c, copy_auth.c, copy_princ.c, gc_frm_kdc.c, parse.c,
+ send_tgs.c, srv_rcache.c: Unsigned/signed int cleanup.
+
+ * unparse.c (krb5_unparse_name_ext): size parameter changed to
+ unsigned int *.
+
2000-10-04 Ezra Peisach <epeisach@mit.edu>
* rd_req_dec.c (krb5_rd_req_decrypt_tkt_part): Fix memory leak if
2000-10-03 Ezra Peisach <epeisach@mit.edu>
+ * srv_rcache.c (krb5_get_server_rcache): Signed vs unsigned int
+ warning fix.
+
+ * pr_to_salt.c (krb5_principal2salt_internal): Add prototype for
+ internal function, and declare static.
+
* copy_addrs.c (krb5_copy_addresses): Cleanup unsigned vs signed
warnings as arguments to malloc().
KRB5_DLLIMP krb5_error_code KRB5_CALLCONV_C
#ifdef HAVE_STDARG_H
-krb5_build_principal_ext(krb5_context context, krb5_principal FAR * princ, int rlen, krb5_const char FAR * realm, ...)
+krb5_build_principal_ext(krb5_context context, krb5_principal FAR * princ, unsigned int rlen, krb5_const char FAR * realm, ...)
#else
krb5_build_principal_ext(context, princ, rlen, realm, va_alist)
krb5_context context;
krb5_principal FAR *princ;
- int rlen;
+ unsigned int rlen;
krb5_const char FAR *realm;
va_dcl
#endif
{
va_list ap;
- register int i, count = 0, size;
+ register int i, count = 0;
+ register unsigned int size;
register char *next;
char *tmpdata;
krb5_data *princ_data;
va_start(ap);
#endif
for (i = 0; i < count; i++) {
- size = va_arg(ap, int);
+ size = va_arg(ap, unsigned int);
next = va_arg(ap, char *);
princ_data[i].length = size;
princ_data[i].data = malloc(size+1);
krb5_build_principal_va(context, princ, rlen, realm, ap)
krb5_context context;
krb5_principal princ;
- int rlen;
+ unsigned int rlen;
krb5_const char *realm;
va_list ap;
{
KRB5_DLLIMP krb5_error_code KRB5_CALLCONV_C
#ifdef HAVE_STDARG_H
-krb5_build_principal(krb5_context context, krb5_principal * princ, int rlen,
- krb5_const char FAR * realm, ...)
+krb5_build_principal(krb5_context context, krb5_principal * princ,
+ unsigned int rlen,
+ krb5_const char FAR * realm, ...)
#else
krb5_build_principal(context, princ, rlen, realm, va_alist)
krb5_context context;
krb5_principal *princ;
- int rlen;
+ unsigned int rlen;
krb5_const char FAR *realm;
va_dcl
#endif
const struct krb_convert *p;
krb5_data *compo;
char *c, *tmp_realm, *tmp_prealm;
- int tmp_realm_len, retval;
+ unsigned int tmp_realm_len;
+ int retval;
*name = *inst = '\0';
switch (krb5_princ_size(context, princ)) {
{
krb5_error_code retval;
krb5_authdata ** tempauthdat;
- register int nelems = 0;
+ register unsigned int nelems = 0;
if (!inauthdat) {
*outauthdat = 0;
}
for (i = 0; i < nelems; i++) {
- int len = krb5_princ_component(context, inprinc, i)->length;
+ unsigned int len = krb5_princ_component(context, inprinc, i)->length;
krb5_princ_component(context, tempprinc, i)->length = len;
if (((krb5_princ_component(context, tempprinc, i)->data =
malloc(len)) == 0) && len) {
krb5_principal *tgs_list = NULL;
krb5_principal *top_server = NULL;
krb5_principal *next_server = NULL;
- int nservers = 0;
+ unsigned int nservers = 0;
/* in case we never get a TGT, zero the return */
if (options && (options->flags & KRB5_GET_INIT_CREDS_OPT_SALT)) {
salt = *options->salt;
} else {
- salt.length = -1;
+ salt.length = SALT_TYPE_AFS_LENGTH;
salt.data = NULL;
}
krb5int_set_prompt_types(context, 0);
}
- if ((salt->length == -1) && (salt->data == NULL)) {
+ if ((salt->length == -1 || salt->length == SALT_TYPE_AFS_LENGTH) && (salt->data == NULL)) {
if ((ret = krb5_principal2salt(context, client, &defsalt)))
return(ret);
result_string.length = sizeof(banner)-100;
sprintf(banner, "%.*s%s%.*s. Please try again.\n",
- code_string.length, code_string.data,
+ (int) code_string.length, code_string.data,
result_string.length?": ":"",
- result_string.length, result_string.data);
+ (int) result_string.length, result_string.data);
krb5_xfree(code_string.data);
krb5_xfree(result_string.data);
{
krb5_error_code retval;
krb5_data * password;
- int pwsize;
+ unsigned int pwsize;
password = (krb5_data *)keyseed;
int components = 0;
const char *parsed_realm = NULL;
int fcompsize[FCOMPNUM];
- int realmsize = 0;
+ unsigned int realmsize = 0;
static char *default_realm = NULL;
static int default_realm_size = 0;
char *tmpdata;
#include "k5-int.h"
+static krb5_error_code krb5_principal2salt_internal
+ PROTOTYPE((krb5_context, krb5_const_principal, krb5_data *ret, int));
+
/*
* Convert a krb5_principal into the default salt for that principal.
*/
-krb5_error_code
+static krb5_error_code
krb5_principal2salt_internal(context, pr, ret, use_realm)
krb5_context context;
register krb5_const_principal pr;
krb5_data *ret;
int use_realm;
{
- int size = 0, offset = 0;
+ unsigned int size = 0, offset=0;
krb5_int32 nelem;
register int i;
enctype = request->ktype[0];
salt.data = 0;
- salt.length = -1;
+ salt.length = SALT_TYPE_NO_LENGTH;
if (etype_info) {
enctype = etype_info[0]->etype;
salt.data = (char *) etype_info[0]->salt;
- salt.length = etype_info[0]->length;
+ if(etype_info[0]->length == KRB5_ETYPE_NO_SALT)
+ salt.length = SALT_TYPE_NO_LENGTH; /* XXX */
+ else
+ salt.length = etype_info[0]->length;
}
- if (salt.length == -1) {
+ if (salt.length == SALT_TYPE_NO_LENGTH) {
+ /*
+ * This will set the salt length
+ */
if ((retval = krb5_principal2salt(context, request->client, &salt)))
return(retval);
f_salt = 1;
salt.data = (char *) padata->contents;
salt.length =
- (padata->pa_type == KRB5_PADATA_AFS3_SALT)?(-1):(padata->length);
+ (padata->pa_type == KRB5_PADATA_AFS3_SALT)?(SALT_TYPE_AFS_LENGTH):(padata->length);
if ((retval = (*key_proc)(context, as_reply->enc_part.enctype,
&salt, keyseed, decrypt_key))) {
krb5_sam_challenge *sc;
{
char *label = sc->sam_challenge_label.data;
- int label_len = sc->sam_challenge_label.length;
+ unsigned int label_len = sc->sam_challenge_label.length;
char *prompt = sc->sam_response_prompt.data;
- int prompt_len = sc->sam_response_prompt.length;
+ unsigned int prompt_len = sc->sam_response_prompt.length;
char *challenge = sc->sam_challenge.data;
- int challenge_len = sc->sam_challenge.length;
+ unsigned int challenge_len = sc->sam_challenge.length;
char *prompt1, *p;
char *sep1 = ": [";
char *sep2 = "]\n";
return retval;
if (sam_challenge->sam_flags & KRB5_SAM_SEND_ENCRYPTED_SAD) {
/* encrypt passcode in key by stuffing it here */
- int pcsize = 256;
+ unsigned int pcsize = 256;
char *passcode = malloc(pcsize+1);
if (passcode == NULL)
return ENOMEM;
/* assume that no other salt was allocated */
if (in_padata->pa_type == KRB5_PADATA_AFS3_SALT)
- salt->length = -1;
+ salt->length = SALT_TYPE_AFS_LENGTH;
return(0);
}
/* generate a salt using the requested principal */
- if ((salt->length == -1) && (salt->data == NULL)) {
+ if ((salt->length == -1 || salt->length == SALT_TYPE_AFS_LENGTH) && (salt->data == NULL)) {
if ((ret = krb5_principal2salt(context, request->client,
&defsalt))) {
krb5_xfree(sam_challenge);
}
#if 0
- if ((salt->length == -1) && (salt->data == NULL)) {
+ if ((salt->length == SALT_TYPE_AFS_LENGTH) && (salt->data == NULL)) {
if (ret = krb5_principal2salt(context, request->client,
&defsalt)) {
krb5_xfree(sam_challenge);
krb5_etype_info_entry *e = etype_info[j];
fprintf (stderr, "etype info %d: etype %d salt len=%d",
j, e->etype, e->length);
- if (e->length > 0)
+ if (e->length > 0 && e->length != KRB5_ETYPE_NO_SALT)
fprintf (stderr, " '%*s'", e->length, e->salt);
fprintf (stderr, "\n");
}
/* combine in any other supplied padata */
if (padata) {
krb5_pa_data * const * counter;
- register int i = 0;
+ register unsigned int i = 0;
for (counter = padata; *counter; counter++, i++);
combined_padata = (krb5_pa_data **)malloc(i+2);
if (!combined_padata) {
char *cachename = 0;
char tmp[4];
krb5_error_code retval;
- int len, p, i;
+ int p, i;
+ unsigned int len;
#ifdef HAVE_GETEUID
unsigned long tens;
krb5_context context;
krb5_const_principal principal;
register char FAR * FAR *name;
- int FAR *size;
+ unsigned int FAR *size;
{
register char *cp, *q;
register int i,j;
int length;
krb5_int32 nelem;
- register int totalsize = 0;
+ register unsigned int totalsize = 0;
cp = krb5_princ_realm(context, principal)->data;
length = krb5_princ_realm(context, principal)->length;