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
99797252
Commit
99797252
authored
13 years ago
by
Ken Thomases
Committed by
Alexandre Julliard
13 years ago
Browse files
Options
Downloads
Patches
Plain Diff
netapi32: Wait for and reap smbpasswd child process.
parent
6df7adff
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
dlls/netapi32/access.c
+34
-11
34 additions, 11 deletions
dlls/netapi32/access.c
with
34 additions
and
11 deletions
dlls/netapi32/access.c
+
34
−
11
View file @
99797252
...
...
@@ -21,6 +21,12 @@
#include
"config.h"
#include
<stdarg.h>
#include
<fcntl.h>
#ifdef HAVE_SYS_ERRNO_H
#include
<sys/errno.h>
#endif
#ifdef HAVE_SYS_WAIT_H
#include
<sys/wait.h>
#endif
#ifdef HAVE_UNISTD_H
#include
<unistd.h>
#endif
...
...
@@ -872,7 +878,7 @@ NET_API_STATUS WINAPI NetUserModalsGet(
return
NERR_Success
;
}
static
int
fork_smbpasswd
(
char
*
const
argv
[]
)
static
int
fork_smbpasswd
(
char
*
const
argv
[]
,
pid_t
*
pid
)
{
#ifdef HAVE_FORK
int
pipe_out
[
2
];
...
...
@@ -881,7 +887,7 @@ static int fork_smbpasswd( char * const argv[] )
fcntl
(
pipe_out
[
0
],
F_SETFD
,
FD_CLOEXEC
);
fcntl
(
pipe_out
[
1
],
F_SETFD
,
FD_CLOEXEC
);
switch
(
fork
())
switch
(
(
*
pid
=
fork
())
)
{
case
-
1
:
close
(
pipe_out
[
0
]
);
...
...
@@ -893,7 +899,7 @@ static int fork_smbpasswd( char * const argv[] )
close
(
pipe_out
[
1
]
);
execvp
(
"smbpasswd"
,
argv
);
ERR
(
"can't execute smbpasswd, is it installed?
\n
"
);
return
-
1
;
_exit
(
1
)
;
default:
close
(
pipe_out
[
0
]
);
break
;
...
...
@@ -917,12 +923,14 @@ static char *strdup_unixcp( const WCHAR *str )
static
NET_API_STATUS
change_password_smb
(
LPCWSTR
domainname
,
LPCWSTR
username
,
LPCWSTR
oldpassword
,
LPCWSTR
newpassword
)
{
NET_API_STATUS
ret
=
NERR_Success
;
static
char
option_silent
[]
=
"-s"
;
static
char
option_user
[]
=
"-U"
;
static
char
option_remote
[]
=
"-r"
;
static
char
smbpasswd
[]
=
"smbpasswd"
;
int
pipe_out
;
char
*
server
=
NULL
,
*
user
,
*
argv
[
7
],
*
old
,
*
new
;
pid_t
pid
;
char
*
server
=
NULL
,
*
user
,
*
argv
[
7
],
*
old
,
*
new
=
NULL
;
if
(
domainname
&&
!
(
server
=
strdup_unixcp
(
domainname
)))
return
ERROR_OUTOFMEMORY
;
if
(
!
(
user
=
strdup_unixcp
(
username
)))
...
...
@@ -942,21 +950,20 @@ static NET_API_STATUS change_password_smb( LPCWSTR domainname, LPCWSTR username,
}
else
argv
[
4
]
=
NULL
;
pipe_out
=
fork_smbpasswd
(
argv
);
pipe_out
=
fork_smbpasswd
(
argv
,
&
pid
);
HeapFree
(
GetProcessHeap
(),
0
,
server
);
HeapFree
(
GetProcessHeap
(),
0
,
user
);
if
(
pipe_out
==
-
1
)
return
NERR_InternalError
;
if
(
!
(
old
=
strdup_unixcp
(
oldpassword
)))
{
close
(
pipe_out
)
;
return
ERROR_OUTOFMEMORY
;
ret
=
ERROR_OUTOFMEMORY
;
goto
end
;
}
if
(
!
(
new
=
strdup_unixcp
(
newpassword
)))
{
close
(
pipe_out
);
HeapFree
(
GetProcessHeap
(),
0
,
old
);
return
ERROR_OUTOFMEMORY
;
ret
=
ERROR_OUTOFMEMORY
;
goto
end
;
}
write
(
pipe_out
,
old
,
strlen
(
old
)
);
write
(
pipe_out
,
"
\n
"
,
1
);
...
...
@@ -965,10 +972,26 @@ static NET_API_STATUS change_password_smb( LPCWSTR domainname, LPCWSTR username,
write
(
pipe_out
,
new
,
strlen
(
new
)
);
write
(
pipe_out
,
"
\n
"
,
1
);
end:
close
(
pipe_out
);
#ifdef HAVE_FORK
{
pid_t
wret
;
int
status
;
do
{
wret
=
waitpid
(
pid
,
&
status
,
0
);
}
while
(
wret
<
0
&&
errno
==
EINTR
);
if
(
ret
==
NERR_Success
&&
(
wret
<
0
||
!
WIFEXITED
(
status
)
||
WEXITSTATUS
(
status
)))
ret
=
NERR_InternalError
;
}
#endif
HeapFree
(
GetProcessHeap
(),
0
,
old
);
HeapFree
(
GetProcessHeap
(),
0
,
new
);
return
NERR_Success
;
return
ret
;
}
/******************************************************************************
...
...
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