-2000-09-20 Ezra Peisach <epeisach@engrailed.mit.edu>
+2000-10-17 Ezra Peisach <epeisach@mit.edu>
+
+ * fetch_mkey.c: Signed/unsigned int cleanup.
+
+ * kdb_cpw.c (add_key_pwd): Change salt data length of -1 to
+ SALT_TYPE_AFS_LENGTH.
+
+2000-09-20 Ezra Peisach <epeisach@mit.edu>
* kdb_xdr.c (krb5_dbe_free_contents): Clean up signedness warning.
krb5_error_code retval;
char password[BUFSIZ];
krb5_data pwd;
- int size = sizeof(password);
+ unsigned int size = sizeof(password);
if (fromkeyboard) {
krb5_data scratch;
char defkeyfile[MAXPATHLEN+1];
krb5_data *realm = krb5_princ_realm(context, mname);
FILE *kf;
- unsigned int len;
retval = 0;
key->magic = KV5M_KEYBLOCK;
retval = KRB5_KDB_CANTREAD_STORED;
goto errout;
}
- if (!key->length || key->length < 0) {
+ if (!key->length || ((int) key->length) < 0) {
retval = KRB5_KDB_BADSTORED_MKEY;
goto errout;
}
- /* Provide an unsigned int */
- len = key->length;
- if (!(key->contents = (krb5_octet *)malloc(len))) {
+ if (!(key->contents = (krb5_octet *)malloc(key->length))) {
retval = ENOMEM;
goto errout;
}
if (fread((krb5_pointer) key->contents,
- sizeof(key->contents[0]), len, kf)
+ sizeof(key->contents[0]), key->length, kf)
!= key->length) {
retval = KRB5_KDB_CANTREAD_STORED;
- memset(key->contents, 0, len);
+ memset(key->contents, 0, key->length);
free(key->contents);
key->contents = 0;
} else
return(retval);
key_salt.data = *saltdata;
- key_salt.data.length = -1; /*length actually used below...*/
+ key_salt.data.length = SALT_TYPE_AFS_LENGTH; /*length actually used below...*/
krb5_xfree(saltdata);
#else
/* Why do we do this? Well, the afs_mit_string_to_key needs to
memcpy((char *)key_salt.data.data,
(char *)(*krb5_princ_realm(context,db_entry->princ)).data,
slen);
- key_salt.data.length = -1; /*length actually used below...*/
+ key_salt.data.length = SALT_TYPE_AFS_LENGTH; /*length actually used below...*/
#endif
}
pwd.data = passwd;
pwd.length = strlen(passwd);
+ /* AFS string to key will happen here */
if ((retval = krb5_c_string_to_key(context, ks_tuple[i].ks_enctype,
&pwd, &key_salt.data, &key))) {
if (key_salt.data.data)
return(retval);
}
- if (key_salt.data.length == -1)
+ if (key_salt.data.length == SALT_TYPE_AFS_LENGTH)
key_salt.data.length =
krb5_princ_realm(context, db_entry->princ)->length;