Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
7b5e5b65
Commit
7b5e5b65
authored
May 12, 2006
by
Mike McCormack
Committed by
Alexandre Julliard
May 15, 2006
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rpcrt4: Add infrastructure for send authentication data.
parent
1912fcea
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
49 additions
and
20 deletions
+49
-20
rpc_message.c
dlls/rpcrt4/rpc_message.c
+49
-20
No files found.
dlls/rpcrt4/rpc_message.c
View file @
7b5e5b65
...
...
@@ -239,53 +239,71 @@ VOID RPCRT4_FreeHeader(RpcPktHdr *Header)
}
/***********************************************************************
* RPCRT4_Send (internal)
* RPCRT4_Send
Auth
(internal)
*
* Transmit a packet over connection in acceptable fragments.
* Transmit a packet
with authorization data
over connection in acceptable fragments.
*/
RPC_STATUS
RPCRT4_Send
(
RpcConnection
*
Connection
,
RpcPktHdr
*
Header
,
void
*
Buffer
,
unsigned
int
BufferLength
)
static
RPC_STATUS
RPCRT4_SendAuth
(
RpcConnection
*
Connection
,
RpcPktHdr
*
Header
,
void
*
Buffer
,
unsigned
int
BufferLength
,
void
*
Auth
,
unsigned
int
AuthLength
)
{
PUCHAR
buffer_pos
;
DWORD
hdr_size
;
LONG
count
;
unsigned
char
*
pkt
,
*
auth_hdr
;
LONG
alen
=
AuthLength
?
(
AuthLength
+
8
)
:
0
;
buffer_pos
=
Buffer
;
/* The packet building functions save the packet header size, so we can use it. */
hdr_size
=
Header
->
common
.
frag_len
;
Header
->
common
.
auth_len
=
AuthLength
;
Header
->
common
.
flags
|=
RPC_FLG_FIRST
;
Header
->
common
.
flags
&=
~
RPC_FLG_LAST
;
while
(
!
(
Header
->
common
.
flags
&
RPC_FLG_LAST
))
{
/* decide if we need to split the packet into fragments */
if
((
BufferLength
+
hdr_size
)
<=
Connection
->
MaxTransmissionSize
)
{
if
((
BufferLength
+
hdr_size
+
alen
)
<=
Connection
->
MaxTransmissionSize
)
{
Header
->
common
.
flags
|=
RPC_FLG_LAST
;
Header
->
common
.
frag_len
=
BufferLength
+
hdr_size
;
Header
->
common
.
frag_len
=
BufferLength
+
hdr_size
+
alen
;
}
else
{
Header
->
common
.
frag_len
=
Connection
->
MaxTransmissionSize
;
}
/* transmit packet header */
count
=
rpcrt4_conn_write
(
Connection
,
Header
,
hdr_size
);
if
(
count
<
0
)
{
WARN
(
"rpcrt4_conn_write failed
\n
"
);
return
RPC_S_PROTOCOL_ERROR
;
}
pkt
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
Header
->
common
.
frag_len
);
memcpy
(
pkt
,
Header
,
hdr_size
);
/* fragment consisted of header only and is the last one */
if
(
hdr_size
==
Header
->
common
.
frag_len
&&
Header
->
common
.
flags
&
RPC_FLG_LAST
)
{
return
RPC_S_OK
;
if
(
hdr_size
==
Header
->
common
.
frag_len
)
goto
write
;
memcpy
(
pkt
+
hdr_size
,
buffer_pos
,
Header
->
common
.
frag_len
-
hdr_size
-
alen
);
/* add the authorization info */
if
(
AuthLength
)
{
auth_hdr
=
&
pkt
[
Header
->
common
.
frag_len
-
alen
];
/* FIXME: is this per fragment or per message? */
auth_hdr
[
0
]
=
RPC_C_AUTHN_WINNT
;
auth_hdr
[
1
]
=
RPC_C_AUTHN_LEVEL_CONNECT
;
auth_hdr
[
2
]
=
0x00
;
/* FIXME: add padding */
auth_hdr
[
3
]
=
0x00
;
/* a unique number... */
memcpy
(
&
auth_hdr
[
4
],
&
Connection
,
4
);
memcpy
(
&
auth_hdr
[
8
],
Auth
,
AuthLength
);
}
/* send the fragment data */
count
=
rpcrt4_conn_write
(
Connection
,
buffer_pos
,
Header
->
common
.
frag_len
-
hdr_size
);
write:
count
=
rpcrt4_conn_write
(
Connection
,
pkt
,
Header
->
common
.
frag_len
);
HeapFree
(
GetProcessHeap
(),
0
,
pkt
);
if
(
count
<
0
)
{
WARN
(
"rpcrt4_conn_write failed
\n
"
);
WARN
(
"rpcrt4_conn_write failed
(auth)
\n
"
);
return
RPC_S_PROTOCOL_ERROR
;
}
buffer_pos
+=
Header
->
common
.
frag_len
-
hdr_size
;
BufferLength
-=
Header
->
common
.
frag_len
-
hdr_size
;
buffer_pos
+=
Header
->
common
.
frag_len
-
hdr_size
-
alen
;
BufferLength
-=
Header
->
common
.
frag_len
-
hdr_size
-
alen
;
Header
->
common
.
flags
&=
~
RPC_FLG_FIRST
;
}
...
...
@@ -293,6 +311,17 @@ RPC_STATUS RPCRT4_Send(RpcConnection *Connection, RpcPktHdr *Header,
}
/***********************************************************************
* RPCRT4_Send (internal)
*
* Transmit a packet over connection in acceptable fragments.
*/
RPC_STATUS
RPCRT4_Send
(
RpcConnection
*
Connection
,
RpcPktHdr
*
Header
,
void
*
Buffer
,
unsigned
int
BufferLength
)
{
return
RPCRT4_SendAuth
(
Connection
,
Header
,
Buffer
,
BufferLength
,
NULL
,
0
);
}
/***********************************************************************
* RPCRT4_Receive (internal)
*
* Receive a packet from connection and merge the fragments.
...
...
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