2 Unix SMB/CIFS implementation.
4 In-Child server implementation of the routines defined in wbint.idl
6 Copyright (C) Volker Lendecke 2009
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 3 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program. If not, see <http://www.gnu.org/licenses/>.
23 #include "winbindd/winbindd.h"
24 #include "winbindd/winbindd_proto.h"
25 #include "librpc/gen_ndr/srv_wbint.h"
27 void _wbint_Ping(pipes_struct *p, struct wbint_Ping *r)
29 *r->out.out_data = r->in.in_data;
32 NTSTATUS _wbint_LookupSid(pipes_struct *p, struct wbint_LookupSid *r)
34 struct winbindd_domain *domain = wb_child_domain();
37 enum lsa_SidType type;
41 return NT_STATUS_REQUEST_NOT_ACCEPTED;
44 status = domain->methods->sid_to_name(domain, p->mem_ctx, r->in.sid,
45 &dom_name, &name, &type);
46 if (!NT_STATUS_IS_OK(status)) {
50 *r->out.domain = dom_name;
56 NTSTATUS _wbint_LookupName(pipes_struct *p, struct wbint_LookupName *r)
58 struct winbindd_domain *domain = wb_child_domain();
61 return NT_STATUS_REQUEST_NOT_ACCEPTED;
64 return domain->methods->name_to_sid(
65 domain, p->mem_ctx, r->in.domain, r->in.name, r->in.flags,
66 r->out.sid, r->out.type);
69 NTSTATUS _wbint_Sid2Uid(pipes_struct *p, struct wbint_Sid2Uid *r)
74 status = idmap_sid_to_uid(r->in.dom_name ? r->in.dom_name : "",
76 if (!NT_STATUS_IS_OK(status)) {
83 NTSTATUS _wbint_Sid2Gid(pipes_struct *p, struct wbint_Sid2Gid *r)
88 status = idmap_sid_to_gid(r->in.dom_name ? r->in.dom_name : "",
90 if (!NT_STATUS_IS_OK(status)) {
97 NTSTATUS _wbint_Uid2Sid(pipes_struct *p, struct wbint_Uid2Sid *r)
101 status = idmap_uid_to_sid(r->in.dom_name ? r->in.dom_name : "",
102 r->out.sid, r->in.uid);
103 if (!NT_STATUS_IS_OK(status)) {
109 NTSTATUS _wbint_Gid2Sid(pipes_struct *p, struct wbint_Gid2Sid *r)
113 status = idmap_gid_to_sid(r->in.dom_name ? r->in.dom_name : "",
114 r->out.sid, r->in.gid);
115 if (!NT_STATUS_IS_OK(status)) {
121 NTSTATUS _wbint_QueryUser(pipes_struct *p, struct wbint_QueryUser *r)
123 struct winbindd_domain *domain = wb_child_domain();
124 WINBIND_USERINFO uinfo;
127 if (domain == NULL) {
128 return NT_STATUS_REQUEST_NOT_ACCEPTED;
131 status = domain->methods->query_user(domain, p->mem_ctx, r->in.sid,
133 if (!NT_STATUS_IS_OK(status)) {
137 r->out.info->acct_name = uinfo.acct_name;
138 r->out.info->full_name = uinfo.full_name;
139 r->out.info->homedir = uinfo.homedir;
140 r->out.info->shell = uinfo.shell;
141 r->out.info->primary_gid = uinfo.primary_gid;
142 sid_copy(&r->out.info->user_sid, &uinfo.user_sid);
143 sid_copy(&r->out.info->group_sid, &uinfo.group_sid);
148 NTSTATUS _wbint_LookupUserAliases(pipes_struct *p,
149 struct wbint_LookupUserAliases *r)
151 struct winbindd_domain *domain = wb_child_domain();
153 if (domain == NULL) {
154 return NT_STATUS_REQUEST_NOT_ACCEPTED;
157 return domain->methods->lookup_useraliases(
158 domain, p->mem_ctx, r->in.sids->num_sids, r->in.sids->sids,
159 &r->out.rids->num_rids, &r->out.rids->rids);