summaryrefslogtreecommitdiff
path: root/source3/nsswitch/winbindd_user.c
diff options
context:
space:
mode:
authorSimo Sorce <idra@samba.org>2003-04-27 12:07:20 +0000
committerSimo Sorce <idra@samba.org>2003-04-27 12:07:20 +0000
commitc737b1f7587ca7d32a974c6249eec9510e566a9c (patch)
treee64d93c90d9ef832a1bf50f535d60752bb383392 /source3/nsswitch/winbindd_user.c
parentd2fd4707ab6c53d1dd886c6ec189163d12c8ce8b (diff)
downloadsamba-c737b1f7587ca7d32a974c6249eec9510e566a9c.tar.gz
samba-c737b1f7587ca7d32a974c6249eec9510e566a9c.tar.bz2
samba-c737b1f7587ca7d32a974c6249eec9510e566a9c.zip
make winbind use idmap as well.
change idmap_init call removed ldap backend for winbind idmap, seem it had problems anyway and it have to be reworked to work with idmap without calling winbind code. simo (This used to be commit 9d7d007443fc75264b2764b90f272ffc40c9be6c)
Diffstat (limited to 'source3/nsswitch/winbindd_user.c')
-rw-r--r--source3/nsswitch/winbindd_user.c28
1 files changed, 17 insertions, 11 deletions
diff --git a/source3/nsswitch/winbindd_user.c b/source3/nsswitch/winbindd_user.c
index d2bd231918..dd66275390 100644
--- a/source3/nsswitch/winbindd_user.c
+++ b/source3/nsswitch/winbindd_user.c
@@ -36,25 +36,29 @@ static BOOL winbindd_fill_pwent(char *dom_name, char *user_name,
fstring output_username;
pstring homedir;
fstring sid_string;
+ unid_t id;
+ int id_type;
if (!pw || !dom_name || !user_name)
return False;
/* Resolve the uid number */
-
- if (!winbindd_idmap_get_uid_from_sid(user_sid,
- &pw->pw_uid)) {
+
+ id_type = ID_USERID;
+ if (NT_STATUS_IS_ERR(idmap_get_id_from_sid(&id, &id_type, user_sid))) {
DEBUG(1, ("error getting user id for sid %s\n", sid_to_string(sid_string, user_sid)));
return False;
}
+ pw->pw_uid = id.uid;
/* Resolve the gid number */
-
- if (!winbindd_idmap_get_gid_from_sid(group_sid,
- &pw->pw_gid)) {
+
+ id_type = ID_GROUPID;
+ if (NT_STATUS_IS_ERR(idmap_get_id_from_sid(&id, &id_type, group_sid))) {
DEBUG(1, ("error getting group id for sid %s\n", sid_to_string(sid_string, group_sid)));
return False;
}
+ pw->pw_gid = id.gid;
/* Username */
@@ -178,9 +182,10 @@ enum winbindd_result winbindd_getpwuid(struct winbindd_cli_state *state)
fstring user_name;
enum SID_NAME_USE name_type;
WINBIND_USERINFO user_info;
- gid_t gid;
TALLOC_CTX *mem_ctx;
NTSTATUS status;
+ unid_t id;
+ int id_type;
/* Bug out if the uid isn't in the winbind range */
@@ -193,8 +198,8 @@ enum winbindd_result winbindd_getpwuid(struct winbindd_cli_state *state)
/* Get rid from uid */
- if (!winbindd_idmap_get_sid_from_uid(state->request.data.uid,
- &user_sid)) {
+ id.uid = state->request.data.uid;
+ if (NT_STATUS_IS_ERR(idmap_get_sid_from_id(&user_sid, id, ID_USERID))) {
DEBUG(1, ("could not convert uid %d to SID\n",
state->request.data.uid));
return WINBINDD_ERROR;
@@ -236,9 +241,10 @@ enum winbindd_result winbindd_getpwuid(struct winbindd_cli_state *state)
return WINBINDD_ERROR;
}
- /* Resolve gid number */
+ /* Check group has a gid number */
- if (!winbindd_idmap_get_gid_from_sid(user_info.group_sid, &gid)) {
+ id_type = ID_GROUPID;
+ if (NT_STATUS_IS_ERR(idmap_get_id_from_sid(&id, &id_type, user_info.group_sid))) {
DEBUG(1, ("error getting group id for user %s\n", user_name));
talloc_destroy(mem_ctx);
return WINBINDD_ERROR;