Cygwin: (mostly) drop NT4 and Samba < 3.0 support

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This commit is contained in:
Corinna Vinschen 2024-03-20 12:31:12 +01:00
parent 14970f2645
commit 1719169604
5 changed files with 27 additions and 66 deletions

View File

@ -148,14 +148,9 @@ path_conv::isgood_inode (ino_t ino) const
are to be trusted. */ are to be trusted. */
if (ino > UINT32_MAX || !isremote ()) if (ino > UINT32_MAX || !isremote ())
return true; 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 /* 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 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 get_FileIndex). */
< 3.0) are ephemeral. */
if (fs_is_samba () && fs.samba_version () < 0x03050400) if (fs_is_samba () && fs.samba_version () < 0x03050400)
return false; return false;
/* Otherwise, trust the inode numbers unless proved otherwise. */ /* Otherwise, trust the inode numbers unless proved otherwise. */

View File

@ -293,10 +293,6 @@ fhandler_netdrive::readdir (DIR *dir, dirent *de)
char *rpath = tp.c_get (); char *rpath = tp.c_get ();
sys_wcstombs (rpath, NT_MAX_PATH, nro->lpRemoteName); sys_wcstombs (rpath, NT_MAX_PATH, nro->lpRemoteName);
de->d_ino = readdir_get_ino (rpath, false); 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; de->d_type = DT_DIR;

View File

@ -19,3 +19,5 @@ What changed:
- ps -f now prints the commandline rather than the full path to the - ps -f now prints the commandline rather than the full path to the
executable. executable.
- Drop support for NT4 and Samba < 3.0.

View File

@ -310,7 +310,8 @@ get_file_attribute (HANDLE handle, path_conv &pc,
share returns STATUS_INVALID_NETWORK_RESPONSE, which in turn is share returns STATUS_INVALID_NETWORK_RESPONSE, which in turn is
converted to ERROR_BAD_NET_RESP. This potentially occurs when trying 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 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) else if (get_errno () != ENOSYS)
{ {
if (uidret) if (uidret)

View File

@ -2459,9 +2459,6 @@ pwdgrp::fetch_account_from_windows (fetch_user_arg_t &arg, cyg_ldap *pldap)
/* Skip this when creating group entries and for non-users. */ /* Skip this when creating group entries and for non-users. */
if (is_group() || acc_type != SidTypeUser) if (is_group() || acc_type != SidTypeUser)
break; 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 /* Fetch primary group from AD and overwrite the one we
just guessed above. */ just guessed above. */
if (cldap->fetch_ad_account (sid, false, domain)) if (cldap->fetch_ad_account (sid, false, domain))
@ -2489,36 +2486,6 @@ pwdgrp::fetch_account_from_windows (fetch_user_arg_t &arg, cyg_ldap *pldap)
cygheap->ugid_cache.add_uid (id_val, uid); cygheap->ugid_cache.add_uid (id_val, uid);
} }
} }
/* 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
{
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);
}
}
/* Otherwise check account domain (local SAM).*/ /* Otherwise check account domain (local SAM).*/
else else
{ {