public inbox for cygwin-cvs@sourceware.org
help / color / mirror / Atom feed
* [newlib-cygwin/main] Cygwin: (mostly) drop NT4 and Samba < 3.0 support
@ 2024-03-20 13:49 Corinna Vinschen
  0 siblings, 0 replies; only message in thread
From: Corinna Vinschen @ 2024-03-20 13:49 UTC (permalink / raw)
  To: cygwin-cvs

https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=17191696040a59dfbdc092d0ffe938a17039baed

commit 17191696040a59dfbdc092d0ffe938a17039baed
Author:     Corinna Vinschen <corinna@vinschen.de>
AuthorDate: Wed Mar 20 12:31:12 2024 +0100
Commit:     Corinna Vinschen <corinna@vinschen.de>
CommitDate: Wed Mar 20 12:31:50 2024 +0100

    Cygwin: (mostly) drop NT4 and Samba < 3.0 support
    
    Signed-off-by: Corinna Vinschen <corinna@vinschen.de>

Diff:
---
 winsup/cygwin/fhandler/disk_file.cc |  7 +---
 winsup/cygwin/fhandler/netdrive.cc  |  4 --
 winsup/cygwin/release/3.6.0         |  2 +
 winsup/cygwin/sec/base.cc           |  3 +-
 winsup/cygwin/uinfo.cc              | 77 +++++++++++--------------------------
 5 files changed, 27 insertions(+), 66 deletions(-)

diff --git a/winsup/cygwin/fhandler/disk_file.cc b/winsup/cygwin/fhandler/disk_file.cc
index 9aadbb539f01..c5b78984d72a 100644
--- a/winsup/cygwin/fhandler/disk_file.cc
+++ b/winsup/cygwin/fhandler/disk_file.cc
@@ -148,14 +148,9 @@ path_conv::isgood_inode (ino_t ino) const
      are to be trusted. */
   if (ino > UINT32_MAX || !isremote ())
     return true;
-  /* The inode numbers returned from a remote NT4 NTFS are ephemeral
-     32 bit numbers. */
-  if (fs_is_ntfs ())
-    return false;
   /* Starting with version 3.5.4, Samba returns the real inode numbers, if
      the file is on the same device as the root of the share (Samba function
-     get_FileIndex).  32 bit inode numbers returned by older versions (likely
-     < 3.0) are ephemeral. */
+     get_FileIndex). */
   if (fs_is_samba () && fs.samba_version () < 0x03050400)
     return false;
   /* Otherwise, trust the inode numbers unless proved otherwise. */
diff --git a/winsup/cygwin/fhandler/netdrive.cc b/winsup/cygwin/fhandler/netdrive.cc
index 58ab8811b0f8..7c3207139846 100644
--- a/winsup/cygwin/fhandler/netdrive.cc
+++ b/winsup/cygwin/fhandler/netdrive.cc
@@ -293,10 +293,6 @@ fhandler_netdrive::readdir (DIR *dir, dirent *de)
 	  char *rpath = tp.c_get ();
 	  sys_wcstombs (rpath, NT_MAX_PATH, nro->lpRemoteName);
 	  de->d_ino = readdir_get_ino (rpath, false);
-	  /* We can't trust remote inode numbers of only 32 bit.  That means,
-	     remote NT4 NTFS, as well as shares of Samba version < 3.0. */
-	  if (de->d_ino <= UINT32_MAX)
-	    de->d_ino = hash_path_name (0, rpath);
 	}
       de->d_type = DT_DIR;
 
diff --git a/winsup/cygwin/release/3.6.0 b/winsup/cygwin/release/3.6.0
index 20aab2b44dc8..8d9e483803e0 100644
--- a/winsup/cygwin/release/3.6.0
+++ b/winsup/cygwin/release/3.6.0
@@ -19,3 +19,5 @@ What changed:
 
 - ps -f now prints the commandline rather than the full path to the
   executable.
