Make MIC conditional on integrity being requested
authorSimo Sorce <simo@redhat.com>
Sun, 13 Apr 2014 05:45:42 +0000 (01:45 -0400)
committerSimo Sorce <simo@redhat.com>
Sun, 4 May 2014 21:21:06 +0000 (17:21 -0400)
If integrity is requested by any party then the MIC, if requested by the
server will be generated, otherwise it will not be.

src/gss_sec_ctx.c
src/ntlm.c
src/ntlm.h

index 92dd981d3a169fd3e0f7602a7f2c9dccbaa358e0..4400bc70a1ed5514bd83c5f701569bd25f247c57 100644 (file)
@@ -400,7 +400,8 @@ uint32_t gssntlm_init_sec_context(uint32_t *minor_status,
                                                   &target_info,
                                                   server_name,
                                                   &client_target_info,
-                                                  &srv_time, &add_mic);
+                                                  &srv_time,
+                                                  protect ? &add_mic: NULL);
                 if (retmin) {
                     if (retmin == ERR_DECODE) {
                         retmaj = GSS_S_DEFECTIVE_TOKEN;
index d10917fb5a9bbb039dd6f8a8bc123a451a714b85..73934d7bfff62bb35b25c22123328028c84c2347 100644 (file)
@@ -832,7 +832,7 @@ int ntlm_process_target_info(struct ntlm_ctx *ctx,
     /* the server did not send the timestamp, use current time */
     if (srv_time == 0) {
         srv_time = ntlm_timestamp_now();
-    } else {
+    } else if (add_mic) {
         av_flags |= MSVAVFLAGS_MIC_PRESENT;
         *add_mic = true;
     }
index 72d62c84bec245989ed7cc351f0cbf0d2497d68d..f338bbdddfecf761a1da54453f6fe2eee903208d 100644 (file)
@@ -518,7 +518,9 @@ int ntlm_decode_target_info(struct ntlm_ctx *ctx, struct ntlm_buffer *buffer,
  * @param server                The Client Supplied Server Name if available
  * @param out                   The processed target_info buffer
  * @param out_srv_time          A 64 bit FILETIME timestamp
- * @param add_mic               Whether the caller should generate a MIC
+ * @param add_mic               A pointer to a boolean. If NULL MIC flags will
+ *                               not be set, otherwise if allowed the MIC flag
+ *                               will be set and true will be returned.
  *
  * @return      0 if everyting parses correctly, or an error code
  */