All of lore.kernel.org
 help / color / mirror / Atom feed
From: bill.c.roberts@gmail.com
To: bill.c.roberts@gmail.com
Cc: plautrba@redhat.com, sds@tycho.nsa.gov, selinux@vger.kernel.org,
	William Roberts <william.c.roberts@intel.com>
Subject: [PATCH v2 17/18] utils: matchpathcon to use interal interfaces
Date: Thu, 16 Apr 2020 10:43:51 -0500	[thread overview]
Message-ID: <20200416154352.21619-18-william.c.roberts@intel.com> (raw)
In-Reply-To: <20200416154352.21619-1-william.c.roberts@intel.com>

From: William Roberts <william.c.roberts@intel.com>

Not that the matchpathcon library interfaces are deprecated,
matchpathcon needs to use the 2 variants and statically link.

Signed-off-by: William Roberts <william.c.roberts@intel.com>
---
 libselinux/src/matchpathcon.c          | 6 +++++-
 libselinux/src/matchpathcon_internal.h | 2 ++
 libselinux/utils/Makefile              | 6 ++++++
 libselinux/utils/matchpathcon.c        | 9 ++++++---
 4 files changed, 19 insertions(+), 4 deletions(-)

diff --git a/libselinux/src/matchpathcon.c b/libselinux/src/matchpathcon.c
index 88539e627f5d..d71e792c3f8e 100644
--- a/libselinux/src/matchpathcon.c
+++ b/libselinux/src/matchpathcon.c
@@ -352,10 +352,14 @@ int matchpathcon_init_prefix(const char *path, const char *subset)
 	return hnd ? 0 : -1;
 }
 
+int matchpathcon_init2(const char *path)
+{
+	return matchpathcon_init_prefix(path, NULL);
+}
 
 int matchpathcon_init(const char *path)
 {
-	return matchpathcon_init_prefix(path, NULL);
+	return matchpathcon_init2(path);
 }
 
 void matchpathcon_fini2(void)
diff --git a/libselinux/src/matchpathcon_internal.h b/libselinux/src/matchpathcon_internal.h
index c63bcecfec89..73f0c78fc9d0 100644
--- a/libselinux/src/matchpathcon_internal.h
+++ b/libselinux/src/matchpathcon_internal.h
@@ -1,6 +1,8 @@
 #ifndef SRC_MATCHPATHCON_INTERNAL_H_
 #define SRC_MATCHPATHCON_INTERNAL_H_
 
+int matchpathcon_init2(const char *path);
+
 void matchpathcon_fini2(void);
 
 int matchpathcon2(const char *path, mode_t mode, char ** con);
diff --git a/libselinux/utils/Makefile b/libselinux/utils/Makefile
index a5632b7c38ec..5f16ab957610 100644
--- a/libselinux/utils/Makefile
+++ b/libselinux/utils/Makefile
@@ -58,6 +58,12 @@ sefcontext_compile: LDLIBS += $(PCRE_LDLIBS) ../src/libselinux.a -lsepol
 
 sefcontext_compile: sefcontext_compile.o ../src/regex.o
 
+matchpathcon: LDLIBS += $(PCRE_LDLIBS) ../src/libselinux.a
+
+matchpathcon: CFLAGS += -I../src
+
+matchpathcon: matchpathcon.o ../src/regex.o
+
 all: $(TARGETS)
 
 install: all
diff --git a/libselinux/utils/matchpathcon.c b/libselinux/utils/matchpathcon.c
index eb39a1881066..3d94af365071 100644
--- a/libselinux/utils/matchpathcon.c
+++ b/libselinux/utils/matchpathcon.c
@@ -11,6 +11,9 @@
 #include <limits.h>
 #include <stdlib.h>
 
