All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ian Kent <raven@themaw.net>
To: autofs mailing list <autofs@vger.kernel.org>
Subject: [PATCH 02/35] autofs-5.1.3 - fix unset tsd group name handling
Date: Mon, 16 Oct 2017 13:06:01 +0800	[thread overview]
Message-ID: <150813036170.25695.10708028814225890860.stgit@pluto.themaw.net> (raw)
In-Reply-To: <150813019190.25695.13810689562896522990.stgit@pluto.themaw.net>

Commit 1a64a6bbc5 changed set_tsd_user_vars() to set thread specific
values even if the group name could not be obtained.

But the structure holding the values was not initialized on allocation
so the group field might not be NULL when no group name is available.

Also the macro addition and removal functions didn't properly handle a
macro value of NULL.

Signed-off-by: Ian Kent <raven@themaw.net>
Reported-by: Donald Buczek <buczek@molgen.mpg.de>
---
 CHANGELOG    |    1 +
 lib/macros.c |    8 +++++---
 lib/mounts.c |    1 +
 3 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/CHANGELOG b/CHANGELOG
index e796fb36..8d79bd60 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,5 +1,6 @@
 xx/xx/2017 autofs-5.1.4
 - fix spec file url.
+- fix unset tsd group name handling.
 
 24/05/2017 autofs-5.1.3
 =======================
