From: Linda Knippers <linda.knippers@hp.com>
To: Xavier Toth <txtoth@gmail.com>
Cc: selinux@tycho.nsa.gov
Subject: Re: directory polyinstantiation failure
Date: Wed, 18 Apr 2007 16:04:08 -0400 [thread overview]
Message-ID: <462679B8.7080600@hp.com> (raw)
In-Reply-To: <cadfc0e40704180959i4aad6211r6b66d1433c69a1ee@mail.gmail.com>
Xavier Toth wrote:
> Here is the patch for to expand $HOME. However as I looked at the code
> I see the reason for behavior that had confused me partly because it
> isn't documented and partly because I don't think it is desired. I'd
> specified some directories to be polyinstantiated by level but then
> I'd see that they might also get polyinstantiated by user. The code as
> described in the following comment is overriding my specified method
> if getexeccon fails.
> /*
> * This function checks if the calling program has requested context
> * change by calling setexeccon(). If context change is not requested
> * then it does not make sense to polyinstantiate based on context.
> * The return value from this function is used when selecting the
> * polyinstantiation method. If context change is not requested then
> * the polyinstantiation method is set to USER, even if the configuration
> * file lists the method as "context" or "both".
> */
> static int ctxt_based_inst_needed(void)
>
> Why if getexeccon fails doesn't it make sense to polyinstantiate based
> on context/level? Why not call getcon lf getexeccon fails and use that
> context instead of switching the method?
Good question. What did you end up with for directory names?
Would you be willing to file a couple of bugzillas (one for the $HOME
expansion and one for this behavior) for the LSPP project? That will
help us determine whether we need fixes for our certification or just
some documentation for now.
Thanks,
-- ljk
>
> Oh yeah I also patch the debug output of an error that pam_namespace
> doesn't care about so why should I.
>
> On 4/17/07, Michael C Thompson <thompsmc@us.ibm.com> wrote:
>
>> Xavier Toth wrote:
>> > If you try and use $HOME in the directory name for instance
>> > $HOME/.mozilla the $HOME is not expanded. I'll submit a patch.
>>
>> Nice find, thank you for the patch. :)
>>
>> Mike
>>
>
> ------------------------------------------------------------------------
>
> --- Linux-PAM-0.99.7.0/modules/pam_namespace/pam_namespace.c 2007-04-18 09:32:05.000000000 -0500
> +++ Linux-PAM-0.99.7.0.new/modules/pam_namespace/pam_namespace.c 2007-04-18 09:31:23.000000000 -0500
> @@ -196,14 +196,18 @@
> uids = strtok_r(NULL, " \t", &tptr);
>
> /*
> - * If the directory being polyinstantiated is the home directory
> - * of the user who is establishing a session, we have to swap
> - * the "$HOME" string with the user's home directory that is
> - * passed in as an argument.
> + * Expand $HOME in dir
> */
> - if (strcmp(dir, "$HOME") == 0) {
> - dir = home;
> + if ((tptr = strstr(dir, "$HOME")) != 0) {
> + if (strlen(dir) > 5) {
> + char *expanded = alloca(strlen(home)+strlen(dir)-5+1);
> + *tptr = 0;
> + sprintf(expanded, "%s%s", home, tptr+5);
> + dir = expanded;
> + }
> + else
> + dir = home;
> }
>
> /*
> * Expand $HOME and $USER in instance dir prefix
> @@ -1117,10 +1141,11 @@
>
> if (umount(pptr->dir) < 0) {
> int saved_errno = errno;
> - pam_syslog(idata->pamh, LOG_ERR, "Unmount of %s failed, %m",
> + if (saved_errno != EINVAL) {
> + pam_syslog(idata->pamh, LOG_ERR, "Unmount of %s failed, %m",
> pptr->dir);
> - if (saved_errno != EINVAL)
> return PAM_SESSION_ERR;
> + }
> } else if (idata->flags & PAMNS_DEBUG)
> pam_syslog(idata->pamh, LOG_DEBUG, "Umount succeeded %s",
> pptr->dir);
--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to majordomo@tycho.nsa.gov with
the words "unsubscribe selinux" without quotes as the message.
next prev parent reply other threads:[~2007-04-18 20:06 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-04-17 18:07 directory polyinstantiation failure Xavier Toth
2007-04-17 18:47 ` Michael C Thompson
2007-04-17 19:23 ` Xavier Toth
2007-04-17 20:19 ` Michael C Thompson
2007-04-18 16:59 ` Xavier Toth
2007-04-18 20:04 ` Linda Knippers [this message]
2007-04-19 14:04 ` Ted X Toth
2007-04-24 9:06 ` Russell Coker
2007-04-24 20:19 ` Ted X Toth
-- strict thread matches above, loose matches on Subject: below --
2007-04-24 15:06 Chad Hanson
2007-04-24 17:49 ` Ted X Toth
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=462679B8.7080600@hp.com \
--to=linda.knippers@hp.com \
--cc=selinux@tycho.nsa.gov \
--cc=txtoth@gmail.com \
/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.