All of lore.kernel.org
 help / color / mirror / Atom feed
From: Petr Lautrbach <lautrbach@redhat.com>
To: Tristan Ross <tristan.ross@midstall.com>, selinux@vger.kernel.org
Cc: Tristan Ross <tristan.ross@midstall.com>
Subject: Re: [PATCH 1/2] libsemanage: add semanage_handle_create_with_path
Date: Wed, 16 Apr 2025 21:46:59 +0200	[thread overview]
Message-ID: <87bjsvzy6k.fsf@redhat.com> (raw)
In-Reply-To: <20250416045011.29923-2-tristan.ross@midstall.com>

Tristan Ross <tristan.ross@midstall.com> writes:

> ---
>  libsemanage/include/semanage/handle.h |  6 +++++-
>  libsemanage/src/handle.c              | 26 +++++++++++++++++++-------
>  libsemanage/src/libsemanage.map       |  4 ++++
>  3 files changed, 28 insertions(+), 8 deletions(-)
>
> diff --git a/libsemanage/include/semanage/handle.h b/libsemanage/include/semanage/handle.h
> index a5ea31de..601cd9ee 100644
> --- a/libsemanage/include/semanage/handle.h
> +++ b/libsemanage/include/semanage/handle.h
> @@ -30,7 +30,11 @@
>  struct semanage_handle;
>  typedef struct semanage_handle semanage_handle_t;
>  
> -/* Create and return a semanage handle.
> +/* Create and return a semanage handle with a specific config path.
> +   The handle is initially in the disconnected state. */
> +semanage_handle_t *semanage_handle_create_with_path(const char *conf_name);
> +
> +/* Create and return a semanage handle with the default config path.
>     The handle is initially in the disconnected state. */
>  extern semanage_handle_t *semanage_handle_create(void);
>  
> diff --git a/libsemanage/src/handle.c b/libsemanage/src/handle.c
> index faea0606..ca57702a 100644
> --- a/libsemanage/src/handle.c
> +++ b/libsemanage/src/handle.c
> @@ -59,19 +59,14 @@ const char * semanage_root(void)
>  	return private_semanage_root;
>  }
>  
> -
> -semanage_handle_t *semanage_handle_create(void)
> +semanage_handle_t *semanage_handle_create_with_path(const char *conf_name)
>  {
>  	semanage_handle_t *sh = NULL;
> -	char *conf_name = NULL;
>  
>  	/* Allocate handle */
>  	if ((sh = calloc(1, sizeof(semanage_handle_t))) == NULL)
>  		goto err;
>  
> -	if ((conf_name = semanage_conf_path()) == NULL)
> -		goto err;
> -
>  	if ((sh->conf = semanage_conf_parse(conf_name)) == NULL)
>  		goto err;
>  
> @@ -106,13 +101,30 @@ semanage_handle_t *semanage_handle_create(void)
>  	sh->msg_callback = semanage_msg_default_handler;
>  	sh->msg_callback_arg = NULL;
>  
> +	return sh;
> +
> +      err:
> +	semanage_handle_destroy(sh);
> +	return NULL;
> +}
> +
> +semanage_handle_t *semanage_handle_create(void)
> +{
> +	semanage_handle_t *sh = NULL;
> +	char *conf_name = NULL;
> +
> +	if ((conf_name = semanage_conf_path()) == NULL)
> +		goto err;
> +
> +	if ((sh = semanage_handle_create_with_path(conf_name)) == NULL)
> +		goto err;
> +
>  	free(conf_name);
>  
>  	return sh;
>  
>        err:
>  	free(conf_name);
> -	semanage_handle_destroy(sh);
>  	return NULL;
>  }
>  
> diff --git a/libsemanage/src/libsemanage.map b/libsemanage/src/libsemanage.map
> index c8214b26..5dab7bf7 100644
> --- a/libsemanage/src/libsemanage.map
> +++ b/libsemanage/src/libsemanage.map
> @@ -350,3 +350,7 @@ LIBSEMANAGE_3.4 {
>      semanage_module_compute_checksum;
>      semanage_set_check_ext_changes;
>  } LIBSEMANAGE_1.1;
> +
> +LIBSEMANAGE_3.5 {
> +    semanage_handle_create_with_path;
> +} LIBSEMANAGE_3.4;
>

It will be part of the next 3.9 release therefore this should be

+LIBSEMANAGE_3.9 {
+    semanage_handle_create_with_path;
+} LIBSEMANAGE_3.4;



 -- 
> 2.47.2


  parent reply	other threads:[~2025-04-16 19:47 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-11 18:59 [PATCH 1/2] libsemanage: add semanage_handle_create_with_path Tristan Ross
2025-04-11 18:59 ` [PATCH 2/2] semodule: add config argument Tristan Ross
2025-04-15 14:34 ` [PATCH 1/2] libsemanage: add semanage_handle_create_with_path Christian Göttsche
2025-04-16  4:50   ` Tristan Ross
2025-04-16 15:53     ` James Carter
2025-04-16 19:46     ` Petr Lautrbach [this message]
2025-04-17  2:16       ` Tristan Ross
2025-04-17  2:16         ` [PATCH 2/2] semodule: add config argument Tristan Ross
2025-04-18 18:12       ` [PATCH 1/2] libsemanage: add semanage_handle_create_with_path Tristan Ross
2025-04-18 18:12         ` [PATCH 2/2] semodule: add config argument Tristan Ross
2025-04-23 19:03           ` James Carter
2025-04-25 18:06             ` [PATCH 1/2] libsemanage: add semanage_handle_create_with_path Tristan Ross
2025-04-25 18:06               ` [PATCH 2/2] semodule: add config argument Tristan Ross
2025-04-25 18:09             ` [PATCH 1/2] libsemanage: add semanage_handle_create_with_path Tristan Ross
2025-04-25 18:09               ` [PATCH 2/2] semodule: add config argument Tristan Ross
2025-04-29 15:18               ` [PATCH 1/2] libsemanage: add semanage_handle_create_with_path James Carter
2025-05-06 19:33                 ` James Carter

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=87bjsvzy6k.fsf@redhat.com \
    --to=lautrbach@redhat.com \
    --cc=selinux@vger.kernel.org \
    --cc=tristan.ross@midstall.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.