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
1307d44f
Commit
1307d44f
authored
Nov 09, 2021
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msv1_0: Define the communication structure only on the Unix side.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
fcc827d1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
22 deletions
+39
-22
unixlib.c
dlls/msv1_0/unixlib.c
+36
-19
unixlib.h
dlls/msv1_0/unixlib.h
+3
-3
No files found.
dlls/msv1_0/unixlib.c
View file @
1307d44f
...
...
@@ -44,38 +44,51 @@ WINE_DECLARE_DEBUG_CHANNEL(winediag);
#define INITIAL_BUFFER_SIZE 200
struct
com_buf
{
char
*
buffer
;
unsigned
int
size
;
unsigned
int
offset
;
};
static
SECURITY_STATUS
read_line
(
struct
ntlm_ctx
*
ctx
,
unsigned
int
*
offset
)
{
char
*
newline
;
struct
com_buf
*
com_buf
=
ctx
->
com_buf
;
if
(
!
c
tx
->
c
om_buf
)
if
(
!
com_buf
)
{
if
(
!
(
ctx
->
com_buf
=
malloc
(
INITIAL_BUFFER_SIZE
)))
if
(
!
(
com_buf
=
malloc
(
sizeof
(
*
com_buf
)
)))
return
SEC_E_INSUFFICIENT_MEMORY
;
if
(
!
(
com_buf
->
buffer
=
malloc
(
INITIAL_BUFFER_SIZE
)))
{
free
(
com_buf
);
return
SEC_E_INSUFFICIENT_MEMORY
;
ctx
->
com_buf_size
=
INITIAL_BUFFER_SIZE
;
ctx
->
com_buf_offset
=
0
;
}
com_buf
->
size
=
INITIAL_BUFFER_SIZE
;
com_buf
->
offset
=
0
;
ctx
->
com_buf
=
com_buf
;
}
do
{
ssize_t
size
;
if
(
c
tx
->
com_buf_offset
+
INITIAL_BUFFER_SIZE
>
ctx
->
com_buf_
size
)
if
(
c
om_buf
->
offset
+
INITIAL_BUFFER_SIZE
>
com_buf
->
size
)
{
char
*
buf
=
realloc
(
c
tx
->
com_buf
,
ctx
->
com_buf_
size
+
INITIAL_BUFFER_SIZE
);
char
*
buf
=
realloc
(
c
om_buf
->
buffer
,
com_buf
->
size
+
INITIAL_BUFFER_SIZE
);
if
(
!
buf
)
return
SEC_E_INSUFFICIENT_MEMORY
;
c
tx
->
com_buf_
size
+=
INITIAL_BUFFER_SIZE
;
c
tx
->
com_buf
=
buf
;
c
om_buf
->
size
+=
INITIAL_BUFFER_SIZE
;
c
om_buf
->
buffer
=
buf
;
}
size
=
read
(
ctx
->
pipe_in
,
ctx
->
com_buf
+
ctx
->
com_buf_offset
,
ctx
->
com_buf_size
-
ctx
->
com_buf_
offset
);
size
=
read
(
ctx
->
pipe_in
,
com_buf
->
buffer
+
com_buf
->
offset
,
com_buf
->
size
-
com_buf
->
offset
);
if
(
size
<=
0
)
return
SEC_E_INTERNAL_ERROR
;
c
tx
->
com_buf_
offset
+=
size
;
newline
=
memchr
(
c
tx
->
com_buf
,
'\n'
,
ctx
->
com_buf_
offset
);
c
om_buf
->
offset
+=
size
;
newline
=
memchr
(
c
om_buf
->
buffer
,
'\n'
,
com_buf
->
offset
);
}
while
(
!
newline
);
/* if there's a newline character, and we read more than that newline, we have to store the offset so we can
preserve the additional data */
if
(
newline
!=
c
tx
->
com_buf
+
ctx
->
com_buf_offset
)
*
offset
=
(
ctx
->
com_buf
+
ctx
->
com_buf_
offset
)
-
(
newline
+
1
);
if
(
newline
!=
c
om_buf
->
buffer
+
com_buf
->
offset
)
*
offset
=
(
com_buf
->
buffer
+
com_buf
->
offset
)
-
(
newline
+
1
);
else
*
offset
=
0
;
*
newline
=
0
;
...
...
@@ -86,6 +99,7 @@ static NTSTATUS ntlm_chat( void *args )
{
struct
chat_params
*
params
=
args
;
struct
ntlm_ctx
*
ctx
=
params
->
ctx
;
struct
com_buf
*
com_buf
;
SECURITY_STATUS
status
=
SEC_E_OK
;
unsigned
int
offset
;
...
...
@@ -93,19 +107,20 @@ static NTSTATUS ntlm_chat( void *args )
write
(
ctx
->
pipe_out
,
"
\n
"
,
1
);
if
((
status
=
read_line
(
ctx
,
&
offset
))
!=
SEC_E_OK
)
return
status
;
*
params
->
retlen
=
strlen
(
ctx
->
com_buf
);
com_buf
=
ctx
->
com_buf
;
*
params
->
retlen
=
strlen
(
com_buf
->
buffer
);
if
(
*
params
->
retlen
>
params
->
buflen
)
return
SEC_E_BUFFER_TOO_SMALL
;
if
(
*
params
->
retlen
<
2
)
return
SEC_E_ILLEGAL_MESSAGE
;
if
(
!
strncmp
(
c
tx
->
com_buf
,
"ERR"
,
3
))
return
SEC_E_INVALID_TOKEN
;
if
(
!
strncmp
(
c
om_buf
->
buffer
,
"ERR"
,
3
))
return
SEC_E_INVALID_TOKEN
;
memcpy
(
params
->
buf
,
c
tx
->
com_buf
,
*
params
->
retlen
+
1
);
memcpy
(
params
->
buf
,
c
om_buf
->
buffer
,
*
params
->
retlen
+
1
);
if
(
!
offset
)
c
tx
->
com_buf_
offset
=
0
;
if
(
!
offset
)
c
om_buf
->
offset
=
0
;
else
{
memmove
(
c
tx
->
com_buf
,
ctx
->
com_buf
+
ctx
->
com_buf_
offset
,
offset
);
c
tx
->
com_buf_
offset
=
offset
;
memmove
(
c
om_buf
->
buffer
,
com_buf
->
buffer
+
com_buf
->
offset
,
offset
);
c
om_buf
->
offset
=
offset
;
}
return
SEC_E_OK
;
...
...
@@ -115,6 +130,7 @@ static NTSTATUS ntlm_cleanup( void *args )
{
struct
cleanup_params
*
params
=
args
;
struct
ntlm_ctx
*
ctx
=
params
->
ctx
;
struct
com_buf
*
com_buf
=
ctx
->
com_buf
;
if
(
!
ctx
||
(
ctx
->
mode
!=
MODE_CLIENT
&&
ctx
->
mode
!=
MODE_SERVER
))
return
STATUS_INVALID_HANDLE
;
ctx
->
mode
=
MODE_INVALID
;
...
...
@@ -131,7 +147,8 @@ static NTSTATUS ntlm_cleanup( void *args )
}
while
(
ret
<
0
&&
errno
==
EINTR
);
}
free
(
ctx
->
com_buf
);
if
(
com_buf
)
free
(
com_buf
->
buffer
);
free
(
com_buf
);
return
STATUS_SUCCESS
;
}
...
...
dlls/msv1_0/unixlib.h
View file @
1307d44f
...
...
@@ -57,6 +57,8 @@ struct arc4_info
#define FLAG_NEGOTIATE_NTLM2 0x00080000
#define FLAG_NEGOTIATE_KEY_EXCHANGE 0x40000000
struct
com_buf
;
struct
ntlm_ctx
{
enum
mode
mode
;
...
...
@@ -64,11 +66,9 @@ struct ntlm_ctx
unsigned
int
attrs
;
int
pipe_in
;
int
pipe_out
;
char
*
com_buf
;
unsigned
int
com_buf_size
;
unsigned
int
com_buf_offset
;
char
session_key
[
16
];
unsigned
int
flags
;
struct
com_buf
*
com_buf
;
struct
{
struct
...
...
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