|
|
306fa1 |
autofs-5.1.3 - fix unset tsd group name handling
|
|
|
306fa1 |
|
|
|
306fa1 |
From: Ian Kent <raven@themaw.net>
|
|
|
306fa1 |
|
|
|
306fa1 |
Commit 1a64a6bbc5 changed set_tsd_user_vars() to the thread specific
|
|
|
306fa1 |
values even if the group name could not be obtained.
|
|
|
306fa1 |
|
|
|
306fa1 |
But the structure holding the values was not initialized on allocation
|
|
|
306fa1 |
so the group field might not be NULL when no group name is available.
|
|
|
306fa1 |
|
|
|
306fa1 |
Also the macro addition and removal functions didn't properly handle a
|
|
|
306fa1 |
macro value of NULL.
|
|
|
306fa1 |
|
|
|
306fa1 |
Signed-off-by: Ian Kent <raven@themaw.net>
|
|
|
306fa1 |
Reported-by: Donald Buczek <buczek@molgen.mpg.de>
|
|
|
306fa1 |
---
|
|
|
306fa1 |
CHANGELOG | 1 +
|
|
|
306fa1 |
lib/macros.c | 8 +++++---
|
|
|
306fa1 |
lib/mounts.c | 1 +
|
|
|
306fa1 |
3 files changed, 7 insertions(+), 3 deletions(-)
|
|
|
306fa1 |
|
|
|
306fa1 |
--- autofs-5.0.7.orig/CHANGELOG
|
|
|
306fa1 |
+++ autofs-5.0.7/CHANGELOG
|
|
|
306fa1 |
@@ -250,6 +250,7 @@
|
|
|
306fa1 |
- increase worker thread per-thread stack size.
|
|
|
306fa1 |
- limit getgrgid_r() buffer size.
|
|
|
306fa1 |
- add congigure option for limiting getgrgid_r() stack usage.
|
|
|
306fa1 |
+- fix unset tsd group name handling.
|
|
|
306fa1 |
|
|
|
306fa1 |
25/07/2012 autofs-5.0.7
|
|
|
306fa1 |
=======================
|
|
|
306fa1 |
--- autofs-5.0.7.orig/lib/macros.c
|
|
|
306fa1 |
+++ autofs-5.0.7/lib/macros.c
|
|
|
306fa1 |
@@ -281,18 +281,20 @@ macro_addvar(struct substvar *table, con
|
|
|
306fa1 |
}
|
|
|
306fa1 |
|
|
|
306fa1 |
if (lv) {
|
|
|
306fa1 |
- char *this = malloc(strlen(value) + 1);
|
|
|
306fa1 |
+ const char *val = value ? value : "";
|
|
|
306fa1 |
+ char *this = malloc(strlen(val) + 1);
|
|
|
306fa1 |
if (!this) {
|
|
|
306fa1 |
lv = table;
|
|
|
306fa1 |
goto done;
|
|
|
306fa1 |
}
|
|
|
306fa1 |
- strcpy(this, value);
|
|
|
306fa1 |
+ strcpy(this, val);
|
|
|
306fa1 |
free(lv->val);
|
|
|
306fa1 |
lv->val = this;
|
|
|
306fa1 |
if (lv != table)
|
|
|
306fa1 |
lv = table;
|
|
|
306fa1 |
} else {
|
|
|
306fa1 |
struct substvar *new;
|
|
|
306fa1 |
+ const char *this = value ? value : "";
|
|
|
306fa1 |
char *def, *val;
|
|
|
306fa1 |
|
|
|
306fa1 |
def = strdup(str);
|
|
|
306fa1 |
@@ -302,7 +304,7 @@ macro_addvar(struct substvar *table, con
|
|
|
306fa1 |
}
|
|
|
306fa1 |
def[len] = '\0';
|
|
|
306fa1 |
|
|
|
306fa1 |
- val = strdup(value);
|
|
|
306fa1 |
+ val = strdup(this);
|
|
|
306fa1 |
if (!val) {
|
|
|
306fa1 |
lv = table;
|
|
|
306fa1 |
free(def);
|
|
|
306fa1 |
--- autofs-5.0.7.orig/lib/mounts.c
|
|
|
306fa1 |
+++ autofs-5.0.7/lib/mounts.c
|
|
|
306fa1 |
@@ -1456,6 +1456,7 @@ void set_tsd_user_vars(unsigned int logo
|
|
|
306fa1 |
error(logopt, "failed alloc tsv storage");
|
|
|
306fa1 |
return;
|
|
|
306fa1 |
}
|
|
|
306fa1 |
+ memset(tsv, 0, sizeof(struct thread_stdenv_vars));
|
|
|
306fa1 |
|
|
|
306fa1 |
tsv->uid = uid;
|
|
|
306fa1 |
tsv->gid = gid;
|