diff options
author | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2011-09-30 19:59:06 +0000 |
---|---|---|
committer | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2011-09-30 19:59:06 +0000 |
commit | 304678df87c7aceb295870ccd396b1acdd8bb42b (patch) | |
tree | 01e85e75ec89c1a13d6e63b2d4b86b1c22b745e7 | |
parent | e37d3d72becfd45604987338cdc011e043c0feba (diff) |
Set user PATH from login.conf instead of hard-coded default.
prodded by ajacoutot@. Patch tweaks and ok millert@.
-rw-r--r-- | app/xdm/greeter/verify.c | 18 | ||||
-rw-r--r-- | app/xdm/xdm.man.cpp | 7 |
2 files changed, 19 insertions, 6 deletions
diff --git a/app/xdm/greeter/verify.c b/app/xdm/greeter/verify.c index 7c86ae3fb..3c25c5626 100644 --- a/app/xdm/greeter/verify.c +++ b/app/xdm/greeter/verify.c @@ -125,8 +125,8 @@ Verify (struct display *d, struct greet_info *greet, struct verify_info *verify) struct passwd *p; login_cap_t *lc; auth_session_t *as; - char *style, *shell, *home, *s, **argv; - char path[MAXPATHLEN]; + char *style, *shell, *home, *path, *s, **argv; + char auth_path[MAXPATHLEN]; int authok; size_t passwd_len; @@ -178,8 +178,8 @@ Verify (struct display *d, struct greet_info *greet, struct verify_info *verify) bzero(greet->password, passwd_len); #endif /* Build path of the auth script and call it */ - snprintf(path, sizeof(path), _PATH_AUTHPROG "%s", style); - auth_call(as, path, style, "-s", "response", greet->name, + snprintf(auth_path, sizeof(auth_path), _PATH_AUTHPROG "%s", style); + auth_call(as, auth_path, style, "-s", "response", greet->name, lc->lc_class, (void *)NULL); authok = auth_getstate(as); @@ -199,6 +199,16 @@ Verify (struct display *d, struct greet_info *greet, struct verify_info *verify) return 0; } auth_close(as); + path = d->userPath; + d->userPath = login_getcapstr(lc, "path", path, path); + if (d->userPath != path) { + free(path); + /* login.conf path is space delimited */ + for (path = d->userPath; *path != '\0'; path++) { + if (*path == ' ') + *path = ':'; + } + } login_close(lc); /* Check empty passwords against allowNullPasswd */ if (!greet->allow_null_passwd && passwd_len == 0) { diff --git a/app/xdm/xdm.man.cpp b/app/xdm/xdm.man.cpp index b947e5a96..ef12677ff 100644 --- a/app/xdm/xdm.man.cpp +++ b/app/xdm/xdm.man.cpp @@ -494,7 +494,9 @@ sets the PATH environment variable for the session to this value. It should be a colon separated list of directories; see .IR sh (1) for a full description. -The default value is ``DEF_USER_PATH''. +The default value is derived from the default login class parameters defined in +\fI/etc/login.conf\fP +if available or otherwise is set to``DEF_USER_PATH''. .IP "\fBDisplayManager.\fP\fIDISPLAY\fP\fB.systemPath\fP" .I Xdm sets the PATH environment variable for the startup and reset scripts to the @@ -1438,7 +1440,8 @@ Kerberos credentials cache .IR Xserver (__appmansuffix__), .\" .IR chooser (__appmansuffix__), \" except that there isn't a manual for it yet .\" .IR xdmshell (__appmansuffix__), \" except that there isn't a manual for it yet -.IR fonts.conf (__filemansuffix__). +.IR fonts.conf (__filemansuffix__), +.IR login.conf (__filemansuffix__). .br .I "X Display Manager Control Protocol" .br |