diff mbox

[PATCHv2,1/3] gssd: fix strncmp bug causing client removals

Message ID 1379624632-31476-1-git-send-email-bfields@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Bruce Fields Sept. 19, 2013, 9:03 p.m. UTC
From: "J. Bruce Fields" <bfields@redhat.com>

Both dirname and pdir are null-terminated strings, so there's no reason
I can see for the strncmp.

And this gives the wrong result when comparing the "nfsd" and "nfsd4_cb"
directories!  The results were callback clients being removed
immediately after creation, when lack of a client with the corresponding
name under "nfsd" lead gssd to believe it had disappeared from
"nfsd4_cb".

Signed-off-by: J. Bruce Fields <bfields@redhat.com>
---
 utils/gssd/gssd_proc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Steve Dickson Sept. 24, 2013, 7:17 p.m. UTC | #1
On 19/09/13 17:03, J. Bruce Fields wrote:
> From: "J. Bruce Fields" <bfields@redhat.com>
> 
> Both dirname and pdir are null-terminated strings, so there's no reason
> I can see for the strncmp.
> 
> And this gives the wrong result when comparing the "nfsd" and "nfsd4_cb"
> directories!  The results were callback clients being removed
> immediately after creation, when lack of a client with the corresponding
> name under "nfsd" lead gssd to believe it had disappeared from
> "nfsd4_cb".
> 
> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Committed...

steved.

> ---
>  utils/gssd/gssd_proc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/utils/gssd/gssd_proc.c b/utils/gssd/gssd_proc.c
> index 2d3dbec..0383883 100644
> --- a/utils/gssd/gssd_proc.c
> +++ b/utils/gssd/gssd_proc.c
> @@ -525,7 +525,7 @@ update_old_clients(struct dirent **namelist, int size, char *pdir)
>  		/* only compare entries in the global list that are from the
>  		 * same pipefs parent directory as "pdir"
>  		 */
> -		if (strncmp(clp->dirname, pdir, strlen(pdir)) != 0) continue;
> +		if (strcmp(clp->dirname, pdir) != 0) continue;
>  
>  		stillhere = 0;
>  		for (i=0; i < size; i++) {
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/utils/gssd/gssd_proc.c b/utils/gssd/gssd_proc.c
index 2d3dbec..0383883 100644
--- a/utils/gssd/gssd_proc.c
+++ b/utils/gssd/gssd_proc.c
@@ -525,7 +525,7 @@  update_old_clients(struct dirent **namelist, int size, char *pdir)
 		/* only compare entries in the global list that are from the
 		 * same pipefs parent directory as "pdir"
 		 */
-		if (strncmp(clp->dirname, pdir, strlen(pdir)) != 0) continue;
+		if (strcmp(clp->dirname, pdir) != 0) continue;
 
 		stillhere = 0;
 		for (i=0; i < size; i++) {