From 6df64028850b170d358c88e2dca2b74abafe1a23 Mon Sep 17 00:00:00 2001 From: Paul Park Date: Mon, 7 Aug 1995 21:44:32 +0000 Subject: [PATCH] Restore input strings to their original state after parsing git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@6442 dc483132-0cff-0310-8789-dd5450dbe970 --- src/lib/kadm/ChangeLog | 8 ++++++++ src/lib/kadm/keysalt.c | 17 ++++++++--------- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/src/lib/kadm/ChangeLog b/src/lib/kadm/ChangeLog index 7af5edab8..e1083625b 100644 --- a/src/lib/kadm/ChangeLog +++ b/src/lib/kadm/ChangeLog @@ -1,4 +1,12 @@ +Mon Aug 7 17:38:45 EDT 1995 Paul Park (pjpark@mit.edu) + * keysalt.c(krb5_string_to_keysalt) - Don't do the silly whitespace + filling logic. If the string has imbedded whitespace, then + it's just tough rocks. Save replaced string separators and + terminators so that they string looks the same coming out as + going in. + + Fri Aug 4 16:21:50 EDT 1995 Paul Park (pjpark@mit.edu) * Makefile.in, .Sanitize, keysalt.c - Add keysalt.c modules. diff --git a/src/lib/kadm/keysalt.c b/src/lib/kadm/keysalt.c index 2802de261..817cb66ad 100644 --- a/src/lib/kadm/keysalt.c +++ b/src/lib/kadm/keysalt.c @@ -110,7 +110,8 @@ krb5_string_to_keysalts(string, tupleseps, ksaltseps, dups, ksaltp, nksaltp) krb5_int32 *nksaltp; { krb5_error_code kret; - char *kp, *sp, *ep, *tp; + char *kp, *sp, *ep; + char sepchar, trailchar; krb5_keytype ktype; krb5_int32 stype; krb5_key_salt_tuple *savep; @@ -133,16 +134,9 @@ krb5_string_to_keysalts(string, tupleseps, ksaltseps, dups, ksaltp, nksaltp) } if (ep) { - /* Fill in trailing whitespace of kp */ - tp = ep - 1; - while (isspace(*tp) && (tp < kp)) { - *tp = '\0'; - tp--; - } + trailchar = *ep; *ep = '\0'; ep++; - /* Skip trailing whitespace of ep */ - while (isspace(*ep) && (*ep)) ep++; } /* * kp points to something (hopefully) of the form: @@ -159,6 +153,7 @@ krb5_string_to_keysalts(string, tupleseps, ksaltseps, dups, ksaltp, nksaltp) if (sp) { /* Separate keytype from salttype */ + sepchar = *sp; *sp = '\0'; sp++; } @@ -198,6 +193,10 @@ krb5_string_to_keysalts(string, tupleseps, ksaltseps, dups, ksaltp, nksaltp) break; } } + if (sp) + sp[-1] = sepchar; + if (ep) + ep[-1] = trailchar; kp = ep; } return(kret); -- 2.26.2