extern unsigned long getlogindefs_num(const char *name, unsigned long dflt);
extern const char *getlogindefs_str(const char *name, const char *dflt);
extern void free_getlogindefs_data(void);
+
extern int logindefs_setenv(const char *name, const char *conf, const char *dflt);
+extern int logindefs_setenv_path(uid_t uid);
+
extern int effective_access(const char *path, int mode);
extern int get_hushlogin_status(struct passwd *pwd, const char *override_home, int force_check);
return val ? setenv(name, val, 1) : -1;
}
+/*
+ * logindefs based setenv("PATH")
+ */
+int logindefs_setenv_path(uid_t uid)
+{
+ int rc = 0;
+
+ if (uid)
+ rc = logindefs_setenv("PATH", "ENV_PATH", _PATH_DEFPATH);
+
+ else if ((rc = logindefs_setenv("PATH", "ENV_SUPATH", NULL)) != 0)
+ rc = logindefs_setenv("PATH", "ENV_ROOTPATH", _PATH_DEFPATH_ROOT);
+
+ return rc;
+}
+
/*
* We need to check the effective UID/GID. For example, $HOME could be on a
* root-squashed NFS or on an NFS with UID mapping, and access(2) uses the