struct winbindd_domain *user_domain;
struct tevent_context *ev;
struct dom_sid sid;
- struct winbind_userinfo *userinfo;
+ struct wbint_userinfo *userinfo;
struct winbindd_pw *pw;
};
struct wb_queryuser_state {
struct dom_sid sid;
- struct wbint_userinfo info;
+ struct wbint_userinfo *info;
};
static void wb_queryuser_done(struct tevent_req *subreq);
struct tevent_req *req, *subreq;
struct wb_queryuser_state *state;
struct winbindd_domain *domain;
- struct winbind_userinfo info;
NTSTATUS status;
req = tevent_req_create(mem_ctx, &state, struct wb_queryuser_state);
return tevent_req_post(req, ev);
}
- status = wcache_query_user(domain, state, &state->sid, &info);
+ state->info = talloc(state, struct wbint_userinfo);
+ if (tevent_req_nomem(state->info, req)) {
+ return tevent_req_post(req, ev);
+ }
+
+ status = wcache_query_user(domain, state, &state->sid, state->info);
if (NT_STATUS_IS_OK(status)) {
- state->info.acct_name = info.acct_name;
- state->info.full_name = info.full_name;
- state->info.homedir = info.homedir;
- state->info.shell = info.shell;
- state->info.primary_gid = info.primary_gid;
- sid_copy(&state->info.user_sid, &info.user_sid);
- sid_copy(&state->info.group_sid, &info.group_sid);
tevent_req_done(req);
return tevent_req_post(req, ev);
}
subreq = rpccli_wbint_QueryUser_send(state, ev, domain->child.rpccli,
- &state->sid, &state->info);
+ &state->sid, state->info);
if (tevent_req_nomem(subreq, req)) {
return tevent_req_post(req, ev);
}
}
NTSTATUS wb_queryuser_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
- struct winbind_userinfo **pinfo)
+ struct wbint_userinfo **pinfo)
{
struct wb_queryuser_state *state = tevent_req_data(
req, struct wb_queryuser_state);
- struct winbind_userinfo *info;
NTSTATUS status;
if (tevent_req_is_nterror(req, &status)) {
return status;
}
-
- info = talloc(mem_ctx, struct winbind_userinfo);
- if (info == NULL) {
- return NT_STATUS_NO_MEMORY;
- }
- info->acct_name = talloc_move(info, &state->info.acct_name);
- info->full_name = talloc_move(info, &state->info.full_name);
- info->homedir = talloc_move(info, &state->info.homedir);
- info->shell = talloc_move(info, &state->info.shell);
- info->primary_gid = state->info.primary_gid;
- sid_copy(&info->user_sid, &state->info.user_sid);
- sid_copy(&info->group_sid, &state->info.group_sid);
- *pinfo = info;
+ *pinfo = talloc_move(mem_ctx, &state->info);
return NT_STATUS_OK;
}
#include "nsswitch/winbind_struct_protocol.h"
#include "nsswitch/libwbclient/wbclient.h"
+#include "librpc/gen_ndr/wbint.h"
#ifdef HAVE_LIBNSCD
#include <libnscd.h>
DOM_SID group_sid;
};
-/* Server state structure */
-
-typedef struct winbind_userinfo {
- const char *acct_name;
- const char *full_name;
- const char *homedir;
- const char *shell;
- gid_t primary_gid; /* allow the nss_info
- backend to set the primary group */
- DOM_SID user_sid; /* NT user and primary group SIDs */
- DOM_SID group_sid;
-} WINBIND_USERINFO;
-
/* Our connection to the DC */
struct winbindd_cm_conn {
always correct) */
bool consistent;
- /* get a list of users, returning a WINBIND_USERINFO for each one */
+ /* get a list of users, returning a wbint_userinfo for each one */
NTSTATUS (*query_user_list)(struct winbindd_domain *domain,
TALLOC_CTX *mem_ctx,
uint32 *num_entries,
- WINBIND_USERINFO **info);
+ struct wbint_userinfo **info);
/* get a list of domain groups */
NTSTATUS (*enum_dom_groups)(struct winbindd_domain *domain,
NTSTATUS (*query_user)(struct winbindd_domain *domain,
TALLOC_CTX *mem_ctx,
const DOM_SID *user_sid,
- WINBIND_USERINFO *user_info);
+ struct wbint_userinfo *user_info);
/* lookup all groups that a user is a member of. The backend
can also choose to lookup by username or rid for this
static NTSTATUS query_user_list(struct winbindd_domain *domain,
TALLOC_CTX *mem_ctx,
uint32 *num_entries,
- WINBIND_USERINFO **info)
+ struct wbint_userinfo **info)
{
ADS_STRUCT *ads = NULL;
const char *attrs[] = { "*", NULL };
goto done;
}
- (*info) = TALLOC_ZERO_ARRAY(mem_ctx, WINBIND_USERINFO, count);
+ (*info) = TALLOC_ZERO_ARRAY(mem_ctx, struct wbint_userinfo, count);
if (!*info) {
status = NT_STATUS_NO_MEMORY;
goto done;
static NTSTATUS query_user(struct winbindd_domain *domain,
TALLOC_CTX *mem_ctx,
const DOM_SID *sid,
- WINBIND_USERINFO *info)
+ struct wbint_userinfo *info)
{
ADS_STRUCT *ads = NULL;
const char *attrs[] = { "*", NULL };
uint32 group_rid;
NTSTATUS status = NT_STATUS_UNSUCCESSFUL;
struct netr_SamInfo3 *user = NULL;
+ gid_t gid;
DEBUG(3,("ads: query_user\n"));
if ( (user = netsamlogon_cache_get( mem_ctx, sid )) != NULL )
{
-
DEBUG(5,("query_user: Cache lookup succeeded for %s\n",
sid_string_dbg(sid)));
nss_get_info_cached( domain, sid, mem_ctx, NULL, NULL,
&info->homedir, &info->shell, &info->full_name,
- &info->primary_gid );
+ &gid );
+ info->primary_gid = gid;
TALLOC_FREE(user);
nss_get_info_cached( domain, sid, mem_ctx, NULL, NULL,
&info->homedir, &info->shell, &info->full_name,
- &info->primary_gid );
+ &gid);
+ info->primary_gid = gid;
status = NT_STATUS_OK;
goto done;
nss_get_info_cached( domain, sid, mem_ctx, ads, msg,
&info->homedir, &info->shell, &info->full_name,
- &info->primary_gid );
+ &gid);
+ info->primary_gid = gid;
if (info->full_name == NULL) {
info->full_name = ads_pull_string(ads, mem_ctx, msg, "name");
enum winbindd_result winbindd_dual_list_users(struct winbindd_domain *domain,
struct winbindd_cli_state *state)
{
- WINBIND_USERINFO *info;
+ struct wbint_userinfo *info;
NTSTATUS status;
struct winbindd_methods *methods;
uint32 num_entries = 0;
}
-static void wcache_save_user(struct winbindd_domain *domain, NTSTATUS status, WINBIND_USERINFO *info)
+static void wcache_save_user(struct winbindd_domain *domain, NTSTATUS status,
+ struct wbint_userinfo *info)
{
struct cache_entry *centry;
fstring sid_string;
static NTSTATUS query_user_list(struct winbindd_domain *domain,
TALLOC_CTX *mem_ctx,
uint32 *num_entries,
- WINBIND_USERINFO **info)
+ struct wbint_userinfo **info)
{
struct winbind_cache *cache = get_cache(domain);
struct cache_entry *centry = NULL;
if (*num_entries == 0)
goto do_cached;
- (*info) = TALLOC_ARRAY(mem_ctx, WINBIND_USERINFO, *num_entries);
+ (*info) = TALLOC_ARRAY(mem_ctx, struct wbint_userinfo, *num_entries);
if (! (*info)) {
smb_panic_fn("query_user_list out of memory");
}
NTSTATUS wcache_query_user(struct winbindd_domain *domain,
TALLOC_CTX *mem_ctx,
const struct dom_sid *user_sid,
- struct winbind_userinfo *info)
+ struct wbint_userinfo *info)
{
struct winbind_cache *cache = get_cache(domain);
struct cache_entry *centry = NULL;
static NTSTATUS query_user(struct winbindd_domain *domain,
TALLOC_CTX *mem_ctx,
const DOM_SID *user_sid,
- WINBIND_USERINFO *info)
+ struct wbint_userinfo *info)
{
NTSTATUS status;
NTSTATUS _wbint_QueryUser(pipes_struct *p, struct wbint_QueryUser *r)
{
struct winbindd_domain *domain = wb_child_domain();
- WINBIND_USERINFO uinfo;
- NTSTATUS status;
if (domain == NULL) {
return NT_STATUS_REQUEST_NOT_ACCEPTED;
}
- status = domain->methods->query_user(domain, p->mem_ctx, r->in.sid,
- &uinfo);
- if (!NT_STATUS_IS_OK(status)) {
- return status;
- }
-
- r->out.info->acct_name = uinfo.acct_name;
- r->out.info->full_name = uinfo.full_name;
- r->out.info->homedir = uinfo.homedir;
- r->out.info->shell = uinfo.shell;
- r->out.info->primary_gid = uinfo.primary_gid;
- sid_copy(&r->out.info->user_sid, &uinfo.user_sid);
- sid_copy(&r->out.info->group_sid, &uinfo.group_sid);
-
- return NT_STATUS_OK;
+ return domain->methods->query_user(domain, p->mem_ctx, r->in.sid,
+ r->out.info);
}
NTSTATUS _wbint_LookupUserAliases(pipes_struct *p,
static NTSTATUS builtin_query_user_list(struct winbindd_domain *domain,
TALLOC_CTX *mem_ctx,
uint32 *num_entries,
- WINBIND_USERINFO **info)
+ struct wbint_userinfo **info)
{
/* We don't have users */
*num_entries = 0;
static NTSTATUS builtin_query_user(struct winbindd_domain *domain,
TALLOC_CTX *mem_ctx,
const DOM_SID *user_sid,
- WINBIND_USERINFO *user_info)
+ struct wbint_userinfo *user_info)
{
return NT_STATUS_NO_SUCH_USER;
}
static NTSTATUS sam_query_user_list(struct winbindd_domain *domain,
TALLOC_CTX *mem_ctx,
uint32 *num_entries,
- WINBIND_USERINFO **info)
+ struct wbint_userinfo **info)
{
struct pdb_search *ps = pdb_search_users(talloc_tos(), ACB_NORMAL);
struct samr_displayentry *entries = NULL;
1, 0xffffffff,
&entries);
- *info = TALLOC_ZERO_ARRAY(mem_ctx, WINBIND_USERINFO, *num_entries);
+ *info = TALLOC_ZERO_ARRAY(mem_ctx, struct wbint_userinfo, *num_entries);
if (!(*info)) {
TALLOC_FREE(ps);
return NT_STATUS_NO_MEMORY;
static NTSTATUS sam_query_user(struct winbindd_domain *domain,
TALLOC_CTX *mem_ctx,
const DOM_SID *user_sid,
- WINBIND_USERINFO *user_info)
+ struct wbint_userinfo *user_info)
{
struct samu *sampass = NULL;
NTSTATUS wcache_query_user(struct winbindd_domain *domain,
TALLOC_CTX *mem_ctx,
const struct dom_sid *user_sid,
- struct winbind_userinfo *info);
+ struct wbint_userinfo *info);
NTSTATUS wcache_lookup_useraliases(struct winbindd_domain *domain,
TALLOC_CTX *mem_ctx,
uint32 num_sids, const DOM_SID *sids,
struct tevent_context *ev,
const struct dom_sid *user_sid);
NTSTATUS wb_queryuser_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
- struct winbind_userinfo **pinfo);
+ struct wbint_userinfo **pinfo);
struct tevent_req *wb_getpwsid_send(TALLOC_CTX *mem_ctx,
struct tevent_context *ev,
static NTSTATUS query_user_list(struct winbindd_domain *domain,
TALLOC_CTX *mem_ctx,
uint32 *num_entries,
- WINBIND_USERINFO **info)
+ struct wbint_userinfo **info)
{
NTSTATUS result;
static NTSTATUS query_user(struct winbindd_domain *domain,
TALLOC_CTX *mem_ctx,
const DOM_SID *user_sid,
- WINBIND_USERINFO *user_info)
+ struct wbint_userinfo *user_info)
{
NTSTATUS result;
static NTSTATUS query_user_list(struct winbindd_domain *domain,
TALLOC_CTX *mem_ctx,
uint32 *num_entries,
- WINBIND_USERINFO **info)
+ struct wbint_userinfo **info)
{
NTSTATUS result;
struct policy_handle dom_pol;
*num_entries += num_dom_users;
- *info = TALLOC_REALLOC_ARRAY(mem_ctx, *info, WINBIND_USERINFO,
+ *info = TALLOC_REALLOC_ARRAY(mem_ctx, *info,
+ struct wbint_userinfo,
*num_entries);
if (!(*info)) {
static NTSTATUS query_user(struct winbindd_domain *domain,
TALLOC_CTX *mem_ctx,
const DOM_SID *user_sid,
- WINBIND_USERINFO *user_info)
+ struct wbint_userinfo *user_info)
{
NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
struct policy_handle dom_pol, user_pol;
struct winbindd_cli_state *state)
{
DOM_SID sid;
- WINBIND_USERINFO user_info;
+ struct wbint_userinfo user_info;
NTSTATUS status;
/* Ensure null termination */
{
NTSTATUS status;
uint32 num_entries;
- WINBIND_USERINFO *info;
+ struct wbint_userinfo *info;
struct getpwent_user *name_list = NULL;
struct winbindd_domain *domain;
struct winbindd_methods *methods;