From patchwork Sat Apr 23 06:04:54 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Zaman X-Patchwork-Id: 8916981 Return-Path: X-Original-To: patchwork-selinux@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 1FC929F1C1 for ; Sat, 23 Apr 2016 06:10:31 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 22BB920254 for ; Sat, 23 Apr 2016 06:10:30 +0000 (UTC) Received: from emvm-gh1-uea08.nsa.gov (emvm-gh1-uea08.nsa.gov [8.44.101.8]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 36D7F20225 for ; Sat, 23 Apr 2016 06:10:29 +0000 (UTC) X-TM-IMSS-Message-ID: <64d1913a0000754d@nsa.gov> Received: from tarius.tycho.ncsc.mil ([144.51.242.1]) by nsa.gov ([10.208.42.193]) with ESMTP (TREND IMSS SMTP Service 7.1) id 64d1913a0000754d ; Sat, 23 Apr 2016 02:07:31 -0400 Received: from prometheus.infosec.tycho.ncsc.mil (prometheus [192.168.25.40]) by tarius.tycho.ncsc.mil (8.14.4/8.14.4) with ESMTP id u3N689pg007895; Sat, 23 Apr 2016 02:08:10 -0400 Received: from tarius.tycho.ncsc.mil (tarius.infosec.tycho.ncsc.mil [144.51.242.1]) by prometheus.infosec.tycho.ncsc.mil (8.15.2/8.15.2) with ESMTP id u3N65Xkm117832 for ; Sat, 23 Apr 2016 02:05:33 -0400 Received: from goalie.tycho.ncsc.mil (goalie [144.51.242.250]) by tarius.tycho.ncsc.mil (8.14.4/8.14.4) with ESMTP id u3N65XAG007368 for ; Sat, 23 Apr 2016 02:05:33 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0CtBACSDxtX/yQp0Apegw2Be7d2gmqBHgoXhXcCgW4BAQEBAQFmJ4RCAQEBAxIVGQEBNwEPUTQBBQEcGSKICAGgd4ExPjGKT4UoAQSMSQEBAQEBAQQCARcGCoQNi2CBfAtAgkOHeYVfc4lJjhZjiEaFZY1xMIEOYoF4ggBfAYh6AQEB X-IPAS-Result: A0CtBACSDxtX/yQp0Apegw2Be7d2gmqBHgoXhXcCgW4BAQEBAQFmJ4RCAQEBAxIVGQEBNwEPUTQBBQEcGSKICAGgd4ExPjGKT4UoAQSMSQEBAQEBAQQCARcGCoQNi2CBfAtAgkOHeYVfc4lJjhZjiEaFZY1xMIEOYoF4ggBfAYh6AQEB X-IronPort-AV: E=Sophos;i="5.24,520,1454994000"; d="scan'208";a="5403914" Received: from emsm-gh1-uea10.corp.nsa.gov (HELO emsm-gh1-uea10.nsa.gov) ([10.208.41.36]) by goalie.tycho.ncsc.mil with ESMTP; 23 Apr 2016 02:05:32 -0400 IronPort-PHdr: =?us-ascii?q?9a23=3A8BVl1h2ecu4NK9fQsmDT+DRfVm0co7zxezQtwd8Z?= =?us-ascii?q?segVIvad9pjvdHbS+e9qxAeQG96Lu7Qb0qGH4+jJYi8p39WoiDg6aptCVhsI24?= =?us-ascii?q?09vjcLJ4q7M3D9N+PgdCcgHc5PBxdP9nC/NlVJSo6lPwWB6kO74TNaIBjjLw09?= =?us-ascii?q?fr2zQd6CyZvunLHis7ToICx2xxOFKYtoKxu3qQiD/uI3uqBFbpgL9x3Sv3FTcP?= =?us-ascii?q?5Xz247bXianhL7+9vitMU7q3cY6Lod8JtbXKH7ebkoZaBJBzQhdWYu7YvksgeQ?= =?us-ascii?q?YxGI4y4+W34RlFJ6Cg3M6lmuXJ7qtS3Srudn1iicPMrwC7szXGLxvO9QVBb0hX?= =?us-ascii?q?JfZHYC+2bNh5kogQ=3D=3D?= X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A1EQAQBwDxtXiMTAVdFegw2Be7d2gmqBH?= =?us-ascii?q?goXgXaEAQKBbgEBAQEBAQICDwEBAQgLCwkfgl59Wz0BAQEDEhUZAQE3AQ9RNAE?= =?us-ascii?q?FARwZIogIAaB3gTE+MYpPhSgBBIxJAQEBAQEBBAIBFwYKhA2LYIF8C0CCQ4d5h?= =?us-ascii?q?V9ziUmOFmOIRoVljXEwgQ6CWh6BYl8BiHoBAQE?= X-IPAS-Result: =?us-ascii?q?A1EQAQBwDxtXiMTAVdFegw2Be7d2gmqBHgoXgXaEAQKBbgE?= =?us-ascii?q?BAQEBAQICDwEBAQgLCwkfgl59Wz0BAQEDEhUZAQE3AQ9RNAEFARwZIogIAaB3g?= =?us-ascii?q?TE+MYpPhSgBBIxJAQEBAQEBBAIBFwYKhA2LYIF8C0CCQ4d5hV9ziUmOFmOIRoV?= =?us-ascii?q?ljXEwgQ6CWh6BYl8BiHoBAQE?= X-IronPort-AV: E=Sophos;i="5.24,520,1454976000"; d="scan'208";a="12950730" Received: from emvm-gh1-uea09.nsa.gov ([10.208.42.194]) by emsm-gh1-uea10.nsa.gov with ESMTP/TLS/DHE-RSA-AES256-SHA; 23 Apr 2016 06:05:31 +0000 X-TM-IMSS-Message-ID: Received: from mail-pf0-f196.google.com (mail-pf0-f196.google.com [209.85.192.196]) by nsa.gov ([10.208.42.194]) with ESMTP (TREND IMSS SMTP Service 7.1; TLSv1/SSLv3 AES128-SHA (128/128)) id b0ad86ac0000642d ; Sat, 23 Apr 2016 02:05:03 -0400 Received: by mail-pf0-f196.google.com with SMTP id e190so11702910pfe.0 for ; Fri, 22 Apr 2016 23:05:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=perfinion-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=s6YwvFEXaZ6f9mdUP1/iabS0Q9l+0kMwLlQkktesGM4=; b=f6CJOeZ1tJ13h+NwumkXC2w3cH7C8/LAi3b1F+orPK5eC0Fmzl3Fhiw7SDa4EDjhcc dljbe3NX15UEPDbixHhbDPkqAaYKuBedCfJnPsruqV2GNuSoM0OTo7JCXGfeXXJ5BeRj DkPGNEuFC8zkBArFGh+K0PHs9vXvc/tPts8F8lOmhg6g9xrl6yRkR4t1cJlYn5WyJmPb TeWSPpGqJjfBt0Pk4hckUzw/B9pXSZThQhY8bPfZNQ3gL+48h5MOzcgKG+NOE3ZQbVEE oOTMPJ0ts+J0PFfA0XaJj+U+Wk+6rEunnMVnNvYQKxyBTEaMk6G/HiRKueZKyNFuWO5m HCfg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=s6YwvFEXaZ6f9mdUP1/iabS0Q9l+0kMwLlQkktesGM4=; b=D7BdICqvuf51WFIzdbv7Ek/mJN0d0Oke5bfo6GLnE6NlqRx+Y9gy9ruJG+tFw/0YRe PlVVeU3jfCg/1is31HktrtSEegeE6rJBHI4ubhWgGe9A7qtk1r86t0k+55RA5UfwrQji aNq/CZtZYqS+i43Y8D50vVFwgoa8OGOLxAyIhVrflqM5L9j+Xrzp5BKuU4xDKDBjs3GL YqIEUyF5CPlbRBoOQBDOLfIo+Be2R2hm4wiCQhKo1BThdSa5BXJYz8Fiocr+Uhb45Np2 Bo6ltih/7tsozgWekA4+7AzrlsNc26OvWu4XBXEwMppM2Edunv+NbqmIb0npABbX/rRB 2kEg== X-Gm-Message-State: AOPr4FVAHAu6luabtcyYsokGpdKvmTChx/TEQF2RImP5eWmSOwTHoOVImZcry11a1nLe4w== X-Received: by 10.98.11.205 with SMTP id 74mr33807848pfl.98.1461391530095; Fri, 22 Apr 2016 23:05:30 -0700 (PDT) Received: from localhost ([2404:e800:e600:38b:b52d:863:7600:b418]) by smtp.gmail.com with ESMTPSA id w15sm12315269pfa.34.2016.04.22.23.05.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 22 Apr 2016 23:05:29 -0700 (PDT) From: Jason Zaman To: selinux@tycho.nsa.gov Subject: [PATCH v2 3/8] genhomedircon: rename FALLBACK #defines consistent with struct Date: Sat, 23 Apr 2016 14:04:54 +0800 Message-Id: <1461391499-20593-4-git-send-email-jason@perfinion.com> X-Mailer: git-send-email 2.7.3 In-Reply-To: <1461391499-20593-1-git-send-email-jason@perfinion.com> References: <1460131535-15688-1-git-send-email-jason@perfinion.com> <1461391499-20593-1-git-send-email-jason@perfinion.com> X-TM-AS-MML: disable X-BeenThere: selinux@tycho.nsa.gov X-Mailman-Version: 2.1.20 Precedence: list List-Id: "Security-Enhanced Linux \(SELinux\) mailing list" List-Post: List-Help: MIME-Version: 1.0 Errors-To: selinux-bounces@tycho.nsa.gov Sender: "Selinux" X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Jason Zaman --- libsemanage/src/genhomedircon.c | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/libsemanage/src/genhomedircon.c b/libsemanage/src/genhomedircon.c index 1e35b7e..9529020 100644 --- a/libsemanage/src/genhomedircon.c +++ b/libsemanage/src/genhomedircon.c @@ -78,9 +78,10 @@ #define TEMPLATE_SEUSER "system_u" #define TEMPLATE_LEVEL "s0" -#define FALLBACK_USER "user_u" -#define FALLBACK_USER_PREFIX "user" -#define FALLBACK_USER_LEVEL "s0" +#define FALLBACK_SENAME "user_u" +#define FALLBACK_PREFIX "user" +#define FALLBACK_LEVEL "s0" +#define FALLBACK_NAME ".*" #define DEFAULT_LOGIN "__default__" typedef struct user_entry { @@ -751,14 +752,14 @@ static int setup_fallback_user(genhomedircon_settings_t * s) if (semanage_user_query(s->h_semanage, key, &u) < 0) { prefix = name; - level = FALLBACK_USER_LEVEL; + level = FALLBACK_LEVEL; } else { prefix = semanage_user_get_prefix(u); level = semanage_user_get_mlslevel(u); if (!level) - level = FALLBACK_USER_LEVEL; + level = FALLBACK_LEVEL; } if (set_fallback_user(s, seuname, prefix, level) != 0) @@ -843,10 +844,10 @@ static genhomedircon_user_entry_t *get_users(genhomedircon_settings_t * s, prefix = semanage_user_get_prefix(*u); level = semanage_user_get_mlslevel(*u); if (!level) - level = FALLBACK_USER_LEVEL; + level = FALLBACK_LEVEL; } else { prefix = name; - level = FALLBACK_USER_LEVEL; + level = FALLBACK_LEVEL; } retval = getpwnam_r(name, &pwstorage, rbuf, rbuflen, &pwent); @@ -1050,10 +1051,14 @@ int semanage_genhomedircon(semanage_handle_t * sh, goto done; } - s.fallback->sename = strdup(FALLBACK_USER); - s.fallback->prefix = strdup(FALLBACK_USER_PREFIX); - s.fallback->level = strdup(FALLBACK_USER_LEVEL); - if (s.fallback->sename == NULL || s.fallback->prefix == NULL || s.fallback->level == NULL) { + s.fallback->name = strdup(FALLBACK_NAME); + s.fallback->sename = strdup(FALLBACK_SENAME); + s.fallback->prefix = strdup(FALLBACK_PREFIX); + s.fallback->level = strdup(FALLBACK_LEVEL); + if (s.fallback->name == NULL + || s.fallback->sename == NULL + || s.fallback->prefix == NULL + || s.fallback->level == NULL) { retval = STATUS_ERR; goto done; }