From patchwork Fri Apr 8 16:05:31 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Zaman X-Patchwork-Id: 8784391 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 671D39F659 for ; Fri, 8 Apr 2016 16:13:14 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A51CB202DD for ; Fri, 8 Apr 2016 16:13:13 +0000 (UTC) Received: from emvm-gh1-uea09.nsa.gov (smtp.nsa.gov [8.44.101.9]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B651B2011D for ; Fri, 8 Apr 2016 16:13:12 +0000 (UTC) X-TM-IMSS-Message-ID: <6598d2af000a10c1@nsa.gov> Received: from tarius.tycho.ncsc.mil ([144.51.242.1]) by nsa.gov ([10.208.42.194]) with ESMTP (TREND IMSS SMTP Service 7.1) id 6598d2af000a10c1 ; Fri, 8 Apr 2016 12:09:49 -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 u38GAo3d022258; Fri, 8 Apr 2016 12:10:50 -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 u38G6Omq083024 for ; Fri, 8 Apr 2016 12:06:24 -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 u38G6LBG021119 for ; Fri, 8 Apr 2016 12:06:24 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A1AyCgBH1gdXd0LcVdFcgwyBe7g2gmyBJIYNAoF/AQEBAQEBEwEKCxQhcAwBg3QBAQEDEhUZAQE3AQ9RNAEFARw7iAUBoRuBMT4xik+FKAEEjT4BAQEBAQEEAgEXBgqEDotfgXwLQIJDh3WFXnOJQ44OZIhFhWKNaC+BDoJZgX1fAYEfiBkBAQE X-IPAS-Result: A1AyCgBH1gdXd0LcVdFcgwyBe7g2gmyBJIYNAoF/AQEBAQEBEwEKCxQhcAwBg3QBAQEDEhUZAQE3AQ9RNAEFARw7iAUBoRuBMT4xik+FKAEEjT4BAQEBAQEEAgEXBgqEDotfgXwLQIJDh3WFXnOJQ44OZIhFhWKNaC+BDoJZgX1fAYEfiBkBAQE X-IronPort-AV: E=Sophos;i="5.24,454,1454994000"; d="scan'208";a="5363085" Received: from emvm-gh1-uea09.nsa.gov ([10.208.42.194]) by goalie.tycho.ncsc.mil with ESMTP; 08 Apr 2016 12:06:24 -0400 X-TM-IMSS-Message-ID: <6594b762000a0e8e@nsa.gov> Received: from mail-pa0-f66.google.com (mail-pa0-f66.google.com [209.85.220.66]) by nsa.gov ([10.208.42.194]) with ESMTP (TREND IMSS SMTP Service 7.1; TLSv1/SSLv3 AES128-SHA (128/128)) id 6594b762000a0e8e ; Fri, 8 Apr 2016 12:05:20 -0400 Received: by mail-pa0-f66.google.com with SMTP id zy2so9376094pac.2 for ; Fri, 08 Apr 2016 09:06:22 -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=bR4AP6TQFKLjUEygQok76K0HVN111Pses4PwaupEEUI=; b=z2PlKWu3nGYwzmGmvzrHXTrSZyYsSG9rZ2YJhtI6FAH9ZmMtil9LoMB78ZgdTUW9MQ E+TnHfZU2s3QmrzxagJyTMpfUE9xK+J/dMW2kt0M5RFH69+FW6MBJzSOKWEu2FyjPBD9 mGnVRN/tlzH2BCYRixAMC49vVJ+CuqNOe9XMgGFwLUk6UfzulufNMaFNWW0jYQPClK2R PNJzhSO7k16Lshw8q4X6pibnE2yFwFx2NbZ0DbDxWkoKdmWxG9WbYKpdC5EFxaurGYMv Fkt/H6sLp9cu0xI8pLwUqnGGdjZvVR8o9xqyvz2OIBMD+gJelpLqpk35xNHb3QOXMNr4 2RDg== 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=bR4AP6TQFKLjUEygQok76K0HVN111Pses4PwaupEEUI=; b=RLJTc6tmfLxEy/Y79oQDWDe9G2Vrz7Lfa3zsT5YPBP0sjh66MgTg/1rlJa3H7Z/gnm MQrl5yHjqBYuJKqbIc0fRAXmbwx63GFrwfOljJHp87+8IJ85gbKtOA0rruNTf2U2RP/D xnNtA7sXhcfN2L2FoHtHskAP/KFWm1Iub6k1nPwAO3fkaPDZedMAeMMfenR++yjjLprt KB0T3hrnA3QyNT2RCCi5KelaQNBsOenxuaq9t2jClQPqCJ+RV34MXSIcUcIhC1DhWf6n 6tJltl5YeSCW6ReOK4t2ZSN+ESGMizhzMH6MjIov2+mcoMSxmSIQa9nsyc5Xshmy5ZjJ vlWg== X-Gm-Message-State: AD7BkJLIjv8/Eia9kkTz6GPM2xKcz+ITCKLLqh+ymhZH64Qg/z4g1kdspJ451tI83F2zEQ== X-Received: by 10.66.180.111 with SMTP id dn15mr13556779pac.69.1460131581304; Fri, 08 Apr 2016 09:06:21 -0700 (PDT) Received: from localhost ([2404:e800:e600:38b:5121:e6bd:6ddf:d757]) by smtp.gmail.com with ESMTPSA id c18sm19708733pfj.41.2016.04.08.09.06.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 08 Apr 2016 09:06:20 -0700 (PDT) From: Jason Zaman To: selinux@tycho.nsa.gov Subject: [PATCH 3/7] genhomedircon: rename FALLBACK #defines consistent with struct Date: Sat, 9 Apr 2016 00:05:31 +0800 Message-Id: <1460131535-15688-4-git-send-email-jason@perfinion.com> X-Mailer: git-send-email 2.7.3 In-Reply-To: <1460131535-15688-1-git-send-email-jason@perfinion.com> References: <20160201093633.GB21978@meriadoc.perfinion.com> <1460131535-15688-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 --- 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 3289954..61f503f 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 { @@ -750,14 +751,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) @@ -842,10 +843,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); @@ -1049,10 +1050,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; }