cifs-utils/svcgssd: Fix use-after-free bug (config variables)
Subsystems (2)
PATCH 1/3 cifs-utils/svcgssd: Fix use-after-free bug (config variables)
From: Marcel Ritter <[email protected]>
This patch fixes a bug when trying to set "principal" in /etc/nfs.conf. Memory gets freed by conf_cleanup() before being used - moving cleanup code resolves that.
--- utils/gssd/svcgssd.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
utils/gssd/svcgssd.c +3 -3
@@ -211,9 +211,6 @@ main(int argc, char *argv[]) rpc_verbosity =conf_get_num ("svcgssd" ,"RPC-Verbosity" , rpc_verbosity); idmap_verbosity =conf_get_num ("svcgssd" ,"IDMAP-Verbosity" , idmap_verbosity); -/* We don't need the config anymore */ -conf_cleanup (); -while ((opt =getopt (argc, argv,"fivrnp:" )) !=-1 ) {switch (opt) {case 'f' :
@@ -328,6 +325,9 @@ main(int argc, char *argv[])daemon_ready (); +/* We don't need the config anymore */ +conf_cleanup (); +nfs4_init_name_mapping (NULL );/* XXX: should only do this once */ rc =event_base_dispatch (evbase);
Signature · 1 line
2.34.1
PATCH 2/3 cifs-utils/svcgssd: Display principal if set
From: Marcel Ritter <[email protected]>
It's a little irritating to only see the template "<...>@<...>" if you set a specific principal name. So let's show it (if set).
--- utils/gssd/svcgssd.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
utils/gssd/svcgssd.c +3 -3
@@ -295,9 +295,9 @@ main(int argc, char *argv[]) (const gss_OID)GSS_C_NT_HOSTBASED_SERVICE);if (status == FALSE) {printerr (0 ,"unable to obtain root (machine) credentials\n" ); -printerr (0 ,"do you have a keytab entry for " -"nfs/<your.host>@<YOUR.REALM> in " -"/etc/krb5.keytab?\n" ); +printerr (0 ,"do you have a keytab entry for %s in" +"/etc/krb5.keytab?\n" , + principal ? principal :"nfs/<your.host>@<YOUR.REALM>" );exit (1 ); } }else {
Signature · 1 line
2.34.1
PATCH 3/3 cifs-utils/svcgssd: Add (undocumented) config options to man page
In reply to [email protected]From: Marcel Ritter <[email protected]>
There seem to be some undocumented options implemented. Why not mention them in the man page?
--- utils/gssd/svcgssd.man | 13 +++++++++++++ 1 file changed, 13 insertions(+)
utils/gssd/svcgssd.man +13 -0
@@ -61,6 +61,19 @@ this is equivalent to the option. If set to any other value, that is used like the .B -p option. +.TP +.B verbosity +Value which is equivalent to the number of +.BR -v . +.TP +.B rpc-verbosity +Value which is equivalent to the number of +.BR -r . +.TP +.B idmap-verbosity +Value which is equivalent to the number of +.BR -i . + .SH SEE ALSO .BR rpc.gssd(8),
Signature · 1 line
2.34.1
Hi again,
argl - just noticed that I described the patches with "cifs-utils" - should be "nfs-utils" of course :-( Sorry for that.
Marcel
Quoted 36 lines · June 7, 2022 10:19 AM, [email protected] wrote:
From: Marcel Ritter <[email protected]>
This patch fixes a bug when trying to set "principal" in
/etc/nfs.conf. Memory gets freed byconf_cleanup()before being used - moving cleanup code resolves that.---
utils/gssd/svcgssd.c| 6 +++---1 file changed, 3 insertions(+), 3 deletions(-)utils/gssd/svcgssd.c +0
-3@@ -211,9 +211,6 @@ main(int argc, char *argv[]) rpc_verbosity =conf_get_num ("svcgssd" ,"RPC-Verbosity" , rpc_verbosity); idmap_verbosity =conf_get_num ("svcgssd" ,"IDMAP-Verbosity" , idmap_verbosity); -/* We don't need the config anymore */ -conf_cleanup (); -while ((opt =getopt (argc, argv,"fivrnp:" )) !=-1 ) {switch (opt) {case 'f':
utils/gssd/svcgssd.c +3
-0@@ -328,6 +325,9 @@ main(int argc, char *argv[])daemon_ready (); +/* We don't need the config anymore */ +conf_cleanup (); +
nfs4_init_name_mapping(NULL); /* XXX: should only do this once */rc =
event_base_dispatch(evbase);Signature · 1 line
2.34.1
All 3 patch committed (tag: nfs-utils-2-6-2-rc7)
steved.
Quoted 34 lines · On 6/7/22 4:19 AM, [email protected] wrote:
From: Marcel Ritter <[email protected]>
This patch fixes a bug when trying to set "principal" in
/etc/nfs.conf. Memory gets freed byconf_cleanup()before being used - moving cleanup code resolves that.--- utils/gssd/svcgssd.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)utils/gssd/svcgssd.c +3
-3@@ -211,9 +211,6 @@ main(int argc, char *argv[]) rpc_verbosity =conf_get_num ("svcgssd" ,"RPC-Verbosity" , rpc_verbosity); idmap_verbosity =conf_get_num ("svcgssd" ,"IDMAP-Verbosity" , idmap_verbosity); -/* We don't need the config anymore */ -conf_cleanup (); -while ((opt =getopt (argc, argv,"fivrnp:" )) !=-1 ) {switch (opt) {case 'f' :@@ -328,6 +325,9 @@ main(int argc, char *argv[])daemon_ready (); +/* We don't need the config anymore */ +conf_cleanup (); +nfs4_init_name_mapping (NULL );/* XXX: should only do this once */ rc =event_base_dispatch (evbase);
Re: [PATCH 3/3] cifs-utils/svcgssd: Add (undocumented) config options to man page
In reply to [email protected]On the heels of this patch, you might want to add this tiny bit to also update the nfs.conf(5) manpage:
systemd/nfs.conf.man +4 -1
@@ -283,7 +283,10 @@ .TP .B svcgssd Recognized values: -.BR principal . +.BR principal , +.BR verbosity , +.BR rpc-verbosity , +.BR idmap-verbosity . See .BR rpc.svcgssd (8)
Quoted 37 lines · On Tue, Jun 7, 2022 at 8:19 AM <[email protected]> wrote:
From: Marcel Ritter <[email protected]>
There seem to be some undocumented options implemented. Why not mention them in the man page?
--- utils/gssd/svcgssd.man | 13 +++++++++++++ 1 file changed, 13 insertions(+)utils/gssd/svcgssd.man +13
-1@@ -61,6 +61,19 @@ this is equivalent to the option. If set to any other value, that is used like the .B -p option. +.TP +.B verbosity +Value which is equivalent to the number of +.BR -v . +.TP +.B rpc-verbosity +Value which is equivalent to the number of +.BR -r . +.TP +.B idmap-verbosity +Value which is equivalent to the number of +.BR -i . + .SH SEE ALSO .BR rpc.gssd(8), --2.34.1