aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorJeff Layton <jlayton@redhat.com>2007-10-16 13:32:19 -0400
committerSteve French <sfrench@us.ibm.com>2007-10-16 13:32:19 -0400
commit0d3a01fadacef5901005dc8f61688a8f0471dc79 (patch)
tree7108a14b5bd800f9338ad6129ee96470e7d1bc62 /fs
parente187e44eb8902089da0c7725d606b0e20fee981d (diff)
[CIFS] Break up unicode_sessetup string functions
SPNEGO setup needs only some of these strings. Break up unicode_ssetup_strings so we can call them individually. Signed-off-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Steve French <sfrench@us.ibm.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/cifs/cifsglob.h8
-rw-r--r--fs/cifs/sess.c73
2 files changed, 55 insertions, 26 deletions
diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h
index 61d617370e56..9b7762c754cb 100644
--- a/fs/cifs/cifsglob.h
+++ b/fs/cifs/cifsglob.h
@@ -495,9 +495,15 @@ require use of the stronger protocol */
495#ifdef CONFIG_CIFS_WEAK_PW_HASH 495#ifdef CONFIG_CIFS_WEAK_PW_HASH
496#define CIFSSEC_MUST_LANMAN 0x10010 496#define CIFSSEC_MUST_LANMAN 0x10010
497#define CIFSSEC_MUST_PLNTXT 0x20020 497#define CIFSSEC_MUST_PLNTXT 0x20020
498#ifdef CONFIG_CIFS_UPCALL
499#define CIFSSEC_MASK 0x3F03F /* allows weak security but also krb5 */
500#else
498#define CIFSSEC_MASK 0x37037 /* current flags supported if weak */ 501#define CIFSSEC_MASK 0x37037 /* current flags supported if weak */
502#else /* do not allow weak pw hash */
503#ifdef CONFIG_CIFS_UPCALL
504#define CIFSSEC_MASK 0x0F00F /* flags supported if no weak allowed */
499#else 505#else
500#define CIFSSEC_MASK 0x07007 /* flags supported if no weak config */ 506#define CIFSSEC_MASK 0x07007 /* flags supported if no weak allowed */
501#endif /* WEAK_PW_HASH */ 507#endif /* WEAK_PW_HASH */
502#define CIFSSEC_MUST_SEAL 0x40040 /* not supported yet */ 508#define CIFSSEC_MUST_SEAL 0x40040 /* not supported yet */
503 509
diff --git a/fs/cifs/sess.c b/fs/cifs/sess.c
index 78797c0e076c..c74a064e7825 100644
--- a/fs/cifs/sess.c
+++ b/fs/cifs/sess.c
@@ -74,6 +74,52 @@ static __u32 cifs_ssetup_hdr(struct cifsSesInfo *ses, SESSION_SETUP_ANDX *pSMB)
74 return capabilities; 74 return capabilities;
75} 75}
76 76
77static void
78unicode_oslm_strings(char **pbcc_area, const struct nls_table *nls_cp)
79{
80 char *bcc_ptr = *pbcc_area;
81 int bytes_ret = 0;
82
83 /* Copy OS version */
84 bytes_ret = cifs_strtoUCS((__le16 *)bcc_ptr, "Linux version ", 32,
85 nls_cp);
86 bcc_ptr += 2 * bytes_ret;
87 bytes_ret = cifs_strtoUCS((__le16 *) bcc_ptr, init_utsname()->release,
88 32, nls_cp);
89 bcc_ptr += 2 * bytes_ret;
90 bcc_ptr += 2; /* trailing null */
91
92 bytes_ret = cifs_strtoUCS((__le16 *) bcc_ptr, CIFS_NETWORK_OPSYS,
93 32, nls_cp);
94 bcc_ptr += 2 * bytes_ret;
95 bcc_ptr += 2; /* trailing null */
96
97 *pbcc_area = bcc_ptr;
98}
99
100static void unicode_domain_string(char **pbcc_area, struct cifsSesInfo *ses,
101 const struct nls_table *nls_cp)
102{
103 char *bcc_ptr = *pbcc_area;
104 int bytes_ret = 0;
105
106 /* copy domain */
107 if (ses->domainName == NULL) {
108 /* Sending null domain better than using a bogus domain name (as
109 we did briefly in 2.6.18) since server will use its default */
110 *bcc_ptr = 0;
111 *(bcc_ptr+1) = 0;
112 bytes_ret = 0;
113 } else
114 bytes_ret = cifs_strtoUCS((__le16 *) bcc_ptr, ses->domainName,
115 256, nls_cp);
116 bcc_ptr += 2 * bytes_ret;
117 bcc_ptr += 2; /* account for null terminator */
118
119 *pbcc_area = bcc_ptr;
120}
121
122
77static void unicode_ssetup_strings(char **pbcc_area, struct cifsSesInfo *ses, 123static void unicode_ssetup_strings(char **pbcc_area, struct cifsSesInfo *ses,
78 const struct nls_table *nls_cp) 124 const struct nls_table *nls_cp)
79{ 125{
@@ -99,32 +145,9 @@ static void unicode_ssetup_strings(char **pbcc_area, struct cifsSesInfo *ses,
99 } 145 }
100 bcc_ptr += 2 * bytes_ret; 146 bcc_ptr += 2 * bytes_ret;
101 bcc_ptr += 2; /* account for null termination */ 147 bcc_ptr += 2; /* account for null termination */
102 /* copy domain */
103 if (ses->domainName == NULL) {
104 /* Sending null domain better than using a bogus domain name (as
105 we did briefly in 2.6.18) since server will use its default */
106 *bcc_ptr = 0;
107 *(bcc_ptr+1) = 0;
108 bytes_ret = 0;
109 } else
110 bytes_ret = cifs_strtoUCS((__le16 *) bcc_ptr, ses->domainName,
111 256, nls_cp);
112 bcc_ptr += 2 * bytes_ret;
113 bcc_ptr += 2; /* account for null terminator */
114 148
115 /* Copy OS version */ 149 unicode_domain_string(&bcc_ptr, ses, nls_cp);
116 bytes_ret = cifs_strtoUCS((__le16 *)bcc_ptr, "Linux version ", 32, 150 unicode_oslm_strings(&bcc_ptr, nls_cp);
117 nls_cp);
118 bcc_ptr += 2 * bytes_ret;
119 bytes_ret = cifs_strtoUCS((__le16 *) bcc_ptr, init_utsname()->release,
120 32, nls_cp);
121 bcc_ptr += 2 * bytes_ret;
122 bcc_ptr += 2; /* trailing null */
123
124 bytes_ret = cifs_strtoUCS((__le16 *) bcc_ptr, CIFS_NETWORK_OPSYS,
125 32, nls_cp);
126 bcc_ptr += 2 * bytes_ret;
127 bcc_ptr += 2; /* trailing null */
128 151
129 *pbcc_area = bcc_ptr; 152 *pbcc_area = bcc_ptr;
130} 153}