Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
01d37f03
Commit
01d37f03
authored
Apr 10, 2004
by
Trond Myklebust
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
RPCSEC_GSS: Fix RPC padding in two instances of RPCSEC_GSS code.
RPC: Clean up XDR encoding of opaque data.
parent
bcb23e3c
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
51 additions
and
26 deletions
+51
-26
fs/nfs/nfs4xdr.c
fs/nfs/nfs4xdr.c
+1
-12
include/linux/sunrpc/xdr.h
include/linux/sunrpc/xdr.h
+7
-1
net/sunrpc/auth_gss/auth_gss.c
net/sunrpc/auth_gss/auth_gss.c
+2
-5
net/sunrpc/sunrpc_syms.c
net/sunrpc/sunrpc_syms.c
+0
-1
net/sunrpc/xdr.c
net/sunrpc/xdr.c
+41
-7
No files found.
fs/nfs/nfs4xdr.c
View file @
01d37f03
...
...
@@ -297,7 +297,7 @@ struct compound_hdr {
*p++ = htonl((uint32_t)(n)); \
} while (0)
#define WRITEMEM(ptr,nbytes) do { \
p = xdr_
writemem(p, ptr, nbytes);
\
p = xdr_
encode_opaque_fixed(p, ptr, nbytes);
\
} while (0)
#define RESERVE_SPACE(nbytes) do { \
...
...
@@ -306,17 +306,6 @@ struct compound_hdr {
BUG_ON(!p); \
} while (0)
static
inline
uint32_t
*
xdr_writemem
(
uint32_t
*
p
,
const
void
*
ptr
,
int
nbytes
)
{
int
tmp
=
XDR_QUADLEN
(
nbytes
);
if
(
!
tmp
)
return
p
;
p
[
tmp
-
1
]
=
0
;
memcpy
(
p
,
ptr
,
nbytes
);
return
p
+
tmp
;
}
static
int
encode_compound_hdr
(
struct
xdr_stream
*
xdr
,
struct
compound_hdr
*
hdr
)
{
...
...
include/linux/sunrpc/xdr.h
View file @
01d37f03
...
...
@@ -87,7 +87,8 @@ struct xdr_buf {
/*
* Miscellaneous XDR helper functions
*/
u32
*
xdr_encode_array
(
u32
*
p
,
const
void
*
s
,
unsigned
int
len
);
u32
*
xdr_encode_opaque_fixed
(
u32
*
p
,
const
void
*
ptr
,
unsigned
int
len
);
u32
*
xdr_encode_opaque
(
u32
*
p
,
const
void
*
ptr
,
unsigned
int
len
);
u32
*
xdr_encode_string
(
u32
*
p
,
const
char
*
s
);
u32
*
xdr_decode_string
(
u32
*
p
,
char
**
sp
,
int
*
lenp
,
int
maxlen
);
u32
*
xdr_decode_string_inplace
(
u32
*
p
,
char
**
sp
,
int
*
lenp
,
int
maxlen
);
...
...
@@ -100,6 +101,11 @@ void xdr_encode_pages(struct xdr_buf *, struct page **, unsigned int,
void
xdr_inline_pages
(
struct
xdr_buf
*
,
unsigned
int
,
struct
page
**
,
unsigned
int
,
unsigned
int
);
static
inline
u32
*
xdr_encode_array
(
u32
*
p
,
const
void
*
s
,
unsigned
int
len
)
{
return
xdr_encode_opaque
(
p
,
s
,
len
);
}
/*
* Decode 64bit quantities (NFSv3 support)
*/
...
...
net/sunrpc/auth_gss/auth_gss.c
View file @
01d37f03
...
...
@@ -721,8 +721,7 @@ gss_marshal(struct rpc_task *task, u32 *p, int ruid)
printk
(
"gss_marshal: gss_get_mic FAILED (%d)
\n
"
,
maj_stat
);
goto
out_put_ctx
;
}
*
p
++
=
htonl
(
mic
.
len
);
p
+=
XDR_QUADLEN
(
mic
.
len
);
p
=
xdr_encode_opaque
(
p
,
NULL
,
mic
.
len
);
gss_put_ctx
(
ctx
);
return
p
;
out_put_ctx:
...
...
@@ -857,9 +856,7 @@ gss_wrap_req(struct rpc_task *task,
status
=
-
EIO
;
/* XXX? */
if
(
maj_stat
)
goto
out
;
q
=
p
;
*
q
++
=
htonl
(
mic
.
len
);
q
+=
XDR_QUADLEN
(
mic
.
len
);
q
=
xdr_encode_opaque
(
p
,
NULL
,
mic
.
len
);
offset
=
(
u8
*
)
q
-
(
u8
*
)
p
;
iov
->
iov_len
+=
offset
;
...
...
net/sunrpc/sunrpc_syms.c
View file @
01d37f03
...
...
@@ -120,7 +120,6 @@ EXPORT_SYMBOL(svcauth_unix_purge);
EXPORT_SYMBOL
(
unix_domain_find
);
/* Generic XDR */
EXPORT_SYMBOL
(
xdr_encode_array
);
EXPORT_SYMBOL
(
xdr_encode_string
);
EXPORT_SYMBOL
(
xdr_decode_string
);
EXPORT_SYMBOL
(
xdr_decode_string_inplace
);
...
...
net/sunrpc/xdr.c
View file @
01d37f03
...
...
@@ -53,16 +53,50 @@ xdr_decode_netobj(u32 *p, struct xdr_netobj *obj)
return
p
+
XDR_QUADLEN
(
len
);
}
u32
*
xdr_encode_array
(
u32
*
p
,
const
void
*
array
,
unsigned
int
len
)
/**
* xdr_encode_opaque_fixed - Encode fixed length opaque data
* @p - pointer to current position in XDR buffer.
* @ptr - pointer to data to encode (or NULL)
* @nbytes - size of data.
*
* Copy the array of data of length nbytes at ptr to the XDR buffer
* at position p, then align to the next 32-bit boundary by padding
* with zero bytes (see RFC1832).
* Note: if ptr is NULL, only the padding is performed.
*
* Returns the updated current XDR buffer position
*
*/
u32
*
xdr_encode_opaque_fixed
(
u32
*
p
,
const
void
*
ptr
,
unsigned
int
nbytes
)
{
int
quadlen
=
XDR_QUADLEN
(
len
);
if
(
likely
(
nbytes
!=
0
))
{
unsigned
int
quadlen
=
XDR_QUADLEN
(
nbytes
);
unsigned
int
padding
=
(
quadlen
<<
2
)
-
nbytes
;
if
(
ptr
!=
NULL
)
memcpy
(
p
,
ptr
,
nbytes
);
if
(
padding
!=
0
)
memset
((
char
*
)
p
+
nbytes
,
0
,
padding
);
p
+=
quadlen
;
}
return
p
;
}
EXPORT_SYMBOL
(
xdr_encode_opaque_fixed
);
p
[
quadlen
]
=
0
;
*
p
++
=
htonl
(
len
);
memcpy
(
p
,
array
,
len
);
return
p
+
quadlen
;
/**
* xdr_encode_opaque - Encode variable length opaque data
* @p - pointer to current position in XDR buffer.
* @ptr - pointer to data to encode (or NULL)
* @nbytes - size of data.
*
* Returns the updated current XDR buffer position
*/
u32
*
xdr_encode_opaque
(
u32
*
p
,
const
void
*
ptr
,
unsigned
int
nbytes
)
{
*
p
++
=
htonl
(
nbytes
);
return
xdr_encode_opaque_fixed
(
p
,
ptr
,
nbytes
);
}
EXPORT_SYMBOL
(
xdr_encode_opaque
);
u32
*
xdr_encode_string
(
u32
*
p
,
const
char
*
string
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment