* samba/lib/util.c (tmpdir): Use MC_TMPDIR environment variable.

(automount_lookup): More secure code.
This commit is contained in:
Andrew V. Samoilov 2004-08-20 21:05:02 +00:00
parent fb4fd57695
commit 6478efd184
2 changed files with 9 additions and 7 deletions

View File

@ -1,3 +1,8 @@
2004-08-21 Pavel S. Shirshov <pavelsh@mail.ru>
* samba/lib/util.c (tmpdir): Use MC_TMPDIR environment variable.
(automount_lookup): More secure code.
2004-08-19 Roland Illig <roland.illig@gmx.de> 2004-08-19 Roland Illig <roland.illig@gmx.de>
* extfs/deb.in (mcdebfs_list): Separated the use of quoted and * extfs/deb.in (mcdebfs_list): Separated the use of quoted and

View File

@ -114,7 +114,7 @@ static char *filename_dos(char *path,char *buf);
char *tmpdir(void) char *tmpdir(void)
{ {
char *p; char *p;
if ((p = getenv("TMPDIR"))) { if ((p = getenv("MC_TMPDIR")) || (p = getenv("TMPDIR"))) {
return p; return p;
} }
return "/tmp"; return "/tmp";
@ -1885,20 +1885,17 @@ static char *automount_lookup(char *user_name)
char *nis_map = (char *)lp_nis_home_map_name(); char *nis_map = (char *)lp_nis_home_map_name();
char nis_domain[NIS_MAXNAMELEN + 1];
char buffer[NIS_MAXATTRVAL + 1]; char buffer[NIS_MAXATTRVAL + 1];
nis_result *result; nis_result *result;
nis_object *object; nis_object *object;
entry_obj *entry; entry_obj *entry;
strncpy(nis_domain, (char *)nis_local_directory(), NIS_MAXNAMELEN); DEBUG(5, ("NIS+ Domain: %s\n", (char *)nis_local_directory()));
nis_domain[NIS_MAXNAMELEN] = '\0';
DEBUG(5, ("NIS+ Domain: %s\n", nis_domain));
if (strcmp(user_name, last_key)) if (strcmp(user_name, last_key))
{ {
slprintf(buffer, sizeof(buffer)-1, "[%s=%s]%s.%s", "key", user_name, nis_map, nis_domain); slprintf(buffer, sizeof(buffer)-1, "[%s=%s]%s.%s", "key", user_name, nis_map,
(char *)nis_local_directory());
DEBUG(5, ("NIS+ querystring: %s\n", buffer)); DEBUG(5, ("NIS+ querystring: %s\n", buffer));
if (result = nis_list(buffer, RETURN_RESULT, NULL, NULL)) if (result = nis_list(buffer, RETURN_RESULT, NULL, NULL))