public inbox for cygwin-apps-cvs@sourceware.org
help / color / mirror / Atom feed
* [setup - the official Cygwin setup program] branch master, updated. release_2.923-1-g04abf40f
@ 2022-11-20 15:21 Jon TURNEY
0 siblings, 0 replies; only message in thread
From: Jon TURNEY @ 2022-11-20 15:21 UTC (permalink / raw)
To: cygwin-apps-cvs
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 11933 bytes --]
https://sourceware.org/git/gitweb.cgi?p=cygwin-apps/setup.git;h=04abf40fef99fcc592e44c62eb255cd145dabe2d
commit 04abf40fef99fcc592e44c62eb255cd145dabe2d
Author: Jon Turney <jon.turney@dronecode.org.uk>
Date: Sun Nov 20 14:28:23 2022 +0000
Fix mismatched-new-delete warning in mkwslsymlink()
Fix mismatched-new-delete warning (new in gcc 12) in mkwslsymlink(),
introduced by 93b295d6
> ../mklink2.cc: In function 'int mkwslsymlink(const char*, const char*)':
> ../mklink2.cc:194:10: error: 'void operator delete(void*)' called on pointer returned from a mismatched allocation function [-Werror=mismatched-new-delete]
> ../mklink2.cc:178:115: note: returned from 'void* operator new [](std::size_t)'
https://sourceware.org/git/gitweb.cgi?p=cygwin-apps/setup.git;h=2437c6508cb283c584e1656375c63eecf6beedc9
commit 2437c6508cb283c584e1656375c63eecf6beedc9
Author: Jon Turney <jon.turney@dronecode.org.uk>
Date: Sun Nov 20 12:09:13 2022 +0000
Revert "Drop group change while running postinstall scripts"
This reverts commit 45d8e84e692ebdda636fc84733ae9fca9ca4bf5c.
https://sourceware.org/git/gitweb.cgi?p=cygwin-apps/setup.git;h=f389d77b202d2ed7dbabc2e01e5d1550c5bb6a73
commit f389d77b202d2ed7dbabc2e01e5d1550c5bb6a73
Author: Jon Turney <jon.turney@dronecode.org.uk>
Date: Sun Nov 20 12:08:55 2022 +0000
Revert "Defer setting group until after All Users/Just For Me is chosen"
This reverts commit 495b0148b29d30a0b52f0fbc240ff9648af80516.
https://sourceware.org/git/gitweb.cgi?p=cygwin-apps/setup.git;h=67115e92ec108aa84ab1f78b052a44a89a636c42
commit 67115e92ec108aa84ab1f78b052a44a89a636c42
Author: Jon Turney <jon.turney@dronecode.org.uk>
Date: Sun Nov 20 12:08:39 2022 +0000
Revert "Drop setting root_scope as a side-effect of read_mounts()"
This reverts commit b5b442157755ec33779783188b88e3349379c79b.
https://sourceware.org/git/gitweb.cgi?p=cygwin-apps/setup.git;h=2f27eceacbfa067634319f75b6f5c521f93bdddc
commit 2f27eceacbfa067634319f75b6f5c521f93bdddc
Author: Ellie ROBIN <miiyr@inventati.org>
Date: Mon Aug 29 09:26:26 2022 +0000
Update French translation
Diff:
---
main.cc | 2 +-
mklink2.cc | 2 +-
mount.cc | 30 +++++++-----------------------
mount.h | 9 ++++++++-
po/fr/res.po | 4 +++-
postinstall.cc | 13 +++++++++++++
res/fr/res.rc | 5 +++--
root.cc | 17 -----------------
win32.cc | 13 +++++++++++--
win32.h | 2 +-
10 files changed, 48 insertions(+), 49 deletions(-)
diff --git a/main.cc b/main.cc
index ca5639cf..cd25cb28 100644
--- a/main.cc
+++ b/main.cc
@@ -359,7 +359,7 @@ WinMain (HINSTANCE h,
}
/* Set default DACL and Group. */
- nt_sec.setDefaultSecurity ();
+ nt_sec.setDefaultSecurity ((root_scope == IDC_ROOT_SYSTEM));
/*
If --symlink-type option isn't given, look for winsymlinks in CYGWIN
diff --git a/mklink2.cc b/mklink2.cc
index 098f3be2..7763ad5d 100644
--- a/mklink2.cc
+++ b/mklink2.cc
@@ -191,7 +191,7 @@ mkwslsymlink (const char *from, const char *to)
Log (LOG_PLAIN) << "FSCTL_SET_REPARSE_POINT status " << std::hex << status << endLog;
}
- delete rpl;
+ delete[] rpl;
NtClose(fh);
return NT_SUCCESS (status) ? 0 : 1;
}
diff --git a/mount.cc b/mount.cc
index a38f52ce..01363965 100644
--- a/mount.cc
+++ b/mount.cc
@@ -140,6 +140,10 @@ create_install_root ()
: "LOCAL_MACHINE\\")
<< buf << "\\rootdir = \"" << get_root_dir () << "\""
<< endLog;
+
+ // The mount table is already in the right shape at this point.
+ // Reading it again is not necessary.
+ //read_mounts (std::string ());
}
inline char *
@@ -312,6 +316,8 @@ read_mounts (const std::string val)
}
got_usr_bin = got_usr_lib = false;
+ root_scope = (nt_sec.isRunAsAdmin ())? IDC_ROOT_SYSTEM : IDC_ROOT_USER;
+
if (val.size ())
{
/* Cygwin rootdir always < MAX_PATH. */
@@ -347,6 +353,7 @@ read_mounts (const std::string val)
{
m->native = std::string (aBuffer);
m->posix = "/";
+ root_scope = isuser ? IDC_ROOT_USER : IDC_ROOT_SYSTEM;
root_here = m++;
from_fstab (m, root_here->native);
add_usr_mnts (m);
@@ -369,29 +376,6 @@ read_mounts (const std::string val)
}
}
-// set default root_scope: USER if only HKEY_CURRENT_USER registry key exists,
-// otherwise SYSTEM.
-void set_default_root_scope()
-{
- root_scope = IDC_ROOT_SYSTEM;
-
- char buf[10000];
- for (int isuser = 0; isuser <= 1; isuser++)
- {
- snprintf (buf, sizeof(buf), "Software\\%s\\%s",
- CYGWIN_INFO_CYGWIN_REGISTRY_NAME,
- CYGWIN_INFO_CYGWIN_SETUP_REGISTRY_NAME);
- HKEY key = isuser ? HKEY_CURRENT_USER : HKEY_LOCAL_MACHINE;
- if (RegOpenKeyEx (key, buf, 0, KEY_ALL_ACCESS | SETUP_KEY_WOW64,
- &key) == ERROR_SUCCESS)
- {
- RegCloseKey (key);
- root_scope = isuser ? IDC_ROOT_USER : IDC_ROOT_SYSTEM;
- break;
- }
- }
-}
-
void
set_root_dir (const std::string val)
{
diff --git a/mount.h b/mount.h
index c451a02d..a7d7e393 100644
--- a/mount.h
+++ b/mount.h
@@ -15,6 +15,11 @@
#ifndef SETUP_MOUNT_H
#define SETUP_MOUNT_H
+
+/* Finds the existing root mount, or returns NULL. istext is set to
+ nonzero if the existing mount is a text mount, else zero for
+ binary. */
+
#include <string>
#include "String++.h"
@@ -22,7 +27,9 @@
void create_install_root ();
void read_mounts (const std::string);
-void set_default_root_scope();
+
+/* Sets the cygdrive flags. Used to make the automounted drives' binary/text
+mode consistent with the standard Cygwin mounts. */
std::string cygpath (const std::string&);
void set_root_dir (const std::string);
diff --git a/po/fr/res.po b/po/fr/res.po
index ec0e52b1..8c143f7e 100644
--- a/po/fr/res.po
+++ b/po/fr/res.po
@@ -1333,6 +1333,8 @@ msgstr "Spécifie les catégories à installer"
msgid ""
"Compress installed files with Compact OS (xpress4k, xpress8k, xpress16k, lzx)"
msgstr ""
+"Compresser les fichiers installés avec Compact OS (xpress4k, xpress8k, "
+"xpress16k, lzx)"
#: STRINGTABLE.IDS_HELPTEXT_DELETE_ORPHANS
msgid "Remove orphaned packages"
@@ -1425,7 +1427,7 @@ msgstr "Ne pas avertir pour les vieilles versions de Windows"
#: STRINGTABLE.IDS_HELPTEXT_NO_WRITE_REGISTRY
msgid "Don't write root installation directory to registry"
-msgstr ""
+msgstr "Ne pas écrire le répertoire d'installation racine dans le registre"
#: STRINGTABLE.IDS_HELPTEXT_OLD_KEYS
msgid "Enable old cygwin.com keys"
diff --git a/postinstall.cc b/postinstall.cc
index 32bc401b..e990f520 100644
--- a/postinstall.cc
+++ b/postinstall.cc
@@ -249,6 +249,11 @@ do_postinstall_reflector (void *p)
// Tell the postinstall results page the results string
PostInstallResults.SetResultsString(s);
+ /* Revert primary group to admins group. This allows to create all the
+ state files written by setup as admin group owned. */
+ if (root_scope == IDC_ROOT_SYSTEM)
+ nt_sec.setAdminGroup ();
+
// Tell the progress page that we're done running scripts
Progress.PostMessageNow (WM_APP_POSTINSTALL_THREAD_COMPLETE, 0,
s.empty() ? IDD_DESKTOP : IDD_POSTINSTALL);
@@ -263,6 +268,14 @@ static HANDLE context[2];
void
do_postinstall (HINSTANCE h, HWND owner)
{
+ /* Switch back to original primary group. Otherwise we end up with a
+ broken passwd entry for the current user.
+ FIXME: Unfortunately this has the unfortunate side-effect that *all*
+ files created via postinstall are group owned by the original primary
+ group of the user. Find a way to avoid this at one point. */
+ if (root_scope == IDC_ROOT_SYSTEM)
+ nt_sec.resetPrimaryGroup ();
+
context[0] = h;
context[1] = owner;
diff --git a/res/fr/res.rc b/res/fr/res.rc
index d081bb2c..747e1dd9 100644
--- a/res/fr/res.rc
+++ b/res/fr/res.rc
@@ -648,7 +648,7 @@ BEGIN
IDS_HELPTEXT_ALLOW_UNSUPPORTED_WINDOWS "Autoriser les vieilles versions de Windows"
IDS_HELPTEXT_ARCH "Architecture à installer (x86_64 ou x86)"
IDS_HELPTEXT_CATEGORIES "Spécifie les catégories à installer"
- // IDS_HELPTEXT_COMPACTOS "XXX: missing translation"
+ IDS_HELPTEXT_COMPACTOS "Compresser les fichiers installés avec Compact OS (xpress4k, xpress8k, xpress16k, lzx)"
IDS_HELPTEXT_DELETE_ORPHANS "Supprimer les paquets orphelins"
IDS_HELPTEXT_DISABLE_ANTIVIRUS "Inhibe les anti-virus buggés à l'exécution"
IDS_HELPTEXT_DOWNLOAD "Télécharger depuis internet"
@@ -669,7 +669,8 @@ BEGIN
IDS_HELPTEXT_NO_VERIFY "Ne pas vérifier les signatures de setup.ini"
IDS_HELPTEXT_NO_VERSION_CHECK "Ne pas vérifier si une version plus récente de l'assistant est disponible"
IDS_HELPTEXT_NO_WARN_DEPRECATED_WINDOWS "Ne pas avertir pour les vieilles versions de Windows"
- // IDS_HELPTEXT_NO_WRITE_REGISTRY "XXX: missing translation"
+ IDS_HELPTEXT_NO_WRITE_REGISTRY
+ "Ne pas écrire le répertoire d'installation racine dans le registre"
IDS_HELPTEXT_OLD_KEYS "Utiliser les anciennes clés de cygwin.com"
IDS_HELPTEXT_ONLY_SITE "Ignorer tous les sites sauf ceux spécifiés par -s"
IDS_HELPTEXT_PACKAGES "Spécifie les paquets à installer"
diff --git a/root.cc b/root.cc
index ccbd6ae3..1723a532 100644
--- a/root.cc
+++ b/root.cc
@@ -259,18 +259,6 @@ RootPage::OnInit ()
if (!get_root_dir ().size())
read_mounts (std::string ());
orig_root_dir = get_root_dir();
-
- if (!nt_sec.isRunAsAdmin())
- {
- // disable IDC_ROOT_SYSTEM if not running as admin
- EnableWindow(GetDlgItem(IDC_ROOT_SYSTEM), FALSE);
- root_scope = IDC_ROOT_USER;
- }
- else
- {
- set_default_root_scope();
- }
-
load_dialog (GetHWND ());
}
@@ -309,11 +297,6 @@ RootPage::OnNext ()
Log (LOG_PLAIN) << "root: " << get_root_dir ()
<< (root_scope == IDC_ROOT_USER ? " user" : " system") << endLog;
- if (root_scope == IDC_ROOT_SYSTEM)
- nt_sec.setAdminGroup ();
- else
- nt_sec.resetPrimaryGroup ();
-
return 0;
}
diff --git a/win32.cc b/win32.cc
index ea3d53af..55072a90 100644
--- a/win32.cc
+++ b/win32.cc
@@ -308,7 +308,7 @@ NTSecurity::setAdminGroup ()
}
void
-NTSecurity::setDefaultSecurity ()
+NTSecurity::setDefaultSecurity (bool isAdmin)
{
/* Get the processes access token. */
if (!OpenProcessToken (GetCurrentProcess (),
@@ -350,7 +350,11 @@ NTSecurity::setDefaultSecurity ()
NoteFailedAPI ("SetTokenInformation(owner)");
return;
}
- /* Get original primary group */
+ /* Get original primary group. The token's primary group will be reset
+ to the original group right before we call the postinstall scripts.
+ This is necessary, otherwise, if the installing user is a domain user,
+ the group information created by the postinstall calls to `mkpasswd -c,
+ mkgroup -c' will be plain wrong. */
if (!GetTokenInformation (token.theHANDLE (), TokenPrimaryGroup,
&primaryGroupSID, sizeof primaryGroupSID, &size))
{
@@ -358,6 +362,11 @@ NTSecurity::setDefaultSecurity ()
primaryGroupSID.pgrp.PrimaryGroup = (PSID) NULL;
}
groupSID = primaryGroupSID.pgrp.PrimaryGroup;
+ /* Try to set the primary group to the Administrators group, but only if
+ "Install for all users" has been chosen. If it doesn't work, we're
+ no admin and that's all there's to say about it. */
+ if (isAdmin)
+ setAdminGroup ();
}
bool
diff --git a/win32.h b/win32.h
index bf3ff101..02c1d06e 100644
--- a/win32.h
+++ b/win32.h
@@ -130,7 +130,7 @@ public:
void resetPrimaryGroup();
void setAdminGroup ();
void initialiseWellKnownSIDs ();
- void setDefaultSecurity ();
+ void setDefaultSecurity(bool isAdmin);
bool isRunAsAdmin ();
bool hasSymlinkCreationRights ();
private:
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-11-20 15:21 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-20 15:21 [setup - the official Cygwin setup program] branch master, updated. release_2.923-1-g04abf40f Jon TURNEY
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).