]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
Curl_ntlm_create_type3_message: Tidied up the use of Curl_gethostname.
authorSteve Holme <steve_holme@hotmail.com>
Mon, 19 Sep 2011 19:55:56 +0000 (20:55 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Sun, 25 Sep 2011 21:59:53 +0000 (23:59 +0200)
Removed the code that striped off the domain name when Curl_gethostname
returned the fully qualified domain name as the function has been
updated to return the un-qualified host name.

Replaced the use of HOSTNAME_MAX as the size of the buffer in the call
to Curl_gethostname with sizeof(host) as this is safer should the buffer
size ever be changed.

lib/curl_ntlm_msgs.c

index d2d34a7b32e65a62de90be65ecadc8f5801514ba..c67fdb2cf8e3736f193dbb8c6ebed08abbab8753 100644 (file)
@@ -683,18 +683,13 @@ CURLcode Curl_ntlm_create_type3_message(struct SessionHandle *data,
   if(user)
     userlen = strlen(user);
 
-  if(Curl_gethostname(host, HOSTNAME_MAX)) {
+  /* Get the machine's un-qualified host name as NTLM doesn't like the fully
+     qualified domain name */
+  if(Curl_gethostname(host, sizeof(host))) {
     infof(data, "gethostname() failed, continuing without!");
     hostlen = 0;
   }
   else {
-    /* If the workstation if configured with a full DNS name (i.e.
-     * workstation.somewhere.net) gethostname() returns the fully qualified
-     * name, which NTLM doesn't like.
-     */
-    char *dot = strchr(host, '.');
-    if(dot)
-      *dot = '\0';
     hostlen = strlen(host);
   }