diff options
Diffstat (limited to 'net/sunrpc/auth_gss/gss_generic_token.c')
-rw-r--r-- | net/sunrpc/auth_gss/gss_generic_token.c | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/net/sunrpc/auth_gss/gss_generic_token.c b/net/sunrpc/auth_gss/gss_generic_token.c index 310b78e99456..c586e92bcf76 100644 --- a/net/sunrpc/auth_gss/gss_generic_token.c +++ b/net/sunrpc/auth_gss/gss_generic_token.c | |||
@@ -76,19 +76,19 @@ static int | |||
76 | der_length_size( int length) | 76 | der_length_size( int length) |
77 | { | 77 | { |
78 | if (length < (1<<7)) | 78 | if (length < (1<<7)) |
79 | return(1); | 79 | return 1; |
80 | else if (length < (1<<8)) | 80 | else if (length < (1<<8)) |
81 | return(2); | 81 | return 2; |
82 | #if (SIZEOF_INT == 2) | 82 | #if (SIZEOF_INT == 2) |
83 | else | 83 | else |
84 | return(3); | 84 | return 3; |
85 | #else | 85 | #else |
86 | else if (length < (1<<16)) | 86 | else if (length < (1<<16)) |
87 | return(3); | 87 | return 3; |
88 | else if (length < (1<<24)) | 88 | else if (length < (1<<24)) |
89 | return(4); | 89 | return 4; |
90 | else | 90 | else |
91 | return(5); | 91 | return 5; |
92 | #endif | 92 | #endif |
93 | } | 93 | } |
94 | 94 | ||
@@ -121,14 +121,14 @@ der_read_length(unsigned char **buf, int *bufsize) | |||
121 | int ret; | 121 | int ret; |
122 | 122 | ||
123 | if (*bufsize < 1) | 123 | if (*bufsize < 1) |
124 | return(-1); | 124 | return -1; |
125 | sf = *(*buf)++; | 125 | sf = *(*buf)++; |
126 | (*bufsize)--; | 126 | (*bufsize)--; |
127 | if (sf & 0x80) { | 127 | if (sf & 0x80) { |
128 | if ((sf &= 0x7f) > ((*bufsize)-1)) | 128 | if ((sf &= 0x7f) > ((*bufsize)-1)) |
129 | return(-1); | 129 | return -1; |
130 | if (sf > SIZEOF_INT) | 130 | if (sf > SIZEOF_INT) |
131 | return (-1); | 131 | return -1; |
132 | ret = 0; | 132 | ret = 0; |
133 | for (; sf; sf--) { | 133 | for (; sf; sf--) { |
134 | ret = (ret<<8) + (*(*buf)++); | 134 | ret = (ret<<8) + (*(*buf)++); |
@@ -138,7 +138,7 @@ der_read_length(unsigned char **buf, int *bufsize) | |||
138 | ret = sf; | 138 | ret = sf; |
139 | } | 139 | } |
140 | 140 | ||
141 | return(ret); | 141 | return ret; |
142 | } | 142 | } |
143 | 143 | ||
144 | /* returns the length of a token, given the mech oid and the body size */ | 144 | /* returns the length of a token, given the mech oid and the body size */ |
@@ -148,7 +148,7 @@ g_token_size(struct xdr_netobj *mech, unsigned int body_size) | |||
148 | { | 148 | { |
149 | /* set body_size to sequence contents size */ | 149 | /* set body_size to sequence contents size */ |
150 | body_size += 2 + (int) mech->len; /* NEED overflow check */ | 150 | body_size += 2 + (int) mech->len; /* NEED overflow check */ |
151 | return(1 + der_length_size(body_size) + body_size); | 151 | return 1 + der_length_size(body_size) + body_size; |
152 | } | 152 | } |
153 | 153 | ||
154 | EXPORT_SYMBOL_GPL(g_token_size); | 154 | EXPORT_SYMBOL_GPL(g_token_size); |
@@ -186,27 +186,27 @@ g_verify_token_header(struct xdr_netobj *mech, int *body_size, | |||
186 | int ret = 0; | 186 | int ret = 0; |
187 | 187 | ||
188 | if ((toksize-=1) < 0) | 188 | if ((toksize-=1) < 0) |
189 | return(G_BAD_TOK_HEADER); | 189 | return G_BAD_TOK_HEADER; |
190 | if (*buf++ != 0x60) | 190 | if (*buf++ != 0x60) |
191 | return(G_BAD_TOK_HEADER); | 191 | return G_BAD_TOK_HEADER; |
192 | 192 | ||
193 | if ((seqsize = der_read_length(&buf, &toksize)) < 0) | 193 | if ((seqsize = der_read_length(&buf, &toksize)) < 0) |
194 | return(G_BAD_TOK_HEADER); | 194 | return G_BAD_TOK_HEADER; |
195 | 195 | ||
196 | if (seqsize != toksize) | 196 | if (seqsize != toksize) |
197 | return(G_BAD_TOK_HEADER); | 197 | return G_BAD_TOK_HEADER; |
198 | 198 | ||
199 | if ((toksize-=1) < 0) | 199 | if ((toksize-=1) < 0) |
200 | return(G_BAD_TOK_HEADER); | 200 | return G_BAD_TOK_HEADER; |
201 | if (*buf++ != 0x06) | 201 | if (*buf++ != 0x06) |
202 | return(G_BAD_TOK_HEADER); | 202 | return G_BAD_TOK_HEADER; |
203 | 203 | ||
204 | if ((toksize-=1) < 0) | 204 | if ((toksize-=1) < 0) |
205 | return(G_BAD_TOK_HEADER); | 205 | return G_BAD_TOK_HEADER; |
206 | toid.len = *buf++; | 206 | toid.len = *buf++; |
207 | 207 | ||
208 | if ((toksize-=toid.len) < 0) | 208 | if ((toksize-=toid.len) < 0) |
209 | return(G_BAD_TOK_HEADER); | 209 | return G_BAD_TOK_HEADER; |
210 | toid.data = buf; | 210 | toid.data = buf; |
211 | buf+=toid.len; | 211 | buf+=toid.len; |
212 | 212 | ||
@@ -217,17 +217,17 @@ g_verify_token_header(struct xdr_netobj *mech, int *body_size, | |||
217 | to return G_BAD_TOK_HEADER if the token header is in fact bad */ | 217 | to return G_BAD_TOK_HEADER if the token header is in fact bad */ |
218 | 218 | ||
219 | if ((toksize-=2) < 0) | 219 | if ((toksize-=2) < 0) |
220 | return(G_BAD_TOK_HEADER); | 220 | return G_BAD_TOK_HEADER; |
221 | 221 | ||
222 | if (ret) | 222 | if (ret) |
223 | return(ret); | 223 | return ret; |
224 | 224 | ||
225 | if (!ret) { | 225 | if (!ret) { |
226 | *buf_in = buf; | 226 | *buf_in = buf; |
227 | *body_size = toksize; | 227 | *body_size = toksize; |
228 | } | 228 | } |
229 | 229 | ||
230 | return(ret); | 230 | return ret; |
231 | } | 231 | } |
232 | 232 | ||
233 | EXPORT_SYMBOL_GPL(g_verify_token_header); | 233 | EXPORT_SYMBOL_GPL(g_verify_token_header); |