diff mbox series

[cifs-utils,RFC,08/12] upcall-helper: build command-line and set environment variables for cifs.upcall

Message ID 20250510161609.2615639-9-sorenson@redhat.com
State New
Headers show
Series cifs.upcall helper script enabling complex key description matching | expand

Commit Message

Frank Sorenson May 10, 2025, 4:16 p.m. UTC
When executing cifs.upcall, use the values of upcall_opts to
determine the command-line arguments, and set environment
variables if specified.

Signed-off-by: Frank Sorenson <sorenson@redhat.com>
---
 contrib/upcall-helper/cifs-upcall-helper | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
diff mbox series

Patch

diff --git a/contrib/upcall-helper/cifs-upcall-helper b/contrib/upcall-helper/cifs-upcall-helper
index 083ede5..18e41df 100755
--- a/contrib/upcall-helper/cifs-upcall-helper
+++ b/contrib/upcall-helper/cifs-upcall-helper
@@ -68,6 +68,23 @@  sub log_msg {
 }
 sub exec_upcall {
 	my @upcall_args = ( '/usr/sbin/cifs.upcall' );
+	foreach my $opt (keys %upcall_opts) {
+		if ($opt eq 'keytab') {
+			push @upcall_args, ('-K', $upcall_opts{$opt});
+		} elsif ($opt eq 'krb5conf') {
+			push @upcall_args, ('-k', $upcall_opts{$opt});
+		} elsif ($opt eq 'krb5_trace') {
+			$ENV{'KRB5_TRACE'} = $upcall_opts{$opt};
+		} elsif ($opt eq 'use_proxy') {
+			$ENV{'GSS_USE_PROXY'} = 'yes';
+		} elsif ($opt eq 'legacy_uid') {
+			push @upcall_args, '-l';
+		} elsif ($opt eq 'trust_dns') {
+			push @upcall_args, '-t';
+		} elsif ($opt eq 'no_env_probe') {
+			push @upcall_args, '-E';
+		}
+	}
 	push @upcall_args, $keyid;
 
 	log_msg 1, sprintf("executing cifs.upcall: %s", join(' ', @upcall_args));