delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2009/03/20/09:39:21

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-1.3 required=5.0 tests=AWL,BAYES_00,J_CHICKENPOX_64,SARE_MSGID_LONG40,SPF_PASS
X-Spam-Check-By: sourceware.org
MIME-Version: 1.0
In-Reply-To: <af075b00903191649j64e9e301s74b591bcbddef120@mail.gmail.com>
References: <af075b00903190936y1dd515fdi237abe92d7321b1b AT mail DOT gmail DOT com> <20090319182945 DOT GA9322 AT calimero DOT vinschen DOT de> <af075b00903191649j64e9e301s74b591bcbddef120 AT mail DOT gmail DOT com>
Date: Fri, 20 Mar 2009 14:39:01 +0000
Message-ID: <af075b00903200739t45e62630yb8b2ab9863a85620@mail.gmail.com>
Subject: Re: syslog-ng: some packaging glitches
From: Julio Emanuel <costaju AT gmail DOT com>
To: cygwin AT cygwin DOT com
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT 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

On Thu, Mar 19, 2009 at 23:49, Julio Emanuel wrote:
> On Thu, Mar 19, 2009 at 18:29, Corinna Vinschen wrote:
>>
>>> Now, for the part I didn't manage to solve yet: the syslog-ng service
>>> also spits this warning (error?) when starting: "Error resolving user;
>>> user=3D'system'", but I have the 'vanilla' system entry in /etc/passwd:
>>> ~ $ grep system /etc/passwd
>>> system:*:18:544:,S-1-5-18::
>>> and indeed all does seem well:
>>> ~ $ id system
>>> uid=3D18(system) gid=3D544(Administrators) groups=3D544(Administrators)
>>>
>>> Is it any misleading message, maybe?
>>
>> Is the /etc/syslog-ng.conf file owned by the system user?
>>
>
> ~ $ ls -l /etc/syslog-ng.conf
> -rw-r--r--+ 1 security Domain Users 1171 Mar 19 16:07 /etc/syslog-ng.conf
>
> No it isn't. it is owned by an admin user named 'security' . Should be
> owned by system?
> Note that the default config contains the lines
> =C2=A0owner("SYSTEM");
> =C2=A0group("root");
> =C2=A0perm(0660);
> that defines the default ownership and mode of created files.
> But this IS working:
> ~ $ ls -l /var/log/*messages
> -rw-rw---- 1 system root 1854 Mar 19 23:28 /var/log/20090319_messages
>
> And so this error message (from /var/log/syslog-ng.log) seems to be
> misleading...
> Is there anything I can do to help hunting down the root cause (if
> there is a need to do so)?
>

Answering to myself: after some source code analysis, I've arrived to
this tiny function in misc.c:

gboolean
resolve_user(const char *user, uid_t *uid)
{
  struct passwd *pw;

  *uid =3D 0;
  if (*user)
    return FALSE;

  pw =3D getpwnam(user);
  if (pw)
    {
      *uid =3D pw->pw_uid;
    }
  else
    {
      gchar *endptr;

      *uid =3D strtol(user, &endptr, 0);
      if (*endptr)
        return FALSE;
    }
  return TRUE;
}

Now, it's been some time that I coded something in C, but I could bet
that first if should be "if (!*user)" - notice the NOT...
Because that's precisely the trigger (this function returning FALSE)
needed to generate the error message I've been seeing.
Now the mistery part is: how come this is even working, at least in cygwin?=
 :)

Can anybody confirm my findings, please?

_________
Julio Costa

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019