Remove unneeded whitespace.
* fhandler_fifo.cc (fhandler_fifo::open): Rework to cause errno to be set to ENXIO when opening a fifo write/nonblocking. * environ.cc (ucreqenv): Rename to ucenv. Move code from old ucenv here and conditionalize it on create_upcaseenv. (ucenv): Delete. (environ_init): Fix compiler warning by moving create_upcaseenv test to ucenv. Don't bother checking for child_proc_info when calling ucenv since it is assumed to be NULL at the point where the function is called. * path.cc (symlink_worker): Turn off MS-DOS path warnings when dealing with devices since the device handler passes in a translated MS-DOS path. * sec_auth.cc (lsaprivkeyauth): Avoid variable initialization which causes a compiler error. * fhandler_netdrive.cc: Update copyright.
This commit is contained in:
		
							parent
							
								
									f43f75a09d
								
							
						
					
					
						commit
						025c1fac6e
					
				| 
						 | 
				
			
			@ -1,3 +1,27 @@
 | 
			
		|||
2008-11-26  Christopher Faylor  <me+cygwin@cgf.cx>
 | 
			
		||||
 | 
			
		||||
	Remove unneeded whitespace.
 | 
			
		||||
 | 
			
		||||
	* fhandler_fifo.cc (fhandler_fifo::open): Rework to cause errno to be
 | 
			
		||||
	set to ENXIO when opening a fifo write/nonblocking.
 | 
			
		||||
 | 
			
		||||
	* environ.cc (ucreqenv): Rename to ucenv.  Move code from old ucenv
 | 
			
		||||
	here and conditionalize it on create_upcaseenv.
 | 
			
		||||
	(ucenv): Delete.
 | 
			
		||||
	(environ_init): Fix compiler warning by moving create_upcaseenv test to
 | 
			
		||||
	ucenv.  Don't bother checking for child_proc_info when calling ucenv
 | 
			
		||||
	since it is assumed to be NULL at the point where the function is
 | 
			
		||||
	called.
 | 
			
		||||
 | 
			
		||||
	* path.cc (symlink_worker): Turn off MS-DOS path warnings when dealing
 | 
			
		||||
	with devices since the device handler passes in a translated MS-DOS
 | 
			
		||||
	path.
 | 
			
		||||
 | 
			
		||||
	* sec_auth.cc (lsaprivkeyauth): Avoid variable initialization which
 | 
			
		||||
	causes a compiler error.
 | 
			
		||||
 | 
			
		||||
	* fhandler_netdrive.cc: Update copyright.
 | 
			
		||||
 | 
			
		||||
2008-11-26  Corinna Vinschen  <corinna@vinschen.de>
 | 
			
		||||
 | 
			
		||||
	* Makefile.in (DLL_OFILES): Add setlsapwd.o.
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -437,53 +437,36 @@ unsetenv (const char *name)
 | 
			
		|||
  return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* Turn environment variable part of a=b string into uppercase. */
 | 
			
		||||
static __inline__ void
 | 
			
		||||
