inet: Turn __ivaliduser into a compatibility symbol

Message ID 8735eu4tk2.fsf@oldenburg.str.redhat.com
State Superseded
Headers
Series inet: Turn __ivaliduser into a compatibility symbol |

Checks

Context Check Description
dj/TryBot-apply_patch success Patch applied to master at the time it was sent
dj/TryBot-32bit success Build for i686

Commit Message

Florian Weimer July 21, 2022, 11:02 a.m. UTC
  It is not declared in a header file, and as the comment indicates,
it is not expected to be used.

Tested on i686-linux-gnu and x86_64-linux-gnu.

---
 inet/rcmd.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
  

Comments

Andreas Schwab July 21, 2022, 12:29 p.m. UTC | #1
On Jul 21 2022, Florian Weimer via Libc-alpha wrote:

> It is not declared in a header file, and as the comment indicates,
> it is not expected to be used.

Well, as the comment says, this is not quite true.  The FreeBSD lpd
command still uses that interface (which is why the FreeBSD libc still
exports it), but it now uses a variant of it so that it no longer works
with glibc.
  
Carlos O'Donell July 21, 2022, 12:41 p.m. UTC | #2
On 7/21/22 07:02, Florian Weimer via Libc-alpha wrote:
> It is not declared in a header file, and as the comment indicates,
> it is not expected to be used.
> 
> Tested on i686-linux-gnu and x86_64-linux-gnu.
> 
> ---
>  inet/rcmd.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/inet/rcmd.c b/inet/rcmd.c
> index 0d6b595572..624561f830 100644
> --- a/inet/rcmd.c
> +++ b/inet/rcmd.c
> @@ -79,6 +79,7 @@
>  #include <wchar.h>
>  #include <sys/uio.h>
>  #include <sigsetops.h>
> +#include <shlib-compat.h>
>  
>  
>  int __ivaliduser (FILE *, uint32_t, const char *, const char *);
> @@ -621,6 +622,7 @@ iruserok (uint32_t raddr, int superuser, const char *ruser, const char *luser)
>    return iruserok_af (&raddr, superuser, ruser, luser, AF_INET);
>  }
>  
> +#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_36)
>  /*
>   * XXX
>   * Don't make static, used by lpd(8).
> @@ -632,7 +634,7 @@ iruserok (uint32_t raddr, int superuser, const char *ruser, const char *luser)
>   * or PAM.
>   * Returns 0 if ok, -1 if not ok.
>   */
> -int
> +int attribute_compat_text_section
>  __ivaliduser (FILE *hostf, uint32_t raddr, const char *luser,
>  	      const char *ruser)
>  {
> @@ -643,7 +645,8 @@ __ivaliduser (FILE *hostf, uint32_t raddr, const char *luser,
>  	return __validuser2_sa(hostf, (struct sockaddr *)&ra, sizeof(ra),
>  			       luser, ruser, "-");
>  }
> -
> +compat_symbol (libc, __ivaliduser, __ivaliduser, GLIBC_2_0);
> +#endif

Good catch. I don't think we should be exporting this anymore.

Please repost this in August for glibc 2.37. There is no strong reason to deprecate
this in the 2.36 release.

As a matter of procedure I don't want to change or review ABI changes at this point.


>  /* Returns 1 on positive match, 0 on no match, -1 on negative match.  */
>  static int
>
  
Florian Weimer July 21, 2022, 1:23 p.m. UTC | #3
* Andreas Schwab:

> On Jul 21 2022, Florian Weimer via Libc-alpha wrote:
>
>> It is not declared in a header file, and as the comment indicates,
>> it is not expected to be used.
>
> Well, as the comment says, this is not quite true.  The FreeBSD lpd
> command still uses that interface (which is why the FreeBSD libc still
> exports it), but it now uses a variant of it so that it no longer works
> with glibc.

The Debian lpr package calls __ivaliduser_sa these days and has its own
bundled rcmd.c, so I really think we don't need to export this anymore.
(I expect other distributions have switched to CUPS entirely, or use a
similar lpr package version.)

Thanks,
Florian
  
Andreas Schwab July 21, 2022, 1:30 p.m. UTC | #4
At least the comment should be updated to describe the current
situation.
  

Patch

diff --git a/inet/rcmd.c b/inet/rcmd.c
index 0d6b595572..624561f830 100644
--- a/inet/rcmd.c
+++ b/inet/rcmd.c
@@ -79,6 +79,7 @@ 
 #include <wchar.h>
 #include <sys/uio.h>
 #include <sigsetops.h>
+#include <shlib-compat.h>
 
 
 int __ivaliduser (FILE *, uint32_t, const char *, const char *);
@@ -621,6 +622,7 @@  iruserok (uint32_t raddr, int superuser, const char *ruser, const char *luser)
   return iruserok_af (&raddr, superuser, ruser, luser, AF_INET);
 }
 
+#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_36)
 /*
  * XXX
  * Don't make static, used by lpd(8).
@@ -632,7 +634,7 @@  iruserok (uint32_t raddr, int superuser, const char *ruser, const char *luser)
  * or PAM.
  * Returns 0 if ok, -1 if not ok.
  */
-int
+int attribute_compat_text_section
 __ivaliduser (FILE *hostf, uint32_t raddr, const char *luser,
 	      const char *ruser)
 {
@@ -643,7 +645,8 @@  __ivaliduser (FILE *hostf, uint32_t raddr, const char *luser,
 	return __validuser2_sa(hostf, (struct sockaddr *)&ra, sizeof(ra),
 			       luser, ruser, "-");
 }
-
+compat_symbol (libc, __ivaliduser, __ivaliduser, GLIBC_2_0);
+#endif
 
 /* Returns 1 on positive match, 0 on no match, -1 on negative match.  */
 static int