* passwd.cc (pwdgrp::read_passwd): Check if we're called within
user_shared initialization and ignore myself, if so. Reformat conditional expression.
This commit is contained in:
parent
054dcc734c
commit
df54adb746
|
@ -1,3 +1,9 @@
|
||||||
|
2008-10-21 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
|
* passwd.cc (pwdgrp::read_passwd): Check if we're called within
|
||||||
|
user_shared initialization and ignore myself, if so. Reformat
|
||||||
|
conditional expression.
|
||||||
|
|
||||||
2008-10-20 Corinna Vinschen <corinna@vinschen.de>
|
2008-10-20 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
* ntdll.h (NtSetAttributesFile): New inline function.
|
* ntdll.h (NtSetAttributesFile): New inline function.
|
||||||
|
|
|
@ -19,6 +19,7 @@ details. */
|
||||||
#include "pinfo.h"
|
#include "pinfo.h"
|
||||||
#include "cygheap.h"
|
#include "cygheap.h"
|
||||||
#include "pwdgrp.h"
|
#include "pwdgrp.h"
|
||||||
|
#include "shared_info.h"
|
||||||
|
|
||||||
/* Read /etc/passwd only once for better performance. This is done
|
/* Read /etc/passwd only once for better performance. This is done
|
||||||
on the first call that needs information from it. */
|
on the first call that needs information from it. */
|
||||||
|
@ -62,20 +63,22 @@ pwdgrp::read_passwd ()
|
||||||
add_line (pretty_ls);
|
add_line (pretty_ls);
|
||||||
cygsid tu = cygheap->user.sid ();
|
cygsid tu = cygheap->user.sid ();
|
||||||
tu.string (strbuf);
|
tu.string (strbuf);
|
||||||
if (myself->uid == ILLEGAL_UID)
|
if (!user_shared->cb || myself->uid == ILLEGAL_UID)
|
||||||
searchentry = !internal_getpwsid (tu);
|
searchentry = !internal_getpwsid (tu);
|
||||||
if (searchentry &&
|
if (searchentry
|
||||||
(!(pw = internal_getpwnam (cygheap->user.name ())) ||
|
&& (!(pw = internal_getpwnam (cygheap->user.name ()))
|
||||||
(myself->uid != ILLEGAL_UID &&
|
|| !user_shared->cb
|
||||||
myself->uid != (__uid32_t) pw->pw_uid &&
|
|| (myself->uid != ILLEGAL_UID
|
||||||
!internal_getpwuid (myself->uid))))
|
&& myself->uid != (__uid32_t) pw->pw_uid
|
||||||
|
&& !internal_getpwuid (myself->uid))))
|
||||||
{
|
{
|
||||||
static char linebuf[1024]; // must be static and
|
static char linebuf[1024]; // must be static and
|
||||||
// should not be NO_COPY
|
// should not be NO_COPY
|
||||||
snprintf (linebuf, sizeof (linebuf), "%s:*:%lu:%lu:,%s:%s:/bin/sh",
|
snprintf (linebuf, sizeof (linebuf), "%s:*:%lu:%lu:,%s:%s:/bin/sh",
|
||||||
cygheap->user.name (),
|
cygheap->user.name (),
|
||||||
myself->uid == ILLEGAL_UID ? UNKNOWN_UID : myself->uid,
|
(!user_shared->cb || myself->uid == ILLEGAL_UID)
|
||||||
myself->gid,
|
? UNKNOWN_UID : myself->uid,
|
||||||
|
!user_shared->cb ? UNKNOWN_GID : myself->gid,
|
||||||
strbuf, getenv ("HOME") ?: "");
|
strbuf, getenv ("HOME") ?: "");
|
||||||
debug_printf ("Completing /etc/passwd: %s", linebuf);
|
debug_printf ("Completing /etc/passwd: %s", linebuf);
|
||||||
add_line (linebuf);
|
add_line (linebuf);
|
||||||
|
|
Loading…
Reference in New Issue