ucenv (char *p, char *eq)
 | 
			
		||||
{
 | 
			
		||||
  /* Amazingly, NT has a case sensitive environment name list,
 | 
			
		||||
     but only sometimes.
 | 
			
		||||
     It's normal to have NT set your "Path" to something.
 | 
			
		||||
     Later, you set "PATH" to something else.  This alters "Path".
 | 
			
		||||
     But if you try and do a naive getenv on "PATH" you'll get nothing.
 | 
			
		||||
 | 
			
		||||
     So we upper case the labels here to prevent confusion later but
 | 
			
		||||
     we only do it for the first process in a session group. */
 | 
			
		||||
  for (; p < eq; p++)
 | 
			
		||||
    if (islower (*p))
 | 
			
		||||
      *p = cyg_toupper (*p);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* Minimal list of Windows vars which must be converted to uppercase.
 | 
			
		||||
   Either for POSIX compatibility of for backward compatibility with
 | 
			
		||||
   existing applications. */
 | 
			
		||||
static struct renv {
 | 
			
		||||
        const char *name;
 | 
			
		||||
        const size_t namelen;
 | 
			
		||||
	const char *name;
 | 
			
		||||
	const size_t namelen;
 | 
			
		||||
} renv_arr[] = {
 | 
			
		||||
        { NL("ALLUSERSPROFILE=") },		// 0
 | 
			
		||||
        { NL("COMMONPROGRAMFILES=") },		// 1
 | 
			
		||||
        { NL("COMPUTERNAME=") },
 | 
			
		||||
        { NL("COMSPEC=") },
 | 
			
		||||
        { NL("HOME=") },			// 4
 | 
			
		||||
        { NL("HOMEDRIVE=") },
 | 
			
		||||
        { NL("HOMEPATH=") },
 | 
			
		||||
        { NL("NUMBER_OF_PROCESSORS=") },	// 7
 | 
			
		||||
        { NL("OS=") },				// 8
 | 
			
		||||
        { NL("PATH=") },			// 9
 | 
			
		||||
        { NL("PATHEXT=") },
 | 
			
		||||
        { NL("PROCESSOR_ARCHITECTURE=") },
 | 
			
		||||
        { NL("PROCESSOR_IDENTIFIER=") },
 | 
			
		||||
        { NL("PROCESSOR_LEVEL=") },
 | 
			
		||||
        { NL("PROCESSOR_REVISION=") },
 | 
			
		||||
        { NL("PROGRAMFILES=") },
 | 
			
		||||
        { NL("SYSTEMDRIVE=") },			// 16
 | 
			
		||||
        { NL("SYSTEMROOT=") },
 | 
			
		||||
        { NL("TEMP=") },			// 18
 | 
			
		||||
        { NL("TERM=") },
 | 
			
		||||
        { NL("TMP=") },
 | 
			
		||||
        { NL("TMPDIR=") },
 | 
			
		||||
        { NL("WINDIR=") }			// 22
 | 
			
		||||
	{ NL("ALLUSERSPROFILE=") },		// 0
 | 
			
		||||
	{ NL("COMMONPROGRAMFILES=") },		// 1
 | 
			
		||||
	{ NL("COMPUTERNAME=") },
 | 
			
		||||
	{ NL("COMSPEC=") },
 | 
			
		||||
	{ NL("HOME=") },			// 4
 | 
			
		||||
	{ NL("HOMEDRIVE=") },
 | 
			
		||||
	{ NL("HOMEPATH=") },
 | 
			
		||||
	{ NL("NUMBER_OF_PROCESSORS=") },	// 7
 | 
			
		||||
	{ NL("OS=") },				// 8
 | 
			
		||||
	{ NL("PATH=") },			// 9
 | 
			
		||||
	{ NL("PATHEXT=") },
 | 
			
		||||
	{ NL("PROCESSOR_ARCHITECTURE=") },
 | 
			
		||||
	{ NL("PROCESSOR_IDENTIFIER=") },
 | 
			
		||||
	{ NL("PROCESSOR_LEVEL=") },
 | 
			
		||||
	{ NL("PROCESSOR_REVISION=") },
 | 
			
		||||
	{ NL("PROGRAMFILES=") },
 | 
			
		||||
	{ NL("SYSTEMDRIVE=") },			// 16
 | 
			
		||||
	{ NL("SYSTEMROOT=") },
 | 
			
		||||
	{ NL("TEMP=") },			// 18
 | 
			
		||||
	{ NL("TERM=") },
 | 
			
		||||
	{ NL("TMP=") },
 | 
			
		||||
	{ NL("TMPDIR=") },
 | 
			
		||||
	{ NL("WINDIR=") }			// 22
 | 
			
		||||
};
 | 
			
		||||
#define RENV_SIZE (sizeof (renv_arr) / sizeof (renv_arr[0]))
 | 
			
		||||
/* Set of first characters of the above list of variables. */
 | 
			
		||||
| 
						 | 
				
			
			@ -492,22 +475,41 @@ static const char idx_arr[] = "ACHNOPSTW";
 | 
			
		|||
   starts. */
 | 
			
		||||
static const int start_at[] = { 0, 1, 4, 7, 8, 9, 16, 18, 22 };
 | 
			
		||||
 | 
			
		||||
/* Hopefully as quick as possible.  Only upcase specific set of important
 | 
			
		||||
   Windows variables. */
 | 
			
		||||
/* Turn environment variable part of a=b string into uppercase.
 | 
			
		||||
   Conditionally controlled by upcaseenv CYGWIN setting.  */
 | 
			
		||||
static __inline__ void
 | 
			
		||||
ucreqenv (char *p)
 | 
			
		||||
ucenv (char *p, const char *eq)
 | 
			
		||||
{
 | 
			
		||||
  char first = cyg_toupper (*p);
 | 
			
		||||
  const char *idx = strchr (idx_arr, first);
 | 
			
		||||
  if (idx)
 | 
			
		||||
    for (size_t i = start_at[idx - idx_arr];
 | 
			
		||||
	 i < RENV_SIZE && renv_arr[i].name[0] == first;
 | 
			
		||||
	 ++i)
 | 
			
		||||
      if (strncasematch (p, renv_arr[i].name, renv_arr[i].namelen))
 | 
			
		||||
	{
 | 
			
		||||
	  strncpy (p, renv_arr[i].name, renv_arr[i].namelen);
 | 
			
		||||
	  break;
 | 
			
		||||
	}
 | 
			
		||||
  if (create_upcaseenv)
 | 
			
		||||
    {
 | 
			
		||||
      /* Amazingly, NT has a case sensitive environment name list,
 | 
			
		||||
	 but only sometimes.
 | 
			
		||||
	 It's normal to have NT set your "Path" to something.
 | 
			
		||||
	 Later, you set "PATH" to something else.  This alters "Path".
 | 
			
		||||
	 But if you try and do a naive getenv on "PATH" you'll get nothing.
 | 
			
		||||
 | 
			
		||||
	 So we upper case the labels here to prevent confusion later but
 | 
			
		||||
	 we only do it for processes that are started by non-Cygwin programs. */
 | 
			
		||||
      for (; p < eq; p++)
 | 
			
		||||
	if (islower (*p))
 | 
			
		||||
	  *p = cyg_toupper (*p);
 | 
			
		||||
    }
 | 
			
		||||
  else
 | 
			
		||||
    {
 | 
			
		||||
      /* Hopefully as quickly as possible - only upcase specific set of important
 | 
			
		||||
	 Windows variables. */
 | 
			
		||||
      char first = cyg_toupper (*p);
 | 
			
		||||
      const char *idx = strchr (idx_arr, first);
 | 
			
		||||
      if (idx)
 | 
			
		||||
	for (size_t i = start_at[idx - idx_arr];
 | 
			
		||||
	     i < RENV_SIZE && renv_arr[i].name[0] == first;
 | 
			
		||||
	     ++i)
 | 
			
		||||
	  if (strncasematch (p, renv_arr[i].name, renv_arr[i].namelen))
 | 
			
		||||
	    {
 | 
			
		||||
	      strncpy (p, renv_arr[i].name, renv_arr[i].namelen);
 | 
			
		||||
	      break;
 | 
			
		||||
	    }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* Parse CYGWIN options */
 | 
			
		||||
| 
						 | 
				
			
			@ -847,14 +849,10 @@ environ_init (char **envp, int envc)
 | 
			
		|||
      if (*newp == '=')
 | 
			
		||||
	*newp = '!';
 | 
			
		||||
      char *eq = strechr (newp, '=');
 | 
			
		||||
      if (!child_proc_info)
 | 
			
		||||
	if (create_upcaseenv)
 | 
			
		||||
	  ucenv (newp, eq);	/* Uppercase all env vars. */
 | 
			
		||||
	else
 | 
			
		||||
	  ucreqenv (newp);	/* Uppercase only selected vars. */
 | 
			
		||||
      ucenv (newp, eq);	/* (possibly conditionally) uppercase env vars. */
 | 
			
		||||
      if (*newp == 'T' && strncmp (newp, "TERM=", 5) == 0)
 | 
			
		||||
	sawTERM = 1;
 | 
			
		||||
      if (*eq && conv_start_chars[(unsigned char)envp[i][0]])
 | 
			
		||||
      if (*eq && conv_start_chars[(unsigned char) envp[i][0]])
 | 
			
		||||
	posify (envp + i, *++eq ? eq : --eq, tmpbuf);
 | 
			
		||||
      debug_printf ("%p: %s", envp[i], envp[i]);
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -46,9 +46,9 @@ fcntl64 (int fd, int cmd, ...)
 | 
			
		|||
    case F_SETLK:
 | 
			
		||||
    case F_SETLKW:
 | 
			
		||||
      {
 | 
			
		||||
        struct __flock64 *fl = (struct __flock64 *) arg;
 | 
			
		||||
        fl->l_type &= F_RDLCK | F_WRLCK | F_UNLCK;
 | 
			
		||||
        res = cfd->lock (cmd, fl);
 | 
			
		||||
	struct __flock64 *fl = (struct __flock64 *) arg;
 | 
			
		||||
	fl->l_type &= F_RDLCK | F_WRLCK | F_UNLCK;
 | 
			
		||||
	res = cfd->lock (cmd, fl);
 | 
			
		||||
      }
 | 
			
		||||
      break;
 | 
			
		||||
    default:
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -524,11 +524,11 @@ fhandler_base::open (int flags, mode_t mode)
 | 
			
		|||
  if (query_open () && pc.fs_is_nfs ())
 | 
			
		||||
    {
 | 
			
		||||
      /* Make sure we can read EAs of files on an NFS share.  Also make
 | 
			
		||||
         sure that we're going to act on the file itself, even if it'a
 | 
			
		||||
	 sure that we're going to act on the file itself, even if it'a
 | 
			
		||||
	 a symlink. */
 | 
			
		||||
      access |= FILE_READ_EA;
 | 
			
		||||
      if (query_open () >= query_write_control)
 | 
			
		||||
        access |=  FILE_WRITE_EA;
 | 
			
		||||
	access |=  FILE_WRITE_EA;
 | 
			
		||||
      plen = sizeof nfs_aol_ffei;
 | 
			
		||||
      p = (PFILE_FULL_EA_INFORMATION) &nfs_aol_ffei;
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			@ -583,7 +583,7 @@ fhandler_base::open (int flags, mode_t mode)
 | 
			
		|||
	  else if (pc.fs_is_nfs ())
 | 
			
		||||
	    {
 | 
			
		||||
	      /* When creating a file on an NFS share, we have to set the
 | 
			
		||||
	         file mode by writing a NFS fattr3 structure with the
 | 
			
		||||
		 file mode by writing a NFS fattr3 structure with the
 | 
			
		||||
		 correct mode bits set. */
 | 
			
		||||
	      access |= FILE_WRITE_EA;
 | 
			
		||||
	      plen = sizeof (FILE_FULL_EA_INFORMATION) + sizeof (NFS_V3_ATTR)
 | 
			
		||||
| 
						 | 
				
			
			@ -595,7 +595,7 @@ fhandler_base::open (int flags, mode_t mode)
 | 
			
		|||
	      p->EaValueLength = sizeof (fattr3);
 | 
			
		||||
	      strcpy (p->EaName, NFS_V3_ATTR);
 | 
			
		||||
	      fattr3 *nfs_attr = (fattr3 *) (p->EaName
 | 
			
		||||
	                                     + p->EaNameLength + 1);
 | 
			
		||||
					     + p->EaNameLength + 1);
 | 
			
		||||
	      memset (nfs_attr, 0, sizeof (fattr3));
 | 
			
		||||
	      nfs_attr->type = NF3REG;
 | 
			
		||||
	      nfs_attr->mode = mode;
 | 
			
		||||
| 
						 | 
				
			
			@ -634,7 +634,7 @@ fhandler_base::open (int flags, mode_t mode)
 | 
			
		|||
     authenticating using a local user account on the sharing machine.
 | 
			
		||||
     If the SIDs of the client machine are used, that's entirely
 | 
			
		||||
     unexpected behaviour.
 | 
			
		||||
     
 | 
			
		||||
 | 
			
		||||
     Doing it like we do here creates the expected SD in a domain as
 | 
			
		||||
     well as on standalone servers. */
 | 
			
		||||
  if ((flags & O_CREAT) && has_acls () && pc.isremote ())
 | 
			
		||||
| 
						 | 
				
			
			@ -1609,7 +1609,7 @@ fhandler_base::fpathconf (int v)
 | 
			
		|||
    case _PC_NAME_MAX:
 | 
			
		||||
      /* NAME_MAX is without trailing \0 */
 | 
			
		||||
      if (!pc.isdir ())
 | 
			
		||||
        return NAME_MAX;
 | 
			
		||||
	return NAME_MAX;
 | 
			
		||||
      ret = NT_MAX_PATH - strlen (get_name ()) - 2;
 | 
			
		||||
      return ret < 0 ? 0 : ret > NAME_MAX ? NAME_MAX : ret;
 | 
			
		||||
    case _PC_PATH_MAX:
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -394,13 +394,13 @@ class fhandler_mailslot : public fhandler_base
 | 
			
		|||
  select_record *select_read (select_record *s);
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
struct wsa_event 
 | 
			
		||||
struct wsa_event
 | 
			
		||||
{
 | 
			
		||||
  LONG serial_number;
 | 
			
		||||
  long events;
 | 
			
		||||
  int  connect_errorcode;
 | 
			
		||||
  pid_t owner;
 | 
			
		||||
};  
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
class fhandler_socket: public fhandler_base
 | 
			
		||||
{
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -785,7 +785,7 @@ fhandler_disk_file::fchmod (mode_t mode)
 | 
			
		|||
  if (pc.fs_is_nfs ())
 | 
			
		||||
    {
 | 
			
		||||
      /* chmod on NFS shares works by writing an EA of type NfsV3Attributes.
 | 
			
		||||
         Only type and mode have to be set.  Apparently type isn't checked
 | 
			
		||||
	 Only type and mode have to be set.  Apparently type isn't checked
 | 
			
		||||
	 for consistency, so it's sufficent to set it to NF3REG all the time. */
 | 
			
		||||
      struct {
 | 
			
		||||
	FILE_FULL_EA_INFORMATION ffei;
 | 
			
		||||
| 
						 | 
				
			
			@ -806,7 +806,7 @@ fhandler_disk_file::fchmod (mode_t mode)
 | 
			
		|||
      if (!NT_SUCCESS (status))
 | 
			
		||||
	__seterrno_from_nt_status (status);
 | 
			
		||||
      else
 | 
			
		||||
 	res = 0;
 | 
			
		||||
	res = 0;
 | 
			
		||||
      goto out;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -1571,7 +1571,7 @@ fhandler_disk_file::opendir (int fd)
 | 
			
		|||
	     persistent ACLs, FileDirectoryInformation otherwise.
 | 
			
		||||
 | 
			
		||||
	     NFS clients hide dangling symlinks from directory queries,
 | 
			
		||||
	     unless you use the FileNamesInformation info class.  
 | 
			
		||||
	     unless you use the FileNamesInformation info class.
 | 
			
		||||
	     On newer NFS clients (>=Vista) FileIdBothDirectoryInformation
 | 
			
		||||
	     works fine, but only if the NFS share is mounted to a drive
 | 
			
		||||
	     letter.  TODO: We don't test that here for now, but it might
 | 
			
		||||
| 
						 | 
				
			
			@ -1582,7 +1582,7 @@ fhandler_disk_file::opendir (int fd)
 | 
			
		|||
	    {
 | 
			
		||||
	      dir->__flags |= dirent_set_d_ino;
 | 
			
		||||
	      if (pc.fs_is_nfs ())
 | 
			
		||||
	      	dir->__flags |= dirent_nfs_d_ino;
 | 
			
		||||
		dir->__flags |= dirent_nfs_d_ino;
 | 
			
		||||
	      else if (wincap.has_fileid_dirinfo ()
 | 
			
		||||
		       && !pc.has_buggy_fileid_dirinfo ())
 | 
			
		||||
		dir->__flags |= dirent_get_d_ino;
 | 
			
		||||
| 
						 | 
				
			
			@ -1714,7 +1714,7 @@ fhandler_disk_file::readdir_helper (DIR *dir, dirent *de, DWORD w32_err,
 | 
			
		|||
	{
 | 
			
		||||
	  tmp_pathbuf tp;
 | 
			
		||||
	  UNICODE_STRING fbuf;
 | 
			
		||||
	  
 | 
			
		||||
 | 
			
		||||
	  tp.u_get (&fbuf);
 | 
			
		||||
	  RtlCopyUnicodeString (&fbuf, pc.get_nt_native_path ());
 | 
			
		||||
	  RtlAppendUnicodeToString (&fbuf, L"\\");
 | 
			
		||||
| 
						 | 
				
			
			@ -1853,7 +1853,7 @@ go_ahead:
 | 
			
		|||
	{
 | 
			
		||||
	  FileName = ((PFILE_NAMES_INFORMATION) buf)->FileName;
 | 
			
		||||
	  FileNameLength = ((PFILE_NAMES_INFORMATION) buf)->FileNameLength;
 | 
			
		||||
      	}
 | 
			
		||||
	}
 | 
			
		||||
      else
 | 
			
		||||
	{
 | 
			
		||||
	  FileName = ((PFILE_DIRECTORY_INFORMATION) buf)->FileName;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -86,13 +86,26 @@ fhandler_fifo::open (int flags, mode_t)
 | 
			
		|||
      LPSECURITY_ATTRIBUTES sa_buf =
 | 
			
		||||
	sec_user ((PSECURITY_ATTRIBUTES) char_sa_buf, cygheap->user.sid());
 | 
			
		||||
      mode |= FILE_FLAG_OVERLAPPED;
 | 
			
		||||
      HANDLE h = CreateNamedPipe(npname, mode, FIFO_PIPE_MODE,
 | 
			
		||||
				 PIPE_UNLIMITED_INSTANCES, 0, 0,
 | 
			
		||||
				 NMPWAIT_WAIT_FOREVER, sa_buf);
 | 
			
		||||
 | 
			
		||||
      HANDLE h;
 | 
			
		||||
      DWORD err;
 | 
			
		||||
      bool nonblocking_write = !!((flags & (O_WRONLY | O_NONBLOCK)) == (O_WRONLY | O_NONBLOCK));
 | 
			
		||||
      if (nonblocking_write)
 | 
			
		||||
	{
 | 
			
		||||
	  h = INVALID_HANDLE_VALUE;
 | 
			
		||||
	  err = ERROR_ACCESS_DENIED;
 | 
			
		||||
	}
 | 
			
		||||
      else
 | 
			
		||||
	{
 | 
			
		||||
	  h = CreateNamedPipe(npname, mode, FIFO_PIPE_MODE,
 | 
			
		||||
			      PIPE_UNLIMITED_INSTANCES, 0, 0,
 | 
			
		||||
			      NMPWAIT_WAIT_FOREVER, sa_buf);
 | 
			
		||||
	  err = GetLastError ();
 | 
			
		||||
	}
 | 
			
		||||
      if (h != INVALID_HANDLE_VALUE)
 | 
			
		||||
	wait_state = fifo_wait_for_client;
 | 
			
		||||
      else
 | 
			
		||||
	  switch (GetLastError ())
 | 
			
		||||
	  switch (err)
 | 
			
		||||
	    {
 | 
			
		||||
	    case ERROR_ACCESS_DENIED:
 | 
			
		||||
	      h = open_nonserver (npname, low_flags, sa_buf);
 | 
			
		||||
| 
						 | 
				
			
			@ -101,6 +114,11 @@ fhandler_fifo::open (int flags, mode_t)
 | 
			
		|||
		  wait_state = fifo_wait_for_server;
 | 
			
		||||
		  break;
 | 
			
		||||
		}
 | 
			
		||||
	      if (nonblocking_write && GetLastError () == ERROR_FILE_NOT_FOUND)
 | 
			
		||||
		{
 | 
			
		||||
		  set_errno (ENXIO);
 | 
			
		||||
		  break;
 | 
			
		||||
		}
 | 
			
		||||
	      /* fall through intentionally */
 | 
			
		||||
	    default:
 | 
			
		||||
	      __seterrno ();
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,6 +1,6 @@
 | 
			
		|||
/* fhandler_netdrive.cc: fhandler for // and //MACHINE handling
 | 
			
		||||
 | 
			
		||||
   Copyright 2005 Red Hat, Inc.
 | 
			
		||||
   Copyright 2005, 2006, 2007, 2008 Red Hat, Inc.
 | 
			
		||||
 | 
			
		||||
This file is part of Cygwin.
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -107,7 +107,7 @@ thread_netdrive (void *arg)
 | 
			
		|||
    case GET_RESOURCE_ENUM:
 | 
			
		||||
      nh = (struct net_hdls *) ndi->in;
 | 
			
		||||
      if (!nh->dom)
 | 
			
		||||
        {
 | 
			
		||||
	{
 | 
			
		||||
	  ndi->ret = ERROR_NO_MORE_ITEMS;
 | 
			
		||||
	  break;
 | 
			
		||||
	}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1452,7 +1452,7 @@ fhandler_socket::send_internal (struct _WSABUF *wsabuf, DWORD wsacnt, int flags,
 | 
			
		|||
      else if (is_nonblocking () || err != WSAEWOULDBLOCK)
 | 
			
		||||
	break;
 | 
			
		||||
    }
 | 
			
		||||
  
 | 
			
		||||
 | 
			
		||||
  if (sum)
 | 
			
		||||
    res = sum;
 | 
			
		||||
  else if (res == SOCKET_ERROR)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -13,8 +13,8 @@
 | 
			
		|||
   The essential code of the lf_XXX functions has been taken from the
 | 
			
		||||
   module src/sys/kern/kern_lockf.c.  It has been adapted to use NT
 | 
			
		||||
   global namespace subdirs and event objects for synchronization
 | 
			
		||||
   purposes. 
 | 
			
		||||
   
 | 
			
		||||
   purposes.
 | 
			
		||||
 | 
			
		||||
   So, the following copyright applies to most of the code in the lf_XXX
 | 
			
		||||
   functions.
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -49,7 +49,7 @@
 | 
			
		|||
 * SUCH DAMAGE.
 | 
			
		||||
 *
 | 
			
		||||
 *      @(#)ufs_lockf.c 8.3 (Berkeley) 1/6/94
 | 
			
		||||
*/   
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * The flock() function is based upon source taken from the Red Hat
 | 
			
		||||
| 
						 | 
				
			
			@ -354,7 +354,7 @@ fhandler_base::del_my_locks (bool after_fork)
 | 
			
		|||
  if (node)
 | 
			
		||||
    {
 | 
			
		||||
      bool no_locks_left =
 | 
			
		||||
      	node->del_my_locks (after_fork ? 0 : get_unique_id (), get_handle ());
 | 
			
		||||
	node->del_my_locks (after_fork ? 0 : get_unique_id (), get_handle ());
 | 
			
		||||
      if (no_locks_left)
 | 
			
		||||
	{
 | 
			
		||||
	  LIST_REMOVE (node, i_next);
 | 
			
		||||
| 
						 | 
				
			
			@ -501,28 +501,28 @@ inode_t::get_all_locks_list ()
 | 
			
		|||
	continue;
 | 
			
		||||
      short type = wcstol (endptr + 1, &endptr, 16);
 | 
			
		||||
      if ((type != F_RDLCK && type != F_WRLCK) || !endptr || *endptr != L'-')
 | 
			
		||||
        continue;
 | 
			
		||||
	continue;
 | 
			
		||||
      _off64_t start = (_off64_t) wcstoull (endptr + 1, &endptr, 16);
 | 
			
		||||
      if (start < 0 || !endptr || *endptr != L'-')
 | 
			
		||||
        continue;
 | 
			
		||||
	continue;
 | 
			
		||||
      _off64_t end = (_off64_t) wcstoull (endptr + 1, &endptr, 16);
 | 
			
		||||
      if (end < -1LL || (end > 0 && end < start) || !endptr || *endptr != L'-')
 | 
			
		||||
      	continue;
 | 
			
		||||
	continue;
 | 
			
		||||
      long long id = wcstoll (endptr + 1, &endptr, 16);
 | 
			
		||||
      if (!endptr || *endptr != L'-'
 | 
			
		||||
	  || ((flags & F_POSIX) && (id < 1 || id > ULONG_MAX)))
 | 
			
		||||
      	continue;
 | 
			
		||||
	continue;
 | 
			
		||||
      DWORD wid = wcstoul (endptr + 1, &endptr, 16);
 | 
			
		||||
      if (endptr && *endptr != L'\0')
 | 
			
		||||
      	continue;
 | 
			
		||||
	continue;
 | 
			
		||||
      if (lock - i_all_lf >= MAX_LOCKF_CNT)
 | 
			
		||||
        {
 | 
			
		||||
	{
 | 
			
		||||
	  system_printf ("Warning, can't handle more than %d locks per file.",
 | 
			
		||||
			 MAX_LOCKF_CNT);
 | 
			
		||||
	  break;
 | 
			
		||||
	}
 | 
			
		||||
      if (lock > i_all_lf)
 | 
			
		||||
        lock[-1].lf_next = lock;
 | 
			
		||||
	lock[-1].lf_next = lock;
 | 
			
		||||
      new (lock++) lockf_t (this, &i_all_lf, flags, type, start, end, id, wid);
 | 
			
		||||
    }
 | 
			
		||||
  /* If no lock has been found, return NULL. */
 | 
			
		||||
| 
						 | 
				
			
			@ -637,7 +637,7 @@ fhandler_disk_file::lock (int a_op, struct __flock64 *fl)
 | 
			
		|||
 | 
			
		||||
  short a_flags = fl->l_type & (F_POSIX | F_FLOCK);
 | 
			
		||||
  short type = fl->l_type & (F_RDLCK | F_WRLCK | F_UNLCK);
 | 
			
		||||
  
 | 
			
		||||
 | 
			
		||||
  if (!a_flags)
 | 
			
		||||
    a_flags = F_POSIX; /* default */
 | 
			
		||||
  if (a_op == F_SETLKW)
 | 
			
		||||
| 
						 | 
				
			
			@ -652,21 +652,21 @@ fhandler_disk_file::lock (int a_op, struct __flock64 *fl)
 | 
			
		|||
	a_op = F_UNLCK;
 | 
			
		||||
	break;
 | 
			
		||||
      case F_RDLCK:
 | 
			
		||||
        if (!(get_access () & GENERIC_READ))
 | 
			
		||||
	if (!(get_access () & GENERIC_READ))
 | 
			
		||||
	  {
 | 
			
		||||
	    set_errno (EBADF);
 | 
			
		||||
	    return -1;
 | 
			
		||||
	  }
 | 
			
		||||
	break;
 | 
			
		||||
      case F_WRLCK:
 | 
			
		||||
        if (!(get_access () & GENERIC_WRITE))
 | 
			
		||||
	if (!(get_access () & GENERIC_WRITE))
 | 
			
		||||
	  {
 | 
			
		||||
	    set_errno (EBADF);
 | 
			
		||||
	    return -1;
 | 
			
		||||
	  }
 | 
			
		||||
	break;
 | 
			
		||||
      default:
 | 
			
		||||
      	set_errno (EINVAL);
 | 
			
		||||
	set_errno (EINVAL);
 | 
			
		||||
	return -1;
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -776,7 +776,7 @@ fhandler_disk_file::lock (int a_op, struct __flock64 *fl)
 | 
			
		|||
    {
 | 
			
		||||
      clean = new lockf_t ();
 | 
			
		||||
      if (!clean)
 | 
			
		||||
        {
 | 
			
		||||
	{
 | 
			
		||||
	  node->UNLOCK ();
 | 
			
		||||
	  set_errno (ENOLCK);
 | 
			
		||||
	  return -1;
 | 
			
		||||
| 
						 | 
				
			
			@ -805,9 +805,9 @@ fhandler_disk_file::lock (int a_op, struct __flock64 *fl)
 | 
			
		|||
    case F_UNLCK:
 | 
			
		||||
      error = lf_clearlock (lock, &clean, get_handle ());
 | 
			
		||||
      lock->lf_next = clean;
 | 
			
		||||
      clean = lock; 
 | 
			
		||||
      clean = lock;
 | 
			
		||||
      break;
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
    case F_GETLK:
 | 
			
		||||
      error = lf_getlock (lock, node, fl);
 | 
			
		||||
      lock->lf_next = clean;
 | 
			
		||||
| 
						 | 
				
			
			@ -850,7 +850,7 @@ fhandler_disk_file::lock (int a_op, struct __flock64 *fl)
 | 
			
		|||
 */
 | 
			
		||||
static int
 | 
			
		||||
lf_setlock (lockf_t *lock, inode_t *node, lockf_t **clean, HANDLE fhdl)
 | 
			
		||||
{ 
 | 
			
		||||
{
 | 
			
		||||
  lockf_t *block;
 | 
			
		||||
  lockf_t **head = lock->lf_head;
 | 
			
		||||
  lockf_t **prev, *overlap;
 | 
			
		||||
| 
						 | 
				
			
			@ -896,7 +896,7 @@ lf_setlock (lockf_t *lock, inode_t *node, lockf_t **clean, HANDLE fhdl)
 | 
			
		|||
       * do not go off into neverland.
 | 
			
		||||
       */
 | 
			
		||||
      /* FIXME: We check the handle count of all the lock event objects
 | 
			
		||||
                this process holds.  If it's > 1, another process is
 | 
			
		||||
		this process holds.  If it's > 1, another process is
 | 
			
		||||
		waiting for one of our locks.  This method isn't overly
 | 
			
		||||
		intelligent.  If it turns out to be too dumb, we might
 | 
			
		||||
		have to remove it or to find another method. */
 | 
			
		||||
| 
						 | 
				
			
			@ -937,7 +937,7 @@ lf_setlock (lockf_t *lock, inode_t *node, lockf_t **clean, HANDLE fhdl)
 | 
			
		|||
	}
 | 
			
		||||
      SetThreadPriority (GetCurrentThread (), priority);
 | 
			
		||||
      if (lock->lf_flags & F_POSIX)
 | 
			
		||||
        {
 | 
			
		||||
	{
 | 
			
		||||
	  HANDLE proc = OpenProcess (SYNCHRONIZE, FALSE, block->lf_wid);
 | 
			
		||||
	  if (!proc)
 | 
			
		||||
	    {
 | 
			
		||||
| 
						 | 
				
			
			@ -955,7 +955,7 @@ lf_setlock (lockf_t *lock, inode_t *node, lockf_t **clean, HANDLE fhdl)
 | 
			
		|||
	  CloseHandle (proc);
 | 
			
		||||
	}
 | 
			
		||||
      else
 | 
			
		||||
        {
 | 
			
		||||
	{
 | 
			
		||||
	  HANDLE w4[2] = { obj, signal_arrived };
 | 
			
		||||
	  node->UNLOCK ();
 | 
			
		||||
	  /* Unfortunately, since BSD flock locks are not attached to a
 | 
			
		||||
| 
						 | 
				
			
			@ -977,7 +977,7 @@ lf_setlock (lockf_t *lock, inode_t *node, lockf_t **clean, HANDLE fhdl)
 | 
			
		|||
	  /* The lock object has been set to signalled. */
 | 
			
		||||
	  break;
 | 
			
		||||
	case WAIT_OBJECT_0 + 1:
 | 
			
		||||
	  /* For POSIX locks, the process holding the lock has exited. */ 
 | 
			
		||||
	  /* For POSIX locks, the process holding the lock has exited. */
 | 
			
		||||
	  if (lock->lf_flags & F_POSIX)
 | 
			
		||||
	    break;
 | 
			
		||||
	  /*FALLTHRU*/
 | 
			
		||||
| 
						 | 
				
			
			@ -1016,16 +1016,16 @@ lf_setlock (lockf_t *lock, inode_t *node, lockf_t **clean, HANDLE fhdl)
 | 
			
		|||
       */
 | 
			
		||||
      switch (ovcase)
 | 
			
		||||
	{
 | 
			
		||||
        case 0: /* no overlap */
 | 
			
		||||
	case 0: /* no overlap */
 | 
			
		||||
	  if (needtolink)
 | 
			
		||||
	    {
 | 
			
		||||
	      *prev = lock;
 | 
			
		||||
	      lock->lf_next = overlap;
 | 
			
		||||
	      lock->create_lock_obj ();
 | 
			
		||||
            }
 | 
			
		||||
            break;
 | 
			
		||||
	    }
 | 
			
		||||
	    break;
 | 
			
		||||
 | 
			
		||||
        case 1: /* overlap == lock */
 | 
			
		||||
	case 1: /* overlap == lock */
 | 
			
		||||
	  /*
 | 
			
		||||
	   * If downgrading lock, others may be
 | 
			
		||||
	   * able to acquire it.
 | 
			
		||||
| 
						 | 
				
			
			@ -1038,7 +1038,7 @@ lf_setlock (lockf_t *lock, inode_t *node, lockf_t **clean, HANDLE fhdl)
 | 
			
		|||
	  *clean = lock;
 | 
			
		||||
	  break;
 | 
			
		||||
 | 
			
		||||
        case 2: /* overlap contains lock */
 | 
			
		||||
	case 2: /* overlap contains lock */
 | 
			
		||||
	  /*
 | 
			
		||||
	   * Check for common starting point and different types.
 | 
			
		||||
	   */
 | 
			
		||||
| 
						 | 
				
			
			@ -1063,7 +1063,7 @@ lf_setlock (lockf_t *lock, inode_t *node, lockf_t **clean, HANDLE fhdl)
 | 
			
		|||
	    lock->lf_next->create_lock_obj ();
 | 
			
		||||
	  break;
 | 
			
		||||
 | 
			
		||||
        case 3: /* lock contains overlap */
 | 
			
		||||
	case 3: /* lock contains overlap */
 | 
			
		||||
	  /*
 | 
			
		||||
	   * If downgrading lock, others may be able to
 | 
			
		||||
	   * acquire it, otherwise take the list.
 | 
			
		||||
| 
						 | 
				
			
			@ -1087,7 +1087,7 @@ lf_setlock (lockf_t *lock, inode_t *node, lockf_t **clean, HANDLE fhdl)
 | 
			
		|||
	  *clean = overlap;
 | 
			
		||||
	  continue;
 | 
			
		||||
 | 
			
		||||
        case 4: /* overlap starts before lock */
 | 
			
		||||
	case 4: /* overlap starts before lock */
 | 
			
		||||
	  /*
 | 
			
		||||
	   * Add lock after overlap on the list.
 | 
			
		||||
	   */
 | 
			
		||||
| 
						 | 
				
			
			@ -1101,7 +1101,7 @@ lf_setlock (lockf_t *lock, inode_t *node, lockf_t **clean, HANDLE fhdl)
 | 
			
		|||
	  needtolink = 0;
 | 
			
		||||
	  continue;
 | 
			
		||||
 | 
			
		||||
        case 5: /* overlap ends after lock */
 | 
			
		||||
	case 5: /* overlap ends after lock */
 | 
			
		||||
	  /*
 | 
			
		||||
	   * Add the new lock before overlap.
 | 
			
		||||
	   */
 | 
			
		||||
| 
						 | 
				
			
			@ -1146,13 +1146,13 @@ lf_clearlock (lockf_t *unlock, lockf_t **clean, HANDLE fhdl)
 | 
			
		|||
 | 
			
		||||
      switch (ovcase)
 | 
			
		||||
	{
 | 
			
		||||
        case 1: /* overlap == lock */
 | 
			
		||||
	case 1: /* overlap == lock */
 | 
			
		||||
	  *prev = overlap->lf_next;
 | 
			
		||||
	  overlap->lf_next = *clean;
 | 
			
		||||
	  *clean = overlap;
 | 
			
		||||
	  break;
 | 
			
		||||
 | 
			
		||||
        case 2: /* overlap contains lock: split it */
 | 
			
		||||
	case 2: /* overlap contains lock: split it */
 | 
			
		||||
	  if (overlap->lf_start == unlock->lf_start)
 | 
			
		||||
	    {
 | 
			
		||||
	      overlap->lf_start = unlock->lf_end + 1;
 | 
			
		||||
| 
						 | 
				
			
			@ -1166,24 +1166,24 @@ lf_clearlock (lockf_t *unlock, lockf_t **clean, HANDLE fhdl)
 | 
			
		|||
	    overlap->lf_next->create_lock_obj ();
 | 
			
		||||
	  break;
 | 
			
		||||
 | 
			
		||||
        case 3: /* lock contains overlap */
 | 
			
		||||
	case 3: /* lock contains overlap */
 | 
			
		||||
	  *prev = overlap->lf_next;
 | 
			
		||||
	  lf = overlap->lf_next;
 | 
			
		||||
	  overlap->lf_next = *clean;
 | 
			
		||||
	  *clean = overlap;
 | 
			
		||||
	  continue;
 | 
			
		||||
 | 
			
		||||
        case 4: /* overlap starts before lock */
 | 
			
		||||
            overlap->lf_end = unlock->lf_start - 1;
 | 
			
		||||
            prev = &overlap->lf_next;
 | 
			
		||||
            lf = overlap->lf_next;
 | 
			
		||||
	case 4: /* overlap starts before lock */
 | 
			
		||||
	    overlap->lf_end = unlock->lf_start - 1;
 | 
			
		||||
	    prev = &overlap->lf_next;
 | 
			
		||||
	    lf = overlap->lf_next;
 | 
			
		||||
	    overlap->create_lock_obj ();
 | 
			
		||||
            continue;
 | 
			
		||||
	    continue;
 | 
			
		||||
 | 
			
		||||
        case 5: /* overlap ends after lock */
 | 
			
		||||
            overlap->lf_start = unlock->lf_end + 1;
 | 
			
		||||
	case 5: /* overlap ends after lock */
 | 
			
		||||
	    overlap->lf_start = unlock->lf_end + 1;
 | 
			
		||||
	    overlap->create_lock_obj ();
 | 
			
		||||
            break;
 | 
			
		||||
	    break;
 | 
			
		||||
	}
 | 
			
		||||
      break;
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			@ -1229,7 +1229,7 @@ lf_getlock (lockf_t *lock, inode_t *node, struct __flock64 *fl)
 | 
			
		|||
 */
 | 
			
		||||
static lockf_t *
 | 
			
		||||
lf_getblock (lockf_t *lock, inode_t *node)
 | 
			
		||||
{   
 | 
			
		||||
{
 | 
			
		||||
  lockf_t **prev, *overlap;
 | 
			
		||||
  lockf_t *lf = node->get_all_locks_list ();
 | 
			
		||||
  int ovcase;
 | 
			
		||||
| 
						 | 
				
			
			@ -1272,7 +1272,7 @@ lf_getblock (lockf_t *lock, inode_t *node)
 | 
			
		|||
 *
 | 
			
		||||
 * NOTE: this returns only the FIRST overlapping lock.  There
 | 
			
		||||
 *   may be more than one.
 | 
			
		||||
 */ 
 | 
			
		||||
 */
 | 
			
		||||
static int
 | 
			
		||||
lf_findoverlap (lockf_t *lf, lockf_t *lock, int type, lockf_t ***prev,
 | 
			
		||||
		lockf_t **overlap)
 | 
			
		||||
| 
						 | 
				
			
			@ -1295,7 +1295,7 @@ lf_findoverlap (lockf_t *lf, lockf_t *lock, int type, lockf_t ***prev,
 | 
			
		|||
	  *prev = &lf->lf_next;
 | 
			
		||||
	  *overlap = lf = lf->lf_next;
 | 
			
		||||
	  continue;
 | 
			
		||||
        }
 | 
			
		||||
	}
 | 
			
		||||
      /*
 | 
			
		||||
       * OK, check for overlap
 | 
			
		||||
       *
 | 
			
		||||
| 
						 | 
				
			
			@ -1316,7 +1316,7 @@ lf_findoverlap (lockf_t *lf, lockf_t *lock, int type, lockf_t ***prev,
 | 
			
		|||
	  *prev = &lf->lf_next;
 | 
			
		||||
	  *overlap = lf = lf->lf_next;
 | 
			
		||||
	  continue;
 | 
			
		||||
        }
 | 
			
		||||
	}
 | 
			
		||||
      if ((lf->lf_start == start) && (lf->lf_end == end))
 | 
			
		||||
	{
 | 
			
		||||
	  /* Case 1 */
 | 
			
		||||
| 
						 | 
				
			
			@ -1360,7 +1360,7 @@ lf_split (lockf_t *lock1, lockf_t *lock2, lockf_t **split)
 | 
			
		|||
{
 | 
			
		||||
  lockf_t *splitlock;
 | 
			
		||||
 | 
			
		||||
  /* 
 | 
			
		||||
  /*
 | 
			
		||||
   * Check to see if spliting into only two pieces.
 | 
			
		||||
   */
 | 
			
		||||
  if (lock1->lf_start == lock2->lf_start)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -326,14 +326,14 @@ details. */
 | 
			
		|||
      181: Export cygwin_conv_path, cygwin_create_path, cygwin_conv_path_list.
 | 
			
		||||
      182: Export lockf.
 | 
			
		||||
      FIXME: Removed 12 year old and entirely wrong wprintf function at
 | 
			
		||||
           this point.  We need a working implementation soon.
 | 
			
		||||
	   this point.  We need a working implementation soon.
 | 
			
		||||
      183: Export open_memstream, fmemopen.
 | 
			
		||||
      184: Export openat, faccessat, fchmodat, fchownat, fstatat, futimesat,
 | 
			
		||||
	   linkat, mkdirat, mkfifoat, mknodat, readlinkat, renameat, symlinkat, 
 | 
			
		||||
	   linkat, mkdirat, mkfifoat, mknodat, readlinkat, renameat, symlinkat,
 | 
			
		||||
	   unlinkat.
 | 
			
		||||
      185: Export futimens, utimensat.
 | 
			
		||||
      186: Remove ancient V8 regexp functions.  Also eliminate old crt0 interface
 | 
			
		||||
           which provided its own user_data structure.
 | 
			
		||||
	   which provided its own user_data structure.
 | 
			
		||||
      187: Export cfmakeraw.
 | 
			
		||||
      188: Export CW_SET_PRIV_KEY.
 | 
			
		||||
     */
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -74,7 +74,7 @@ OpenEventW (DWORD dwDesiredAccess, BOOL bInheritHandle, LPCWSTR lpName)
 | 
			
		|||
  OBJECT_ATTRIBUTES attr;
 | 
			
		||||
  NTSTATUS status;
 | 
			
		||||
  ULONG flags = 0;
 | 
			
		||||
  
 | 
			
		||||
 | 
			
		||||
  if (bInheritHandle)
 | 
			
		||||
    flags |= OBJ_INHERIT;
 | 
			
		||||
  if (lpName)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -42,8 +42,8 @@ details. */
 | 
			
		|||
#define isproc(path) \
 | 
			
		||||
  (path_prefix_p (proc, (path), proc_len, false))
 | 
			
		||||
 | 
			
		||||
/* is_unc_share: Return non-zero if PATH begins with //server/share 
 | 
			
		||||
                 or with one of the native prefixes //./ or //?/ 
 | 
			
		||||
/* is_unc_share: Return non-zero if PATH begins with //server/share
 | 
			
		||||
		 or with one of the native prefixes //./ or //?/
 | 
			
		||||
   This function is only used to test for valid input strings.
 | 
			
		||||
   The later normalization drops the native prefixes. */
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -105,7 +105,7 @@ mount_info::init ()
 | 
			
		|||
  nmounts = 0;
 | 
			
		||||
  PWCHAR pathend;
 | 
			
		||||
  WCHAR path[PATH_MAX];
 | 
			
		||||
  
 | 
			
		||||
 | 
			
		||||
  pathend = wcpcpy (path, cygwin_shared->installation_root);
 | 
			
		||||
  create_root_entry (path);
 | 
			
		||||
  pathend = wcpcpy (pathend, L"\\etc\\fstab");
 | 
			
		||||
| 
						 | 
				
			
			@ -616,7 +616,7 @@ conv_fstab_spaces (char *field)
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
struct opt
 | 
			
		||||
{   
 | 
			
		||||
{
 | 
			
		||||
  const char *name;
 | 
			
		||||
  unsigned val;
 | 
			
		||||
  bool clear;
 | 
			
		||||
| 
						 | 
				
			
			@ -643,21 +643,21 @@ read_flags (char *options, unsigned &flags)
 | 
			
		|||
    {
 | 
			
		||||
      char *p = strchr (options, ',');
 | 
			
		||||
      if (p)
 | 
			
		||||
        *p++ = '\0';
 | 
			
		||||
	*p++ = '\0';
 | 
			
		||||
      else
 | 
			
		||||
        p = strchr (options, '\0');
 | 
			
		||||
	p = strchr (options, '\0');
 | 
			
		||||
 | 
			
		||||
      for (opt *o = oopts;
 | 
			
		||||
	   o < (oopts + (sizeof (oopts) / sizeof (oopts[0])));
 | 
			
		||||
	   o++)
 | 
			
		||||
        if (strcmp (options, o->name) == 0)
 | 
			
		||||
          {
 | 
			
		||||
            if (o->clear)
 | 
			
		||||
              flags &= ~o->val;
 | 
			
		||||
            else
 | 
			
		||||
              flags |= o->val;
 | 
			
		||||
            goto gotit;
 | 
			
		||||
          }
 | 
			
		||||
	if (strcmp (options, o->name) == 0)
 | 
			
		||||
	  {
 | 
			
		||||
	    if (o->clear)
 | 
			
		||||
	      flags &= ~o->val;
 | 
			
		||||
	    else
 | 
			
		||||
	      flags |= o->val;
 | 
			
		||||
	    goto gotit;
 | 
			
		||||
	  }
 | 
			
		||||
      system_printf ("invalid fstab option - '%s'", options);
 | 
			
		||||
      return false;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -736,7 +736,7 @@ mount_info::from_fstab (bool user, WCHAR fstab[], PWCHAR fstab_end)
 | 
			
		|||
		    NT_MAX_PATH - (fstab_end - fstab),
 | 
			
		||||
		    cygheap->user.name ());
 | 
			
		||||
      /* Make sure special chars in the username are converted according to
 | 
			
		||||
         the rules. */
 | 
			
		||||
	 the rules. */
 | 
			
		||||
      transform_chars (username, username + wcslen (username) - 1);
 | 
			
		||||
    }
 | 
			
		||||
  RtlInitUnicodeString (&upath, fstab);
 | 
			
		||||
| 
						 | 
				
			
			@ -770,7 +770,7 @@ mount_info::from_fstab (bool user, WCHAR fstab[], PWCHAR fstab_end)
 | 
			
		|||
retry:
 | 
			
		||||
      bool got_nl = false;
 | 
			
		||||
      while (got < buf + len && (end = strchr (got, '\n')))
 | 
			
		||||
        {
 | 
			
		||||
	{
 | 
			
		||||
	  got_nl = true;
 | 
			
		||||
	  end[end[-1] == '\r' ? -1 : 0] = '\0';
 | 
			
		||||
	  if (!from_fstab_line (got, user))
 | 
			
		||||
| 
						 | 
				
			
			@ -779,21 +779,21 @@ retry:
 | 
			
		|||
	  ++line;
 | 
			
		||||
	}
 | 
			
		||||
      if (len < (sizeof (buf) - 2))
 | 
			
		||||
        break;
 | 
			
		||||
	break;
 | 
			
		||||
      /* Check if the buffer contained at least one \n.  If not, the
 | 
			
		||||
         line length is > 32K.  We don't take such long lines.  Print
 | 
			
		||||
	 line length is > 32K.  We don't take such long lines.  Print
 | 
			
		||||
	 a debug message and skip this line entirely. */
 | 
			
		||||
      if (!got_nl)
 | 
			
		||||
        {
 | 
			
		||||
	{
 | 
			
		||||
	  system_printf ("%W: Line %d too long, skipping...", fstab, line);
 | 
			
		||||
	  while (NT_SUCCESS (NtReadFile (fh, NULL, NULL, NULL, &io, buf,
 | 
			
		||||
	  				 (sizeof (buf) - 2), NULL, NULL)))
 | 
			
		||||
					 (sizeof (buf) - 2), NULL, NULL)))
 | 
			
		||||
	    {
 | 
			
		||||
	      len = io.Information;
 | 
			
		||||
	      buf[len] = buf[len + 1] = '\0';
 | 
			
		||||
	      got = strchr (buf, '\n');
 | 
			
		||||
	      if (got)
 | 
			
		||||
	        {
 | 
			
		||||
		{
 | 
			
		||||
		  ++got;
 | 
			
		||||
		  ++line;
 | 
			
		||||
		  goto retry;
 | 
			
		||||
| 
						 | 
				
			
			@ -803,7 +803,7 @@ retry:
 | 
			
		|||
	  break;
 | 
			
		||||
	}
 | 
			
		||||
      /* We have to read once more.  Move remaining bytes to the start of
 | 
			
		||||
         the buffer and reposition got so that it points to the end of
 | 
			
		||||
	 the buffer and reposition got so that it points to the end of
 | 
			
		||||
	 the remaining bytes. */
 | 
			
		||||
      len = buf + len - got;
 | 
			
		||||
      memmove (buf, got, len);
 | 
			
		||||
| 
						 | 
				
			
			@ -869,7 +869,7 @@ mount_info::get_cygdrive_info (char *user, char *system, char *user_flags,
 | 
			
		|||
      strcpy (path, cygdrive);
 | 
			
		||||
      /* Strip trailing slash for backward compatibility. */
 | 
			
		||||
      if (cygdrive_len > 2)
 | 
			
		||||
        path[cygdrive_len - 1] = '\0';
 | 
			
		||||
	path[cygdrive_len - 1] = '\0';
 | 
			
		||||
    }
 | 
			
		||||
  if (flags)
 | 
			
		||||
    strcpy (flags, (cygdrive_flags & MOUNT_BINARY) ? "binmode" : "textmode");
 | 
			
		||||
| 
						 | 
				
			
			@ -1017,7 +1017,7 @@ mount_info::add_item (const char *native, const char *posix,
 | 
			
		|||
  for (i = 0; i < nmounts; i++)
 | 
			
		||||
    {
 | 
			
		||||
      if (!strcmp (mount[i].posix_path, posixtmp))
 | 
			
		||||
        {
 | 
			
		||||
	{
 | 
			
		||||
	  /* Don't allow to override a system mount with a user mount. */
 | 
			
		||||
	  if ((mount[i].flags & MOUNT_SYSTEM) && !(mountflags & MOUNT_SYSTEM))
 | 
			
		||||
	    {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -14,5 +14,5 @@ struct nfs_aol_ffei_t nfs_aol_ffei = { 0, 0, sizeof (NFS_ACT_ON_LINK) - 1, 0,
 | 
			
		|||
				       NFS_ACT_ON_LINK };
 | 
			
		||||
 | 
			
		||||
uint32_t nfs_type_mapping[] = { 0, S_IFREG, S_IFDIR, S_IFBLK,
 | 
			
		||||
                                S_IFCHR, S_IFLNK, S_IFSOCK, S_IFIFO };
 | 
			
		||||
				S_IFCHR, S_IFLNK, S_IFSOCK, S_IFIFO };
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -203,10 +203,10 @@ typedef struct _FILE_ID_BOTH_DIR_INFORMATION
 | 
			
		|||
 | 
			
		||||
/* Specific ACCESS_MASKSs for objects created in Cygwin. */
 | 
			
		||||
#define CYG_SHARED_DIR_ACCESS	(DIRECTORY_QUERY \
 | 
			
		||||
                                 | DIRECTORY_TRAVERSE \
 | 
			
		||||
                                 | DIRECTORY_CREATE_SUBDIRECTORY \
 | 
			
		||||
                                 | DIRECTORY_CREATE_OBJECT \
 | 
			
		||||
                                 | READ_CONTROL)
 | 
			
		||||
				 | DIRECTORY_TRAVERSE \
 | 
			
		||||
				 | DIRECTORY_CREATE_SUBDIRECTORY \
 | 
			
		||||
				 | DIRECTORY_CREATE_OBJECT \
 | 
			
		||||
				 | READ_CONTROL)
 | 
			
		||||
 | 
			
		||||
#define CYG_MUTANT_ACCESS	(MUTANT_QUERY_STATE \
 | 
			
		||||
				 | SYNCHRONIZE \
 | 
			
		||||
| 
						 | 
				
			
			@ -863,7 +863,7 @@ extern "C"
 | 
			
		|||
  NTSTATUS NTAPI NtCreateDirectoryObject (PHANDLE, ACCESS_MASK,
 | 
			
		||||
					  POBJECT_ATTRIBUTES);
 | 
			
		||||
  NTSTATUS NTAPI NtCreateEvent (PHANDLE, ACCESS_MASK, POBJECT_ATTRIBUTES,
 | 
			
		||||
  				EVENT_TYPE, BOOLEAN);
 | 
			
		||||
				EVENT_TYPE, BOOLEAN);
 | 
			
		||||
  NTSTATUS NTAPI NtCreateFile (PHANDLE, ACCESS_MASK, POBJECT_ATTRIBUTES,
 | 
			
		||||
			     PIO_STATUS_BLOCK, PLARGE_INTEGER, ULONG, ULONG,
 | 
			
		||||
			     ULONG, ULONG, PVOID, ULONG);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,4 +1,4 @@
 | 
			
		|||
  /* path.cc: path support.
 | 
			
		||||
/* path.cc: path support.
 | 
			
		||||
 | 
			
		||||
     Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
 | 
			
		||||
     2006, 2007, 2008 Red Hat, Inc.
 | 
			
		||||
| 
						 | 
				
			
			@ -505,7 +505,7 @@ fs_info::update (PUNICODE_STRING upath, HANDLE in_vol)
 | 
			
		|||
		  && FS_IS_SAMBA);
 | 
			
		||||
 | 
			
		||||
      if (!is_samba ())
 | 
			
		||||
        {
 | 
			
		||||
	{
 | 
			
		||||
	  is_netapp (RtlEqualUnicodeString (&fsname, &testname, FALSE)
 | 
			
		||||
		     && FS_IS_NETAPP_DATAONTAP);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -515,7 +515,7 @@ fs_info::update (PUNICODE_STRING upath, HANDLE in_vol)
 | 
			
		|||
	  if (!is_nfs ())
 | 
			
		||||
	    {
 | 
			
		||||
	      /* Known remote file systems which can't handle calls to
 | 
			
		||||
	         NtQueryDirectoryFile(FileIdBothDirectoryInformation) */
 | 
			
		||||
		 NtQueryDirectoryFile(FileIdBothDirectoryInformation) */
 | 
			
		||||
	      RtlInitUnicodeString (&testname, L"UNIXFS");
 | 
			
		||||
	      has_buggy_fileid_dirinfo (RtlEqualUnicodeString (&fsname,
 | 
			
		||||
							       &testname,
 | 
			
		||||
| 
						 | 
				
			
			@ -1525,6 +1525,7 @@ symlink_worker (const char *oldpath, const char *newpath, bool use_winsym,
 | 
			
		|||
  NTSTATUS status;
 | 
			
		||||
  HANDLE fh;
 | 
			
		||||
  tmp_pathbuf tp;
 | 
			
		||||
  unsigned check_opt;
 | 
			
		||||
 | 
			
		||||
  /* POSIX says that empty 'newpath' is invalid input while empty
 | 
			
		||||
     'oldpath' is valid -- it's symlink resolver job to verify if
 | 
			
		||||
| 
						 | 
				
			
			@ -1551,14 +1552,16 @@ symlink_worker (const char *oldpath, const char *newpath, bool use_winsym,
 | 
			
		|||
      set_errno (ENOENT);
 | 
			
		||||
      goto done;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
  check_opt = PC_SYM_NOFOLLOW | PC_POSIX | (isdevice ? PC_NOWARN : 0);
 | 
			
		||||
  /* We need the normalized full path below. */
 | 
			
		||||
  win32_newpath.check (newpath, PC_SYM_NOFOLLOW | PC_POSIX, stat_suffixes);
 | 
			
		||||
  win32_newpath.check (newpath, check_opt, stat_suffixes);
 | 
			
		||||
  if (use_winsym && !win32_newpath.exists ()
 | 
			
		||||
      && (isdevice || !win32_newpath.fs_is_nfs ()))
 | 
			
		||||
    {
 | 
			
		||||
      char *newplnk = tp.c_get ();
 | 
			
		||||
      stpcpy (stpcpy (newplnk, newpath), ".lnk");
 | 
			
		||||
      win32_newpath.check (newplnk, PC_SYM_NOFOLLOW | PC_POSIX);
 | 
			
		||||
      win32_newpath.check (newplnk, check_opt);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
  if (win32_newpath.error)
 | 
			
		||||
| 
						 | 
				
			
			@ -1621,7 +1624,11 @@ symlink_worker (const char *oldpath, const char *newpath, bool use_winsym,
 | 
			
		|||
	  /* The symlink target is relative to the directory in which
 | 
			
		||||
	     the symlink gets created, not relative to the cwd.  Therefore
 | 
			
		||||
	     we have to mangle the path quite a bit before calling path_conv. */
 | 
			
		||||
	  if (!isabspath (oldpath))
 | 
			
		||||
	if (isabspath (oldpath))
 | 
			
		||||
	  win32_oldpath.check (oldpath,
 | 
			
		||||
			       PC_SYM_NOFOLLOW,
 | 
			
		||||
			       stat_suffixes);
 | 
			
		||||
	else
 | 
			
		||||
	    {
 | 
			
		||||
	      len = strrchr (win32_newpath.normalized_path, '/')
 | 
			
		||||
		    - win32_newpath.normalized_path + 1;
 | 
			
		||||
| 
						 | 
				
			
			@ -1630,8 +1637,6 @@ symlink_worker (const char *oldpath, const char *newpath, bool use_winsym,
 | 
			
		|||
		      oldpath);
 | 
			
		||||
	      win32_oldpath.check (absoldpath, PC_SYM_NOFOLLOW, stat_suffixes);
 | 
			
		||||
	    }
 | 
			
		||||
	  else
 | 
			
		||||
	    win32_oldpath.check (oldpath, PC_SYM_NOFOLLOW, stat_suffixes);
 | 
			
		||||
	  if (SUCCEEDED (SHGetDesktopFolder (&psl)))
 | 
			
		||||
	    {
 | 
			
		||||
	      WCHAR wc_path[win32_oldpath.get_wide_win32_path_len () + 1];
 | 
			
		||||
| 
						 | 
				
			
			@ -1777,7 +1782,7 @@ symlink_worker (const char *oldpath, const char *newpath, bool use_winsym,
 | 
			
		|||
    }
 | 
			
		||||
  if (win32_newpath.has_acls () && win32_newpath.isremote ())
 | 
			
		||||
    set_file_attribute (fh, win32_newpath, ILLEGAL_UID, ILLEGAL_GID,
 | 
			
		||||
    			S_IFLNK | STD_RBITS | STD_WBITS);
 | 
			
		||||
			S_IFLNK | STD_RBITS | STD_WBITS);
 | 
			
		||||
  status = NtWriteFile (fh, NULL, NULL, NULL, &io, buf, cp - buf, NULL, NULL);
 | 
			
		||||
  if (NT_SUCCESS (status) && io.Information == (ULONG) (cp - buf))
 | 
			
		||||
    {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -720,7 +720,7 @@ verify_token (HANDLE token, cygsid &usersid, user_groups &groups, bool *pintern)
 | 
			
		|||
		   groups in the token, which are not in the group list set
 | 
			
		||||
		   with setgroups().  That's rather dangerous.  What we're
 | 
			
		||||
		   really interested in is that all groups in the setgroups()
 | 
			
		||||
		   list are in the token.  A token created through ADVAPI 
 | 
			
		||||
		   list are in the token.  A token created through ADVAPI
 | 
			
		||||
		   should be allowed to contain more groups than requested
 | 
			
		||||
		   through setgroups(), esecially since Vista and the
 | 
			
		||||
		   addition of integrity groups. So we disable this statement
 | 
			
		||||
| 
						 | 
				
			
			@ -1221,7 +1221,8 @@ lsaprivkeyauth (struct passwd *pw)
 | 
			
		|||
    }
 | 
			
		||||
 | 
			
		||||
  /* The key is not 0-terminated. */
 | 
			
		||||
  PWCHAR passwd = (PWCHAR) alloca (data->Length + sizeof (WCHAR));
 | 
			
		||||
  PWCHAR passwd;
 | 
			
		||||
  passwd = (PWCHAR) alloca (data->Length + sizeof (WCHAR));
 | 
			
		||||
  *wcpncpy (passwd, data->Buffer, data->Length / sizeof (WCHAR)) = L'\0';
 | 
			
		||||
  LsaFreeMemory (data);
 | 
			
		||||
  debug_printf ("Try logon for %W\\%W", domain, user);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -543,7 +543,7 @@ _everyone_sd (void *buf, ACCESS_MASK access)
 | 
			
		|||
      InitializeSecurityDescriptor (psd, SECURITY_DESCRIPTOR_REVISION);
 | 
			
		||||
      PACL dacl = (PACL) (psd + 1);
 | 
			
		||||
      InitializeAcl (dacl, MAX_DACL_LEN (1), ACL_REVISION);
 | 
			
		||||
      if (!AddAccessAllowedAce (dacl, ACL_REVISION, access, 
 | 
			
		||||
      if (!AddAccessAllowedAce (dacl, ACL_REVISION, access,
 | 
			
		||||
				well_known_world_sid))
 | 
			
		||||
	{
 | 
			
		||||
	  debug_printf ("AddAccessAllowedAce: %lu", GetLastError ());
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -52,13 +52,13 @@ get_shared_parent_dir ()
 | 
			
		|||
			_cygwin_testing ? cygwin_version.dll_build_date : "");
 | 
			
		||||
      RtlInitUnicodeString (&uname, bnoname);
 | 
			
		||||
      InitializeObjectAttributes (&attr, &uname, OBJ_INHERIT | OBJ_OPENIF,
 | 
			
		||||
                                  NULL, everyone_sd (CYG_SHARED_DIR_ACCESS));
 | 
			
		||||
				  NULL, everyone_sd (CYG_SHARED_DIR_ACCESS));
 | 
			
		||||
      status = NtCreateDirectoryObject (&dir, CYG_SHARED_DIR_ACCESS, &attr);
 | 
			
		||||
      if (!NT_SUCCESS (status))
 | 
			
		||||
        api_fatal ("NtCreateDirectoryObject(%S): %p", &uname, status);
 | 
			
		||||
	api_fatal ("NtCreateDirectoryObject(%S): %p", &uname, status);
 | 
			
		||||
    }
 | 
			
		||||
  return dir;
 | 
			
		||||
} 
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
HANDLE
 | 
			
		||||
get_session_parent_dir ()
 | 
			
		||||
| 
						 | 
				
			
			@ -77,7 +77,7 @@ get_session_parent_dir ()
 | 
			
		|||
      if (!NT_SUCCESS (status) || psi.SessionId == 0)
 | 
			
		||||
	dir = get_shared_parent_dir ();
 | 
			
		||||
      else
 | 
			
		||||
        {
 | 
			
		||||
	{
 | 
			
		||||
	  WCHAR bnoname[MAX_PATH];
 | 
			
		||||
	  __small_swprintf (bnoname,
 | 
			
		||||
			    L"\\Sessions\\BNOLINKS\\%d\\%s%s",
 | 
			
		||||
| 
						 | 
				
			
			@ -92,7 +92,7 @@ get_session_parent_dir ()
 | 
			
		|||
	}
 | 
			
		||||
    }
 | 
			
		||||
  return dir;
 | 
			
		||||
} 
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
char * __stdcall
 | 
			
		||||
shared_name (char *ret_buf, const char *str, int num)
 | 
			
		||||
| 
						 | 
				
			
			@ -150,7 +150,7 @@ open_shared (const char *name, int n, HANDLE& shared_h, DWORD size,
 | 
			
		|||
      else
 | 
			
		||||
	{
 | 
			
		||||
	  shared_h = CreateFileMapping (INVALID_HANDLE_VALUE, psa,
 | 
			
		||||
	  				PAGE_READWRITE, 0, size, mapname);
 | 
			
		||||
					PAGE_READWRITE, 0, size, mapname);
 | 
			
		||||
	  if (GetLastError () == ERROR_ALREADY_EXISTS)
 | 
			
		||||
	    m = SH_JUSTOPEN;
 | 
			
		||||
	}
 | 
			
		||||
| 
						 | 
				
			
			@ -211,7 +211,7 @@ user_shared_initialize ()
 | 
			
		|||
      /* Correct the user name with what's defined in /etc/passwd before
 | 
			
		||||
	 loading the user fstab file. */
 | 
			
		||||
      if (pw)
 | 
			
		||||
      	cygheap->user.set_name (pw->pw_name);
 | 
			
		||||
	cygheap->user.set_name (pw->pw_name);
 | 
			
		||||
      user_shared->mountinfo.init ();	/* Initialize the mount table.  */
 | 
			
		||||
      user_shared->cb =  sizeof (*user_shared);
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -358,7 +358,7 @@ spawn_guts (const char *prog_arg, const char *const *argv,
 | 
			
		|||
 | 
			
		||||
  wascygexec = real_path.iscygexec ();
 | 
			
		||||
  res = newargv.fixup (prog_arg, real_path, ext);
 | 
			
		||||
  
 | 
			
		||||
 | 
			
		||||
  if (!real_path.iscygexec ()
 | 
			
		||||
      && (cygheap->cwd.drive_length == 0
 | 
			
		||||
	  || cygheap->cwd.win32.Length >= MAX_PATH * sizeof (WCHAR)))
 | 
			
		||||
| 
						 | 
				
			
			@ -480,7 +480,7 @@ spawn_guts (const char *prog_arg, const char *const *argv,
 | 
			
		|||
    	|| (runpath[5] != L':'				/* UNC path */
 | 
			
		||||
	    && len < (MAX_PATH + 6) * sizeof (WCHAR)))
 | 
			
		||||
      {
 | 
			
		||||
        PWCHAR r = runpath + 4;
 | 
			
		||||
	PWCHAR r = runpath + 4;
 | 
			
		||||
	if (r[1] != L':') /* UNC path */
 | 
			
		||||
	  *(r += 2) = L'\\';
 | 
			
		||||
	if (!RtlIsDosDeviceName_U (r))
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -2504,7 +2504,7 @@ seteuid32 (__uid32_t uid)
 | 
			
		|||
     the privileged user instead of using the orignal token.  This can have
 | 
			
		||||
     unfortunate side effects.  The created token has different group
 | 
			
		||||
     memberships, different user rights, and misses possible network
 | 
			
		||||
     credentials. 
 | 
			
		||||
     credentials.
 | 
			
		||||
     Therefore we try this shortcut now.  When switching back to the
 | 
			
		||||
     privileged user, we probably always want a correct (aka original)
 | 
			
		||||
     user token for this privileged user, not only in sshd. */
 | 
			
		||||
| 
						 | 
				
			
			@ -2537,7 +2537,7 @@ seteuid32 (__uid32_t uid)
 | 
			
		|||
    {
 | 
			
		||||
      new_token = lsaprivkeyauth (pw_new);
 | 
			
		||||
      if (new_token)
 | 
			
		||||
        {
 | 
			
		||||
	{
 | 
			
		||||
	  /* We have to verify this token since settings in /etc/group
 | 
			
		||||
	     might render it unusable im terms of group membership. */
 | 
			
		||||
	  if (!verify_token (new_token, usersid, groups))
 | 
			
		||||
| 
						 | 
				
			
			@ -2547,7 +2547,7 @@ seteuid32 (__uid32_t uid)
 | 
			
		|||
	    }
 | 
			
		||||
	}
 | 
			
		||||
      if (!new_token)
 | 
			
		||||
        {
 | 
			
		||||
	{
 | 
			
		||||
	  debug_printf ("lsaprivkeyauth failed, try lsaauth.");
 | 
			
		||||
	  if (!(new_token = lsaauth (usersid, groups, pw_new)))
 | 
			
		||||
	    {
 | 
			
		||||
| 
						 | 
				
			
			@ -3619,7 +3619,7 @@ gen_full_path_at (char *path_ret, int dirfd, const char *pathname,
 | 
			
		|||
      if (dirfd == AT_FDCWD)
 | 
			
		||||
	p = stpcpy (path_ret, cygheap->cwd.posix);
 | 
			
		||||
      else
 | 
			
		||||
        {
 | 
			
		||||
	{
 | 
			
		||||
	  cygheap_fdget cfd (dirfd);
 | 
			
		||||
	  if (cfd < 0)
 | 
			
		||||
	    return -1;
 | 
			
		||||
| 
						 | 
				
			
			@ -3631,7 +3631,7 @@ gen_full_path_at (char *path_ret, int dirfd, const char *pathname,
 | 
			
		|||
	  p = stpcpy (path_ret, cfd->get_name ());
 | 
			
		||||
	}
 | 
			
		||||
      if (!p)
 | 
			
		||||
        {
 | 
			
		||||
	{
 | 
			
		||||
	  set_errno (ENOTDIR);
 | 
			
		||||
	  return -1;
 | 
			
		||||
	}
 | 
			
		||||
| 
						 | 
				
			
			@ -3655,7 +3655,7 @@ openat (int dirfd, const char *pathname, int flags, ...)
 | 
			
		|||
  char *path = tp.c_get ();
 | 
			
		||||
  if (gen_full_path_at (path, dirfd, pathname))
 | 
			
		||||
    return -1;
 | 
			
		||||
  
 | 
			
		||||
 | 
			
		||||
  va_list ap;
 | 
			
		||||
  mode_t mode;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -3680,11 +3680,11 @@ faccessat (int dirfd, const char *pathname, int mode, int flags)
 | 
			
		|||
      if (flags & ~(F_OK|R_OK|W_OK|X_OK))
 | 
			
		||||
	set_errno (EINVAL);
 | 
			
		||||
      else
 | 
			
		||||
	{ 
 | 
			
		||||
	{
 | 
			
		||||
	  fhandler_base *fh = build_fh_name (path, NULL,
 | 
			
		||||
					     (flags & AT_SYMLINK_NOFOLLOW)
 | 
			
		||||
					     ? PC_SYM_NOFOLLOW : PC_SYM_FOLLOW,
 | 
			
		||||
					     stat_suffixes); 
 | 
			
		||||
					     stat_suffixes);
 | 
			
		||||
	  if (fh)
 | 
			
		||||
	    {
 | 
			
		||||
	      res =  fh->fhaccess (mode);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue