This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Perl 5.7.2 (GDB breaks in 1.3.3-2 on certain Win2000 machines)


Kris Erickson wrote:
> 
> >
> >Let's try and at least document what systems are exhibiting this
> >behavior.  My setup:
> >
> >-Win2k workstation with Service pack 1
> Yes.
> >-Logged into NT domain (NOT ActiveDirectory!)
> Yes.

Thanks Kris, that settles it.  I understand why we are getting the 2221
error.  And I am not sure how to fix CygWin.

OK, the deal is this: when a domain user logs into a domain managed
machine, he does NOT have a local account, he has a domain account.
What this means is that this documentation:

--------------------------------------------------------------------
NET_API_STATUS NetUserGetInfo(
  LPWSTR servername,  
  LPWSTR username,    
  DWORD level,        
  LPBYTE *bufptr      
);
 
Parameters
servername 
Pointer to a Unicode string containing the name of the remote server 
on which the function is to execute. A NULL pointer or string 
specifies the local computer. 

username 
Pointer to a Unicode string containing the name of the user account 
on which to return information. 
--------------------------------------------------------------------

is misleading at best and wrong in practice.  You cannot sucessfully
call it with a NULL servername for a domain user, because the domain
user has no local account.  You must have the PDC/BDC name in the
servername.  Here is the output from Kris' program run first against 
my machine then against the PDC:

	D:\working\Test\Debug>test JPeacock
	A system error has occurred: 2221

	D:\working\Test\Debug>test \\JPEACOCK JPeacock
	A system error has occurred: 2221

	D:\working\Test\Debug>test \\CIMARRON JPeacock

	        Account:      JPeacock
	        Comment:
	        User comment:
	        Full name:    John Peacock


where 2221 is NERR_UserNotFound.  QED.

What this means is that this code:

 if (NetUserGetInfo (NULL, wuser, 3, (LPBYTE *) &ui) && user.logsrv ())
   {
      strcat (strcpy (buf, "\\\\"), user.logsrv ());
      sys_mbstowcs (wlogsrv, buf, INTERNET_MAX_HOST_NAME_LENGTH + 3);
      ui = NULL;
      if (NetUserGetInfo (wlogsrv, wuser, 3,(LPBYTE *) &ui))
        ui = NULL;
   }

needs to be rewritten so that NetUserGetInfo() is only called with the
NULL iff !user.logsrv().  I think just turning this if{} to an if{}
else{} would have the appropriate effect.  Something like this maybe?

--- uinfo.cc.orig       Wed Oct 10 14:28:57 2001
+++ uinfo.cc    Wed Oct 10 14:31:25 2001
@@ -83,7 +83,7 @@
       /* HOMEDRIVE and HOMEPATH are wrong most of the time, too,
         after changing user context! */
       sys_mbstowcs (wuser, user.name (), UNLEN + 1);
-      if (NetUserGetInfo (NULL, wuser, 3, (LPBYTE *) &ui) &&
user.logsrv ())
+      if ( user.logsrv () ) /* domain user */
        {
          strcat (strcpy (buf, "\\\\"), user.logsrv ());
          sys_mbstowcs (wlogsrv, buf, INTERNET_MAX_HOST_NAME_LENGTH +
3);
@@ -91,6 +91,10 @@
          if (NetUserGetInfo (wlogsrv, wuser, 3,(LPBYTE *) &ui))
            ui = NULL;
        }
+      else /* local user */
+        {
+          NetUserGetInfo (NULL, wuser, 3, (LPBYTE *) &ui);
+        }
       if (ui)
        {
          sys_wcstombs (buf, ui->usri3_home_dir, MAX_PATH);


John

-- 
John Peacock
Director of Information Research and Technology
Rowman & Littlefield Publishing Group
4720 Boston Way
Lanham, MD 20706
301-459-3366 x.5010
fax 301-429-5747

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]