Skip to content
Snippets Groups Projects
Select Git revision
  • be28e4fb6313cd93d1be25d0345d4c23bf2360b0
  • master default protected
2 results

zs5-thrsafe-strtok.patch

Blame
  • user avatar
    Pavel Vondruska authored
    be28e4fb
    History
    zs5-thrsafe-strtok.patch 2.12 KiB
    Index: nfs-utils-1.3.4/utils/gssd/gssd_proc.c
    ===================================================================
    --- nfs-utils-1.3.4.orig/utils/gssd/gssd_proc.c
    +++ nfs-utils-1.3.4/utils/gssd/gssd_proc.c
    @@ -736,10 +736,18 @@ handle_gssd_upcall(struct clnt_upcall_in
     	char			*target = NULL;
     	char			*service = NULL;
     	char			*enctypes = NULL;
    +	char			*upcall_str;
    +	char			*pbuf = info->lbuf;
     
     	printerr(2, "\n%s: '%s' (%s)\n", __func__, info->lbuf, clp->relpath);
     
    -	for (p = strtok(info->lbuf, " "); p; p = strtok(NULL, " ")) {
    +	upcall_str = strdup(info->lbuf);
    +	if (upcall_str == NULL) {
    +		printerr(0, "ERROR: malloc failure\n");
    +		goto out_nomem;
    +	}
    +
    +	while ((p = strsep(&pbuf, " "))) {
     		if (!strncmp(p, "mech=", strlen("mech=")))
     			mech = p + strlen("mech=");
     		else if (!strncmp(p, "uid=", strlen("uid=")))
    @@ -755,7 +763,7 @@ handle_gssd_upcall(struct clnt_upcall_in
     	if (!mech || strlen(mech) < 1) {
     		printerr(0, "WARNING: handle_gssd_upcall: "
     			    "failed to find gss mechanism name "
    -			    "in upcall string '%s'\n", info->lbuf);
    +			    "in upcall string '%s'\n", upcall_str);
     		goto out;
     	}
     
    @@ -768,7 +776,7 @@ handle_gssd_upcall(struct clnt_upcall_in
     	if (!uidstr) {
     		printerr(0, "WARNING: handle_gssd_upcall: "
     			    "failed to find uid "
    -			    "in upcall string '%s'\n", info->lbuf);
    +			    "in upcall string '%s'\n", upcall_str);
     		goto out;
     	}
     
    @@ -781,7 +789,7 @@ handle_gssd_upcall(struct clnt_upcall_in
     	if (target && strlen(target) < 1) {
     		printerr(0, "WARNING: handle_gssd_upcall: "
     			 "failed to parse target name "
    -			 "in upcall string '%s'\n", info->lbuf);
    +			 "in upcall string '%s'\n", upcall_str);
     		goto out;
     	}
     
    @@ -796,7 +804,7 @@ handle_gssd_upcall(struct clnt_upcall_in
     	if (service && strlen(service) < 1) {
     		printerr(0, "WARNING: handle_gssd_upcall: "
     			 "failed to parse service type "
    -			 "in upcall string '%s'\n", info->lbuf);
    +			 "in upcall string '%s'\n", upcall_str);
     		goto out;
     	}
     
    @@ -809,6 +817,8 @@ handle_gssd_upcall(struct clnt_upcall_in
     		do_error_downcall(clp->gssd_fd, uid, -EACCES);
     	}
     out:
    +	free(upcall_str);
    +out_nomem:
     	free(info);
     	return;
     }