[RFC Patch 2/10] PAM Namespace: expand $HOME

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This patch expands $HOME when it is used in the directory portion of a
namespace.conf configuration line to specify subdirectories of the
home directory for example $HOME/.mozilla.

--- Linux-PAM-0.99.8.1/modules/pam_namespace/pam_namespace.c	2007-11-14
08:30:46.000000000 -0600
+++ Linux-PAM-0.99.8.1.new/modules/pam_namespace/pam_namespace.c	2007-11-14
08:33:13.000000000 -0600
@@ -207,8 +207,10 @@
      * the "$HOME" string with the user's home directory that is
      * passed in as an argument.
      */
-    if (strcmp(dir, "$HOME") == 0) {
-	dir = home;
+    if (strncmp(dir, "$HOME", 5) == 0) {
+            char *expanded = alloca(strlen(home) + strlen(dir) - 5 + 1);
+            sprintf(expanded, "%s%s", home, dir + 5);
+            dir = expanded;
     }

     /*

--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to majordomo@xxxxxxxxxxxxx with
the words "unsubscribe selinux" without quotes as the message.

[Index of Archives]     [Selinux Refpolicy]     [Linux SGX]     [Fedora Users]     [Fedora Desktop]     [Yosemite Photos]     [Yosemite Camping]     [Yosemite Campsites]     [KDE Users]     [Gnome Users]

  Powered by Linux