From patchwork Fri Nov 12 15:41:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Christian_G=C3=B6ttsche?= X-Patchwork-Id: 12617041 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 942DDC433F5 for ; Fri, 12 Nov 2021 15:42:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7352360296 for ; Fri, 12 Nov 2021 15:42:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235209AbhKLPo7 (ORCPT ); Fri, 12 Nov 2021 10:44:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58328 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232194AbhKLPo7 (ORCPT ); Fri, 12 Nov 2021 10:44:59 -0500 Received: from mail-ed1-x529.google.com (mail-ed1-x529.google.com [IPv6:2a00:1450:4864:20::529]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 26A79C061766 for ; Fri, 12 Nov 2021 07:42:08 -0800 (PST) Received: by mail-ed1-x529.google.com with SMTP id o8so39195843edc.3 for ; Fri, 12 Nov 2021 07:42:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20210112; h=from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=n2sA4lrtpEVOts4ZjNUrk5h9lD/gYE8zciz/w6NEhGY=; b=pPIOq+MynqroY6lP/T6I6iT3E5CbD1RKkEe253U2l82j2M1fLMyHZnwunRbbaWbDI3 mtCM9Z2CIiFvdOeSIZqUI232AKTV2GK/XoQbc8Y54HmMdXZJmrgE3BI76LHgzmlvk5mm ehCpEL+CAMlVWG6H6dkWdcYmgOUSRxw5AJRwXUu/34js9bFmWv5vpzmIHAzSp8ANSh3U LEE82OmY8E5ZNOoVwamRjMnD8j2Td9JvR1r74CG+lQoFN7u0vjdz4EWTIizgCh1t3pwi nPQ1jg+h80yfKdpvPpU8MEfKgIzhrQRSqgP//DNO3NYs/SsQlUf3H5JEvTdtX3mvlQ/Y sy7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=n2sA4lrtpEVOts4ZjNUrk5h9lD/gYE8zciz/w6NEhGY=; b=b6zeaTeqCuIdaL32nYwtDA0K33SIKkjE0uM/Og6/CT9+cFLuBXCy//RKxKbehzKHc/ zlq4gD/gLkudS0Sqf96RhK8P2xgbeIB3GkigC5hECnYaC4FEuBxlIcJiQtfqYcsDgRxw 4KYG4uV7RZFm1o0QDFFoN0/iNoy12w5y1HE5WcVoeKnF7u0jhHy6wDpROKjVPpY9EuNB sw6s6AI9QYYd+5UAbS8iFfJjjH84RQlH103qrHpuWQitRGGJpPYIrdSGw9iK1VEWmdRr idKkxu8YR141E+bAlxJq9nGx+evqzdIoUpMG0yV5JBxv1UgQke2ypLnjw3tHRm8oRxgk YSUQ== X-Gm-Message-State: AOAM5331C/Vz56+HVEOgeO7OK1oPZ29rDEiEss2twLbPvMMRl9IWldui ZgKRV7U8N7YqvTGFfg152djHGnu9woE= X-Google-Smtp-Source: ABdhPJzea5PmBGoe/vKsnNg9NPM+g7ozpDUqdqEv8HhQpE3/OUK5eDujKu7VqWcLBstgaJ8OmZ3jdg== X-Received: by 2002:a17:907:6da2:: with SMTP id sb34mr20915060ejc.509.1636731726690; Fri, 12 Nov 2021 07:42:06 -0800 (PST) Received: from debianHome.localdomain (dynamic-077-000-195-130.77.0.pool.telefonica.de. [77.0.195.130]) by smtp.gmail.com with ESMTPSA id m9sm2628914eje.102.2021.11.12.07.42.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Nov 2021 07:42:06 -0800 (PST) From: =?utf-8?q?Christian_G=C3=B6ttsche?= To: selinux@vger.kernel.org Subject: [PATCH 01/12] checkpolicy: use correct unsigned format specifiers Date: Fri, 12 Nov 2021 16:41:50 +0100 Message-Id: <20211112154201.78217-1-cgzones@googlemail.com> X-Mailer: git-send-email 2.33.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: selinux@vger.kernel.org The two variables policydb_lineno and source_lineno are both of the type unsigned long; use the appropriate format specifier. Found by Cppcheck Signed-off-by: Christian Göttsche Acked-by: James Carter --- checkpolicy/policy_scan.l | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/checkpolicy/policy_scan.l b/checkpolicy/policy_scan.l index 129a8a2a..ef9f1899 100644 --- a/checkpolicy/policy_scan.l +++ b/checkpolicy/policy_scan.l @@ -308,11 +308,11 @@ GLBLUB { return(GLBLUB); } int yyerror(const char *msg) { if (source_file[0]) - fprintf(stderr, "%s:%ld:", + fprintf(stderr, "%s:%lu:", source_file, source_lineno); else fprintf(stderr, "(unknown source)::"); - fprintf(stderr, "ERROR '%s' at token '%s' on line %ld:\n%s\n%s\n", + fprintf(stderr, "ERROR '%s' at token '%s' on line %lu:\n%s\n%s\n", msg, yytext, policydb_lineno, @@ -327,11 +327,11 @@ int yywarn(const char *msg) return yyerror(msg); if (source_file[0]) - fprintf(stderr, "%s:%ld:", + fprintf(stderr, "%s:%lu:", source_file, source_lineno); else fprintf(stderr, "(unknown source)::"); - fprintf(stderr, "WARNING '%s' at token '%s' on line %ld:\n%s\n%s\n", + fprintf(stderr, "WARNING '%s' at token '%s' on line %lu:\n%s\n%s\n", msg, yytext, policydb_lineno, From patchwork Fri Nov 12 15:41:51 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Christian_G=C3=B6ttsche?= X-Patchwork-Id: 12617043 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9364DC433EF for ; Fri, 12 Nov 2021 15:42:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7836960296 for ; Fri, 12 Nov 2021 15:42:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235240AbhKLPpA (ORCPT ); Fri, 12 Nov 2021 10:45:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58332 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232194AbhKLPo7 (ORCPT ); Fri, 12 Nov 2021 10:44:59 -0500 Received: from mail-ed1-x534.google.com (mail-ed1-x534.google.com [IPv6:2a00:1450:4864:20::534]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C8F63C061766 for ; Fri, 12 Nov 2021 07:42:08 -0800 (PST) Received: by mail-ed1-x534.google.com with SMTP id w1so39405431edd.10 for ; Fri, 12 Nov 2021 07:42:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20210112; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=ML/+3QOv3GlJ0avXCmvVPY6qAn7nDT9Dty+pznymaJ0=; b=lUgYoOZeRIFDP208YEQl5cprfw0s//aMvBsVmOpSkRUggBLI73zG198ps/TXae7YbO OofiB9TdCorp1FVi6jPYCbc43O3yN1Yr6gwLL/YMhvKBVyokwYwZWE9Z5H//yisYNJx2 cd2mQ78SKzlPHhOTxMntgctXMVCMQdQc09Eb5a+/hPyYQPAxDz/Drp4HgS0rL7CO4ceJ ZqvwIf0Y1/1tgNVmnIT6DX0zf6Yq/Bm0eLclFRIKLv1wFx2Xt1L7gMSWVpZ/ItfnTUkd tLo0uvVh/VdBEbeCcpPmL4d1qqQpS/Gl8Br+y2exS5BwHDaVe7ifl1JwY/dOMR9qNtY4 FxqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ML/+3QOv3GlJ0avXCmvVPY6qAn7nDT9Dty+pznymaJ0=; b=hK2LBOh7uSdz/gJqCw7SdqPnY8yk+C4OAHlJYH50be/04wjfJAxfbJ9PK1ChKEMb1X n/VXulXiAzdizCnXflCfAIP0+HCeFR2D5hki9qDd69lI+IvL7FbwQwCegshh+BiU69vE L/QkMfA3FkBbKazgXTZ+cYF0AKPIpApsECY08xA4QUNskRbXnr3talk4Jvs+vawxsBNL y/zTYDXy2jXXX47A/zYrAT6KLw77PwDTVcR7Ph8vE5VnKWSWCAYEEd12wflyZEmxTiPM whI+LS9/FiG9gCBPJQiV7Y46tDBEjYEEOuD1Q56hOjdo6QgwPeer/Zk7U1pNBqQCmZVJ FylQ== X-Gm-Message-State: AOAM530/DCN/Pl6JQSZB5B65/srYJbaTUUCoL4sF2qKVlSwtVxlkTJ7X VUGN9t+gCD9XtMLAIkqk3j2E7d+BkAM= X-Google-Smtp-Source: ABdhPJwipo3P4/M62CAQyrAMUd4iKn/nBILEFiqH2OYMlm75DdaWQg5Pjuj7BSg/8NE0IINwI0MS2A== X-Received: by 2002:a17:907:3d9e:: with SMTP id he30mr20418842ejc.177.1636731727308; Fri, 12 Nov 2021 07:42:07 -0800 (PST) Received: from debianHome.localdomain (dynamic-077-000-195-130.77.0.pool.telefonica.de. [77.0.195.130]) by smtp.gmail.com with ESMTPSA id m9sm2628914eje.102.2021.11.12.07.42.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Nov 2021 07:42:06 -0800 (PST) From: =?utf-8?q?Christian_G=C3=B6ttsche?= To: selinux@vger.kernel.org Subject: [PATCH 02/12] libsepol: use string literals as format strings Date: Fri, 12 Nov 2021 16:41:51 +0100 Message-Id: <20211112154201.78217-2-cgzones@googlemail.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211112154201.78217-1-cgzones@googlemail.com> References: <20211112154201.78217-1-cgzones@googlemail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: selinux@vger.kernel.org Use string literals as format strings so that compilers can validate the count and types of the inherent arguments. kernel_to_cil.c: In function ‘class_constraint_rules_to_strs’: kernel_to_cil.c:301:17: error: format not a string literal, argument types not checked [-Werror=format-nonliteral] 301 | rc = strs_create_and_add(strs, format_str, 3, classkey, perms+1, expr); | ^~ kernel_to_cil.c: In function ‘class_validatetrans_rules_to_strs’: kernel_to_cil.c:341:17: error: format not a string literal, argument types not checked [-Werror=format-nonliteral] 341 | rc = strs_create_and_add(strs, format_str, 2, classkey, expr); | ^~ kernel_to_cil.c: In function ‘cats_ebitmap_to_str’: kernel_to_cil.c:1068:40: error: format not a string literal, argument types not checked [-Werror=format-nonliteral] 1068 | val_to_name[start], val_to_name[i]); | ^~~~~~~~~~~ kernel_to_conf.c: In function ‘class_constraint_rules_to_strs’: kernel_to_conf.c:301:42: error: format not a string literal, argument types not checked [-Werror=format-nonliteral] 301 | flavor, classkey, perms+1, expr); | ^~~~~~ kernel_to_conf.c: In function ‘cats_ebitmap_to_str’: kernel_to_conf.c:1059:40: error: format not a string literal, argument types not checked [-Werror=format-nonliteral] 1059 | val_to_name[start], sep, val_to_name[i]); | ^~~~~~~~~~~ kernel_to_conf.c:1062:25: error: format not a string literal, argument types not checked [-Werror=format-nonliteral] 1062 | len = snprintf(p, remaining, fmt, val_to_name[start]); | ^~~ module_to_cil.c: In function ‘cond_expr_to_cil’: module_to_cil.c:1340:25: error: format not a string literal, argument types not checked [-Werror=format-nonliteral] 1340 | rlen = snprintf(new_val, len, fmt_str, op, val1, val2); | ^~~~ module_to_cil.c: In function ‘constraint_expr_to_string’: module_to_cil.c:1881:25: error: format not a string literal, argument types not checked [-Werror=format-nonliteral] 1881 | rlen = snprintf(new_val, len, fmt_str, op, val1, val2); | ^~~~ Signed-off-by: Christian Göttsche --- libsepol/src/kernel_to_cil.c | 29 +++++++++++++++++------------ libsepol/src/kernel_to_conf.c | 23 +++++++++++++---------- libsepol/src/module_to_cil.c | 22 ++++++++-------------- 3 files changed, 38 insertions(+), 36 deletions(-) diff --git a/libsepol/src/kernel_to_cil.c b/libsepol/src/kernel_to_cil.c index 305567a5..b81cdb22 100644 --- a/libsepol/src/kernel_to_cil.c +++ b/libsepol/src/kernel_to_cil.c @@ -278,7 +278,7 @@ static int class_constraint_rules_to_strs(struct policydb *pdb, char *classkey, char *expr = NULL; int is_mls; char *perms; - const char *format_str; + const char *key_word; struct strs *strs; for (curr = constraint_rules; curr != NULL; curr = curr->next) { @@ -291,14 +291,14 @@ static int class_constraint_rules_to_strs(struct policydb *pdb, char *classkey, perms = sepol_av_to_string(pdb, class->s.value, curr->permissions); if (is_mls) { - format_str = "(mlsconstrain (%s (%s)) %s)"; + key_word = "mlsconstrain"; strs = mls_list; } else { - format_str = "(constrain (%s (%s)) %s)"; + key_word = "constrain"; strs = non_mls_list; } - rc = strs_create_and_add(strs, format_str, 3, classkey, perms+1, expr); + rc = strs_create_and_add(strs, "(%s (%s (%s)) %s)", 4, key_word, classkey, perms+1, expr); free(expr); if (rc != 0) { goto exit; @@ -319,7 +319,7 @@ static int class_validatetrans_rules_to_strs(struct policydb *pdb, char *classke struct constraint_node *curr; char *expr = NULL; int is_mls; - const char *format_str; + const char *key_word; struct strs *strs; int rc = 0; @@ -331,14 +331,14 @@ static int class_validatetrans_rules_to_strs(struct policydb *pdb, char *classke } if (is_mls) { - format_str = "(mlsvalidatetrans %s %s)"; + key_word = "mlsvalidatetrans"; strs = mls_list; } else { - format_str = "(validatetrans %s %s)"; + key_word = "validatetrans"; strs = non_mls_list; } - rc = strs_create_and_add(strs, format_str, 2, classkey, expr); + rc = strs_create_and_add(strs, "(%s %s %s)", 3, key_word, classkey, expr); free(expr); if (rc != 0) { goto exit; @@ -1035,7 +1035,6 @@ static char *cats_ebitmap_to_str(struct ebitmap *cats, char **val_to_name) struct ebitmap_node *node; uint32_t i, start, range; char *catsbuf = NULL, *p; - const char *fmt; int len, remaining; remaining = (int)cats_ebitmap_len(cats, val_to_name); @@ -1063,9 +1062,15 @@ static char *cats_ebitmap_to_str(struct ebitmap *cats, char **val_to_name) continue; if (range > 1) { - fmt = (range == 2) ? "%s %s " : "(range %s %s) "; - len = snprintf(p, remaining, fmt, - val_to_name[start], val_to_name[i]); + if (range == 2) { + len = snprintf(p, remaining, "%s %s ", + val_to_name[start], + val_to_name[i]); + } else { + len = snprintf(p, remaining, "(range %s %s) ", + val_to_name[start], + val_to_name[i]); + } } else { len = snprintf(p, remaining, "%s ", val_to_name[start]); } diff --git a/libsepol/src/kernel_to_conf.c b/libsepol/src/kernel_to_conf.c index eb72e4ac..460209c8 100644 --- a/libsepol/src/kernel_to_conf.c +++ b/libsepol/src/kernel_to_conf.c @@ -271,7 +271,7 @@ static int class_constraint_rules_to_strs(struct policydb *pdb, char *classkey, { struct constraint_node *curr; struct strs *strs; - const char *format_str, *flavor; + const char *flavor, *perm_prefix, *perm_suffix; char *perms, *expr; int is_mls; int rc = 0; @@ -285,9 +285,11 @@ static int class_constraint_rules_to_strs(struct policydb *pdb, char *classkey, perms = sepol_av_to_string(pdb, class->s.value, curr->permissions); if (strchr(perms, ' ')) { - format_str = "%s %s { %s } %s;"; + perm_prefix = "{ "; + perm_suffix = " }"; } else { - format_str = "%s %s %s %s"; + perm_prefix = ""; + perm_suffix = ""; } if (is_mls) { flavor = "mlsconstrain"; @@ -297,8 +299,10 @@ static int class_constraint_rules_to_strs(struct policydb *pdb, char *classkey, strs = non_mls_list; } - rc = strs_create_and_add(strs, format_str, 4, - flavor, classkey, perms+1, expr); + rc = strs_create_and_add(strs, "%s %s %s%s%s %s;", 6, + flavor, classkey, + perm_prefix, perms+1, perm_suffix, + expr); free(expr); if (rc != 0) { goto exit; @@ -1026,7 +1030,6 @@ static char *cats_ebitmap_to_str(struct ebitmap *cats, char **val_to_name) struct ebitmap_node *node; uint32_t i, start, range, first; char *catsbuf = NULL, *p; - const char *fmt; char sep; int len, remaining; @@ -1054,12 +1057,12 @@ static char *cats_ebitmap_to_str(struct ebitmap *cats, char **val_to_name) if (range > 1) { sep = (range == 2) ? ',' : '.'; - fmt = first ? "%s%c%s" : ",%s%c%s"; - len = snprintf(p, remaining, fmt, + len = snprintf(p, remaining, "%s%s%c%s", + first ? "" : ",", val_to_name[start], sep, val_to_name[i]); } else { - fmt = first ? "%s" : ",%s"; - len = snprintf(p, remaining, fmt, val_to_name[start]); + len = snprintf(p, remaining, "%s%s", first ? "" : ",", + val_to_name[start]); } if (len < 0 || len >= remaining) { diff --git a/libsepol/src/module_to_cil.c b/libsepol/src/module_to_cil.c index 16e4004e..b231d7f8 100644 --- a/libsepol/src/module_to_cil.c +++ b/libsepol/src/module_to_cil.c @@ -1259,7 +1259,7 @@ static int cond_expr_to_cil(int indent, struct policydb *pdb, struct cond_expr * char *val2 = NULL; unsigned int num_params; const char *op; - const char *fmt_str; + const char *sep; const char *type; rc = stack_init(&stack); @@ -1308,11 +1308,11 @@ static int cond_expr_to_cil(int indent, struct policydb *pdb, struct cond_expr * rc = -1; goto exit; } - fmt_str = "(%s %s)"; + sep = ""; } else { val2 = stack_pop(stack); val1 = stack_pop(stack); - fmt_str = "(%s %s %s)"; + sep = " "; } if (val1 == NULL || val2 == NULL) { @@ -1334,10 +1334,7 @@ static int cond_expr_to_cil(int indent, struct policydb *pdb, struct cond_expr * goto exit; } - // although we always supply val2 and there isn't always a 2nd - // value, it should only be used when there are actually two values - // in the format strings - rlen = snprintf(new_val, len, fmt_str, op, val1, val2); + rlen = snprintf(new_val, len, "(%s %s%s%s)", op, val1, sep, val2); if (rlen < 0 || rlen >= len) { log_err("Failed to generate conditional expression"); rc = -1; @@ -1711,7 +1708,7 @@ static int constraint_expr_to_string(struct policydb *pdb, struct constraint_exp char *val2 = NULL; uint32_t num_params; const char *op; - const char *fmt_str; + const char *sep; const char *attr1; const char *attr2; char *names = NULL; @@ -1849,11 +1846,11 @@ static int constraint_expr_to_string(struct policydb *pdb, struct constraint_exp rc = -1; goto exit; } - fmt_str = "(%s %s)"; + sep = ""; } else { val2 = stack_pop(stack); val1 = stack_pop(stack); - fmt_str = "(%s %s %s)"; + sep = " "; } if (val1 == NULL || val2 == NULL) { @@ -1875,10 +1872,7 @@ static int constraint_expr_to_string(struct policydb *pdb, struct constraint_exp goto exit; } - // although we always supply val2 and there isn't always a 2nd - // value, it should only be used when there are actually two values - // in the format strings - rlen = snprintf(new_val, len, fmt_str, op, val1, val2); + rlen = snprintf(new_val, len, "(%s %s%s%s)", op, val1, sep, val2); if (rlen < 0 || rlen >= len) { log_err("Failed to generate constraint expression"); rc = -1; From patchwork Fri Nov 12 15:41:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Christian_G=C3=B6ttsche?= X-Patchwork-Id: 12617045 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2489CC433FE for ; Fri, 12 Nov 2021 15:42:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 044DB60273 for ; Fri, 12 Nov 2021 15:42:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235172AbhKLPpB (ORCPT ); Fri, 12 Nov 2021 10:45:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58338 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235262AbhKLPpA (ORCPT ); Fri, 12 Nov 2021 10:45:00 -0500 Received: from mail-ed1-x530.google.com (mail-ed1-x530.google.com [IPv6:2a00:1450:4864:20::530]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8C714C061766 for ; Fri, 12 Nov 2021 07:42:09 -0800 (PST) Received: by mail-ed1-x530.google.com with SMTP id v11so39384216edc.9 for ; Fri, 12 Nov 2021 07:42:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20210112; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=qBVYVTKeINuYfURZkoIS5asExrr2DTxM1QXEJbOD4c0=; b=CQ6YfIc+2MzVVdKQmRFiCdsbPSQwEmH20zOnDpGR5BZPQs9OCOGu9dUDwtUuXb+4o6 Ed75fIamyD5oILcLTGuxaiG2/9qUNf5nDUCu1pK+3OY+G3DUjTHI4+Bnw5dcDxAFbwcf 3TrtdPc9xd3xAkoUs6gFPrQeJHzUIkKejjKNpD1DXUp+5nHYO8yG8mpPiFw11ci8fHqq GP+yECat23gq1VRIQoLMCVSlp9QIfR5fA12IuESv5xeCaw2C/ZVgyxXN0EAn0v4kgACU aKf6Yx/8AyKXUJznsGJkOL4GI3sB17xDxPiBtNFTXnJuiOKYpT27clndSgokUiLVS8AW QJzg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=qBVYVTKeINuYfURZkoIS5asExrr2DTxM1QXEJbOD4c0=; b=WhYOqnGduHjcv1dpNEo40+JHhmtX4bFpv3+uIDBXoWr428TOLfnNeRzHj9BokmPi11 7D1TnMShAbnTZPrI7TYE88c62LlioMzEQ4Zr329UYVPsNy00n/dS/AMSffXx74dkd5ox z/hNAq3uGwrEutNWSw3pVPtZ4atUgWNFjQjtWqNSUNWD5UhsaFQdaCQbJFiF7iocMsxw BmJ6ZgeEoQ+bYm+uRgbI+wDKrGULQsL5iiKmiL07WJPxrqi6XDM8mXOFtwhqAXC2heI5 BmMpeS4OxK3rLyq4mTR3Wm7HKDEBZPCfwMA4h3pDOks5PcZtbOz7XNDMAHoKgTjYNZGm /lTQ== X-Gm-Message-State: AOAM532DBz7cmCS5usfwozGaDCOYktqn3FYNWxftFhqk0aCbesRfT21W Je14RWcHi7+k+h2/oAQQw4td6MF3AC0= X-Google-Smtp-Source: ABdhPJyYVgWnQOElkW20IVT6aQkUCK942/qdsIQCznr2kkPOz7IP2Ha94hhe6UiCiZsVbDGxCCbQpw== X-Received: by 2002:a17:907:a426:: with SMTP id sg38mr20548653ejc.392.1636731727876; Fri, 12 Nov 2021 07:42:07 -0800 (PST) Received: from debianHome.localdomain (dynamic-077-000-195-130.77.0.pool.telefonica.de. [77.0.195.130]) by smtp.gmail.com with ESMTPSA id m9sm2628914eje.102.2021.11.12.07.42.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Nov 2021 07:42:07 -0800 (PST) From: =?utf-8?q?Christian_G=C3=B6ttsche?= To: selinux@vger.kernel.org Subject: [PATCH 03/12] policycoreutils: use string literal as format strings Date: Fri, 12 Nov 2021 16:41:52 +0100 Message-Id: <20211112154201.78217-3-cgzones@googlemail.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211112154201.78217-1-cgzones@googlemail.com> References: <20211112154201.78217-1-cgzones@googlemail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: selinux@vger.kernel.org Use string literal as format string so that compilers can validate the count and types of the inherent arguments. sestatus.c: In function ‘printf_tab’: sestatus.c:175:16: error: format not a string literal, argument types not checked [-Werror=format-nonliteral] 175 | printf(buf, outp); | ^~~ Signed-off-by: Christian Göttsche --- policycoreutils/sestatus/sestatus.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/policycoreutils/sestatus/sestatus.c b/policycoreutils/sestatus/sestatus.c index ceee0d52..538c73bc 100644 --- a/policycoreutils/sestatus/sestatus.c +++ b/policycoreutils/sestatus/sestatus.c @@ -170,9 +170,7 @@ void load_checks(char *pc[], int *npc, char *fc[], int *nfc) void printf_tab(const char *outp) { - char buf[20]; - snprintf(buf, sizeof(buf), "%%-%us", COL); - printf(buf, outp); + printf("%-*s", COL, outp); } From patchwork Fri Nov 12 15:41:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Christian_G=C3=B6ttsche?= X-Patchwork-Id: 12617047 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AA581C433F5 for ; Fri, 12 Nov 2021 15:42:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 90D6860296 for ; Fri, 12 Nov 2021 15:42:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234295AbhKLPpB (ORCPT ); Fri, 12 Nov 2021 10:45:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58340 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232194AbhKLPpB (ORCPT ); Fri, 12 Nov 2021 10:45:01 -0500 Received: from mail-ed1-x52d.google.com (mail-ed1-x52d.google.com [IPv6:2a00:1450:4864:20::52d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1202AC061767 for ; Fri, 12 Nov 2021 07:42:10 -0800 (PST) Received: by mail-ed1-x52d.google.com with SMTP id b15so39080932edd.7 for ; Fri, 12 Nov 2021 07:42:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20210112; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=YFhXaHULBOuwz63rW/5RrcMDt/edsv5vTFRaH+MB818=; b=idkKkEub23Z2zN/nSY33b/TaQzZKHbgjwY7AOt3kd1AeCC8mEI37JpdW8rTkVh1CNI /9LXhn5QkYQm4RgG3znB5c5xPT/D2xb6ayzpfwQp0YnJX1CBJD1TYOg6BN3UN4v9XLef XtBQRznJkWCK0ZVj8QAHyXWj9EckJ0/NMBXROF7T+6ix3c6qyls3pTWVcoxsz/j4tpbB pVbim/A3P7Ev3VT2jys+6H2RrjsvPzntkx0p0w3ZfMRnOr1Llmq5+PV13fNIUc6IZqWy o7ZCGUUiYJBic3/V6cE+3AJXLZTowfZEnYSW8uf6vRlsDUJhfvhMtaeDPGyZl1uJTtZV XweA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=YFhXaHULBOuwz63rW/5RrcMDt/edsv5vTFRaH+MB818=; b=x1vg1kSne3Xke6s61XYpFDmOpMjOHxb1fJeEDXIhqZBK+DBN3FCAlINi4lU4k6mG1x gX6+9G/Me1knB7oOs16KvRkF0JMdQ4EUT01ZfVsn9pkLZAU8WXTr4hwa52F8t4wo8goE +UrFGfriXEFUNRpWbfmjLQU/z+6bFbo0ukWc7ppgurvb7y7rHcf94gGm5N1BVyzQauLc 271t7JhGGAMy7vBPlryVF3UoaiDK/5WBac8PyAvNRfYyW08nsKTMuEMzSu/6LlWUO3gf phSpOdqODW732hE+GBRBbs6TgpR0OHJLZmccfUrq40EMuNhZiXgAbVzB1SKWd3UoRX5a yzPQ== X-Gm-Message-State: AOAM530Uh+QpXyc1SJoxbqZUOpj2rpvIJK9kRlLgoS0S7f2hlhBDrgwt 9KkhF+m1SUihm8ztktjHzGpRLbT433E= X-Google-Smtp-Source: ABdhPJzf01peZPVZMyTnwqsFJQpJnI25k1BxZ0/NlDspHD+CmhDtHTayZVYtuBRG/vcKkZokBK4tAw== X-Received: by 2002:a05:6402:354f:: with SMTP id f15mr22886054edd.390.1636731728515; Fri, 12 Nov 2021 07:42:08 -0800 (PST) Received: from debianHome.localdomain (dynamic-077-000-195-130.77.0.pool.telefonica.de. [77.0.195.130]) by smtp.gmail.com with ESMTPSA id m9sm2628914eje.102.2021.11.12.07.42.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Nov 2021 07:42:08 -0800 (PST) From: =?utf-8?q?Christian_G=C3=B6ttsche?= To: selinux@vger.kernel.org Subject: [PATCH 04/12] Enable extra global compiler warnings Date: Fri, 12 Nov 2021 16:41:53 +0100 Message-Id: <20211112154201.78217-4-cgzones@googlemail.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211112154201.78217-1-cgzones@googlemail.com> References: <20211112154201.78217-1-cgzones@googlemail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: selinux@vger.kernel.org Enable some extra compiler warnings in the global Makefile. These are supported by GCC and Clang. The global Makefile is almost solely used by developers and the CI, so the interaction with the preexisting -Werror flag is desirable. Signed-off-by: Christian Göttsche --- Makefile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Makefile b/Makefile index 298cd2b7..215e313e 100644 --- a/Makefile +++ b/Makefile @@ -9,8 +9,12 @@ ifeq ($(DEBUG),1) export LDFLAGS = -g else export CFLAGS ?= -O2 -Werror -Wall -Wextra \ + -Wfloat-equal \ + -Wformat=2 \ + -Winit-self \ -Wmissing-format-attribute \ -Wmissing-noreturn \ + -Wnull-dereference \ -Wpointer-arith \ -Wshadow \ -Wstrict-prototypes \ From patchwork Fri Nov 12 15:41:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Christian_G=C3=B6ttsche?= X-Patchwork-Id: 12617049 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 26778C4332F for ; Fri, 12 Nov 2021 15:42:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0A26660EE5 for ; Fri, 12 Nov 2021 15:42:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232194AbhKLPpC (ORCPT ); Fri, 12 Nov 2021 10:45:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58344 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235262AbhKLPpB (ORCPT ); Fri, 12 Nov 2021 10:45:01 -0500 Received: from mail-ed1-x534.google.com (mail-ed1-x534.google.com [IPv6:2a00:1450:4864:20::534]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9B0ADC061766 for ; Fri, 12 Nov 2021 07:42:10 -0800 (PST) Received: by mail-ed1-x534.google.com with SMTP id b15so39081159edd.7 for ; Fri, 12 Nov 2021 07:42:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20210112; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=oybfTQcGxTp5JmZWJtOuu35y0uDEqluqSortKYNJkwU=; b=RdVtgBSMrDJaiAdKeTdw/0eHkz8sY0mULWm30kkKtk7G267cih5GVdg+r92HAGk2DJ BfYChV6kA52CfRgDm2M8jZ9X4BdIytbSKbsXIu2hHHhZwI+Zmq4+FIWaGsAflWylPz/H h8fSGhCEcXQ47ZTPHGgnYxAKkI8UIINGIbv6MeJ/tHuWaJ2VElRx1uMfxbTjMKTTB5wy V7S9KDSKNSIfK2QwqKu8tRAShBh45NOG+uv7BmY/BOsIVshDtXOhyVVXTuvLORK5xTmZ bvuyMoVwqe6GCFnGzX0h96QLQlZ1FLpWwfuvf7BwdddZouYXhN5Kt4zhYAbSoS0DXqwx Lw/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=oybfTQcGxTp5JmZWJtOuu35y0uDEqluqSortKYNJkwU=; b=C1iF8RA9/aycYQrzaNRUFI36Am/pmeiQLT1gPlJz784Yad5AexB+RuelMR/An9ftCv 6JYyF+M0eMb5Va4HgC7SbjwwUf1h2fb+aHCF20IY7ATu5FEa/Jvh8oU+Bc6bgWIGu238 raYY7X68BoLPJnmf9Omc+tscVBs6Tbowk63ytPx01S/+DCnYqBVlzVRbCJpiIH9qbjNw QccLdNi6hhu70H7uQzZQWrUdaA1Pbpy1TlBX5/0r9kwJZr7+VrC0kT/EZaIFGCdJreAH nyUaHG1U3szXl4mGHX6i+OIy2RwU6z6z8c8pNhaZayOprCuke2JQ+BgKZEEfiIwFfK+Z dKxg== X-Gm-Message-State: AOAM5320TTMWF41TDRv0h3crpY1mbjx0QFRIBpCBaXJU11vI1VCwSvuV RqjY37QJn9IG6x+q8W2pQnOvma/C3NY= X-Google-Smtp-Source: ABdhPJzExozhfTwaq1wXDvmnCnJ2yjRtt97DtFM6AdX1r4qzc6gsldgwfvguNbnCV7HQ22td8zdxLQ== X-Received: by 2002:a17:906:919:: with SMTP id i25mr20043440ejd.171.1636731729072; Fri, 12 Nov 2021 07:42:09 -0800 (PST) Received: from debianHome.localdomain (dynamic-077-000-195-130.77.0.pool.telefonica.de. [77.0.195.130]) by smtp.gmail.com with ESMTPSA id m9sm2628914eje.102.2021.11.12.07.42.08 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Nov 2021 07:42:08 -0800 (PST) From: =?utf-8?q?Christian_G=C3=B6ttsche?= To: selinux@vger.kernel.org Subject: [PATCH 05/12] checkpolicy: ignore possible string truncation Date: Fri, 12 Nov 2021 16:41:54 +0100 Message-Id: <20211112154201.78217-5-cgzones@googlemail.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211112154201.78217-1-cgzones@googlemail.com> References: <20211112154201.78217-1-cgzones@googlemail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: selinux@vger.kernel.org The source code line content, saved to improve error reporting, might get truncated, as the current Bison source buffer is 8192 bytes long and only 254 bytes (plus NUL-terminator) are reserved. As the saved string is only used for improving error reports and source lines longer than 254 character are quite uncommon, simply silence the GCC warning. In file included from /usr/include/string.h:519, from lex.yy.c:20: In function ‘strncpy’, inlined from ‘yylex’ at policy_scan.l:63:7: /usr/include/x86_64-linux-gnu/bits/string_fortified.h:91:10: warning: ‘__builtin_strncpy’ output may be truncated copying 255 bytes from a string of length 8190 [-Wstringop-truncation] 91 | return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest)); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Signed-off-by: Christian Göttsche --- checkpolicy/policy_scan.l | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/checkpolicy/policy_scan.l b/checkpolicy/policy_scan.l index ef9f1899..9fefea7b 100644 --- a/checkpolicy/policy_scan.l +++ b/checkpolicy/policy_scan.l @@ -60,7 +60,14 @@ hexval [0-9A-Fa-f] %% \n.* { +#if defined(__GNUC__) && __GNUC__ >= 8 +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wstringop-truncation" +#endif strncpy(linebuf[lno], yytext+1, 255); +#if defined(__GNUC__) && __GNUC__ >= 8 +#pragma GCC diagnostic pop +#endif linebuf[lno][254] = 0; lno = 1 - lno; policydb_lineno++; From patchwork Fri Nov 12 15:41:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Christian_G=C3=B6ttsche?= X-Patchwork-Id: 12617051 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0A3D2C43217 for ; Fri, 12 Nov 2021 15:42:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E273D60296 for ; Fri, 12 Nov 2021 15:42:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235292AbhKLPpC (ORCPT ); Fri, 12 Nov 2021 10:45:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58352 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235262AbhKLPpC (ORCPT ); Fri, 12 Nov 2021 10:45:02 -0500 Received: from mail-ed1-x536.google.com (mail-ed1-x536.google.com [IPv6:2a00:1450:4864:20::536]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 83A31C061766 for ; Fri, 12 Nov 2021 07:42:11 -0800 (PST) Received: by mail-ed1-x536.google.com with SMTP id z21so39283562edb.5 for ; Fri, 12 Nov 2021 07:42:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20210112; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=SN02xIldcHjxtmBai/ug1s+OUlSAhUGWa6QRImMK1rs=; b=mpTt7y8Joy7n/YUZ4zsl6honS6tSIX/NM8ihBauzM93wYunXWaqhZn6GNc9NSNGv9/ mw83bHGgMbC3+lYQRfYJ54RNRQaoBPvEZ1yu2iSssihWKxyV+ml9fjnVsflcEyM6WA0G yLVUwVR6oLp/TarM3TkZAqGMtbq8GTvefMVTzB8LzEqDeJW0/n7+Dt/CqO6C0Rwq+GaB ZL5FsoD+hdmO8TcySzy8LSMjqfUOc+UGeviLcjRpHMgvZBQtTYoxn5M2od9mFYuKbLA4 Aop51MfGSj7MqK0QZ00o9QoHavOh+2OEjxYkNdvSwg1IkEglS8b3yVGWFvN7I0vP1bq/ tyPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=SN02xIldcHjxtmBai/ug1s+OUlSAhUGWa6QRImMK1rs=; b=xrC2lR+s+wKNHwEuLMbQScbEBVa+Pr5+D1F+Zj7l8V0wTH8GH83NVeG7vHrKjPpWyA fxQG9SZpapRHvQjztr09kKL08+BvluyJD1K6WP2K4RwPfyPQSWx18iln3eI82r2gnlm5 4NZIrogcGRf3ymE4Z6vVHWa/BxtA7VGsOfl3rYzOwkJldph2mYwqG6FuFa5EQUWpcBq+ p3g5+W1eLaAYQ9i0V6A4TqGXbCWWTJvvSpU+fUwANebNg+2jdIIhRqVT5FBzFe4s5X9R mN1tw8UM1GAvCk7FDfJIRS+02hLG/r62rzVlDj1DqOpxyy+ZnD+oU87iRZkqA1Pbpmz7 CKkw== X-Gm-Message-State: AOAM533hrCX12svI4mMh0ebCbjHRBeOWG0ffdSueSd7PaL0uXkzAl24q kRfu20G9QGoIY9/U61Awxi7W7JUSuHY= X-Google-Smtp-Source: ABdhPJxvh+ckfbH3RJZH/f1ABOcz697utpcvUYpn4JcuTPEMQuf0uAwhJcChomKNqJx0uo256mWOcA== X-Received: by 2002:a17:906:2e97:: with SMTP id o23mr19531662eji.541.1636731729807; Fri, 12 Nov 2021 07:42:09 -0800 (PST) Received: from debianHome.localdomain (dynamic-077-000-195-130.77.0.pool.telefonica.de. [77.0.195.130]) by smtp.gmail.com with ESMTPSA id m9sm2628914eje.102.2021.11.12.07.42.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Nov 2021 07:42:09 -0800 (PST) From: =?utf-8?q?Christian_G=C3=B6ttsche?= To: selinux@vger.kernel.org Subject: [PATCH 06/12] policycoreutils: mark local functions static Date: Fri, 12 Nov 2021 16:41:55 +0100 Message-Id: <20211112154201.78217-6-cgzones@googlemail.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211112154201.78217-1-cgzones@googlemail.com> References: <20211112154201.78217-1-cgzones@googlemail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: selinux@vger.kernel.org setfiles.c:50:6: warning: no previous prototype for ‘set_rootpath’ [-Wmissing-prototypes] 50 | void set_rootpath(const char *arg) | ^~~~~~~~~~~~ setfiles.c:67:5: warning: no previous prototype for ‘canoncon’ [-Wmissing-prototypes] 67 | int canoncon(char **contextp) | ^~~~~~~~ newrole.c:185:5: warning: no previous prototype for ‘authenticate_via_pam’ [-Wmissing-prototypes] 185 | int authenticate_via_pam(const char *ttyn, pam_handle_t * pam_handle) | ^~~~~~~~~~~~~~~~~~~~ run_init.c:241:5: warning: no previous prototype for ‘authenticate_user’ [-Wmissing-prototypes] 241 | int authenticate_user(void) | ^~~~~~~~~~~~~~~~~ run_init.c:306:5: warning: no previous prototype for ‘get_init_context’ [-Wmissing-prototypes] 306 | int get_init_context(char **context) | ^~~~~~~~~~~~~~~~ sestatus.c:38:5: warning: no previous prototype for ‘cmp_cmdline’ [-Wmissing-prototypes] 38 | int cmp_cmdline(const char *command, int pid) | ^~~~~~~~~~~ sestatus.c:62:5: warning: no previous prototype for ‘pidof’ [-Wmissing-prototypes] 62 | int pidof(const char *command) | ^~~~~ sestatus.c:95:6: warning: no previous prototype for ‘load_checks’ [-Wmissing-prototypes] 95 | void load_checks(char *pc[], int *npc, char *fc[], int *nfc) | ^~~~~~~~~~~ sestatus.c:171:6: warning: no previous prototype for ‘printf_tab’ [-Wmissing-prototypes] 171 | void printf_tab(const char *outp) | ^~~~~~~~~~ Signed-off-by: Christian Göttsche --- policycoreutils/newrole/newrole.c | 4 ++-- policycoreutils/run_init/run_init.c | 12 ++++-------- policycoreutils/sestatus/sestatus.c | 8 ++++---- policycoreutils/setfiles/setfiles.c | 4 ++-- 4 files changed, 12 insertions(+), 16 deletions(-) diff --git a/policycoreutils/newrole/newrole.c b/policycoreutils/newrole/newrole.c index 31b51c5a..9d68b6ab 100644 --- a/policycoreutils/newrole/newrole.c +++ b/policycoreutils/newrole/newrole.c @@ -182,7 +182,7 @@ const char *service_name = "newrole"; * program. This is the only function in this program that makes PAM * calls. */ -int authenticate_via_pam(const char *ttyn, pam_handle_t * pam_handle) +static int authenticate_via_pam(const char *ttyn, pam_handle_t * pam_handle) { int result = 0; /* set to 0 (not authenticated) by default */ @@ -348,7 +348,7 @@ static int read_pam_config(void) * This function uses the shadow passwd file to thenticate the user running * this program. */ -int authenticate_via_shadow_passwd(const char *uname) +static int authenticate_via_shadow_passwd(const char *uname) { struct spwd *p_shadow_line; char *unencrypted_password_s; diff --git a/policycoreutils/run_init/run_init.c b/policycoreutils/run_init/run_init.c index 545490a2..ce499781 100644 --- a/policycoreutils/run_init/run_init.c +++ b/policycoreutils/run_init/run_init.c @@ -86,8 +86,6 @@ /* The file containing the context to run * the scripts under. */ -int authenticate_via_pam(const struct passwd *); - /* authenticate_via_pam() * * in: p_passwd_line - struct containing data from our user's line in @@ -104,7 +102,7 @@ int authenticate_via_pam(const struct passwd *); * */ -int authenticate_via_pam(const struct passwd *p_passwd_line) +static int authenticate_via_pam(const struct passwd *p_passwd_line) { int result = 0; /* our result, set to 0 (not authenticated) by default */ @@ -169,8 +167,6 @@ int authenticate_via_pam(const struct passwd *p_passwd_line) #define PASSWORD_PROMPT _("Password:") /* prompt for getpass() */ -int authenticate_via_shadow_passwd(const struct passwd *); - /* authenticate_via_shadow_passwd() * * in: p_passwd_line - struct containing data from our user's line in @@ -187,7 +183,7 @@ int authenticate_via_shadow_passwd(const struct passwd *); * */ -int authenticate_via_shadow_passwd(const struct passwd *p_passwd_line) +static int authenticate_via_shadow_passwd(const struct passwd *p_passwd_line) { struct spwd *p_shadow_line; /* struct derived from shadow passwd file line */ @@ -238,7 +234,7 @@ int authenticate_via_shadow_passwd(const struct passwd *p_passwd_line) * return: 0 When success * -1 When failure */ -int authenticate_user(void) +static int authenticate_user(void) { #define INITLEN 255 @@ -303,7 +299,7 @@ int authenticate_user(void) * out: The CONTEXT associated with the context. * return: 0 on success, -1 on failure. */ -int get_init_context(char **context) +static int get_init_context(char **context) { FILE *fp; diff --git a/policycoreutils/sestatus/sestatus.c b/policycoreutils/sestatus/sestatus.c index 538c73bc..7dcc9944 100644 --- a/policycoreutils/sestatus/sestatus.c +++ b/policycoreutils/sestatus/sestatus.c @@ -35,7 +35,7 @@ static unsigned int COL = 32; extern char *selinux_mnt; -int cmp_cmdline(const char *command, int pid) +static int cmp_cmdline(const char *command, int pid) { char buf[BUFSIZE]; @@ -59,7 +59,7 @@ int cmp_cmdline(const char *command, int pid) return 0; } -int pidof(const char *command) +static int pidof(const char *command) { /* inspired by killall5.c from psmisc */ char stackpath[PATH_MAX + 1], *p; @@ -92,7 +92,7 @@ int pidof(const char *command) return ret; } -void load_checks(char *pc[], int *npc, char *fc[], int *nfc) +static void load_checks(char *pc[], int *npc, char *fc[], int *nfc) { FILE *fp = fopen(CONF, "r"); @@ -168,7 +168,7 @@ void load_checks(char *pc[], int *npc, char *fc[], int *nfc) return; } -void printf_tab(const char *outp) +static void printf_tab(const char *outp) { printf("%-*s", COL, outp); diff --git a/policycoreutils/setfiles/setfiles.c b/policycoreutils/setfiles/setfiles.c index f018d161..fedb93a1 100644 --- a/policycoreutils/setfiles/setfiles.c +++ b/policycoreutils/setfiles/setfiles.c @@ -47,7 +47,7 @@ static __attribute__((__noreturn__)) void usage(const char *const name) exit(-1); } -void set_rootpath(const char *arg) +static void set_rootpath(const char *arg) { if (strlen(arg) == 1 && strncmp(arg, "/", 1) == 0) { fprintf(stderr, "%s: invalid alt_rootpath: %s\n", @@ -64,7 +64,7 @@ void set_rootpath(const char *arg) } } -int canoncon(char **contextp) +static int canoncon(char **contextp) { char *context = *contextp, *tmpcon; int rc = 0; From patchwork Fri Nov 12 15:41:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Christian_G=C3=B6ttsche?= X-Patchwork-Id: 12617053 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8C20BC433FE for ; Fri, 12 Nov 2021 15:42:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 76A7360296 for ; Fri, 12 Nov 2021 15:42:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235262AbhKLPpD (ORCPT ); Fri, 12 Nov 2021 10:45:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58354 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235274AbhKLPpC (ORCPT ); Fri, 12 Nov 2021 10:45:02 -0500 Received: from mail-ed1-x529.google.com (mail-ed1-x529.google.com [IPv6:2a00:1450:4864:20::529]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E09BFC061767 for ; Fri, 12 Nov 2021 07:42:11 -0800 (PST) Received: by mail-ed1-x529.google.com with SMTP id f4so39242876edx.12 for ; Fri, 12 Nov 2021 07:42:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20210112; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=TxhIoNxNhxpAdljwG1McjlJgpQe7wCkjPNo43yd1RWM=; b=TlweuswXJm4/dOeo3Qz8afOBAU3tmw+Sg5rxyMN+SPZNyRc5yvdb6HGISwrUHJF8T0 /XVMRcWe5sO53zT7BOrYDKxolUZn/tSI+dNJmawf+xsQ+A3QYG95T1n9d6bknuTY0gA1 xNkqvy/0igjbLOSgn28VdSqnpRMvvIragMJEbZeShRO6blwkBMy0neMfQgIY5XVejvcF eTE0tS84jkjk7VT4kxPJ1Ggns6oN/jB4RyfF2cxPfOOF2BtsOsMxVQZbwyiPqrE9lbZ4 OHszGXbDAP7lV2vDtbY2OAcnRNpXmccEAkIn7Dhgqv4gEaXfJB7yGjkrTl93WgKU4PZO JyLQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=TxhIoNxNhxpAdljwG1McjlJgpQe7wCkjPNo43yd1RWM=; b=WjyIQzqB1LzLgLRgC5EOdPkog8I9UBX+tuE+rc1gPUQidTi6DwFYWJydR4huk+0whR 2CDlvM/4ZFPa7BWFxZh61flVamcQrNdBkp4pupn9FbeZYI5B0Eo2nLg42iVBpJRrFVMS jBaVNqZUQdGGx8j5T3L1tqknwEtgIV2+GD5pQPXrPkKmGW4mmlxFBDWiS1/ypc2et6Ua P9Pbs90mklSFgILFI0OklOOK0fT55vKdcyCDHWb6nls4g9bhTRZ8jOpEPxLJypqjmJCx fjxMZnFIBuBr8nem31TXX1a83U4iitciCT0cr1VFnoD0E5wk3crw0kxvwBPUdFdJjLik Y1TA== X-Gm-Message-State: AOAM530LBTDE9XqO3mmmcKPUSUARijwQUigdPs9YS9U45O2EBN8lRqxc eGKeB8x+qn0rNbIRzYyMUkdlrMn1hC8= X-Google-Smtp-Source: ABdhPJz1A5/FUMIQam1u6CByJnJdpxE1n04Gv9MsluJ6G6+gnwj5UjtNTvGtCfvqrhWHHWk+kOfjRw== X-Received: by 2002:a17:907:3e8a:: with SMTP id hs10mr20772214ejc.58.1636731730339; Fri, 12 Nov 2021 07:42:10 -0800 (PST) Received: from debianHome.localdomain (dynamic-077-000-195-130.77.0.pool.telefonica.de. [77.0.195.130]) by smtp.gmail.com with ESMTPSA id m9sm2628914eje.102.2021.11.12.07.42.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Nov 2021 07:42:10 -0800 (PST) From: =?utf-8?q?Christian_G=C3=B6ttsche?= To: selinux@vger.kernel.org Subject: [PATCH 07/12] sandbox: mark local functions static Date: Fri, 12 Nov 2021 16:41:56 +0100 Message-Id: <20211112154201.78217-7-cgzones@googlemail.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211112154201.78217-1-cgzones@googlemail.com> References: <20211112154201.78217-1-cgzones@googlemail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: selinux@vger.kernel.org seunshare.c:92:6: warning: no previous prototype for ‘handler’ [-Wmissing-prototypes] 92 | void handler(int sig) { | ^~~~~~~ Signed-off-by: Christian Göttsche --- sandbox/seunshare.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sandbox/seunshare.c b/sandbox/seunshare.c index d626e98d..8917a0f9 100644 --- a/sandbox/seunshare.c +++ b/sandbox/seunshare.c @@ -89,7 +89,7 @@ static int drop_privs(uid_t uid) /** * If the user sends a siginto to seunshare, kill the child's session */ -void handler(int sig) { +static void handler(int sig) { if (child > 0) kill(-child,sig); } From patchwork Fri Nov 12 15:41:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Christian_G=C3=B6ttsche?= X-Patchwork-Id: 12617055 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 31E99C433EF for ; Fri, 12 Nov 2021 15:42:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1B5FA60273 for ; Fri, 12 Nov 2021 15:42:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235297AbhKLPpE (ORCPT ); Fri, 12 Nov 2021 10:45:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58358 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235312AbhKLPpD (ORCPT ); Fri, 12 Nov 2021 10:45:03 -0500 Received: from mail-ed1-x52d.google.com (mail-ed1-x52d.google.com [IPv6:2a00:1450:4864:20::52d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 57302C061766 for ; Fri, 12 Nov 2021 07:42:12 -0800 (PST) Received: by mail-ed1-x52d.google.com with SMTP id f4so39242942edx.12 for ; Fri, 12 Nov 2021 07:42:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20210112; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=OhjgPaB1eQPAPhm4bIVwHNUnE32r4+v3B8Rqc8yYYJk=; b=ZN1puIIYCkzQ5cW9HrKy4sgPgFlQ6gfBuLqaOVd35Y2CCc2dGKZZ4qrj9uG7LCWTgu +ihEEZJle2dw3ONGFTK0Y8WNaKqNylUrecIAwmKwzQFy05JDFBpvIXv7Q3n0Z87ybupi YhHm3OliB+JKk9yHHFffIktuM6zLfWhtRGqky/2aBKnB1xHthDBrNRqf2fYBimqwe2pT SSHUmXSN4f7L7FdO4U+HWJM9hwkPwOOZTsz0+CchYNqsQnMSZBnOmx+iijxPWdPWNphm kJ/OoaVZaE8bnXjOV606PV3uR7HTvtprjIldb3YK0+fKcVtAZk8tNnhAUelUQZnL1Zae +QzQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=OhjgPaB1eQPAPhm4bIVwHNUnE32r4+v3B8Rqc8yYYJk=; b=jXojEXh4VifRWPgukm8gH8I77N0NKUSEfWSMIRoou/QDlEkMqKut0Xv17cjwDrPbhQ +i9IH3Uoc4mok2iG/m3zCGF982LEFOs7HJdMDlT6ys/HOJxFHFtxYdhJyW59PftkRfD4 J6MoZxIheoFn/lFPapRIoGwsWlL4afMMRauj0NEhZwiEhomKBBqtVJQMnNKiJuW+0UYP qwhf/ZNhahDa14VVzuHGspcBEDirZvWe3WOyzu5c8uTPiCqEBXa4Skz8SsNIeY2Kul29 vGmNm9F/RtR4mp08Y1prppD7pRhavCZBR0i+4wjO7Xrtpo9bUncGWCoD0X8HPhwzdG+2 LSEw== X-Gm-Message-State: AOAM533O1P4fJ3L8YVS6bJW2wEEddZJBvVRgZGgRaaLqojomwZn9xIBX jxl8KGs5ifGZuMZPShC5/IYcP9llAeA= X-Google-Smtp-Source: ABdhPJycW5sjigQQgalKl5nd746rYz2teYIzHQ+XXOSpT4+jAg44+/PW1lButVLY1x42f7Fv/xEwaw== X-Received: by 2002:a17:907:8a1a:: with SMTP id sc26mr20684042ejc.402.1636731730890; Fri, 12 Nov 2021 07:42:10 -0800 (PST) Received: from debianHome.localdomain (dynamic-077-000-195-130.77.0.pool.telefonica.de. [77.0.195.130]) by smtp.gmail.com with ESMTPSA id m9sm2628914eje.102.2021.11.12.07.42.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Nov 2021 07:42:10 -0800 (PST) From: =?utf-8?q?Christian_G=C3=B6ttsche?= To: selinux@vger.kernel.org Subject: [PATCH 08/12] python: mark local functions static Date: Fri, 12 Nov 2021 16:41:57 +0100 Message-Id: <20211112154201.78217-8-cgzones@googlemail.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211112154201.78217-1-cgzones@googlemail.com> References: <20211112154201.78217-1-cgzones@googlemail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: selinux@vger.kernel.org sepolgen-ifgen-attr-helper.c:59:5: warning: no previous prototype for ‘render_access_mask’ [-Wmissing-prototypes] 59 | int render_access_mask(uint32_t av, avtab_key_t *key, policydb_t *policydbp, | ^~~~~~~~~~~~~~~~~~ sepolgen-ifgen-attr-helper.c:114:5: warning: no previous prototype for ‘output_avrule’ [-Wmissing-prototypes] 114 | int output_avrule(avtab_key_t *key, avtab_datum_t *datum, void *args) | ^~~~~~~~~~~~~ sepolgen-ifgen-attr-helper.c:220:6: warning: no previous prototype for ‘usage’ [-Wmissing-prototypes] 220 | void usage(char *progname) | ^~~~~ Signed-off-by: Christian Göttsche --- python/audit2allow/sepolgen-ifgen-attr-helper.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/python/audit2allow/sepolgen-ifgen-attr-helper.c b/python/audit2allow/sepolgen-ifgen-attr-helper.c index f010c958..6f3ba962 100644 --- a/python/audit2allow/sepolgen-ifgen-attr-helper.c +++ b/python/audit2allow/sepolgen-ifgen-attr-helper.c @@ -56,7 +56,7 @@ static int perm_name(hashtab_key_t key, hashtab_datum_t datum, void *data) return 0; } -int render_access_mask(uint32_t av, avtab_key_t *key, policydb_t *policydbp, +static int render_access_mask(uint32_t av, avtab_key_t *key, policydb_t *policydbp, FILE *fp) { struct val_to_name v; @@ -111,7 +111,7 @@ struct callback_data FILE *fp; }; -int output_avrule(avtab_key_t *key, avtab_datum_t *datum, void *args) +static int output_avrule(avtab_key_t *key, avtab_datum_t *datum, void *args) { struct callback_data *cb_data = (struct callback_data *)args; @@ -217,7 +217,7 @@ static policydb_t *load_policy(const char *filename) } -void usage(char *progname) +static void usage(char *progname) { printf("usage: %s out_file [policy_file]\n", progname); } From patchwork Fri Nov 12 15:41:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Christian_G=C3=B6ttsche?= X-Patchwork-Id: 12617059 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BA2E7C433F5 for ; Fri, 12 Nov 2021 15:42:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A35A560296 for ; Fri, 12 Nov 2021 15:42:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235315AbhKLPpE (ORCPT ); Fri, 12 Nov 2021 10:45:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58362 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235273AbhKLPpD (ORCPT ); Fri, 12 Nov 2021 10:45:03 -0500 Received: from mail-ed1-x52a.google.com (mail-ed1-x52a.google.com [IPv6:2a00:1450:4864:20::52a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F1710C0613F5 for ; Fri, 12 Nov 2021 07:42:12 -0800 (PST) Received: by mail-ed1-x52a.google.com with SMTP id t18so19894768edd.8 for ; Fri, 12 Nov 2021 07:42:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20210112; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=JUddoDP6kGYq7g+Vk2s3Fe9n4QrAeiHqLnmwmu+RgEA=; b=O1i2L4pLYmwp6RQuJL59QH9BpVuA6KKvisfuepYnD+Dr8liNerKOzl3F2BThmlfrNE 1dhJlSPbGjBdVbY5QvAJE1tyiR1NXMdxzWGgGlwEvqSLAIjwcEMoZANbn2S5EeXJ1Teq 0VvbqhtDcwLYgf/3jaLJwRuZYOxIM6YMCfQ+jtPdbmW5m/FtjsVFKEnst0gchBQEGJTy /gWMCNSPqW2KFoWLDPPTiIwMBWy4AuaHKMujGVg268EL8nAOWTYSqVWDXFD/cbmbvbvD ClNTl+MeoF0Qg1IhmTLfhWQhXfdw5mOMj0hzIEJTwg0naLfSHWmuQG2m9JG8wbSf7edv RViA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=JUddoDP6kGYq7g+Vk2s3Fe9n4QrAeiHqLnmwmu+RgEA=; b=YFWmPnuabRgb1gP4BLAQSGfu1fJHJBjHAiks+v9uaEFkW71ZgVMJv4W4chlMvT8MZL 0FJYG3NHAqROzMqD0xx/Rs2Zey1NnkblPjBVJXPo3KpTqn3RK6hfDgU6DUvPyXqCC48V TwB8Zf31s3C2Z4Y6LhZkU4w8h9ZQLP7t3802KOoluuzsMWI5ZWNr0g6mUToNmO7O/+MU B8bYizgPrDkaD6OntTtwPKl1hkpadX6IDyyZ539d+vWq3vJMmyO4WKGycrIZvJ1QuDmW lwWDrIDRMejzhG2N7Ke5aheu2FGi2xbryFDIha5kjHvRm4wjef2s0M0mlgbbwB/vhkXb 7NuA== X-Gm-Message-State: AOAM531mtJYzIUZMiYqd+foMWrrenNJyOqgAld7NV21opo7a3nW9u+8E 8cRkznWaW8nucA1GE+Y4Z+BLH7ZrDn0= X-Google-Smtp-Source: ABdhPJyVYgBdhNWmAhf/4d31E5uB0xUzd2XV9OIsHQAfg+IQk5jo2omMYVpyGpTWivDSwY/wVoGb+Q== X-Received: by 2002:a17:907:72cf:: with SMTP id du15mr20496783ejc.167.1636731731468; Fri, 12 Nov 2021 07:42:11 -0800 (PST) Received: from debianHome.localdomain (dynamic-077-000-195-130.77.0.pool.telefonica.de. [77.0.195.130]) by smtp.gmail.com with ESMTPSA id m9sm2628914eje.102.2021.11.12.07.42.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Nov 2021 07:42:11 -0800 (PST) From: =?utf-8?q?Christian_G=C3=B6ttsche?= To: selinux@vger.kernel.org Subject: [PATCH 09/12] mcstrans: avoid missing prototypes Date: Fri, 12 Nov 2021 16:41:58 +0100 Message-Id: <20211112154201.78217-9-cgzones@googlemail.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211112154201.78217-1-cgzones@googlemail.com> References: <20211112154201.78217-1-cgzones@googlemail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: selinux@vger.kernel.org Mark local functions static. Export functions of mcscolor.c in mcscolor.h and avoid bare extern function declarations. Drop unused function emit_whitespace(). Signed-off-by: Christian Göttsche --- mcstrans/src/mcscolor.c | 2 ++ mcstrans/src/mcscolor.h | 8 ++++++ mcstrans/src/mcstrans.c | 57 ++++++++++++++++++---------------------- mcstrans/src/mcstrans.h | 1 - mcstrans/src/mcstransd.c | 13 +++------ 5 files changed, 38 insertions(+), 43 deletions(-) create mode 100644 mcstrans/src/mcscolor.h diff --git a/mcstrans/src/mcscolor.c b/mcstrans/src/mcscolor.c index a3838850..9ff0ce2f 100644 --- a/mcstrans/src/mcscolor.c +++ b/mcstrans/src/mcscolor.c @@ -11,6 +11,8 @@ #include #include #include + +#include "mcscolor.h" #include "mcstrans.h" /* Define data structures */ diff --git a/mcstrans/src/mcscolor.h b/mcstrans/src/mcscolor.h new file mode 100644 index 00000000..c37fe6ed --- /dev/null +++ b/mcstrans/src/mcscolor.h @@ -0,0 +1,8 @@ +#ifndef __mcscolor_h__ +#define __mcscolor_h__ + +extern void finish_context_colors(void); +extern int init_colors(void); +extern int raw_color(const char *raw, char **color_str); + +#endif diff --git a/mcstrans/src/mcstrans.c b/mcstrans/src/mcstrans.c index e92dfddb..09577ea0 100644 --- a/mcstrans/src/mcstrans.c +++ b/mcstrans/src/mcstrans.c @@ -136,7 +136,7 @@ typedef struct cat_constraint { static cat_constraint_t *cat_constraints; -unsigned int +static unsigned int hash(const char *str) { unsigned int hash = 5381; int c; @@ -213,7 +213,7 @@ parse_category(ebitmap_t *e, const char *raw, int allowinverse) return 0; } -int +static int parse_ebitmap(ebitmap_t *e, ebitmap_t *def, const char *raw) { int rc = ebitmap_cpy(e, def); if (rc < 0) @@ -224,7 +224,7 @@ parse_ebitmap(ebitmap_t *e, ebitmap_t *def, const char *raw) { return 0; } -mls_level_t * +static mls_level_t * parse_raw(const char *raw) { mls_level_t *mls = calloc(1, sizeof(mls_level_t)); if (!mls) @@ -248,7 +248,7 @@ err: return NULL; } -void +static void destroy_word(word_t **list, word_t *word) { if (!word) { return; @@ -267,7 +267,7 @@ destroy_word(word_t **list, word_t *word) { free(word); } -word_t * +static word_t * create_word(word_t **list, const char *text) { word_t *w = calloc(1, sizeof(word_t)); if (!w) { @@ -291,7 +291,7 @@ err: return NULL; } -void +static void destroy_group(word_group_t **list, word_group_t *group) { for (; list && *list; list = &(*list)->next) { if (*list == group) { @@ -324,7 +324,7 @@ destroy_group(word_group_t **list, word_group_t *group) { free(group); } -word_group_t * +static word_group_t * create_group(word_group_t **list, const char *name) { word_group_t *group = calloc(1, sizeof(word_group_t)); if (!group) @@ -357,7 +357,7 @@ err: return NULL; } -void +static void destroy_domain(domain_t *domain) { int i; unsigned int rt = 0, tr = 0; @@ -401,7 +401,7 @@ destroy_domain(domain_t *domain) { syslog(LOG_INFO, "cache sizes: tr = %u, rt = %u", tr, rt); } -domain_t * +static domain_t * create_domain(const char *name) { domain_t *domain = calloc(1, sizeof(domain_t)); if (!domain) { @@ -425,7 +425,7 @@ err: return NULL; } -int +static int add_word(word_group_t *group, char *raw, char *trans) { if (strchr(trans,'-')) { log_error("'%s'is invalid because '-' is illegal in modifiers.\n", trans); @@ -451,7 +451,7 @@ add_word(word_group_t *group, char *raw, char *trans) { return 0; } -int +static int add_constraint(char op, char *raw, char *tok) { log_debug("%s\n", "add_constraint"); ebitmap_t empty; @@ -521,7 +521,7 @@ add_constraint(char op, char *raw, char *tok) { return 0; } -int +static int violates_constraints(mls_level_t *l) { int nbits; sens_constraint_t *s; @@ -563,7 +563,7 @@ violates_constraints(mls_level_t *l) { return 0; } -void +static void destroy_sens_constraint(sens_constraint_t **list, sens_constraint_t *constraint) { if (!constraint) { return; @@ -580,7 +580,7 @@ destroy_sens_constraint(sens_constraint_t **list, sens_constraint_t *constraint) free(constraint); } -void +static void destroy_cat_constraint(cat_constraint_t **list, cat_constraint_t *constraint) { if (!constraint) { return; @@ -663,7 +663,7 @@ find_in_table(context_map_node_t **table, const char *key) { return NULL; } -char * +static char * trim(char *str, const char *whitespace) { char *p = str + strlen(str); @@ -672,7 +672,7 @@ trim(char *str, const char *whitespace) { return str; } -char * +static char * triml(char *str, const char *whitespace) { char *p = str; @@ -681,7 +681,7 @@ triml(char *str, const char *whitespace) { return p; } -int +static int update(char **p, char *const val) { free (*p); *p = strdup(val); @@ -692,7 +692,7 @@ update(char **p, char *const val) { return 0; } -int +static int append(affix_t **affixes, const char *val) { affix_t *affix = calloc(1, sizeof(affix_t)); if (!affix) { @@ -887,7 +887,7 @@ init_translations(void) { return(read_translations(selinux_translations_path())); } -char * +static char * extract_range(const char *incon) { context_t con = context_new(incon); if (!con) { @@ -910,7 +910,7 @@ extract_range(const char *incon) { return r; } -char * +static char * new_context_str(const char *incon, const char *range) { char *rcon = NULL; context_t con = context_new(incon); @@ -931,7 +931,7 @@ exit: return NULL; } -char * +static char * find_in_hashtable(const char *range, domain_t *domain, context_map_node_t **table) { char *trans = NULL; context_map_t *map = find_in_table(table, range); @@ -946,13 +946,6 @@ find_in_hashtable(const char *range, domain_t *domain, context_map_node_t **tabl return trans; } -void -emit_whitespace(char*buffer, char *whitespace) { - strcat(buffer, "["); - strcat(buffer, whitespace); - strcat(buffer, "]"); -} - static int string_size(const void *p1, const void *p2) { return strlen(*(char **)p2) - strlen(*(char **)p1); @@ -969,7 +962,7 @@ word_size(const void *p1, const void *p2) { return (w2_len - w1_len); } -void +static void build_regexp(pcre **r, char *buffer) { const char *error; int error_offset; @@ -982,7 +975,7 @@ build_regexp(pcre **r, char *buffer) { buffer[0] = '\0'; } -int +static int build_regexps(domain_t *domain) { char buffer[1024 * 128]; buffer[0] = '\0'; @@ -1086,7 +1079,7 @@ build_regexps(domain_t *domain) { return 0; } -char * +static char * compute_raw_from_trans(const char *level, domain_t *domain) { #ifdef DEBUG @@ -1278,7 +1271,7 @@ err: return NULL; } -char * +static char * compute_trans_from_raw(const char *level, domain_t *domain) { #ifdef DEBUG diff --git a/mcstrans/src/mcstrans.h b/mcstrans/src/mcstrans.h index e5cda93b..0addb325 100644 --- a/mcstrans/src/mcstrans.h +++ b/mcstrans/src/mcstrans.h @@ -6,4 +6,3 @@ extern int init_translations(void); extern void finish_context_translations(void); extern int trans_context(const char *, char **); extern int untrans_context(const char *, char **); - diff --git a/mcstrans/src/mcstransd.c b/mcstrans/src/mcstransd.c index 59c152e7..536c0f32 100644 --- a/mcstrans/src/mcstransd.c +++ b/mcstrans/src/mcstransd.c @@ -16,6 +16,8 @@ #include #include #include + +#include "mcscolor.h" #include "mcstrans.h" #ifdef UNUSED @@ -43,15 +45,6 @@ #define log_debug(fmt, ...) do {} while (0) #endif -extern int init_translations(void); -extern void finish_context_translations(void); -extern int trans_context(const char *, char **); -extern int untrans_context(const char *, char **); - -extern int init_colors(void); -extern void finish_context_colors(void); -extern int raw_color(const char *, char **); - #define SETRANSD_PATHNAME "/sbin/mcstransd" /* name of program (for error messages) */ @@ -514,7 +507,7 @@ initialize(void) } -void dropprivs(void) +static void dropprivs(void) { cap_t new_caps; From patchwork Fri Nov 12 15:41:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Christian_G=C3=B6ttsche?= X-Patchwork-Id: 12617057 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 09F89C4332F for ; Fri, 12 Nov 2021 15:42:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E5AC760296 for ; Fri, 12 Nov 2021 15:42:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235273AbhKLPpE (ORCPT ); Fri, 12 Nov 2021 10:45:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58370 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235313AbhKLPpE (ORCPT ); Fri, 12 Nov 2021 10:45:04 -0500 Received: from mail-ed1-x52f.google.com (mail-ed1-x52f.google.com [IPv6:2a00:1450:4864:20::52f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6D7FEC061767 for ; Fri, 12 Nov 2021 07:42:13 -0800 (PST) Received: by mail-ed1-x52f.google.com with SMTP id t18so19894848edd.8 for ; Fri, 12 Nov 2021 07:42:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20210112; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=01k59ErtnpXUonzYLl2IvtmRKPZ7C13OJe8usqouAM8=; b=Whq0b2BcPDdiTSuBReAfJbZ9TKbPPDvBNxRyGqszwAocBqfvWjPXWUgJ2oGWjQeRcy JTKFu8vkKUwWILOQ9i+QDoFumNRvZ4QlHDHzBxIj867h5SMxvi7QubNuzdVMmMu0iQAQ ci0WMTpzb/AiYo52o6HyivZ6k2svgMoFjUAVD+fRTVFsr5gYloTtRDphb4jfSRTv1rFG 7Qy/BpJrI4LIPYQ0sK7Y9oU+q2XKV/k2bTHEx/fHljBiopqxt5T8AdxRcr6royQFrh4k obkk7k3rkqplMVLPkBVsp+K25rEhucUCkL3y7NhtQtJks8cAjE6kxIlwsGpqt9WoLAog VIDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=01k59ErtnpXUonzYLl2IvtmRKPZ7C13OJe8usqouAM8=; b=k5TLetCTVDal+xlew6Os0qwH/C0RgqCH63BRBbyaQ/5WstGOcrDacYotgtcvKEJe2o QrwwlMUbUVoYLztZB5/MirYsDW8UmEHlRzw7qjv47UJEs3eJ1HUEY0D+S4GYMOUujJA6 OBOIN8r0FyZDsQxQqZ+SLlKuKzHytc1K97QItpJ6xO97wNmmK7Dm2kUk7IAReM3gkgoc qNTgpnSInYrhrtJLZE1RfXK/+MMxqYRQh/C4RiIvTuanzkvP6ZGqAU74ENTZMNy0Y611 D9DkNCU5ozMUWqZWeeKUoMFUpUZNIaVwQX3ygergdmq+wpHtOIXUvCCw2KmU8xT1oacn FQXQ== X-Gm-Message-State: AOAM532UV8Tio69XuMDMawD+bIArXuDXr2X9a6XoP7j0wjHDv/tU1CHV XWyVAoydtr7tyDVovnqUn3OxCD0u3lQ= X-Google-Smtp-Source: ABdhPJwb+ySCRUK0uX64FhViLZpDKx0oQejvfrE1uH7mx3Y60TBUzBrs2k7wDpwQjbyX4cEvivS+dA== X-Received: by 2002:a05:6402:4388:: with SMTP id o8mr22586416edc.342.1636731731996; Fri, 12 Nov 2021 07:42:11 -0800 (PST) Received: from debianHome.localdomain (dynamic-077-000-195-130.77.0.pool.telefonica.de. [77.0.195.130]) by smtp.gmail.com with ESMTPSA id m9sm2628914eje.102.2021.11.12.07.42.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Nov 2021 07:42:11 -0800 (PST) From: =?utf-8?q?Christian_G=C3=B6ttsche?= To: selinux@vger.kernel.org Subject: [PATCH 10/12] libsemanage: mark local functions static Date: Fri, 12 Nov 2021 16:41:59 +0100 Message-Id: <20211112154201.78217-10-cgzones@googlemail.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211112154201.78217-1-cgzones@googlemail.com> References: <20211112154201.78217-1-cgzones@googlemail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: selinux@vger.kernel.org utilities.c:295:18: warning: no previous prototype for ‘list_addafter_controlmem’ [-Wmissing-prototypes] 295 | semanage_list_t *list_addafter_controlmem(semanage_list_t * item, char *data) | ^~~~~~~~~~~~~~~~~~~~~~~~ Signed-off-by: Christian Göttsche --- libsemanage/src/utilities.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libsemanage/src/utilities.c b/libsemanage/src/utilities.c index fc5a6a51..fdbb8ad6 100644 --- a/libsemanage/src/utilities.c +++ b/libsemanage/src/utilities.c @@ -292,7 +292,7 @@ char *semanage_str_replace(const char *search, const char *replace, * * returns the newly created node or NULL on error */ -semanage_list_t *list_addafter_controlmem(semanage_list_t * item, char *data) +static semanage_list_t *list_addafter_controlmem(semanage_list_t * item, char *data) { semanage_list_t *temp = malloc(sizeof(semanage_list_t)); From patchwork Fri Nov 12 15:42:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Christian_G=C3=B6ttsche?= X-Patchwork-Id: 12617061 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6040DC433FE for ; Fri, 12 Nov 2021 15:42:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4818960273 for ; Fri, 12 Nov 2021 15:42:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235313AbhKLPpF (ORCPT ); Fri, 12 Nov 2021 10:45:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58372 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235312AbhKLPpF (ORCPT ); Fri, 12 Nov 2021 10:45:05 -0500 Received: from mail-ed1-x52c.google.com (mail-ed1-x52c.google.com [IPv6:2a00:1450:4864:20::52c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 079BAC061766 for ; Fri, 12 Nov 2021 07:42:14 -0800 (PST) Received: by mail-ed1-x52c.google.com with SMTP id w1so39406459edd.10 for ; Fri, 12 Nov 2021 07:42:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20210112; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=2seubjY8734BEV72WueGd6LV/9Ai9sYr/7KGlo9eHE8=; b=SISBNaKgH94ZtB0vKyie5E7v6t3r2hhLhlmZijSBscvE0+x1vmJEE10NDLwkRvyI+K NKb/0Qiv8chMxr6LnFmBjHZem1Zee6d7gUepUNpJQSNrJR3vkEqPpJEl3MW74znjilL3 ddmdNRc1z/SwX61JEVI59Kg5pA+UwgsqtQD9x8UCSw24TicoVjYCRl/PSDnh2+O5tbY9 XOdrV9eqgy+AXDusAdVMcyJdKTaZ0EAR17/wd8KZInKItRr9rhDHab+hH24LyeeXEs1Y ilBaAyl9MHr+wBXrT23+ZfpbS0Nbu0052hodNUXl7WTLl4C0FcSriH1uHoG9oi+GclwN x1tQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=2seubjY8734BEV72WueGd6LV/9Ai9sYr/7KGlo9eHE8=; b=ayxQ05tOE8t6uXjh32c3VPtkmj+0TejigNGWGNfHMoxYt2L4h2YpMTHeVY0l4JDD4V B8iTWcgdVvNy1IaZqSJcWE3XuIlBA60rP7RsYiSmc/SVJgeBwxmIDGZFz+8XFbjhicYO YCmFSxJz/3yI2OT+nNjeqy/y1JsAJUKC69lYiYMEtnbTB6cKOpnpIPlpn/ttRqQ4cGli vLJ5mey2PCzlQRNANU+TW//zhEE5bdWwEiMdyTywh9WshgkAPnzLjVyyMsZg/ZJJq5xW juGBozs4VMa3T8nXhbZC6WI3IESmfBhS+tse7QTmEVPQ03MCcOhg9UbmtAMrrDJLP6fg WGeA== X-Gm-Message-State: AOAM5313D0VETia+R9QiUem05yVu3wF/DKqA6hOyyaY3MkYmZxwbW6W2 ccBoaGLVPhGesPwPmtkumtkPJ+hWbPM= X-Google-Smtp-Source: ABdhPJy3GwEkbKKejNQh28iO71HoApVozNBWsqRTa4pbuGHCCjmiwW16hIO3JFCixTv2qTtSiyXWqQ== X-Received: by 2002:a17:906:d196:: with SMTP id c22mr20204620ejz.231.1636731732538; Fri, 12 Nov 2021 07:42:12 -0800 (PST) Received: from debianHome.localdomain (dynamic-077-000-195-130.77.0.pool.telefonica.de. [77.0.195.130]) by smtp.gmail.com with ESMTPSA id m9sm2628914eje.102.2021.11.12.07.42.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Nov 2021 07:42:12 -0800 (PST) From: =?utf-8?q?Christian_G=C3=B6ttsche?= To: selinux@vger.kernel.org Subject: [PATCH 11/12] libsemanage: include paired header for prototypes Date: Fri, 12 Nov 2021 16:42:00 +0100 Message-Id: <20211112154201.78217-11-cgzones@googlemail.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211112154201.78217-1-cgzones@googlemail.com> References: <20211112154201.78217-1-cgzones@googlemail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: selinux@vger.kernel.org context_record.c:11:13: warning: no previous prototype for ‘semanage_context_get_user’ [-Wmissing-prototypes] 11 | const char *semanage_context_get_user(const semanage_context_t * con) | ^~~~~~~~~~~~~~~~~~~~~~~~~ Signed-off-by: Christian Göttsche --- libsemanage/src/context_record.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libsemanage/src/context_record.c b/libsemanage/src/context_record.c index 16ba518e..dafb90fc 100644 --- a/libsemanage/src/context_record.c +++ b/libsemanage/src/context_record.c @@ -7,6 +7,8 @@ typedef sepol_context_t semanage_context_t; #define _SEMANAGE_CONTEXT_DEFINED_ +#include + /* User */ const char *semanage_context_get_user(const semanage_context_t * con) { From patchwork Fri Nov 12 15:42:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Christian_G=C3=B6ttsche?= X-Patchwork-Id: 12617063 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C9578C43217 for ; Fri, 12 Nov 2021 15:42:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B2AA560296 for ; Fri, 12 Nov 2021 15:42:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235312AbhKLPpF (ORCPT ); Fri, 12 Nov 2021 10:45:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58376 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235274AbhKLPpF (ORCPT ); Fri, 12 Nov 2021 10:45:05 -0500 Received: from mail-ed1-x532.google.com (mail-ed1-x532.google.com [IPv6:2a00:1450:4864:20::532]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 80F30C061767 for ; Fri, 12 Nov 2021 07:42:14 -0800 (PST) Received: by mail-ed1-x532.google.com with SMTP id v11so39385175edc.9 for ; Fri, 12 Nov 2021 07:42:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20210112; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=2SA3ilvrGlPBPDogl9TVQzXjHfAI8JK4B2c5Fk7b0Rs=; b=KxxgAC+CswL7ijNrxhcJEdJXDiZuk0/oK4aCAtU4WbeOT00n+/DrI0KeOyOpygl+sT SmPFPw7DdxIwPEhl2gUGzQtXFkJref2mbHVRxZN8mW0WAWP4ud0UEajnHkQQM8QugIoa vie5P4DR+vqBvxDm5YgjjyH8oq5CMOgFNlZeQE+gUtSaBmg/sEiRTae3YjaJv3OEDKjc 4pz5rfGSvW6KoKqQXGdt8jFkayJmEn/jlWlm6XjRumuSo7i2G9c1VFe2QZg6ZXPEoH1B Jgxe9sFF9XbkZHGNv1Rbb4DkfOj2yV1o7hMR2uWuTHB6iRVvxN10aB+Ruo7m73DrymeA E3og== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=2SA3ilvrGlPBPDogl9TVQzXjHfAI8JK4B2c5Fk7b0Rs=; b=E1xyRLR8unFY6Kq2MVIPSmsCCjYwPaYrmYclx4XgVu7XKJXaIHtiNFNW4QJFiWLEmE ZRWcwY+GtkbdIZqRw4ClGgjxWB7s5VpQLP0H4so3GzJGrJTXIt6Ict/3uah9sH3Hf/iP 1VirC7vlicpvEXKQUYKC7EDzSwrEqxyLbS0GIUs8h42or8ACOONutsze6bMi5o9C9ASg XxpzHcxwR8kf2TlKDmq0qv6hynxUBgBcxzc3r0liNVkZf7wWY2RLLd6MbGQEsKOJ5Ubw 9Trwl1ywnvpjEZJ9stZwVB/yovVTL/aunrIOwT3g3Fh5cIXPoVPIhoE/MNu67Tun62KZ NgCA== X-Gm-Message-State: AOAM530yaOK1izgwPiLrtKOZKcWcpM2u3k8xuMKx4BuW5tgb3caJSNIw xh0NHIEBPStETr0UUNXkHwgEkPwxPh8= X-Google-Smtp-Source: ABdhPJzXDtjQumQdmkE/w6ixL8jPXmYr6XJSl/+6hRCnA3h3csXx/+IGNHLeLuj4c2tN25eDzIAlUQ== X-Received: by 2002:a17:906:fcd9:: with SMTP id qx25mr21220294ejb.326.1636731733077; Fri, 12 Nov 2021 07:42:13 -0800 (PST) Received: from debianHome.localdomain (dynamic-077-000-195-130.77.0.pool.telefonica.de. [77.0.195.130]) by smtp.gmail.com with ESMTPSA id m9sm2628914eje.102.2021.11.12.07.42.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Nov 2021 07:42:12 -0800 (PST) From: =?utf-8?q?Christian_G=C3=B6ttsche?= To: selinux@vger.kernel.org Subject: [PATCH 12/12] libsemanage: add extern prototype for legacy function Date: Fri, 12 Nov 2021 16:42:01 +0100 Message-Id: <20211112154201.78217-12-cgzones@googlemail.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211112154201.78217-1-cgzones@googlemail.com> References: <20211112154201.78217-1-cgzones@googlemail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: selinux@vger.kernel.org modules.c:171:13: warning: no previous prototype for ‘semanage_module_get_version’ [-Wmissing-prototypes] 171 | const char *semanage_module_get_version(semanage_module_info_t * modinfo | ^~~~~~~~~~~~~~~~~~~~~~~~~~~ Signed-off-by: Christian Göttsche --- libsemanage/src/modules.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libsemanage/src/modules.c b/libsemanage/src/modules.c index b6dd456c..c98df4dd 100644 --- a/libsemanage/src/modules.c +++ b/libsemanage/src/modules.c @@ -168,6 +168,7 @@ const char *semanage_module_get_name(semanage_module_info_t * modinfo) /* Legacy function that remains to preserve ABI * compatibility. */ +extern const char *semanage_module_get_version(semanage_module_info_t *); const char *semanage_module_get_version(semanage_module_info_t * modinfo __attribute__ ((unused))) {