Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
wine
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Package registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Lorenzo Ferrillo
wine
Commits
1307d44f
Commit
1307d44f
authored
3 years ago
by
Alexandre Julliard
Browse files
Options
Downloads
Patches
Plain Diff
msv1_0: Define the communication structure only on the Unix side.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
fcc827d1
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
dlls/msv1_0/unixlib.c
+36
-19
36 additions, 19 deletions
dlls/msv1_0/unixlib.c
dlls/msv1_0/unixlib.h
+3
-3
3 additions, 3 deletions
dlls/msv1_0/unixlib.h
with
39 additions
and
22 deletions
dlls/msv1_0/unixlib.c
+
36
−
19
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
(
!
ctx
->
com_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
(
ctx
->
com_buf
_
offset
+
INITIAL_BUFFER_SIZE
>
ctx
->
com_buf
_
size
)
if
(
com_buf
->
offset
+
INITIAL_BUFFER_SIZE
>
com_buf
->
size
)
{
char
*
buf
=
realloc
(
ctx
->
com_buf
,
ctx
->
com_buf
_
size
+
INITIAL_BUFFER_SIZE
);
char
*
buf
=
realloc
(
com_buf
->
buffer
,
com_buf
->
size
+
INITIAL_BUFFER_SIZE
);
if
(
!
buf
)
return
SEC_E_INSUFFICIENT_MEMORY
;
ctx
->
com_buf
_
size
+=
INITIAL_BUFFER_SIZE
;
ctx
->
com_buf
=
buf
;
com_buf
->
size
+=
INITIAL_BUFFER_SIZE
;
com_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
;
ctx
->
com_buf
_
offset
+=
size
;
newline
=
memchr
(
ctx
->
com_buf
,
'\n'
,
ctx
->
com_buf
_
offset
);
com_buf
->
offset
+=
size
;
newline
=
memchr
(
com_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
!=
ctx
->
com_buf
+
ctx
->
com_buf
_
offset
)
*
offset
=
(
ctx
->
com_buf
+
ctx
->
com_buf
_
offset
)
-
(
newline
+
1
);
if
(
newline
!=
com_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
(
ctx
->
com_buf
,
"ERR"
,
3
))
return
SEC_E_INVALID_TOKEN
;
if
(
!
strncmp
(
com_buf
->
buffer
,
"ERR"
,
3
))
return
SEC_E_INVALID_TOKEN
;
memcpy
(
params
->
buf
,
ctx
->
com_buf
,
*
params
->
retlen
+
1
);
memcpy
(
params
->
buf
,
com_buf
->
buffer
,
*
params
->
retlen
+
1
);
if
(
!
offset
)
ctx
->
com_buf
_
offset
=
0
;
if
(
!
offset
)
com_buf
->
offset
=
0
;
else
{
memmove
(
ctx
->
com_buf
,
ctx
->
com_buf
+
ctx
->
com_buf
_
offset
,
offset
);
ctx
->
com_buf
_
offset
=
offset
;
memmove
(
com_buf
->
buffer
,
com_buf
->
buffer
+
com_buf
->
offset
,
offset
);
com_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
;
}
...
...
This diff is collapsed.
Click to expand it.
dlls/msv1_0/unixlib.h
+
3
−
3
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
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment