[linux-cifs-client] [PATCH 1/5] [CIFS] add ver= prefix to upcall format version

Jeff Layton jlayton at redhat.com
Fri Nov 16 13:52:10 GMT 2007


On Fri, 16 Nov 2007 16:12:42 +0300
"Q (Igor Mammedov)" <qwerty0987654321 at mail.ru> wrote:

> Jeff Layton wrote:
> > ....and change outdated comment.
> > 
> > Signed-off-by: Jeff Layton <jlayton at redhat.com>
> > ---
> >  fs/cifs/cifs_spnego.c |   10 ++++------
> >  1 files changed, 4 insertions(+), 6 deletions(-)
> > 
> > diff --git a/fs/cifs/cifs_spnego.c b/fs/cifs/cifs_spnego.c
> > index ad54a3a..f9fd8aa 100644
> > --- a/fs/cifs/cifs_spnego.c
> > +++ b/fs/cifs/cifs_spnego.c
> > @@ -75,11 +75,9 @@ cifs_get_spnego_key(struct cifsSesInfo *sesInfo,
> > const char *hostname) size_t desc_len;
> >  	struct key *spnego_key;
> >  
> > -
> > -	/* version + ;ip{4|6}= + address + ;host=hostname +
> > -		;sec= + ;uid= + NULL */
> > -	desc_len = 4 + 5 + 32 + 1 + 5 + strlen(hostname) +
> > -		   strlen(";sec=krb5") + 7 + sizeof(uid_t)*2 + 1;
> > +	/* BB: come up with better scheme for determining length */
> > +	desc_len = 7 + 5 + 32 + 1 + 5 + strlen(hostname) +
> > +		   strlen(";sec=ntlmssp") + 7 + sizeof(uid_t)*2 +
> > 1; spnego_key = ERR_PTR(-ENOMEM);
> >  	description = kzalloc(desc_len, GFP_KERNEL);
> >  	if (description == NULL)
> > @@ -88,7 +86,7 @@ cifs_get_spnego_key(struct cifsSesInfo *sesInfo,
> > const char *hostname) dp = description;
> >  	/* start with version and hostname portion of UNC string */
> >  	spnego_key = ERR_PTR(-EINVAL);
> > -	sprintf(dp, "0x%2.2x;host=%s;", CIFS_SPNEGO_UPCALL_VERSION,
> > +	sprintf(dp, "ver=%d;host=%s;", CIFS_SPNEGO_UPCALL_VERSION,
>                         ^^^
> Userspace helper expect hex number as version, as it was before, some
> day it could case trouble.
> 
> >  		hostname);
> >  	dp = description + strlen(description);
> >  
> 
> 

Ok, we can keep it in hex. How's this?

From 0ddf684c07942c1d447b5bd86efec375385a528a Mon Sep 17 00:00:00 2001
From: Jeff Layton <jlayton at redhat.com>
Date: Fri, 16 Nov 2007 08:31:38 -0500
Subject: [PATCH 1/5] [CIFS] add ver= prefix to upcall format version

...and change outdated comment.

Signed-off-by: Jeff Layton <jlayton at redhat.com>
---
 fs/cifs/cifs_spnego.c |   10 ++++------
 1 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/fs/cifs/cifs_spnego.c b/fs/cifs/cifs_spnego.c
index ad54a3a..198065c 100644
--- a/fs/cifs/cifs_spnego.c
+++ b/fs/cifs/cifs_spnego.c
@@ -75,11 +75,9 @@ cifs_get_spnego_key(struct cifsSesInfo *sesInfo, const char *hostname)
 	size_t desc_len;
 	struct key *spnego_key;
 
-
-	/* version + ;ip{4|6}= + address + ;host=hostname +
-		;sec= + ;uid= + NULL */
-	desc_len = 4 + 5 + 32 + 1 + 5 + strlen(hostname) +
-		   strlen(";sec=krb5") + 7 + sizeof(uid_t)*2 + 1;
+	/* BB: come up with better scheme for determining length */
+	desc_len = 9 + 5 + 32 + 1 + 5 + strlen(hostname) +
+		   strlen(";sec=ntlmssp") + 7 + sizeof(uid_t)*2 + 1;
 	spnego_key = ERR_PTR(-ENOMEM);
 	description = kzalloc(desc_len, GFP_KERNEL);
 	if (description == NULL)
@@ -88,7 +86,7 @@ cifs_get_spnego_key(struct cifsSesInfo *sesInfo, const char *hostname)
 	dp = description;
 	/* start with version and hostname portion of UNC string */
 	spnego_key = ERR_PTR(-EINVAL);
-	sprintf(dp, "0x%2.2x;host=%s;", CIFS_SPNEGO_UPCALL_VERSION,
+	sprintf(dp, "ver=0x%x;host=%s;", CIFS_SPNEGO_UPCALL_VERSION,
 		hostname);
 	dp = description + strlen(description);
 
-- 
1.5.3.3



More information about the linux-cifs-client mailing list