return WINBINDD_OK;
}
+static void ndr_child_lookup_sid2name(struct winbindd_domain *domain,
+ struct winbindd_cli_state *state,
+ struct winbind_lookup *r)
+{
+ bool ok;
+
+ DEBUG(3, ("lookup sid2name %s\n",
+ sid_string_dbg(r->in.req.sid)));
+
+ /* Lookup the sid */
+
+ ok = winbindd_lookup_name_by_sid(r, domain,
+ r->in.req.sid,
+ (char **)&r->out.rep->name_info.domain_name,
+ (char **)&r->out.rep->name_info.account_name,
+ &r->out.rep->name_info.type);
+ if (!ok) {
+ DEBUG(1, ("Can't lookup name by sid\n"));
+ r->out.result = WINBIND_STATUS_FOOBAR;
+ return;
+ }
+
+ r->out.result = WINBIND_STATUS_OK;
+}
+
+static void ndr_child_lookup_name2sid(struct winbindd_domain *domain,
+ struct winbindd_cli_state *state,
+ struct winbind_lookup *r)
+{
+ bool ok;
+ char *name_domain;
+ char *name_user;
+ char *p;
+
+ DEBUG(3, ("lookup name2sid %s\n",
+ r->in.req.name));
+
+ name_domain = talloc_strdup(r, r->in.req.name);
+ if (!name_domain) {
+ r->out.result = WINBIND_STATUS_NO_MEMORY;
+ return;
+ }
+
+ /* the name must be a fully qualified name */
+ p = strstr(name_domain, lp_winbind_separator());
+ if (!p) {
+ r->out.result = WINBIND_STATUS_INVALID_PARAMETER;
+ return;
+ }
+
+ *p = 0;
+ name_user = p+1;
+
+ r->out.rep->sid_info.sid = TALLOC_ZERO_P(r, struct dom_sid);
+ if (!r->out.rep->sid_info.sid) {
+ r->out.result = WINBIND_STATUS_NO_MEMORY;
+ return;
+ }
+
+ /* Lookup name from DC using lsa_lookup_names() */
+/* TODO: */ ok = winbindd_lookup_sid_by_name(state->mem_ctx, WINBINDD_LOOKUPNAME,
+ domain, name_domain, name_user,
+ r->out.rep->sid_info.sid,
+ &r->out.rep->sid_info.type);
+ if (!ok) {
+ DEBUG(1, ("Can't lookup name by sid\n"));
+ r->out.result = WINBIND_STATUS_FOOBAR;
+ return;
+ }
+
+ r->out.result = WINBIND_STATUS_OK;
+}
+
+void winbindd_ndr_domain_child_lookup(struct winbindd_domain *domain,
+ struct winbindd_cli_state *state)
+{
+ struct winbind_lookup *r;
+
+ r = talloc_get_type_abort(state->c.ndr.r,
+ struct winbind_lookup);
+
+ switch (*r->in.level) {
+ case WINBIND_LOOKUP_LEVEL_SID2NAME:
+ ndr_child_lookup_sid2name(domain, state, r);
+ return;
+
+ case WINBIND_LOOKUP_LEVEL_NAME2SID:
+ ndr_child_lookup_name2sid(domain, state, r);
+ return;
+ }
+
+ r->out.result = WINBIND_STATUS_UNKNOWN_LEVEL;
+ return;
+}
+
/********************************************************************
This is the second callback after contacting the forest root
********************************************************************/