| delorie.com/archives/browse.cgi | search |
| X-Recipient: | archive-cygwin AT delorie DOT com |
| DomainKey-Signature: | a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id |
| :list-unsubscribe:list-subscribe:list-archive:list-post | |
| :list-help:sender:from:to:references:in-reply-to:subject:date | |
| :message-id:mime-version:content-type; q=dns; s=default; b=iPDxq | |
| hIa4xjhGvBn5KOL7VsU/OdhrD/cs2ft4yxVN78IoGLLDDCx8rHQB4A/4ufBqCWXT | |
| zoaY2RJrl+JUrpd2VOe8l5suLOTrurjjPG3PIs6PhQkyXWxE7+o0mi71/snyuvmn | |
| rFnsNxVKgqbH733FOyBYWku6M2R6I8uiJ2GvRM= | |
| DKIM-Signature: | v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id |
| :list-unsubscribe:list-subscribe:list-archive:list-post | |
| :list-help:sender:from:to:references:in-reply-to:subject:date | |
| :message-id:mime-version:content-type; s=default; bh=zWYPnU0scN+ | |
| 6D0+wynlRDBt0U58=; b=fx3vWLHhjGUY7vdET/EgXMdNEuClnthh3IcJzbdkfNg | |
| V0Ff1DnqsslN4DXruUUwJaNCl5vsrANxnWwxYyT9+2iUxfEeTuPo2PPXM7Qs3Pc+ | |
| inetRutO9f57zF0tg3XooCIlTykDbg5sUQX82Ajxd9oj8UQZTIUOCNwTw2a+IaIM | |
| = | |
| Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
| List-Id: | <cygwin.cygwin.com> |
| List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> |
| List-Archive: | <http://sourceware.org/ml/cygwin/> |
| List-Post: | <mailto:cygwin AT cygwin DOT com> |
| List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs> |
| Sender: | cygwin-owner AT cygwin DOT com |
| Mail-Followup-To: | cygwin AT cygwin DOT com |
| Delivered-To: | mailing list cygwin AT cygwin DOT com |
| Authentication-Results: | sourceware.org; auth=none |
| X-Virus-Found: | No |
| X-Spam-SWARE-Status: | No, score=0.9 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE,SPF_SOFTFAIL autolearn=no version=3.3.2 |
| X-HELO: | vms173021pub.verizon.net |
| X-CMAE-Score: | 0 |
| X-CMAE-Analysis: | v=2.1 cv=GLe/yVJP c=1 sm=1 tr=0 a=++QE0vWJ+/OcbE0B+pKMCw==:117 a=qpBMU8TwT7QA:10 a=o83nqyVRAAAA:8 a=oR5dmqMzAAAA:8 a=-9mUelKeXuEA:10 a=DAwyPP_o2Byb1YXLmDAA:9 a=Zr7miEi8wWIA:10 a=cKsnjEOsciEA:10 a=tdPNcO0outDDvE5JKcIA:9 a=QEXdDO2ut3YA:10 a=g923L2GS_aeYgUanU2wA:9 |
| From: | "Pierre A. Humblet" <Pierre DOT Humblet AT ieee DOT org> |
| To: | <cygwin AT cygwin DOT com> |
| References: | <20141106155247 DOT GA32104 AT calimero DOT vinschen DOT de> <CAAb7UtARFLmr7VJfsdHaYgQM-xa8vtvvUKznzfr9QsMv=cioFQ AT mail DOT gmail DOT com> <20141106185102 DOT GL28195 AT calimero DOT vinschen DOT de> |
| In-reply-to: | |
| Subject: | RE: TEST RELEASE: Cygwin 1.7.33-0.7 |
| Date: | Fri, 07 Nov 2014 13:04:49 -0500 |
| Message-id: | <044301cffab5$52eca9e0$f8c5fda0$@ieee.org> |
| MIME-version: | 1.0 |
------=_NextPart_000_0444_01CFFA8B.6A1FA290
Content-Type: text/plain;
charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
> -----Original Message-----
> From: Pierre A. Humblet=20
> Sent: Thursday, November 06, 2014 16:09
>=20
> > -----Original Message-----
> > From: Corinna Vinschen
> > Sent: Thursday, November 06, 2014 13:51
> >
> > On Nov 6 13:38, Kelley Cook wrote:
> > > On Thu, Nov 6, 2014 at 10:52 AM, Corinna Vinschen wrote:
> > > > Hi Cygwin friends and users,
> > > >
> > > >
> > > > I just released a 7th TEST version of the next upcoming Cygwin
> > > > release, 1.7.33-0.7.
> > > >
> > >
> > > I discovered that /usr/bin/cron-config which is part of the cron
> > > package will need to be updated as it attempts to parse /etc/group .
> >
> > Right, it should use getent instead. Pierre?
>=20
> Right, and ditto for exim config and postinstall How much time do I have?
>=20
> Now cron-config checks if a username appears multiple times in passwd.
> Typically one instance is a domain id and the other one is a local id.
> That causes havoc with cron
> It happens fairly frequently; there was even such a "bug report" recently.
>=20
> How does getent handle that case? Is it detectable from a config file?
=20
Corinna
I just realized that deleting the /etc/passwd file in existing domain syste=
ms may change usernames, which will break cron and other programs that use =
files named after usernames. Also the (local) privileged username will chan=
ge.
For now I have made the following changes to cron-config:
calling getent
checking if /etc/passwd exists
dealing with the extended names for privileged users (they may contain a =
+, don't use EREs)=20=20
Do you intend to keep mkpasswd/mkgroup ?
I still don't have a 64 bit system, but it's coming this year. It will take=
me some time to prepare a new cron package and get familiar with the new p=
ackage upload procedure.=20
I am attaching a cron-config diff. Feel free to update the 32 and 64 bit cr=
on packages if you want that done quickly.
cronbug does not seem to require any changes.
Pierre
------=_NextPart_000_0444_01CFFA8B.6A1FA290
Content-Type: application/octet-stream;
name="cron-config.diff"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
filename="cron-config.diff"
--- cron-config.orig 2014-11-06 15:15:35.037348900 -0500=0A=
+++ cron-config 2014-11-07 12:52:53.970746100 -0500=0A=
@@ -138,114 +138,41 @@ get_NT() {=0A=
return 0=0A=
} # =3D=3D=3D End of get_NT() =3D=3D=3D #=0A=
=20=0A=
-# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A=
-# Routine: warning_for_etc_file=0A=
-# Display a warning message for the user about overwriting the specified=
=0A=
-# file in /etc.=0A=
-# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A=
-warning_for_etc_file() {=0A=
- echo=0A=
- echo "WARNING: The command above overwrites any existing /etc/$1."=0A=
- echo "You may want to preserve /etc/$1 before generating a new,"=0A=
- echo "one, and then compare your saved /etc/$1 file with the"=0A=
- echo "newly-generated one in case you need to restore other"=0A=
- echo "entries."=0A=
- echo=0A=
-} # =3D=3D=3D warning_for_etc_file() =3D=3D=3D #=0A=
-=0A=
=20=0A=
# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A=
# Routine: get_system_and_admins_gids=0A=
-# Get the ADMINs ids from /etc/group and /etc/passwd=0A=
+# Get the ADMINs ids from group and passwd=0A=
# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A=
get_system_and_admins_ids() {=0A=
ret=3D0=0A=
- for fname in /etc/passwd /etc/group; do=0A=
- if ls -ld "${fname}" | grep -Eq '^-r..r..r..'; then=0A=
- true=0A=
- else=0A=
- echo "The file $fname is not readable by all."=0A=
- echo "Please run 'chmod +r $fname'."=0A=
- echo=0A=
- ret=3D1=0A=
- fi=0A=
- done=0A=
-=0A=
- [ ! -r /etc/passwd -o ! -r /etc/group ] && return 1;=0A=
+ ADMINSGID=3D$(getent group S-1-5-32-544 | sed -e 's/[^:]*:[^:]*:\([0-9=
]*\):.*$/\1/')=0A=
+ SYSTEMGID=3D$(getent group S-1-5-18 | sed -e 's/[^:]*:[^:]*:\([0-9]*\)=
:.*$/\1/')=0A=
+ ADMINSUID=3D$(getent passwd S-1-5-32-544 | sed -e 's/[^:]*:[^:]*:\([0-=
9]*\):.*$/\1/')=0A=
+ SYSTEMUID=3D$(getent passwd S-1-5-18 | sed -e 's/[^:]*:[^:]*:\([0-9]*\=
):.*$/\1/')=0A=
=20=0A=
- ADMINSGID=3D$(sed -ne '/^[^:]*:S-1-5-32-544:.*:/{s/[^:]*:[^:]*:\([0-9]=
*\):.*$/\1/p;q}' /etc/group)=0A=
- SYSTEMGID=3D$(sed -ne '/^[^:]*:S-1-5-18:.*:/{s/[^:]*:[^:]*:\([0-9]*\):=
.*$/\1/p;q}' /etc/group)=0A=
if [ -z "$ADMINSGID" -o -z "$SYSTEMGID" ]; then=0A=
- echo "It appears that you do not have correct entries for the"=0A=
- echo "ADMINISTRATORS and/or SYSTEM sids in /etc/group."=0A=
- echo=0A=
- echo "Use the 'mkgroup' utility to generate them"=0A=
- echo " mkgroup -l > /etc/group"=0A=
- warning_for_etc_file group=0A=
+ echo "Entries for the ADMINISTRATORS and/or SYSTEM sids are not found in=
group."=0A=
ret=3D1;=0A=
fi=0A=
=20=0A=
- ADMINSUID=3D$(sed -ne '/^[^:]*:[^:]*:[0-9]*:[0-9]*:[^:]*,S-1-5-32-544:=
.*:/{s/[^:]*:[^:]*:\([0-9]*\):.*$/\1/p;q}' /etc/passwd)=0A=
- SYSTEMUID=3D$(sed -ne '/^[^:]*:[^:]*:[0-9]*:[0-9]*:[^:]*,S-1-5-18:.*:/=
{s/[^:]*:[^:]*:\([0-9]*\):.*$/\1/p;q}' /etc/passwd)=0A=
if [ -z "$ADMINSUID" -o -z "$SYSTEMUID" ]; then=0A=
- echo "It appears that you do not have correct entries for the"=0A=
- echo "ADMINISTRATORS and/or SYSTEM sids in /etc/passwd."=0A=
- echo=0A=
- echo "Use the 'mkpasswd' utility to generate it"=0A=
- echo " mkpasswd -l > /etc/passwd."=0A=
- warning_for_etc_file passwd=0A=
+ echo "Entries for the ADMINISTRATORS and/or SYSTEM sids are not found in=
passwd."=0A=
ret=3D1;=0A=
fi=0A=
return "${ret}"=0A=
} # =3D=3D=3D get_system_and_admins_ids() =3D=3D=3D #=0A=
=20=0A=
-# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A=
-# Routine: check_passwd_and_group=0A=
-# Check to see whether the user's password ID and group exist in the=0A=
-# system /etc/passwd and /etc/group files, respectively.=0A=
-# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A=
-check_passwd_and_group() {=0A=
- ret=3D0=0A=
- if [ "$(id -gn)" =3D "mkpasswd" ]; then=0A=
- echo "It appears that you do not have an entry for your user ID"=0A=
- echo "in /etc/passwd."=0A=
- echo=0A=
- echo "If so, use the 'mkpasswd' utility to generate an"=0A=
- echo "entry for your User ID in the password file:"=0A=
- echo " mkpasswd -l -u User_ID >> /etc/passwd"=0A=
- echo "or"=0A=
- echo " mkpasswd -d -u User_ID >> /etc/passwd."=0A=
- echo=0A=
- ret=3D1=0A=
- fi=0A=
-=0A=
- if [ "$(id -gn)" =3D mkgroup ]; then=0A=
- echo "It appears that you do not have an entry for your group ID"=0A=
- echo "in /etc/group. If this check is incorrect, then re-run"=0A=
- echo "this script with the '-f' command-line option."=0A=
- echo=0A=
- echo "Otherwise, use the 'mkgroup' utility to generate an"=0A=
- echo "entry for your group ID in the password file:"=0A=
- echo " mkgroup -l -g Group_id >> /etc/group"=0A=
- echo "or"=0A=
- echo " mkgroup -d -g Group_id >> /etc/group."=0A=
- echo=0A=
- ret=3D1=0A=
- fi=0A=
- return "${ret}"=0A=
-} # =3D=3D=3D End of check_passwd_and_group() =3D=3D=3D #=0A=
=20=0A=
# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A=
# Routine: check_user=0A=
-# Check to see that the specified user exists once in /etc/passwd=20=0A=
+# Check that the specified user does no exists more than once in /etc/pass=
wd=20=0A=
# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A=
check_user() {=0A=
- count=3D$(grep -ic "^$1:" /etc/passwd)=0A=
- if [ $count =3D 0 ]; then=0A=
- echo "ERROR: User $1 does not appear in /etc/passwd."=0A=
- echo=0A=
- return 1;=0A=
+=20=20=0A=
+ if [ ! -e /etc/passwd ]; then=0A=
+ return 0;=0A=
fi=0A=
+ count=3D$(grep -ic "^$1:" /etc/passwd)=0A=
if [ $count -gt 1 ]; then=0A=
echo "WARNING: User $1 appears $count times in /etc/passwd."=0A=
echo "This may confuse the system."=0A=
@@ -489,7 +416,6 @@ cron_diagnose() {=0A=
fi=0A=
=20=0A=
get_system_and_admins_ids || return 1=0A=
- check_passwd_and_group || return 1=0A=
=20=0A=
if [ "$username" =3D "$USER" ]=0A=
then=0A=
@@ -659,15 +585,22 @@ create_user() {=0A=
fi=0A=
fi=0A=
pwd_entry=3D"$(mkpasswd -l -u "${username}" | sed -e 's?\(^[^:]*:[^:]*=
:[^:]*:[^:]*:[^:]*:\).*?\1/var/empty:/bin/false?')"=0A=
- grep -Eiq "^${username}:" "${SYSCONFDIR}/passwd" && username_in_passwd=
=3Dyes &&=0A=
- grep -Fiq "${pwd_entry}" "${SYSCONFDIR}"/passwd && entry_in_passwd=
=3Dyes=0A=
- if [ "${entry_in_passwd}" !=3D "yes" ]; then=0A=
- if [ "${username_in_passwd}" =3D "yes" ]; then=0A=
- temp=3D"${TEMP_DIR}/passwd.$$.tmp"=0A=
- grep -Ev "^${username}:" "${SYSCONFDIR}/passwd" > "${temp}" &&=0A=
- mv -f "${temp}" "${SYSCONFDIR}/passwd" || return 1=0A=
- fi=0A=
- echo "${pwd_entry}" >> "${SYSCONFDIR}/passwd" || ret=3D1=0A=
+ fullusername=3D$(echo "$pwd_entry" | sed -e 's/^\([^:]*\):.*$/\1/')=20=
=0A=
+ if [ ! -e "${SYSCONFDIR}/passwd" ]; then=0A=
+ echo "${pwd_entry}" > "${SYSCONFDIR}/passwd" || ret=3D1=0A=
+ chown "${ADMINSUID}" "${SYSCONFDIR}/passwd"=0A=
+ chmod 644 "${SYSCONFDIR}/passwd"=0A=
+ else=0A=
+ grep -iq "^${fullusername}:" "${SYSCONFDIR}/passwd" && username_in_pa=
sswd=3Dyes &&=0A=
+ grep -Fiq "${pwd_entry}" "${SYSCONFDIR}"/passwd && entry_in_passwd=
=3Dyes=0A=
+ if [ "${entry_in_passwd}" !=3D "yes" ]; then=0A=
+ if [ "${username_in_passwd}" =3D "yes" ]; then=0A=
+ temp=3D"${TEMP_DIR}/passwd.$$.tmp"=0A=
+ grep -iv "^${fullusername}:" "${SYSCONFDIR}/passwd" > "${temp}" &&=
=0A=
+ mv -f "${temp}" "${SYSCONFDIR}/passwd" || return 1=0A=
+ fi=0A=
+ echo "${pwd_entry}" >> "${SYSCONFDIR}/passwd" || ret=3D1=0A=
+ fi=0A=
fi=0A=
return "${ret}"=0A=
}=0A=
------=_NextPart_000_0444_01CFFA8B.6A1FA290
Content-Type: text/plain; charset=us-ascii
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
------=_NextPart_000_0444_01CFFA8B.6A1FA290--
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |