RFC/Patch 1: "auto.smb" in Kerberos/AD environments

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



[PATCH 1/2] modules/lookup_program.c: pass caller UID to program

This patch passes the UID of the calling process to the program map
in the environment. The program map can use this e.g. to obtain 
credentials.

---
 modules/lookup_program.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/modules/lookup_program.c b/modules/lookup_program.c
index 2457108..2977e64 100644
--- a/modules/lookup_program.c
+++ b/modules/lookup_program.c
@@ -244,6 +244,7 @@ int lookup_mount(struct autofs_point *ap, const char *name, int name_len, void *
 		close(epipefd[1]);
 		goto out_free;
 	} else if (f == 0) {
+		struct thread_stdenv_vars *tsv;
 		reset_signals();
 		close(pipefd[0]);
 		close(epipefd[0]);
@@ -255,6 +256,12 @@ int lookup_mount(struct autofs_point *ap, const char *name, int name_len, void *
 			warn(ap->logopt,
 			     MODPREFIX "failed to set PWD to %s for map %s",
 			     ap->path, ctxt->mapname);
+		tsv = pthread_getspecific(key_thread_stdenv_vars);
+		if (tsv)  {
+			char buf[16]; 
+			if (snprintf(buf, sizeof(buf), "%u", tsv->uid) < sizeof(buf))
+				setenv("CALLER_UID", buf, 1);
+		}
 		execl(ctxt->mapname, ctxt->mapname, name, NULL);
 		_exit(255);	/* execl() failed */
 	}
-- 
1.8.1

--
To unsubscribe from this list: send the line "unsubscribe autofs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Filesystem Development]     [Linux Ext4]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux