Restore input strings to their original state after parsing
authorPaul Park <pjpark@mit.edu>
Mon, 7 Aug 1995 21:44:32 +0000 (21:44 +0000)
committerPaul Park <pjpark@mit.edu>
Mon, 7 Aug 1995 21:44:32 +0000 (21:44 +0000)
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@6442 dc483132-0cff-0310-8789-dd5450dbe970

src/lib/kadm/ChangeLog
src/lib/kadm/keysalt.c

index 7af5edab8c9c54a701ff9bd0df480dae7bc6f68e..e1083625bb714220828159d2fd43ff4383ff0efb 100644 (file)
@@ -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.
 
index 2802de261d1a0d14dcd7912bd4dc9c245e288224..817cb66ade68ea2264d5db9985efcbcddf753891 100644 (file)
@@ -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);