+#include "matchpathcon_internal.h"
+
+
 static __attribute__ ((__noreturn__)) void usage(const char *progname)
 {
 	fprintf(stderr,
@@ -22,7 +25,7 @@ static __attribute__ ((__noreturn__)) void usage(const char *progname)
 static int printmatchpathcon(const char *path, int header, int mode)
 {
 	char *buf;
-	int rc = matchpathcon(path, mode, &buf);
+	int rc = matchpathcon2(path, mode, &buf);
 	if (rc < 0) {
 		if (errno == ENOENT) {
 			buf = strdup("<<none>>");
@@ -103,7 +106,7 @@ int main(int argc, char **argv)
 				exit(1);
 			}
 			init = 1;
-			if (matchpathcon_init(optarg)) {
+			if (matchpathcon_init2(optarg)) {
 				fprintf(stderr,
 					"Error while processing %s:  %s\n",
 					optarg,
@@ -195,6 +198,6 @@ int main(int argc, char **argv)
 			error |= printmatchpathcon(path, header, mode);
 		}
 	}
-	matchpathcon_fini();
+	matchpathcon_fini2();
 	return error;
 }
-- 
2.17.1


  parent reply	other threads:[~2020-04-16 15:44 UTC|newest]

Thread overview: 97+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-25 20:02 Annotate Deprecated Functions in libselinux bill.c.roberts
2020-02-25 20:02 ` [PATCH 01/17] security_load_booleans: update return comment bill.c.roberts
2020-02-25 20:02 ` [PATCH 02/17] selinux_booleans_path: annotate deprecated bill.c.roberts
2020-02-25 20:02 ` [PATCH 03/17] " bill.c.roberts
2020-02-25 20:02 ` [PATCH 04/17] selinux_users_path: " bill.c.roberts
2020-02-25 20:02 ` [PATCH 05/17] rpm_execcon: " bill.c.roberts
2020-02-25 20:02 ` [PATCH 06/17] sidget: " bill.c.roberts
2020-02-25 20:02 ` [PATCH 07/17] sidput: " bill.c.roberts
2020-02-25 20:02 ` [PATCH 08/17] checkPasswdAccess: " bill.c.roberts
2020-02-25 20:58   ` Stephen Smalley
2020-02-25 20:02 ` [PATCH 09/17] matchpathcon_init: " bill.c.roberts
2020-02-25 20:02 ` [PATCH 10/17] matchpathcon_fini: " bill.c.roberts
2020-02-25 20:02 ` [PATCH 11/17] matchpathcon: " bill.c.roberts
2020-02-25 20:02 ` [PATCH 12/17] avc_init: " bill.c.roberts
2020-02-25 20:02 ` [PATCH 13/17] src/selinux_internal.h: fix hidden_proto indents bill.c.roberts
2020-02-25 20:02 ` [PATCH 14/17] selinux_internal.h: disable warnings on deprecated bill.c.roberts
2020-02-25 20:02 ` [PATCH 15/17] avc_open: mark allowed use of avc_init bill.c.roberts
2020-02-25 20:02 ` [PATCH 16/17] src/matchpathcon: allow use of deprecated funcs bill.c.roberts
2020-02-25 20:02 ` [PATCH 17/17] utils/matchpathcon: " bill.c.roberts
2020-02-25 20:51 ` Annotate Deprecated Functions in libselinux Stephen Smalley
2020-02-25 21:06   ` William Roberts
2020-02-27 18:41     ` William Roberts
2020-02-27 19:48       ` Stephen Smalley
2020-02-27 20:03         ` Ondrej Mosnacek
2020-02-27 20:10           ` William Roberts
2020-02-27 20:24             ` Stephen Smalley
2020-02-27 20:43           ` Ulrich Drepper
2020-02-27 21:05             ` William Roberts
2020-02-27 21:13               ` Stephen Smalley
2020-02-27 21:18                 ` William Roberts
2020-02-27 21:32                   ` Stephen Smalley
2020-02-27 21:34                     ` William Roberts
2020-02-27 21:19               ` Ulrich Drepper
2020-02-27 21:31                 ` William Roberts
2020-04-16 15:43 ` bill.c.roberts
2020-04-16 15:43   ` [PATCH v2 01/18] security_load_booleans: update return comment bill.c.roberts
2020-04-16 15:43   ` [PATCH v2 02/18] security_load_booleans: annotate deprecated bill.c.roberts
2020-04-16 15:43   ` [PATCH v2 03/18] selinux_booleans_path: " bill.c.roberts
2020-04-16 15:43   ` [PATCH v2 04/18] selinux_users_path: " bill.c.roberts
2020-04-16 15:43   ` [PATCH v2 05/18] rpm_execcon: " bill.c.roberts
2020-04-16 15:43   ` [PATCH v2 06/18] sidget: " bill.c.roberts
2020-04-16 15:43   ` [PATCH v2 07/18] sidput: " bill.c.roberts
2020-04-16 15:43   ` [PATCH v2 08/18] checkPasswdAccess: " bill.c.roberts
2020-04-16 15:43   ` [PATCH v2 09/18] matchpathcon_init: " bill.c.roberts
2020-04-16 15:43   ` [PATCH v2 10/18] matchpathcon_fini: " bill.c.roberts
2020-04-16 15:43   ` [PATCH v2 11/18] matchpathcon: " bill.c.roberts
2020-04-16 15:43   ` [PATCH v2 12/18] avc_init: " bill.c.roberts
2020-04-16 15:43   ` [PATCH v2 13/18] avc: create internal avc_init interface bill.c.roberts
2020-04-16 15:43   ` [PATCH v2 14/18] matchpathcon: create internal matchpathcon_fini interface bill.c.roberts
2020-04-16 15:43   ` [PATCH v2 15/18] matchpathcon: create internal matchpathcon interface bill.c.roberts
2020-04-16 15:43   ` [PATCH v2 16/18] selinux_check_passwd_access: annotate deprecated bill.c.roberts
2020-04-16 15:43   ` bill.c.roberts [this message]
2020-04-16 15:43   ` [PATCH v2 18/18] utils: matchpathcon add deprecated warning bill.c.roberts
2020-04-19 13:46   ` Annotate Deprecated Functions in libselinux Nicolas Iooss
2020-04-20 14:34     ` Roberts, William C
2020-04-20 15:45     ` [v3] " bill.c.roberts
2020-04-20 15:45       ` [PATCH v3 01/19] security_load_booleans: update return comment bill.c.roberts
2020-04-20 15:45       ` [PATCH v3 02/19] security_load_booleans: annotate deprecated bill.c.roberts
2020-04-20 15:45       ` [PATCH v3 03/19] selinux_booleans_path: " bill.c.roberts
2020-04-20 15:45       ` [PATCH v3 04/19] selinux_users_path: " bill.c.roberts
2020-04-20 15:45       ` [PATCH v3 05/19] rpm_execcon: " bill.c.roberts
2020-04-20 15:45       ` [PATCH v3 06/19] sidget: " bill.c.roberts
2020-04-20 15:45       ` [PATCH v3 07/19] sidput: " bill.c.roberts
2020-04-20 15:45       ` [PATCH v3 08/19] checkPasswdAccess: " bill.c.roberts
2020-04-20 15:45       ` [PATCH v3 09/19] matchpathcon_init: " bill.c.roberts
2020-04-20 15:45       ` [PATCH v3 10/19] matchpathcon_fini: " bill.c.roberts
2020-04-20 15:45       ` [PATCH v3 11/19] matchpathcon: " bill.c.roberts
2020-04-20 15:45       ` [PATCH v3 12/19] avc_init: " bill.c.roberts
2020-04-20 15:45       ` [PATCH v3 13/19] avc: create internal avc_init interface bill.c.roberts
2020-04-26 13:33         ` Nicolas Iooss
2020-04-26 15:53           ` William Roberts
2020-04-20 15:45       ` [PATCH v3 14/19] matchpathcon: create internal matchpathcon_fini interface bill.c.roberts
2020-04-20 15:45       ` [PATCH v3 15/19] matchpathcon: create internal matchpathcon interface bill.c.roberts
2020-04-20 15:45       ` [PATCH v3 16/19] selinux_check_passwd_access: annotate deprecated bill.c.roberts
2020-04-20 15:45       ` [PATCH v3 17/19] matchpathcon: allow use of deprecated routines bill.c.roberts
2020-04-20 15:45       ` [PATCH v3 18/19] utils: matchpathcon add deprecated warning bill.c.roberts
2020-04-20 15:45       ` [PATCH v3 19/19] Makefile: swig build allow deprecated functions bill.c.roberts
2020-04-27 20:22 ` [v4] Annotate Deprecated Functions in libselinux bill.c.roberts
2020-04-27 20:22   ` [PATCH v4 01/18] security_load_booleans: update return comment bill.c.roberts
2020-04-27 20:22   ` [PATCH v4 02/18] security_load_booleans: annotate deprecated bill.c.roberts
2020-04-27 20:23   ` [PATCH v4 03/18] selinux_booleans_path: " bill.c.roberts
2020-04-27 20:23   ` [PATCH v4 04/18] selinux_users_path: " bill.c.roberts
2020-04-27 20:23   ` [PATCH v4 05/18] rpm_execcon: " bill.c.roberts
2020-04-27 20:23   ` [PATCH v4 06/18] sidget: " bill.c.roberts
2020-04-27 20:23   ` [PATCH v4 07/18] sidput: " bill.c.roberts
2020-04-27 20:23   ` [PATCH v4 08/18] checkPasswdAccess: " bill.c.roberts
2020-04-27 20:23   ` [PATCH v4 09/18] matchpathcon_init: " bill.c.roberts
2020-04-27 20:23   ` [PATCH v4 10/18] matchpathcon_fini: " bill.c.roberts
2020-04-27 20:23   ` [PATCH v4 11/18] matchpathcon: " bill.c.roberts
2020-04-27 20:23   ` [PATCH v4 12/18] avc_init: " bill.c.roberts
2020-04-27 20:23   ` [PATCH v4 13/18] avc: create internal avc_init interface bill.c.roberts
2020-04-27 20:23   ` [PATCH v4 14/18] matchpathcon: create internal matchpathcon_fini interface bill.c.roberts
2020-04-27 20:23   ` [PATCH v4 15/18] selinux_check_passwd_access: annotate deprecated bill.c.roberts
2020-04-27 20:23   ` [PATCH v4 16/18] matchpathcon: allow use of deprecated routines bill.c.roberts
2020-04-27 20:23   ` [PATCH v4 17/18] utils: matchpathcon add deprecated warning bill.c.roberts
2020-04-27 20:23   ` [PATCH v4 18/18] Makefile: swig build allow deprecated functions bill.c.roberts
2020-04-28 21:25   ` [v4] Annotate Deprecated Functions in libselinux Nicolas Iooss

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200416154352.21619-18-william.c.roberts@intel.com \
    --to=bill.c.roberts@gmail.com \
    --cc=plautrba@redhat.com \
    --cc=sds@tycho.nsa.gov \
    --cc=selinux@vger.kernel.org \
    --cc=william.c.roberts@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.