Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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-winehq
Commits
99797252
Commit
99797252
authored
Nov 30, 2011
by
Ken Thomases
Committed by
Alexandre Julliard
Dec 01, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
netapi32: Wait for and reap smbpasswd child process.
parent
6df7adff
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
11 deletions
+34
-11
access.c
dlls/netapi32/access.c
+34
-11
No files found.
dlls/netapi32/access.c
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
;
}
/******************************************************************************
...
...
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