diff --git a/lib/macros.c b/lib/macros.c
index ff9ba899..dfdca857 100644
--- a/lib/macros.c
+++ b/lib/macros.c
@@ -281,18 +281,20 @@ macro_addvar(struct substvar *table, const char *str, int len, const char *value
 	}
 
 	if (lv) {
-		char *this = malloc(strlen(value) + 1);
+		const char *val = value ? value : "";
+		char *this = malloc(strlen(val) + 1);
 		if (!this) {
 			lv = table;
 			goto done;
 		}
-		strcpy(this, value);
+		strcpy(this, val);
 		free(lv->val);
 		lv->val = this;
 		if (lv != table)
 			lv = table;
 	} else {
 		struct substvar *new;
+		const char *this = value ? value : "";
 		char *def, *val;
 
 		def = strdup(str);
@@ -302,7 +304,7 @@ macro_addvar(struct substvar *table, const char *str, int len, const char *value
 		}
 		def[len] = '\0';
 
-		val = strdup(value);
+		val = strdup(this);
 		if (!val) {
 			lv = table;
 			free(def);
diff --git a/lib/mounts.c b/lib/mounts.c
index ce6a60a7..0b38bd86 100644
--- a/lib/mounts.c
+++ b/lib/mounts.c
@@ -1463,6 +1463,7 @@ void set_tsd_user_vars(unsigned int logopt, uid_t uid, gid_t gid)
 		error(logopt, "failed alloc tsv storage");
 		return;
 	}
+	memset(tsv, 0, sizeof(struct thread_stdenv_vars));
 
 	tsv->uid = uid;
 	tsv->gid = gid;

--
To unsubscribe from this list: send the line "unsubscribe autofs" in

  parent reply	other threads:[~2017-10-16  5:06 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-16  5:05 [PATCH 00/35] Current autofs patch queue (lets try again) Ian Kent
2017-10-16  5:05 ` [PATCH 01/35] autofs-5.1.3 - fix spec file url Ian Kent
2017-10-16  5:06 ` Ian Kent [this message]
2017-10-16  5:06 ` [PATCH 03/35] autofs-5.1.3 - Add -c option when calling /bin/umount - if supported Ian Kent
2017-10-16  5:06 ` [PATCH 04/35] autofs-5.1.3 - remove some redundant rpc library code Ian Kent
2017-10-16  5:06 ` [PATCH 05/35] autofs-5.1.3 - add port parameter to rpc_ping() Ian Kent
2017-10-16  5:06 ` [PATCH 06/35] autofs-5.1.3 - dont probe NFSv2 by default Ian Kent
2017-10-16  5:06 ` [PATCH 07/35] autofs-5.1.3 - add version parameter to rpc_ping() Ian Kent
2017-10-16  5:06 ` [PATCH 08/35] autofs-5.1.3 - fix typo in autofs config file comments Ian Kent
2017-10-16  5:06 ` [PATCH 09/35] autofs-5.1.3 - fix typos in autofs man pages Ian Kent
2017-10-16  5:06 ` [PATCH 10/35] autofs-5.1.3 - use pkg-config to search for libtirpc to fix cross-compilation Ian Kent
2017-10-16  5:07 ` [PATCH 11/35] autofs-5.1.3 - fix incorrect status return in get_nfs_info() Ian Kent
2017-10-16  5:07 ` [PATCH 12/35] autofs-5.1.3 - fix a couple of compiler warnings Ian Kent
2017-10-18 20:46   ` Jeff Mahoney
2017-10-18 20:57     ` [PATCH] autofs-5.1.3 - fix ordering of seteuid/setegid in do_spawn Jeff Mahoney
2017-10-18 21:07       ` Jeff Mahoney
2017-10-19  1:59       ` Ian Kent
2017-10-18 21:12     ` [PATCH v2] " Jeff Mahoney
2017-10-19  2:07       ` Ian Kent
2017-10-19  2:20         ` Jeff Mahoney
2017-10-19  2:29           ` Ian Kent
2017-10-16  5:07 ` [PATCH 13/35] autofs-5.1.3 - set systemd KillMode to process Ian Kent
2017-10-16  5:07 ` [PATCH 14/35] autofs-5.1.3 - fix mount.nfs blocks on first mount Ian Kent
2017-10-16  5:07 ` [PATCH 15/35] autofs-5.1.3 - fix some man page problems Ian Kent
2017-10-16  5:07 ` [PATCH 16/35] autofs-5.1.3 - add some more debug logging to get_nfs_info() Ian Kent
2017-10-16  5:46   ` Vincent McIntyre
2017-10-16  5:52     ` Ian Kent
2017-10-16  5:07 ` [PATCH 17/35] autofs-5.1.3 - add some more debug logging to get_supported_ver_and_cost() Ian Kent
2017-10-16  5:07 ` [PATCH 18/35] autofs-5.1.3 - fix ipv6 proto option handling Ian Kent
2017-10-16  5:07 ` [PATCH 19/35] autofs-5.1.3 - also check flag file exe name Ian Kent
2017-10-16  5:08 ` [PATCH 20/35] autofs-5.1.3 - fix possible map instance memory leak Ian Kent
2017-10-16  5:08 ` [PATCH 21/35] autofs-5.1.3 - check map instances for staleness on map update Ian Kent
2017-10-16  5:08 ` [PATCH 22/35] autofs-5.1.3 - allow dot in OPTIONSTR value lexer pattern Ian Kent
2017-10-16  5:08 ` [PATCH 23/35] autofs-5.1.3 - fix autofs_use_lofs description Ian Kent
2017-10-16  5:08 ` [PATCH 24/35] autofs-5.1.3 - fix amd parser error buffer size Ian Kent
2017-10-16  5:08 ` [PATCH 25/35] autofs-5.1.3 - make spawn_bind_mount() use mount_wait as well Ian Kent
2017-10-16  5:08 ` [PATCH 26/35] autofs-5.1.3 - document ghost option in auto.master man page Ian Kent
2017-10-16  6:00   ` Vincent McIntyre
2017-10-16  6:07     ` Ian Kent
2017-10-16  5:08 ` [PATCH 27/35] autofs-5.1.3 - only take master map mutex for master map update Ian Kent
2017-10-16  5:08 ` [PATCH 28/35] autofs-5.1.3 - revert fix argc off by one in mount_autofs.c Ian Kent
2017-10-16  5:08 ` [PATCH 29/35] autofs-5.1.3 - fix nisplus lookup init not configured check Ian Kent
2017-10-16  5:09 ` [PATCH 30/35] autofs-5.1.3 - make open_lookup() error handling more consistent Ian Kent
2017-10-16  5:09 ` [PATCH 31/35] autofs-5.1.3 - be silent about sss library not found Ian Kent
2017-10-16  5:09 ` [PATCH 32/35] autofs-5.1.3 - be silent about nis domain not set Ian Kent
2017-10-16  5:09 ` [PATCH 33/35] autofs-5.1.3 - make map source reference message debug only Ian Kent
2017-10-16  5:09 ` [PATCH 34/35] autofs-5.1.3 - improve description of mount_nfs_default_protocol Ian Kent
2017-10-16  5:37   ` Vincent McIntyre
2017-10-16  5:51     ` Ian Kent
2017-10-16  5:09 ` [PATCH 35/35] autofs-5.1.3 - port option should not behave like nobind option Ian Kent

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=150813036170.25695.10708028814225890860.stgit@pluto.themaw.net \
    --to=raven@themaw.net \
    --cc=autofs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.