diff mbox series

libselinux: formally deprecate security_compute_user()

Message ID 20241004164605.7607-1-stephen.smalley.work@gmail.com (mailing list archive)
State Accepted
Commit 9b83fe3d99d2
Delegated to: Petr Lautrbach
Headers show
Series libselinux: formally deprecate security_compute_user() | expand

Commit Message

Stephen Smalley Oct. 4, 2024, 4:46 p.m. UTC
It was originally marked for deprecation back in Feb 2020,
commit a41dfeb55d43 ("libselinux: deprecate security_compute_user(),
update man pages"), but the attribute was not added at the time.

Signed-off-by: Stephen Smalley <stephen.smalley.work@gmail.com>
---
 libselinux/include/selinux/selinux.h | 6 ++++++
 libselinux/src/compute_user.c        | 2 ++
 2 files changed, 8 insertions(+)

Comments

Petr Lautrbach Oct. 16, 2024, 5:53 p.m. UTC | #1
Stephen Smalley <stephen.smalley.work@gmail.com> writes:

> It was originally marked for deprecation back in Feb 2020,
> commit a41dfeb55d43 ("libselinux: deprecate security_compute_user(),
> update man pages"), but the attribute was not added at the time.
>
> Signed-off-by: Stephen Smalley <stephen.smalley.work@gmail.com>

Acked-by: Petr Lautrbach <lautrbach@redhat.com>


> ---
>  libselinux/include/selinux/selinux.h | 6 ++++++
>  libselinux/src/compute_user.c        | 2 ++
>  2 files changed, 8 insertions(+)
>
> diff --git a/libselinux/include/selinux/selinux.h b/libselinux/include/selinux/selinux.h
> index 1318a66a..50419a7c 100644
> --- a/libselinux/include/selinux/selinux.h
> +++ b/libselinux/include/selinux/selinux.h
> @@ -263,9 +263,15 @@ extern int security_compute_member_raw(const char * scon,
>   * These interfaces are deprecated.  Use get_ordered_context_list() or
>   * one of its variant interfaces instead.
>   */
> +#ifdef __GNUC__
> +__attribute__ ((deprecated))
> +#endif
>  extern int security_compute_user(const char * scon,
>  				 const char *username,
>  				 char *** con);
> +#ifdef __GNUC__
> +__attribute__ ((deprecated))
> +#endif
>  extern int security_compute_user_raw(const char * scon,
>  				     const char *username,
>  				     char *** con);
> diff --git a/libselinux/src/compute_user.c b/libselinux/src/compute_user.c
> index f55f945a..d4387aed 100644
> --- a/libselinux/src/compute_user.c
> +++ b/libselinux/src/compute_user.c
> @@ -96,7 +96,9 @@ int security_compute_user(const char * scon,
>  	if (selinux_trans_to_raw_context(scon, &rscon))
>  		return -1;
>  
> +	IGNORE_DEPRECATED_DECLARATION_BEGIN
>  	ret = security_compute_user_raw(rscon, user, con);
> +	IGNORE_DEPRECATED_DECLARATION_END
>  
>  	freecon(rscon);
>  	if (!ret) {
> -- 
> 2.40.1
James Carter Oct. 30, 2024, 1:12 p.m. UTC | #2
On Wed, Oct 16, 2024 at 1:53 PM Petr Lautrbach <lautrbach@redhat.com> wrote:
>
> Stephen Smalley <stephen.smalley.work@gmail.com> writes:
>
> > It was originally marked for deprecation back in Feb 2020,
> > commit a41dfeb55d43 ("libselinux: deprecate security_compute_user(),
> > update man pages"), but the attribute was not added at the time.
> >
> > Signed-off-by: Stephen Smalley <stephen.smalley.work@gmail.com>
>
> Acked-by: Petr Lautrbach <lautrbach@redhat.com>

Merge.
Thanks,
Jim

>
>
> > ---
> >  libselinux/include/selinux/selinux.h | 6 ++++++
> >  libselinux/src/compute_user.c        | 2 ++
> >  2 files changed, 8 insertions(+)
> >
> > diff --git a/libselinux/include/selinux/selinux.h b/libselinux/include/selinux/selinux.h
> > index 1318a66a..50419a7c 100644
> > --- a/libselinux/include/selinux/selinux.h
> > +++ b/libselinux/include/selinux/selinux.h
> > @@ -263,9 +263,15 @@ extern int security_compute_member_raw(const char * scon,
> >   * These interfaces are deprecated.  Use get_ordered_context_list() or
> >   * one of its variant interfaces instead.
> >   */
> > +#ifdef __GNUC__
> > +__attribute__ ((deprecated))
> > +#endif
> >  extern int security_compute_user(const char * scon,
> >                                const char *username,
> >                                char *** con);
> > +#ifdef __GNUC__
> > +__attribute__ ((deprecated))
> > +#endif
> >  extern int security_compute_user_raw(const char * scon,
> >                                    const char *username,
> >                                    char *** con);
> > diff --git a/libselinux/src/compute_user.c b/libselinux/src/compute_user.c
> > index f55f945a..d4387aed 100644
> > --- a/libselinux/src/compute_user.c
> > +++ b/libselinux/src/compute_user.c
> > @@ -96,7 +96,9 @@ int security_compute_user(const char * scon,
> >       if (selinux_trans_to_raw_context(scon, &rscon))
> >               return -1;
> >
> > +     IGNORE_DEPRECATED_DECLARATION_BEGIN
> >       ret = security_compute_user_raw(rscon, user, con);
> > +     IGNORE_DEPRECATED_DECLARATION_END
> >
> >       freecon(rscon);
> >       if (!ret) {
> > --
> > 2.40.1
>
>
diff mbox series

Patch

diff --git a/libselinux/include/selinux/selinux.h b/libselinux/include/selinux/selinux.h
index 1318a66a..50419a7c 100644
--- a/libselinux/include/selinux/selinux.h
+++ b/libselinux/include/selinux/selinux.h
@@ -263,9 +263,15 @@  extern int security_compute_member_raw(const char * scon,
  * These interfaces are deprecated.  Use get_ordered_context_list() or
  * one of its variant interfaces instead.
  */
+#ifdef __GNUC__
+__attribute__ ((deprecated))
+#endif
 extern int security_compute_user(const char * scon,
 				 const char *username,
 				 char *** con);
+#ifdef __GNUC__
+__attribute__ ((deprecated))
+#endif
 extern int security_compute_user_raw(const char * scon,
 				     const char *username,
 				     char *** con);
diff --git a/libselinux/src/compute_user.c b/libselinux/src/compute_user.c
index f55f945a..d4387aed 100644
--- a/libselinux/src/compute_user.c
+++ b/libselinux/src/compute_user.c
@@ -96,7 +96,9 @@  int security_compute_user(const char * scon,
 	if (selinux_trans_to_raw_context(scon, &rscon))
 		return -1;
 
+	IGNORE_DEPRECATED_DECLARATION_BEGIN
 	ret = security_compute_user_raw(rscon, user, con);
+	IGNORE_DEPRECATED_DECLARATION_END
 
 	freecon(rscon);
 	if (!ret) {