Back out previous changes here, replace them with more correct change
authorPaul Park <pjpark@mit.edu>
Thu, 27 Apr 1995 20:41:22 +0000 (20:41 +0000)
committerPaul Park <pjpark@mit.edu>
Thu, 27 Apr 1995 20:41:22 +0000 (20:41 +0000)
of clearing the replaydata block before calling mk_priv_basic.

git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@5570 dc483132-0cff-0310-8789-dd5450dbe970

src/lib/krb5/krb/mk_priv.c

index b29e886f3bf79427c3996eceac2b53f4bf9dadcb..9effca0e8991fa462b1811c60fd5ad0d5b51f7ae 100644 (file)
@@ -145,6 +145,9 @@ krb5_mk_priv(context, auth_context, userdata, outbuf, outdata)
     krb5_keyblock       * keyblock;
     krb5_replay_data      replaydata;
 
+    /* Clear replaydata block */
+    memset((char *) &replaydata, 0, sizeof(krb5_replay_data));
+
     /* Get keyblock */
     if ((keyblock = auth_context->local_subkey) == NULL)
         if ((keyblock = auth_context->remote_subkey) == NULL)
@@ -161,14 +164,15 @@ krb5_mk_priv(context, auth_context, userdata, outbuf, outdata)
        /* Need a better error */
        return KRB5_RC_REQUIRED;
 
-    /* Do the time, regardless */
-    if (retval = krb5_us_timeofday(context, &replaydata.timestamp,
-                                  &replaydata.usec))
-      return retval;
-
-    if (auth_context->auth_context_flags & KRB5_AUTH_CONTEXT_RET_TIME) {
-       outdata->timestamp = replaydata.timestamp;
-       outdata->usec = replaydata.usec;
+    if ((auth_context->auth_context_flags & KRB5_AUTH_CONTEXT_DO_TIME) ||
+       (auth_context->auth_context_flags & KRB5_AUTH_CONTEXT_RET_TIME)) {
+       if (retval = krb5_us_timeofday(context, &replaydata.timestamp,
+                                      &replaydata.usec))
+           return retval;
+       if (auth_context->auth_context_flags & KRB5_AUTH_CONTEXT_RET_TIME) {
+           outdata->timestamp = replaydata.timestamp;
+           outdata->usec = replaydata.usec;
+       }
     }
     if ((auth_context->auth_context_flags & KRB5_AUTH_CONTEXT_DO_SEQUENCE) ||
        (auth_context->auth_context_flags & KRB5_AUTH_CONTEXT_RET_SEQUENCE)) {