[2946] in Kerberos-V5-bugs
Re: pending/613: AFS key incorrect with passwords longer than
daemon@ATHENA.MIT.EDU (Kevin Coffman)
Tue Jun 23 15:27:52 1998
From: Kevin Coffman <kwc@citi.umich.edu>
To: "Theodore Y. Ts'o" <tytso@MIT.EDU>
Cc: krb5-bugs@MIT.EDU, Kevin Coffman <kwc@citi.umich.edu>,
gnats-admin@rt-11.mit.edu, krb5-prs@rt-11.mit.edu
Date: Tue, 23 Jun 98 15:21:32 -0400
In-Reply-To: Your message of "Tue, 23 Jun 98 14:56:19 EDT."
<199806231856.OAA18676@dcl.MIT.EDU>
Sorry, I shoulda known better. Here is a context diff, unified not available.
> Kevin,
>
> Could you resubmit your patch using a context diff ("diff -c")
> or preferably if your diff supports it, a unified diff ("diff -u")? A
> normal ed-style diff is usually almost useless unless the source file is
> identical with the one you used to generate the patch, which is rarely
> the case. Most maintainers generally are much more appriciative if you
> send either a context diff or a unified diff.
>
> Thanks!!
>
> - Ted
Index: kdb_cpw.c
===================================================================
RCS file: /usr/um/src/krb5/krb5-1.0.5UM/src/lib/kdb/kdb_cpw.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -c -r1.1.1.1 -r1.2
*** /tmp/T0_8vwya Tue Jun 23 15:11:26 1998
--- /tmp/T1_Avwyb Tue Jun 23 15:11:26 1998
***************
*** 393,403 ****
break;
case KRB5_KDB_SALTTYPE_AFS3: {
krb5_data * saltdata;
if (retval = krb5_copy_data(context, krb5_princ_realm(context,
db_entry->princ), &saltdata))
return(retval);
-
key_salt.data = *saltdata;
key_salt.data.length = -1; /*length actually used below...*/
krb5_xfree(saltdata);
}
--- 393,420 ----
break;
case KRB5_KDB_SALTTYPE_AFS3: {
krb5_data * saltdata;
+ char * terminated_string;
+
if (retval = krb5_copy_data(context, krb5_princ_realm(context,
db_entry->princ), &saltdata))
return(retval);
key_salt.data = *saltdata;
+ /*
+ * The krb5_string_to_key function expects a null-terminated realm
+ * name. Re-allocate storage with room for a terminator and
+ * terminate the string.
+ */
+ if ((terminated_string = malloc(key_salt.data.length + 1)) == NULL)
+ {
+ if (key_salt.data.data)
+ free(key_salt.data.data);
+ krb5_xfree(saltdata);
+ return(ENOMEM);
+ }
+ memcpy(terminated_string, key_salt.data.data, key_salt.data.length);
+ terminated_string[key_salt.data.length] = '\0';
+ free(key_salt.data.data);
+ key_salt.data.data = terminated_string;
key_salt.data.length = -1; /*length actually used below...*/
krb5_xfree(saltdata);
}