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
2207f20b
Commit
2207f20b
authored
Mar 24, 2007
by
Kai Blin
Committed by
Alexandre Julliard
Mar 26, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
netapi32: Implement NetUserDel.
parent
5934c2c9
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
25 deletions
+31
-25
access.c
dlls/netapi32/access.c
+27
-24
access.c
dlls/netapi32/tests/access.c
+4
-1
No files found.
dlls/netapi32/access.c
View file @
2207f20b
...
...
@@ -91,26 +91,22 @@ static NET_API_STATUS NETAPI_ValidateServername(LPCWSTR ServerName)
}
/************************************************************
* NETAPI_
IsKnown
User
* NETAPI_
Find
User
*
* Checks whether the user name indicates current user.
* Looks for a user in the user database.
* Returns a pointer to the entry in the user list when the user
* is found, NULL otherwise.
*/
static
BOOL
NETAPI_IsKnown
User
(
LPCWSTR
UserName
)
static
struct
sam_user
*
NETAPI_Find
User
(
LPCWSTR
UserName
)
{
DWORD
dwSize
=
UNLEN
+
1
;
BOOL
Result
;
LPWSTR
buf
;
struct
sam_user
*
user
;
if
(
!
lstrcmpW
(
UserName
,
sAdminUserName
)
||
!
lstrcmpW
(
UserName
,
sGuestUserName
))
return
TRUE
;
NetApiBufferAllocate
(
dwSize
*
sizeof
(
WCHAR
),
(
LPVOID
*
)
&
buf
);
Result
=
GetUserNameW
(
buf
,
&
dwSize
);
Result
=
Result
&&
!
lstrcmpW
(
UserName
,
buf
);
NetApiBufferFree
(
buf
);
return
Result
;
LIST_FOR_EACH_ENTRY
(
user
,
&
user_list
,
struct
sam_user
,
entry
)
{
if
(
lstrcmpW
(
user
->
user_name
,
UserName
)
==
0
)
return
user
;
}
return
NULL
;
}
/************************************************************
...
...
@@ -198,17 +194,24 @@ NET_API_STATUS WINAPI NetUserAdd(LPCWSTR servername,
NET_API_STATUS
WINAPI
NetUserDel
(
LPCWSTR
servername
,
LPCWSTR
username
)
{
NET_API_STATUS
status
;
FIXME
(
"(%s, %s) stub!
\n
"
,
debugstr_w
(
servername
),
debugstr_w
(
username
))
;
struct
sam_user
*
user
;
status
=
NETAPI_ValidateServername
(
servername
);
if
(
status
!=
NERR_Success
)
TRACE
(
"(%s, %s)
\n
"
,
debugstr_w
(
servername
),
debugstr_w
(
username
));
if
((
status
=
NETAPI_ValidateServername
(
servername
))
!=
NERR_Success
)
return
status
;
if
(
!
NETAPI_IsKnownUser
(
username
)
)
if
(
(
user
=
NETAPI_FindUser
(
username
))
==
NULL
)
return
NERR_UserNotFound
;
/* Delete the user here */
return
status
;
list_remove
(
&
user
->
entry
);
HeapFree
(
GetProcessHeap
(),
0
,
user
->
home_dir
);
HeapFree
(
GetProcessHeap
(),
0
,
user
->
user_comment
);
HeapFree
(
GetProcessHeap
(),
0
,
user
->
user_logon_script_path
);
HeapFree
(
GetProcessHeap
(),
0
,
user
);
return
NERR_Success
;
}
/************************************************************
...
...
@@ -232,7 +235,7 @@ NetUserGetInfo(LPCWSTR servername, LPCWSTR username, DWORD level,
return
NERR_InvalidComputer
;
}
if
(
!
NETAPI_
IsKnown
User
(
username
))
if
(
!
NETAPI_
Find
User
(
username
))
{
TRACE
(
"User %s is unknown.
\n
"
,
debugstr_w
(
username
));
return
NERR_UserNotFound
;
...
...
@@ -404,7 +407,7 @@ NetUserGetLocalGroups(LPCWSTR servername, LPCWSTR username, DWORD level,
if
(
status
!=
NERR_Success
)
return
status
;
if
(
!
NETAPI_
IsKnown
User
(
username
))
if
(
!
NETAPI_
Find
User
(
username
))
return
NERR_UserNotFound
;
if
(
bufptr
)
*
bufptr
=
NULL
;
...
...
dlls/netapi32/tests/access.c
View file @
2207f20b
...
...
@@ -259,7 +259,10 @@ static void run_userhandling_tests(void)
todo_wine
ok
(
ret
==
NERR_Success
,
"Changing the password failed.
\n
"
);
ret
=
pNetUserDel
(
NULL
,
sTestUserName
);
todo_wine
ok
(
ret
==
NERR_Success
,
"Deleting the user failed.
\n
"
);
ok
(
ret
==
NERR_Success
,
"Deleting the user failed.
\n
"
);
ret
=
pNetUserDel
(
NULL
,
sTestUserName
);
ok
(
ret
==
NERR_UserNotFound
,
"Deleting a nonexistent user returned 0x%08x
\n
"
,
ret
);
}
START_TEST
(
access
)
...
...
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