get_lsa_srv_inf() NT Domain Patch

Jason Tishler jason@tishler.net
Wed Apr 17 08:33:00 GMT 2002


The attached patch prevents extraneous backslashes from being prepended
to the logon server name.  See the following for more details:

    http://cygwin.com/ml/cygwin/2002-04/msg00890.html

Note that there is more than one way to achieve the desired functionality.
Feel free to reorganize to prevent code duplication, etc.

Thanks,
Jason
-------------- next part --------------
Index: security.cc
===================================================================
RCS file: /cvs/src/src/winsup/cygwin/security.cc,v
retrieving revision 1.86
diff -u -p -r1.86 security.cc
--- security.cc	7 Mar 2002 14:32:53 -0000	1.86
+++ security.cc	17 Apr 2002 14:35:03 -0000
@@ -230,19 +230,20 @@ get_lsa_srv_inf (LSA_HANDLE lsa, char *l
       (ret = NetGetDCName(NULL, primary, (LPBYTE *) &buf)) == STATUS_SUCCESS)
     {
       sys_wcstombs (name, buf, INTERNET_MAX_HOST_NAME_LENGTH + 1);
+      strcpy (logonserver, name);
       if (domain)
 	sys_wcstombs (domain, primary, INTERNET_MAX_HOST_NAME_LENGTH + 1);
     }
   else
     {
       sys_wcstombs (name, account, INTERNET_MAX_HOST_NAME_LENGTH + 1);
+      strcpy (logonserver, "\\\\");
+      strcat (logonserver, name);
       if (domain)
 	sys_wcstombs (domain, account, INTERNET_MAX_HOST_NAME_LENGTH + 1);
     }
   if (ret == STATUS_SUCCESS)
     NetApiBufferFree (buf);
-  strcpy (logonserver, "\\\\");
-  strcat (logonserver, name);
   return TRUE;
 }
 
-------------- next part --------------
Wed Apr 17 11:27:04 2002  Jason Tishler <jason@tishler.net>

	* security.cc (get_lsa_srv_inf): Prevent extraneous backslashes for
	the NT Domain case.


More information about the Cygwin-patches mailing list