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. */
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. */

View File

@ -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;

View File

@ -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.

View File

@ -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)

View File

@ -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).*/