* Re: [PATCH rpcbind 2/2] rpcbind: Add -v flag to print version and config
2025-06-05 6:00 ` [PATCH rpcbind 2/2] rpcbind: Add -v flag to print version and config Petr Vorel
@ 2025-06-05 13:45 ` Ricardo B. Marlière
2025-07-26 23:13 ` Steve Dickson
1 sibling, 0 replies; 5+ messages in thread
From: Ricardo B. Marlière @ 2025-06-05 13:45 UTC (permalink / raw)
To: Petr Vorel, linux-nfs
Cc: libtirpc-devel, Steve Dickson, Ricardo B . Marlière
Hi Petr,
On Thu Jun 5, 2025 at 3:00 AM -03, Petr Vorel wrote:
> This helps to see compiled time options, e.g. remote calls enablement.
>
> $ ./rpcbind -v
> rpcbind 1.2.7
> debug: no, libset debug: no, libwrap: no, nss modules: files, remote calls: no, statedir: /run/rpcbind, systemd: yes, user: root, warm start: no
>
> Signed-off-by: Petr Vorel <pvorel@suse.cz>
LGTM, thanks for doing this.
For the series:
Reviewed-by: Ricardo B. Marlière <rbm@suse.com>
> ---
> man/rpcbind.8 | 6 +++-
> src/rpcbind.c | 81 +++++++++++++++++++++++++++++++++++++++++++++++++--
> 2 files changed, 83 insertions(+), 4 deletions(-)
>
> diff --git a/man/rpcbind.8 b/man/rpcbind.8
> index cd0f817..15b70f9 100644
> --- a/man/rpcbind.8
> +++ b/man/rpcbind.8
> @@ -11,7 +11,7 @@
> .Nd universal addresses to RPC program number mapper
> .Sh SYNOPSIS
> .Nm
> -.Op Fl adfhilsw
> +.Op Fl adfhilsvw
> .Sh DESCRIPTION
> The
> .Nm
> @@ -141,6 +141,10 @@ to use non-privileged ports for outgoing connections, preventing non-privileged
> clients from using
> .Nm
> to connect to services from a privileged port.
> +.It Fl v
> +Print
> +.Nm
> +version and builtin configuration and exit.
> .It Fl w
> Cause
> .Nm
> diff --git a/src/rpcbind.c b/src/rpcbind.c
> index 122ce6a..bf7b499 100644
> --- a/src/rpcbind.c
> +++ b/src/rpcbind.c
> @@ -96,10 +96,11 @@ char *rpcbinduser = RPCBIND_USER;
> char *rpcbinduser = NULL;
> #endif
>
> +#define NSS_MODULES_DEFAULT "files"
> #ifdef NSS_MODULES
> char *nss_modules = NSS_MODULES;
> #else
> -char *nss_modules = "files";
> +char *nss_modules = NSS_MODULES_DEFAULT;
> #endif
>
> /* who to suid to if -s is given */
> @@ -143,6 +144,76 @@ static void rbllist_add(rpcprog_t, rpcvers_t, struct netconfig *,
> static void terminate(int);
> static void parseargs(int, char *[]);
>
> +static void version()
> +{
> + fprintf(stderr, "%s\n", PACKAGE_STRING);
> +
> + fprintf(stderr, "debug: ");
> +#ifdef RPCBIND_DEBUG
> + fprintf(stderr, "yes");
> +#else
> + fprintf(stderr, "no");
> +#endif
> +
> + fprintf(stderr, ", libset debug: ");
> +#ifdef LIB_SET_DEBUG
> + fprintf(stderr, "yes");
> +#else
> + fprintf(stderr, "no");
> +#endif
> +
> + fprintf(stderr, ", libwrap: ");
> +#ifdef LIBWRAP
> + fprintf(stderr, "yes");
> +#else
> + fprintf(stderr, "no");
> +#endif
> +
> + fprintf(stderr, ", nss modules: ");
> +#ifdef NSS_MODULES
> + fprintf(stderr, "%s", NSS_MODULES);
> +#else
> + fprintf(stderr, "%s", NSS_MODULES_DEFAULT);
> +#endif
> +
> + fprintf(stderr, ", remote calls: ");
> +#ifdef RMTCALLS
> + fprintf(stderr, "yes");
> +#else
> + fprintf(stderr, "no");
> +#endif
> +
> + fprintf(stderr, ", statedir: ");
> +#ifdef RPCBIND_STATEDIR
> + fprintf(stderr, "%s", RPCBIND_STATEDIR);
> +#else
> + fprintf(stderr, "");
> +#endif
> +
> + fprintf(stderr, ", systemd: ");
> +#ifdef SYSTEMD
> + fprintf(stderr, "yes");
> +#else
> + fprintf(stderr, "no");
> +#endif
> +
> + fprintf(stderr, ", user: ");
> +#ifdef RPCBIND_USER
> + fprintf(stderr, "%s", RPCBIND_USER);
> +#else
> + fprintf(stderr, "");
> +#endif
> +
> + fprintf(stderr, ", warm start: ");
> +#ifdef WARMSTART
> + fprintf(stderr, "yes");
> +#else
> + fprintf(stderr, "no");
> +#endif
> +
> + fprintf(stderr, "\n");
> +}
> +
> int
> main(int argc, char *argv[])
> {
> @@ -888,7 +959,7 @@ parseargs(int argc, char *argv[])
> {
> int c;
> oldstyle_local = 1;
> - while ((c = getopt(argc, argv, "adh:ilswf")) != -1) {
> + while ((c = getopt(argc, argv, "adfh:ilsvw")) != -1) {
> switch (c) {
> case 'a':
> doabort = 1; /* when debugging, do an abort on */
> @@ -918,13 +989,17 @@ parseargs(int argc, char *argv[])
> case 'f':
> dofork = 0;
> break;
> + case 'v':
> + version();
> + exit(0);
> + break;
> #ifdef WARMSTART
> case 'w':
> warmstart = 1;
> break;
> #endif
> default: /* error */
> - fprintf(stderr, "usage: rpcbind [-adhilswf]\n");
> + fprintf(stderr, "usage: rpcbind [-adfhilsvw]\n");
> exit (1);
> }
> }
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH rpcbind 2/2] rpcbind: Add -v flag to print version and config
2025-06-05 6:00 ` [PATCH rpcbind 2/2] rpcbind: Add -v flag to print version and config Petr Vorel
2025-06-05 13:45 ` Ricardo B. Marlière
@ 2025-07-26 23:13 ` Steve Dickson
1 sibling, 0 replies; 5+ messages in thread
From: Steve Dickson @ 2025-07-26 23:13 UTC (permalink / raw)
To: Petr Vorel, linux-nfs; +Cc: libtirpc-devel, Ricardo B . Marlière
On 6/5/25 2:00 AM, Petr Vorel wrote:
> This helps to see compiled time options, e.g. remote calls enablement.
>
> $ ./rpcbind -v
> rpcbind 1.2.7
> debug: no, libset debug: no, libwrap: no, nss modules: files, remote calls: no, statedir: /run/rpcbind, systemd: yes, user: root, warm start: no
>
> Signed-off-by: Petr Vorel <pvorel@suse.cz>
Committed... (tag: rpcbind-1_2_8-rc3)
steved.
> ---
> man/rpcbind.8 | 6 +++-
> src/rpcbind.c | 81 +++++++++++++++++++++++++++++++++++++++++++++++++--
> 2 files changed, 83 insertions(+), 4 deletions(-)
>
> diff --git a/man/rpcbind.8 b/man/rpcbind.8
> index cd0f817..15b70f9 100644
> --- a/man/rpcbind.8
> +++ b/man/rpcbind.8
> @@ -11,7 +11,7 @@
> .Nd universal addresses to RPC program number mapper
> .Sh SYNOPSIS
> .Nm
> -.Op Fl adfhilsw
> +.Op Fl adfhilsvw
> .Sh DESCRIPTION
> The
> .Nm
> @@ -141,6 +141,10 @@ to use non-privileged ports for outgoing connections, preventing non-privileged
> clients from using
> .Nm
> to connect to services from a privileged port.
> +.It Fl v
> +Print
> +.Nm
> +version and builtin configuration and exit.
> .It Fl w
> Cause
> .Nm
> diff --git a/src/rpcbind.c b/src/rpcbind.c
> index 122ce6a..bf7b499 100644
> --- a/src/rpcbind.c
> +++ b/src/rpcbind.c
> @@ -96,10 +96,11 @@ char *rpcbinduser = RPCBIND_USER;
> char *rpcbinduser = NULL;
> #endif
>
> +#define NSS_MODULES_DEFAULT "files"
> #ifdef NSS_MODULES
> char *nss_modules = NSS_MODULES;
> #else
> -char *nss_modules = "files";
> +char *nss_modules = NSS_MODULES_DEFAULT;
> #endif
>
> /* who to suid to if -s is given */
> @@ -143,6 +144,76 @@ static void rbllist_add(rpcprog_t, rpcvers_t, struct netconfig *,
> static void terminate(int);
> static void parseargs(int, char *[]);
>
> +static void version()
> +{
> + fprintf(stderr, "%s\n", PACKAGE_STRING);
> +
> + fprintf(stderr, "debug: ");
> +#ifdef RPCBIND_DEBUG
> + fprintf(stderr, "yes");
> +#else
> + fprintf(stderr, "no");
> +#endif
> +
> + fprintf(stderr, ", libset debug: ");
> +#ifdef LIB_SET_DEBUG
> + fprintf(stderr, "yes");
> +#else
> + fprintf(stderr, "no");
> +#endif
> +
> + fprintf(stderr, ", libwrap: ");
> +#ifdef LIBWRAP
> + fprintf(stderr, "yes");
> +#else
> + fprintf(stderr, "no");
> +#endif
> +
> + fprintf(stderr, ", nss modules: ");
> +#ifdef NSS_MODULES
> + fprintf(stderr, "%s", NSS_MODULES);
> +#else
> + fprintf(stderr, "%s", NSS_MODULES_DEFAULT);
> +#endif
> +
> + fprintf(stderr, ", remote calls: ");
> +#ifdef RMTCALLS
> + fprintf(stderr, "yes");
> +#else
> + fprintf(stderr, "no");
> +#endif
> +
> + fprintf(stderr, ", statedir: ");
> +#ifdef RPCBIND_STATEDIR
> + fprintf(stderr, "%s", RPCBIND_STATEDIR);
> +#else
> + fprintf(stderr, "");
> +#endif
> +
> + fprintf(stderr, ", systemd: ");
> +#ifdef SYSTEMD
> + fprintf(stderr, "yes");
> +#else
> + fprintf(stderr, "no");
> +#endif
> +
> + fprintf(stderr, ", user: ");
> +#ifdef RPCBIND_USER
> + fprintf(stderr, "%s", RPCBIND_USER);
> +#else
> + fprintf(stderr, "");
> +#endif
> +
> + fprintf(stderr, ", warm start: ");
> +#ifdef WARMSTART
> + fprintf(stderr, "yes");
> +#else
> + fprintf(stderr, "no");
> +#endif
> +
> + fprintf(stderr, "\n");
> +}
> +
> int
> main(int argc, char *argv[])
> {
> @@ -888,7 +959,7 @@ parseargs(int argc, char *argv[])
> {
> int c;
> oldstyle_local = 1;
> - while ((c = getopt(argc, argv, "adh:ilswf")) != -1) {
> + while ((c = getopt(argc, argv, "adfh:ilsvw")) != -1) {
> switch (c) {
> case 'a':
> doabort = 1; /* when debugging, do an abort on */
> @@ -918,13 +989,17 @@ parseargs(int argc, char *argv[])
> case 'f':
> dofork = 0;
> break;
> + case 'v':
> + version();
> + exit(0);
> + break;
> #ifdef WARMSTART
> case 'w':
> warmstart = 1;
> break;
> #endif
> default: /* error */
> - fprintf(stderr, "usage: rpcbind [-adhilswf]\n");
> + fprintf(stderr, "usage: rpcbind [-adfhilsvw]\n");
> exit (1);
> }
> }
^ permalink raw reply [flat|nested] 5+ messages in thread