Blame SOURCES/nfs-utils-1.3.0-gssd-thread-safe.patch

fc3648
diff --git a/utils/gssd/gssd_proc.c b/utils/gssd/gssd_proc.c
fc3648
index 646d7e3..14cf7b8 100644
fc3648
--- a/utils/gssd/gssd_proc.c
fc3648
+++ b/utils/gssd/gssd_proc.c
fc3648
@@ -728,10 +728,18 @@ handle_gssd_upcall(struct clnt_upcall_info *info)
fc3648
 	char			*target = NULL;
fc3648
 	char			*service = NULL;
fc3648
 	char			*enctypes = NULL;
fc3648
+	char			*upcall_str;
fc3648
+	char			*pbuf = info->lbuf;
fc3648
 
fc3648
 	printerr(2, "\n%s: '%s' (%s)\n", __func__, info->lbuf, clp->relpath);
fc3648
 
fc3648
-	for (p = strtok(info->lbuf, " "); p; p = strtok(NULL, " ")) {
fc3648
+	upcall_str = strdup(info->lbuf);
fc3648
+	if (upcall_str == NULL) {
fc3648
+		printerr(0, "ERROR: malloc failure\n");
fc3648
+		goto out_nomem;
fc3648
+	}
fc3648
+
fc3648
+	while ((p = strsep(&pbuf, " "))) {
fc3648
 		if (!strncmp(p, "mech=", strlen("mech=")))
fc3648
 			mech = p + strlen("mech=");
fc3648
 		else if (!strncmp(p, "uid=", strlen("uid=")))
fc3648
@@ -747,7 +755,7 @@ handle_gssd_upcall(struct clnt_upcall_info *info)
fc3648
 	if (!mech || strlen(mech) < 1) {
fc3648
 		printerr(0, "WARNING: handle_gssd_upcall: "
fc3648
 			    "failed to find gss mechanism name "
fc3648
-			    "in upcall string '%s'\n", info->lbuf);
fc3648
+			    "in upcall string '%s'\n", upcall_str);
fc3648
 		goto out;
fc3648
 	}
fc3648
 
fc3648
@@ -760,7 +768,7 @@ handle_gssd_upcall(struct clnt_upcall_info *info)
fc3648
 	if (!uidstr) {
fc3648
 		printerr(0, "WARNING: handle_gssd_upcall: "
fc3648
 			    "failed to find uid "
fc3648
-			    "in upcall string '%s'\n", info->lbuf);
fc3648
+			    "in upcall string '%s'\n", upcall_str);
fc3648
 		goto out;
fc3648
 	}
fc3648
 
fc3648
@@ -773,7 +781,7 @@ handle_gssd_upcall(struct clnt_upcall_info *info)
fc3648
 	if (target && strlen(target) < 1) {
fc3648
 		printerr(0, "WARNING: handle_gssd_upcall: "
fc3648
 			 "failed to parse target name "
fc3648
-			 "in upcall string '%s'\n", info->lbuf);
fc3648
+			 "in upcall string '%s'\n", upcall_str);
fc3648
 		goto out;
fc3648
 	}
fc3648
 
fc3648
@@ -788,7 +796,7 @@ handle_gssd_upcall(struct clnt_upcall_info *info)
fc3648
 	if (service && strlen(service) < 1) {
fc3648
 		printerr(0, "WARNING: handle_gssd_upcall: "
fc3648
 			 "failed to parse service type "
fc3648
-			 "in upcall string '%s'\n", info->lbuf);
fc3648
+			 "in upcall string '%s'\n", upcall_str);
fc3648
 		goto out;
fc3648
 	}
fc3648
 
fc3648
@@ -801,6 +809,8 @@ handle_gssd_upcall(struct clnt_upcall_info *info)
fc3648
 		do_error_downcall(clp->gssd_fd, uid, -EACCES);
fc3648
 	}
fc3648
 out:
fc3648
+	free(upcall_str);
fc3648
+out_nomem:
fc3648
 	free(info);
fc3648
 	return;
fc3648
 }