Ignore domain and workstation in negotiate message
authorSimo Sorce <simo@redhat.com>
Fri, 8 Aug 2014 20:11:40 +0000 (16:11 -0400)
committerSimo Sorce <simo@redhat.com>
Fri, 8 Aug 2014 22:29:25 +0000 (18:29 -0400)
We never use these fields, so do not even attempt to decode them
just ignore completely.

src/gss_sec_ctx.c
src/ntlm.c

index 480256738e6ab7d5f5cfdb2376eeecc6d9ea3ed8..3b06d18457eb294ff27dc97831ee9706ff53b0c4 100644 (file)
@@ -521,8 +521,6 @@ uint32_t gssntlm_accept_sec_context(uint32_t *minor_status,
     struct gssntlm_ctx *ctx;
     struct gssntlm_cred *cred;
     int lm_compat_lvl = -1;
-    char *workstation = NULL;
-    char *domain = NULL;
     struct ntlm_buffer challenge = { 0 };
     struct gssntlm_name *server_name = NULL;
     char *computer_name = NULL;
@@ -674,7 +672,7 @@ uint32_t gssntlm_accept_sec_context(uint32_t *minor_status,
             }
 
             retmin = ntlm_decode_neg_msg(ctx->ntlm, &ctx->nego_msg, &in_flags,
-                                         &domain, &workstation);
+                                         NULL, NULL);
             if (retmin) {
                 retmaj = GSS_S_DEFECTIVE_TOKEN;
                 goto done;
@@ -1003,8 +1001,6 @@ done:
     safefree(computer_name);
     safefree(nb_computer_name);
     safefree(nb_domain_name);
-    safefree(workstation);
-    safefree(domain);
     safefree(usr_name);
     safefree(dom_name);
     safefree(wks_name);
index 3702e4c28d5e790628f83679723a3bb6c5ef5af2..d9b3c87372393c0b2424183e2aadd7b43a5d12af 100644 (file)
@@ -979,12 +979,14 @@ int ntlm_decode_neg_msg(struct ntlm_ctx *ctx,
 
     neg_flags = le32toh(msg->neg_flags);
 
-    if (neg_flags & NTLMSSP_NEGOTIATE_OEM_DOMAIN_SUPPLIED) {
+    if (domain &&
+        (neg_flags & NTLMSSP_NEGOTIATE_OEM_DOMAIN_SUPPLIED)) {
         ret = ntlm_decode_oem_str(&msg->domain_name, buffer,
                                   payload_offs, &dom);
         if (ret) goto done;
     }
-    if (neg_flags & NTLMSSP_NEGOTIATE_OEM_WORKSTATION_SUPPLIED) {
+    if (workstation &&
+        (neg_flags & NTLMSSP_NEGOTIATE_OEM_WORKSTATION_SUPPLIED)) {
         ret = ntlm_decode_oem_str(&msg->workstation_name, buffer,
                                   payload_offs, &wks);
         if (ret) goto done;
@@ -996,8 +998,8 @@ done:
         safefree(wks);
     } else {
         *flags = neg_flags;
-        *domain = dom;
-        *workstation = wks;
+        if (domain) *domain = dom;
+        if (workstation) *workstation = wks;
     }
     return ret;
 }