Skip to contentSkip to conversation

sample/auto.smb: Use AUTOFS_ prefixed environment variables

PATCH New Salvatore Bonaccorso 1 participant 1 message Sep 12, 2024 Kernel automounter

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 sample/auto.smb: Use AUTOFS_ prefixed environment variables

As the default value for 'force_standard_program_map_env' from autofs.conf(5) is 'no', for a program map that uses the UID and GID standard environment variables they are prefixed with "AUTOFS_".

To match the behaviour under default conditions of 'force_standard_program_map_env' use AUTOFS_UID and AUTOFS_GID in the sample code for the auto.smb program map.

---
Changes in v2:
- Fix typo 'prevised' -> 'prefixed'

 samples/auto.smb | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
samples/auto.smb +3 -3
index f6d41d35f121..faa5a0acebc6 100755
@@ -24,7 +24,7 @@
 
 get_krb5_cache() {
     cache=
-    uid=${UID}
+    uid=${AUTOFS_UID}
     for x in $(ls -d /run/user/$uid/krb5cc_* 2>/dev/null); do
         if [ -d "$x" ] && klist -s DIR:"$x"; then
 	    cache=DIR:$x
@@ -53,12 +53,12 @@ done
 
 creds=/etc/creds/$key
 if [ -f "$creds" ]; then
-    opts="$opts"',uid=$UID,gid=$GID,credentials='"$creds"
+    opts="$opts"',uid=${AUTOFS_UID},gid=${AUTOFS_GID},credentials='"$creds"
     smbopts="-A $creds"
 else
     get_krb5_cache
     if [ -n "$cache" ]; then
-        opts="$opts"',multiuser,cruid=$UID,sec=krb5i'
+        opts="$opts"',multiuser,cruid=${AUTOFS_UID},sec=krb5i'
         smbopts="-k"
         export KRB5CCNAME=$cache
     else
Signature · 1 line
2.45.2