+
+- Drop support for NT4 and Samba < 3.0.
diff --git a/winsup/cygwin/sec/base.cc b/winsup/cygwin/sec/base.cc
index 0fc8699bfc9e..d5e39d281aee 100644
--- a/winsup/cygwin/sec/base.cc
+++ b/winsup/cygwin/sec/base.cc
@@ -310,7 +310,8 @@ get_file_attribute (HANDLE handle, path_conv &pc,
 	 share returns STATUS_INVALID_NETWORK_RESPONSE, which in turn is
 	 converted to ERROR_BAD_NET_RESP.  This potentially occurs when trying
 	 to fetch DACLs from a NT4 machine which is not part of the domain of
-	 the requesting machine. */
+	 the requesting machine.
+	 FIXME: We dropped NT4 support, but are there other scenarios? */
       else if (get_errno () != ENOSYS)
 	{
 	  if (uidret)
diff --git a/winsup/cygwin/uinfo.cc b/winsup/cygwin/uinfo.cc
index acbc945e41d9..27dc2892c859 100644
--- a/winsup/cygwin/uinfo.cc
+++ b/winsup/cygwin/uinfo.cc
@@ -2459,64 +2459,31 @@ pwdgrp::fetch_account_from_windows (fetch_user_arg_t &arg, cyg_ldap *pldap)
 	      /* Skip this when creating group entries and for non-users. */
 	      if (is_group() || acc_type != SidTypeUser)
 		break;
-	      /* On AD machines, use LDAP to fetch domain account infos. */
-	      if (cygheap->dom.primary_dns_name ())
+	      /* Fetch primary group from AD and overwrite the one we
+		 just guessed above. */
+	      if (cldap->fetch_ad_account (sid, false, domain))
 		{
-		  /* Fetch primary group from AD and overwrite the one we
-		     just guessed above. */
-		  if (cldap->fetch_ad_account (sid, false, domain))
-		    {
-		      if ((val = cldap->get_account_name ()))
-			wcscpy (name, val);
-		      if ((id_val = cldap->get_primary_gid ()) != ILLEGAL_GID)
-			gid = posix_offset + id_val;
-		    }
-		  home = cygheap->pg.get_home (cldap, sid, dom, domain,
-					       name, fully_qualified_name);
-		  shell = cygheap->pg.get_shell (cldap, sid, dom, domain,
-						 name,
-						 fully_qualified_name);
-		  gecos = cygheap->pg.get_gecos (cldap, sid, dom, domain,
-						 name, fully_qualified_name);
-		  /* Check and, if necessary, add unix<->windows id mapping
-		     on the fly, unless we're called from getpwent. */
-		  if (!pldap && cldap->is_open ())
-		    {
-		      id_val = cldap->get_unix_uid ();
-		      if (id_val != ILLEGAL_UID
-			  && cygheap->ugid_cache.get_uid (id_val)
-			     == ILLEGAL_UID)
-			cygheap->ugid_cache.add_uid (id_val, uid);
-		    }
+		  if ((val = cldap->get_account_name ()))
+		    wcscpy (name, val);
+		  if ((id_val = cldap->get_primary_gid ()) != ILLEGAL_GID)
+		    gid = posix_offset + id_val;
 		}
-	      /* If primary_dns_name() is empty, we're likely running under an
-		 NT4 domain, so we can't use LDAP.  For user accounts fall back
-		 to NetUserGetInfo.  This isn't overly fast, but keep in mind
-		 that NT4 domains are mostly replaced by AD these days. */
-	      else
+	      home = cygheap->pg.get_home (cldap, sid, dom, domain,
+					   name, fully_qualified_name);
+	      shell = cygheap->pg.get_shell (cldap, sid, dom, domain,
+					     name,
+					     fully_qualified_name);
+	      gecos = cygheap->pg.get_gecos (cldap, sid, dom, domain,
+					     name, fully_qualified_name);
+	      /* Check and, if necessary, add unix<->windows id mapping
+		 on the fly, unless we're called from getpwent. */
+	      if (!pldap && cldap->is_open ())
 		{
-		  WCHAR server[INTERNET_MAX_HOST_NAME_LENGTH + 3];
-		  NET_API_STATUS nas;
-		  PUSER_INFO_3 ui;
-
-		  if (!get_logon_server (cygheap->dom.primary_flat_name (),
-					 server, DS_IS_FLAT_NAME))
-		    break;
-		  nas = NetUserGetInfo (server, name, 3, (PBYTE *) &ui);
-		  if (nas != NERR_Success)
-		    {
-		      debug_printf ("NetUserGetInfo(%W) %u", name, nas);
-		      break;
-		    }
-		  /* Overwrite name to be sure case is same as in SAM */
-		  wcscpy (name, ui->usri3_name);
-		  gid = posix_offset + ui->usri3_primary_group_id;
-		  home = cygheap->pg.get_home (ui, sid, dom, name,
-					       fully_qualified_name);
-		  shell = cygheap->pg.get_shell (ui, sid, dom, name,
-						 fully_qualified_name);
-		  gecos = cygheap->pg.get_gecos (ui, sid, dom, name,
-						 fully_qualified_name);
+		  id_val = cldap->get_unix_uid ();
+		  if (id_val != ILLEGAL_UID
+		      && cygheap->ugid_cache.get_uid (id_val)
+			 == ILLEGAL_UID)
+		    cygheap->ugid_cache.add_uid (id_val, uid);
 		}
 	    }
 	  /* Otherwise check account domain (local SAM).*/

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-03-20 13:49 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-20 13:49 [newlib-cygwin/main] Cygwin: (mostly) drop NT4 and Samba < 3.0 support Corinna Vinschen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).