All of lore.kernel.org
 help / color / mirror / Atom feed
From: Steve Lawrence <slawrence@tresys.com>
To: Laurent Bigonville <bigon@debian.org>, <selinux@tycho.nsa.gov>
Subject: Re: [PATCH] policycoreutils/chcat: Add a fallback in case os.getlogin() returns nothing
Date: Thu, 17 Dec 2015 09:16:31 -0500	[thread overview]
Message-ID: <5672C3BF.5000800@tresys.com> (raw)
In-Reply-To: <1450046440-25449-1-git-send-email-bigon@bigon.be>

On 12/13/2015 05:40 PM, Laurent Bigonville wrote:
> From: Laurent Bigonville <bigon@bigon.be>
> 
> Some teminal emulators (like the latest version of gnome-terminal) are
> not setting entries in the utmp file, this leads getlogin() to return an
> empty string.
> 
> Fallback to the name of the user running the chcat process.

Applied. Thanks.

Also, in the future, please add a Signed-off-by line.

> ---
>  policycoreutils/scripts/chcat | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/policycoreutils/scripts/chcat b/policycoreutils/scripts/chcat
> index ec527e5..472785c 100755
> --- a/policycoreutils/scripts/chcat
> +++ b/policycoreutils/scripts/chcat
> @@ -372,7 +372,10 @@ def listcats():
>  
>  def listusercats(users):
>      if len(users) == 0:
> -        users.append(os.getlogin())
> +        try:
> +            users.append(os.getlogin())
> +        except:
> +            users.append(pwd.getpwuid(os.getuid()).pw_name)
>  
>      verify_users(users)
>      for u in users:
> 

      reply	other threads:[~2015-12-17 14:16 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-13 22:40 [PATCH] policycoreutils/chcat: Add a fallback in case os.getlogin() returns nothing Laurent Bigonville
2015-12-17 14:16 ` Steve Lawrence [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5672C3BF.5000800@tresys.com \
    --to=slawrence@tresys.com \
    --cc=bigon@debian.org \
    --cc=selinux@tycho.nsa.gov \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.