summaryrefslogtreecommitdiff
path: root/source3/winbindd
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2008-02-17 02:08:12 +0100
committerGünther Deschner <gd@samba.org>2008-02-17 02:12:00 +0100
commitc25958a046bbcfc13db200430e505ac4ee9b3f27 (patch)
tree17dee3afcae407131dd3f88393d578b0e3d132bb /source3/winbindd
parentc35ae5943d5622351f447a5c2a1311c05d4af0c7 (diff)
downloadsamba-c25958a046bbcfc13db200430e505ac4ee9b3f27.tar.gz
samba-c25958a046bbcfc13db200430e505ac4ee9b3f27.tar.bz2
samba-c25958a046bbcfc13db200430e505ac4ee9b3f27.zip
Use netr_SamInfo3 everywhere in winbindd.
Guenther (This used to be commit d9502eb75395131d5a8130ff2c4ebace106cb974)
Diffstat (limited to 'source3/winbindd')
-rw-r--r--source3/winbindd/winbindd_ads.c10
-rw-r--r--source3/winbindd/winbindd_cache.c2
-rw-r--r--source3/winbindd/winbindd_creds.c14
-rw-r--r--source3/winbindd/winbindd_pam.c203
-rw-r--r--source3/winbindd/winbindd_rpc.c14
-rw-r--r--source3/winbindd/winbindd_util.c18
6 files changed, 122 insertions, 139 deletions
diff --git a/source3/winbindd/winbindd_ads.c b/source3/winbindd/winbindd_ads.c
index db7ceca04d..0900d56987 100644
--- a/source3/winbindd/winbindd_ads.c
+++ b/source3/winbindd/winbindd_ads.c
@@ -421,7 +421,7 @@ static NTSTATUS query_user(struct winbindd_domain *domain,
char *sidstr;
uint32 group_rid;
NTSTATUS status = NT_STATUS_UNSUCCESSFUL;
- NET_USER_INFO_3 *user;
+ struct netr_SamInfo3 *user = NULL;
DEBUG(3,("ads: query_user\n"));
@@ -437,11 +437,11 @@ static NTSTATUS query_user(struct winbindd_domain *domain,
DEBUG(5,("query_user: Cache lookup succeeded for %s\n",
sid_string_dbg(sid)));
- sid_compose(&info->user_sid, &domain->sid, user->user_rid);
- sid_compose(&info->group_sid, &domain->sid, user->group_rid);
+ sid_compose(&info->user_sid, &domain->sid, user->base.rid);
+ sid_compose(&info->group_sid, &domain->sid, user->base.primary_gid);
- info->acct_name = unistr2_to_ascii_talloc(mem_ctx, &user->uni_user_name);
- info->full_name = unistr2_to_ascii_talloc(mem_ctx, &user->uni_full_name);
+ info->acct_name = talloc_strdup(mem_ctx, user->base.account_name.string);
+ info->full_name = talloc_strdup(mem_ctx, user->base.full_name.string);
nss_get_info_cached( domain, sid, mem_ctx, NULL, NULL,
&info->homedir, &info->shell, &info->full_name,
diff --git a/source3/winbindd/winbindd_cache.c b/source3/winbindd/winbindd_cache.c
index f235e401e8..4d81ee3960 100644
--- a/source3/winbindd/winbindd_cache.c
+++ b/source3/winbindd/winbindd_cache.c
@@ -2248,7 +2248,7 @@ static int traverse_fn(TDB_CONTEXT *the_tdb, TDB_DATA kbuf, TDB_DATA dbuf,
/* Invalidate the getpwnam and getgroups entries for a winbindd domain */
void wcache_invalidate_samlogon(struct winbindd_domain *domain,
- NET_USER_INFO_3 *info3)
+ struct netr_SamInfo3 *info3)
{
struct winbind_cache *cache;
diff --git a/source3/winbindd/winbindd_creds.c b/source3/winbindd/winbindd_creds.c
index 4dbace5bcc..9c7acd64e6 100644
--- a/source3/winbindd/winbindd_creds.c
+++ b/source3/winbindd/winbindd_creds.c
@@ -29,11 +29,11 @@
NTSTATUS winbindd_get_creds(struct winbindd_domain *domain,
TALLOC_CTX *mem_ctx,
const DOM_SID *sid,
- NET_USER_INFO_3 **info3,
+ struct netr_SamInfo3 **info3,
const uint8 *cached_nt_pass[NT_HASH_LEN],
const uint8 *cred_salt[NT_HASH_LEN])
{
- NET_USER_INFO_3 *info;
+ struct netr_SamInfo3 *info;
NTSTATUS status;
status = wcache_get_creds(domain, mem_ctx, sid, cached_nt_pass, cred_salt);
@@ -56,7 +56,7 @@ NTSTATUS winbindd_store_creds(struct winbindd_domain *domain,
TALLOC_CTX *mem_ctx,
const char *user,
const char *pass,
- NET_USER_INFO_3 *info3,
+ struct netr_SamInfo3 *info3,
const DOM_SID *user_sid)
{
NTSTATUS status;
@@ -66,10 +66,10 @@ NTSTATUS winbindd_store_creds(struct winbindd_domain *domain,
if (info3 != NULL) {
DOM_SID sid;
- sid_copy(&sid, &(info3->dom_sid.sid));
- sid_append_rid(&sid, info3->user_rid);
+ sid_copy(&sid, info3->base.domain_sid);
+ sid_append_rid(&sid, info3->base.rid);
sid_copy(&cred_sid, &sid);
- info3->user_flgs |= NETLOGON_CACHED_ACCOUNT;
+ info3->base.user_flags |= NETLOGON_CACHED_ACCOUNT;
} else if (user_sid != NULL) {
@@ -138,7 +138,7 @@ NTSTATUS winbindd_update_creds_by_info3(struct winbindd_domain *domain,
TALLOC_CTX *mem_ctx,
const char *user,
const char *pass,
- NET_USER_INFO_3 *info3)
+ struct netr_SamInfo3 *info3)
{
return winbindd_store_creds(domain, mem_ctx, user, pass, info3, NULL);
}
diff --git a/source3/winbindd/winbindd_pam.c b/source3/winbindd/winbindd_pam.c
index ad87fd2c67..79b4c764c3 100644
--- a/source3/winbindd/winbindd_pam.c
+++ b/source3/winbindd/winbindd_pam.c
@@ -29,83 +29,75 @@
static NTSTATUS append_info3_as_txt(TALLOC_CTX *mem_ctx,
struct winbindd_cli_state *state,
- NET_USER_INFO_3 *info3)
+ struct netr_SamInfo3 *info3)
{
char *ex;
size_t size;
uint32_t i;
state->response.data.auth.info3.logon_time =
- nt_time_to_unix(info3->logon_time);
+ nt_time_to_unix(info3->base.last_logon);
state->response.data.auth.info3.logoff_time =
- nt_time_to_unix(info3->logoff_time);
+ nt_time_to_unix(info3->base.last_logoff);
state->response.data.auth.info3.kickoff_time =
- nt_time_to_unix(info3->kickoff_time);
+ nt_time_to_unix(info3->base.acct_expiry);
state->response.data.auth.info3.pass_last_set_time =
- nt_time_to_unix(info3->pass_last_set_time);
+ nt_time_to_unix(info3->base.last_password_change);
state->response.data.auth.info3.pass_can_change_time =
- nt_time_to_unix(info3->pass_can_change_time);
+ nt_time_to_unix(info3->base.allow_password_change);
state->response.data.auth.info3.pass_must_change_time =
- nt_time_to_unix(info3->pass_must_change_time);
-
- state->response.data.auth.info3.logon_count = info3->logon_count;
- state->response.data.auth.info3.bad_pw_count = info3->bad_pw_count;
-
- state->response.data.auth.info3.user_rid = info3->user_rid;
- state->response.data.auth.info3.group_rid = info3->group_rid;
- sid_to_fstring(state->response.data.auth.info3.dom_sid, &(info3->dom_sid.sid));
-
- state->response.data.auth.info3.num_groups = info3->num_groups;
- state->response.data.auth.info3.user_flgs = info3->user_flgs;
-
- state->response.data.auth.info3.acct_flags = info3->acct_flags;
- state->response.data.auth.info3.num_other_sids = info3->num_other_sids;
-
- unistr2_to_ascii(state->response.data.auth.info3.user_name,
- &info3->uni_user_name,
- sizeof(state->response.data.auth.info3.user_name));
- unistr2_to_ascii(state->response.data.auth.info3.full_name,
- &info3->uni_full_name,
- sizeof(state->response.data.auth.info3.full_name));
- unistr2_to_ascii(state->response.data.auth.info3.logon_script,
- &info3->uni_logon_script,
- sizeof(state->response.data.auth.info3.logon_script));
- unistr2_to_ascii(state->response.data.auth.info3.profile_path,
- &info3->uni_profile_path,
- sizeof(state->response.data.auth.info3.profile_path));
- unistr2_to_ascii(state->response.data.auth.info3.home_dir,
- &info3->uni_home_dir,
- sizeof(state->response.data.auth.info3.home_dir));
- unistr2_to_ascii(state->response.data.auth.info3.dir_drive,
- &info3->uni_dir_drive,
- sizeof(state->response.data.auth.info3.dir_drive));
-
- unistr2_to_ascii(state->response.data.auth.info3.logon_srv,
- &info3->uni_logon_srv,
- sizeof(state->response.data.auth.info3.logon_srv));
- unistr2_to_ascii(state->response.data.auth.info3.logon_dom,
- &info3->uni_logon_dom,
- sizeof(state->response.data.auth.info3.logon_dom));
+ nt_time_to_unix(info3->base.force_password_change);
+
+ state->response.data.auth.info3.logon_count = info3->base.logon_count;
+ state->response.data.auth.info3.bad_pw_count = info3->base.bad_password_count;
+
+ state->response.data.auth.info3.user_rid = info3->base.rid;
+ state->response.data.auth.info3.group_rid = info3->base.primary_gid;
+ sid_to_fstring(state->response.data.auth.info3.dom_sid, info3->base.domain_sid);
+
+ state->response.data.auth.info3.num_groups = info3->base.groups.count;
+ state->response.data.auth.info3.user_flgs = info3->base.user_flags;
+
+ state->response.data.auth.info3.acct_flags = info3->base.acct_flags;
+ state->response.data.auth.info3.num_other_sids = info3->sidcount;
+
+ fstrcpy(state->response.data.auth.info3.user_name,
+ info3->base.account_name.string);
+ fstrcpy(state->response.data.auth.info3.full_name,
+ info3->base.full_name.string);
+ fstrcpy(state->response.data.auth.info3.logon_script,
+ info3->base.logon_script.string);
+ fstrcpy(state->response.data.auth.info3.profile_path,
+ info3->base.profile_path.string);
+ fstrcpy(state->response.data.auth.info3.home_dir,
+ info3->base.home_directory.string);
+ fstrcpy(state->response.data.auth.info3.dir_drive,
+ info3->base.home_drive.string);
+
+ fstrcpy(state->response.data.auth.info3.logon_srv,
+ info3->base.logon_server.string);
+ fstrcpy(state->response.data.auth.info3.logon_dom,
+ info3->base.domain.string);
ex = talloc_strdup(mem_ctx, "");
NT_STATUS_HAVE_NO_MEMORY(ex);
- for (i=0; i < info3->num_groups; i++) {
+ for (i=0; i < info3->base.groups.count; i++) {
ex = talloc_asprintf_append_buffer(ex, "0x%08X:0x%08X\n",
- info3->gids[i].g_rid,
- info3->gids[i].attr);
+ info3->base.groups.rids[i].rid,
+ info3->base.groups.rids[i].attributes);
NT_STATUS_HAVE_NO_MEMORY(ex);
}
- for (i=0; i < info3->num_other_sids; i++) {
+ for (i=0; i < info3->sidcount; i++) {
char *sid;
- sid = dom_sid_string(mem_ctx, &info3->other_sids[i].sid);
+ sid = dom_sid_string(mem_ctx, info3->sids[i].sid);
NT_STATUS_HAVE_NO_MEMORY(sid);
ex = talloc_asprintf_append_buffer(ex, "%s:0x%08X\n",
sid,
- info3->other_sids_attrib[i]);
+ info3->sids[i].attributes);
NT_STATUS_HAVE_NO_MEMORY(ex);
talloc_free(sid);
@@ -158,7 +150,7 @@ static NTSTATUS append_info3_as_ndr(TALLOC_CTX *mem_ctx,
static NTSTATUS append_unix_username(TALLOC_CTX *mem_ctx,
struct winbindd_cli_state *state,
- const NET_USER_INFO_3 *info3,
+ const struct netr_SamInfo3 *info3,
const char *name_domain,
const char *name_user)
{
@@ -168,15 +160,15 @@ static NTSTATUS append_unix_username(TALLOC_CTX *mem_ctx,
fstring username_out;
const char *nt_username, *nt_domain;
- if (!(nt_domain = unistr2_to_ascii_talloc(mem_ctx,
- &info3->uni_logon_dom))) {
+ nt_domain = talloc_strdup(mem_ctx, info3->base.domain.string);
+ if (!nt_domain) {
/* If the server didn't give us one, just use the one
* we sent them */
nt_domain = name_domain;
}
- if (!(nt_username = unistr2_to_ascii_talloc(mem_ctx,
- &info3->uni_user_name))) {
+ nt_username = talloc_strdup(mem_ctx, info3->base.account_name.string);
+ if (!nt_username) {
/* If the server didn't give us one, just use the one
* we sent them */
nt_username = name_user;
@@ -200,7 +192,7 @@ static NTSTATUS append_unix_username(TALLOC_CTX *mem_ctx,
static NTSTATUS append_afs_token(TALLOC_CTX *mem_ctx,
struct winbindd_cli_state *state,
- const NET_USER_INFO_3 *info3,
+ const struct netr_SamInfo3 *info3,
const char *name_domain,
const char *name_user)
{
@@ -224,8 +216,8 @@ static NTSTATUS append_afs_token(TALLOC_CTX *mem_ctx,
DOM_SID user_sid;
fstring sidstr;
- sid_copy(&user_sid, &info3->dom_sid.sid);
- sid_append_rid(&user_sid, info3->user_rid);
+ sid_copy(&user_sid, info3->base.domain_sid);
+ sid_append_rid(&user_sid, info3->base.rid);
sid_to_fstring(sidstr, &user_sid);
afsname = talloc_string_sub(mem_ctx, afsname,
"%s", sidstr);
@@ -262,7 +254,7 @@ static NTSTATUS append_afs_token(TALLOC_CTX *mem_ctx,
}
static NTSTATUS check_info3_in_group(TALLOC_CTX *mem_ctx,
- NET_USER_INFO_3 *info3,
+ struct netr_SamInfo3 *info3,
const char *group_sid)
/**
* Check whether a user belongs to a group or list of groups.
@@ -576,7 +568,7 @@ static uid_t get_uid_from_state(struct winbindd_cli_state *state)
static NTSTATUS winbindd_raw_kerberos_login(struct winbindd_domain *domain,
struct winbindd_cli_state *state,
- NET_USER_INFO_3 **info3)
+ struct netr_SamInfo3 **info3)
{
#ifdef HAVE_KRB5
NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
@@ -765,7 +757,7 @@ static bool check_request_flags(uint32_t flags)
****************************************************************/
static NTSTATUS append_data(struct winbindd_cli_state *state,
- NET_USER_INFO_3 *info3,
+ struct netr_SamInfo3 *info3,
const char *name_domain,
const char *name_user)
{
@@ -774,14 +766,14 @@ static NTSTATUS append_data(struct winbindd_cli_state *state,
if (flags & WBFLAG_PAM_USER_SESSION_KEY) {
memcpy(state->response.data.auth.user_session_key,
- info3->user_sess_key,
+ info3->base.key.key,
sizeof(state->response.data.auth.user_session_key)
/* 16 */);
}
if (flags & WBFLAG_PAM_LMKEY) {
memcpy(state->response.data.auth.first_8_lm_hash,
- info3->lm_sess_key,
+ info3->base.LMSessKey.key,
sizeof(state->response.data.auth.first_8_lm_hash)
/* 8 */);
}
@@ -882,7 +874,7 @@ void winbindd_pam_auth(struct winbindd_cli_state *state)
NTSTATUS winbindd_dual_pam_auth_cached(struct winbindd_domain *domain,
struct winbindd_cli_state *state,
- NET_USER_INFO_3 **info3)
+ struct netr_SamInfo3 **info3)
{
NTSTATUS result = NT_STATUS_LOGON_FAILURE;
uint16 max_allowed_bad_attempts;
@@ -892,7 +884,7 @@ NTSTATUS winbindd_dual_pam_auth_cached(struct winbindd_domain *domain,
uchar new_nt_pass[NT_HASH_LEN];
const uint8 *cached_nt_pass;
const uint8 *cached_salt;
- NET_USER_INFO_3 *my_info3;
+ struct netr_SamInfo3 *my_info3;
time_t kickoff_time, must_change_time;
bool password_good = False;
#ifdef HAVE_KRB5
@@ -964,43 +956,43 @@ NTSTATUS winbindd_dual_pam_auth_cached(struct winbindd_domain *domain,
/* User *DOES* know the password, update logon_time and reset
* bad_pw_count */
- my_info3->user_flgs |= NETLOGON_CACHED_ACCOUNT;
+ my_info3->base.user_flags |= NETLOGON_CACHED_ACCOUNT;
- if (my_info3->acct_flags & ACB_AUTOLOCK) {
+ if (my_info3->base.acct_flags & ACB_AUTOLOCK) {
return NT_STATUS_ACCOUNT_LOCKED_OUT;
}
- if (my_info3->acct_flags & ACB_DISABLED) {
+ if (my_info3->base.acct_flags & ACB_DISABLED) {
return NT_STATUS_ACCOUNT_DISABLED;
}
- if (my_info3->acct_flags & ACB_WSTRUST) {
+ if (my_info3->base.acct_flags & ACB_WSTRUST) {
return NT_STATUS_NOLOGON_WORKSTATION_TRUST_ACCOUNT;
}
- if (my_info3->acct_flags & ACB_SVRTRUST) {
+ if (my_info3->base.acct_flags & ACB_SVRTRUST) {
return NT_STATUS_NOLOGON_SERVER_TRUST_ACCOUNT;
}
- if (my_info3->acct_flags & ACB_DOMTRUST) {
+ if (my_info3->base.acct_flags & ACB_DOMTRUST) {
return NT_STATUS_NOLOGON_INTERDOMAIN_TRUST_ACCOUNT;
}
- if (!(my_info3->acct_flags & ACB_NORMAL)) {
+ if (!(my_info3->base.acct_flags & ACB_NORMAL)) {
DEBUG(0,("winbindd_dual_pam_auth_cached: whats wrong with that one?: 0x%08x\n",
- my_info3->acct_flags));
+ my_info3->base.acct_flags));
return NT_STATUS_LOGON_FAILURE;
}
- kickoff_time = nt_time_to_unix(my_info3->kickoff_time);
+ kickoff_time = nt_time_to_unix(my_info3->base.acct_expiry);
if (kickoff_time != 0 && time(NULL) > kickoff_time) {
return NT_STATUS_ACCOUNT_EXPIRED;
}
- must_change_time = nt_time_to_unix(my_info3->pass_must_change_time);
+ must_change_time = nt_time_to_unix(my_info3->base.force_password_change);
if (must_change_time != 0 && must_change_time < time(NULL)) {
/* we allow grace logons when the password has expired */
- my_info3->user_flgs |= NETLOGON_GRACE_LOGON;
+ my_info3->base.user_flags |= NETLOGON_GRACE_LOGON;
/* return NT_STATUS_PASSWORD_EXPIRED; */
goto success;
}
@@ -1071,8 +1063,8 @@ NTSTATUS winbindd_dual_pam_auth_cached(struct winbindd_domain *domain,
/* FIXME: we possibly should handle logon hours as well (does xp when
* offline?) see auth/auth_sam.c:sam_account_ok for details */
- unix_to_nt_time(&my_info3->logon_time, time(NULL));
- my_info3->bad_pw_count = 0;
+ unix_to_nt_time(&my_info3->base.last_logon, time(NULL));
+ my_info3->base.bad_password_count = 0;
result = winbindd_update_creds_by_info3(domain,
state->mem_ctx,
@@ -1099,14 +1091,14 @@ NTSTATUS winbindd_dual_pam_auth_cached(struct winbindd_domain *domain,
}
/* increase counter */
- my_info3->bad_pw_count++;
+ my_info3->base.bad_password_count++;
if (max_allowed_bad_attempts == 0) {
goto failed;
}
/* lockout user */
- if (my_info3->bad_pw_count >= max_allowed_bad_attempts) {
+ if (my_info3->base.bad_password_count >= max_allowed_bad_attempts) {
uint32 password_properties;
@@ -1115,9 +1107,9 @@ NTSTATUS winbindd_dual_pam_auth_cached(struct winbindd_domain *domain,
DEBUG(10,("winbindd_dual_pam_auth_cached: failed to get password properties.\n"));
}
- if ((my_info3->user_rid != DOMAIN_USER_RID_ADMIN) ||
+ if ((my_info3->base.rid != DOMAIN_USER_RID_ADMIN) ||
(password_properties & DOMAIN_PASSWORD_LOCKOUT_ADMINS)) {
- my_info3->acct_flags |= ACB_AUTOLOCK;
+ my_info3->base.acct_flags |= ACB_AUTOLOCK;
}
}
@@ -1138,7 +1130,7 @@ failed:
NTSTATUS winbindd_dual_pam_auth_kerberos(struct winbindd_domain *domain,
struct winbindd_cli_state *state,
- NET_USER_INFO_3 **info3)
+ struct netr_SamInfo3 **info3)
{
struct winbindd_domain *contact_domain;
fstring name_domain, name_user;
@@ -1197,7 +1189,7 @@ done:
NTSTATUS winbindd_dual_pam_auth_samlogon(struct winbindd_domain *domain,
struct winbindd_cli_state *state,
- NET_USER_INFO_3 **info3)
+ struct netr_SamInfo3 **info3)
{
struct rpc_pipe_client *netlogon_pipe;
@@ -1211,18 +1203,10 @@ NTSTATUS winbindd_dual_pam_auth_samlogon(struct winbindd_domain *domain,
fstring name_domain, name_user;
bool retry;
NTSTATUS result;
- NET_USER_INFO_3 *my_info3;
-
- ZERO_STRUCTP(info3);
+ struct netr_SamInfo3 *my_info3 = NULL;
*info3 = NULL;
- my_info3 = TALLOC_ZERO_P(state->mem_ctx, NET_USER_INFO_3);
- if (my_info3 == NULL) {
- return NT_STATUS_NO_MEMORY;
- }
-
-
DEBUG(10,("winbindd_dual_pam_auth_samlogon\n"));
/* Parse domain and username */
@@ -1330,7 +1314,7 @@ NTSTATUS winbindd_dual_pam_auth_samlogon(struct winbindd_domain *domain,
chal,
lm_resp,
nt_resp,
- my_info3);
+ &my_info3);
attempts += 1;
/* We have to try a second time as cm_connect_netlogon
@@ -1364,7 +1348,7 @@ NTSTATUS winbindd_dual_pam_auth_samlogon(struct winbindd_domain *domain,
* caller, we look up the account flags ourselve - gd */
if ((state->request.flags & WBFLAG_PAM_INFO3_TEXT) &&
- (my_info3->acct_flags == 0) && NT_STATUS_IS_OK(result)) {
+ (my_info3->base.acct_flags == 0) && NT_STATUS_IS_OK(result)) {
struct rpc_pipe_client *samr_pipe;
POLICY_HND samr_domain_handle, user_pol;
@@ -1384,7 +1368,7 @@ NTSTATUS winbindd_dual_pam_auth_samlogon(struct winbindd_domain *domain,
status_tmp = rpccli_samr_OpenUser(samr_pipe, state->mem_ctx,
&samr_domain_handle,
MAXIMUM_ALLOWED_ACCESS,
- my_info3->user_rid,
+ my_info3->base.rid,
&user_pol);
if (!NT_STATUS_IS_OK(status_tmp)) {
@@ -1412,7 +1396,7 @@ NTSTATUS winbindd_dual_pam_auth_samlogon(struct winbindd_domain *domain,
goto done;
}
- my_info3->acct_flags = acct_flags;
+ my_info3->base.acct_flags = acct_flags;
DEBUG(10,("successfully retrieved acct_flags 0x%x\n", acct_flags));
@@ -1430,8 +1414,8 @@ enum winbindd_result winbindd_dual_pam_auth(struct winbindd_domain *domain,
NTSTATUS result = NT_STATUS_LOGON_FAILURE;
NTSTATUS krb5_result = NT_STATUS_OK;
fstring name_domain, name_user;
- NET_USER_INFO_3 *info3 = NULL;
-
+ struct netr_SamInfo3 *info3 = NULL;
+
/* Ensure null termination */
state->request.data.auth.user[sizeof(state->request.data.auth.user)-1]='\0';
@@ -1526,7 +1510,7 @@ sam_logon:
DEBUG(10,("winbindd_dual_pam_auth_samlogon succeeded\n"));
/* add the Krb5 err if we have one */
if ( NT_STATUS_EQUAL(krb5_result, NT_STATUS_TIME_DIFFERENCE_AT_DC ) ) {
- info3->user_flgs |= LOGON_KRB5_FAIL_CLOCK_SKEW;
+ info3->base.user_flags |= LOGON_KRB5_FAIL_CLOCK_SKEW;
}
goto process_result;
}
@@ -1586,8 +1570,8 @@ process_result:
the cache entry by storing the seq_num for the wrong
domain). */
if ( domain->primary ) {
- sid_compose(&user_sid, &info3->dom_sid.sid,
- info3->user_rid);
+ sid_compose(&user_sid, info3->base.domain_sid,
+ info3->base.rid);
cache_name2sid(domain, name_domain, name_user,
SID_NAME_USER, &user_sid);
}
@@ -1752,7 +1736,7 @@ enum winbindd_result winbindd_dual_pam_auth_crap(struct winbindd_domain *domain,
struct winbindd_cli_state *state)
{
NTSTATUS result;
- NET_USER_INFO_3 info3;
+ struct netr_SamInfo3 *info3 = NULL;
struct rpc_pipe_client *netlogon_pipe;
const char *name_user = NULL;
const char *name_domain = NULL;
@@ -1830,7 +1814,6 @@ enum winbindd_result winbindd_dual_pam_auth_crap(struct winbindd_domain *domain,
}
do {
- ZERO_STRUCT(info3);
retry = False;
netlogon_pipe = NULL;
@@ -1884,12 +1867,12 @@ enum winbindd_result winbindd_dual_pam_auth_crap(struct winbindd_domain *domain,
if (NT_STATUS_IS_OK(result)) {
- netsamlogon_cache_store(name_user, &info3);
- wcache_invalidate_samlogon(find_domain_from_name(name_domain), &info3);
+ netsamlogon_cache_store(name_user, info3);
+ wcache_invalidate_samlogon(find_domain_from_name(name_domain), info3);
/* Check if the user is in the right group */
- if (!NT_STATUS_IS_OK(result = check_info3_in_group(state->mem_ctx, &info3,
+ if (!NT_STATUS_IS_OK(result = check_info3_in_group(state->mem_ctx, info3,
state->request.data.auth_crap.require_membership_of_sid))) {
DEBUG(3, ("User %s is not in the required group (%s), so "
"crap authentication is rejected\n",
@@ -1898,7 +1881,7 @@ enum winbindd_result winbindd_dual_pam_auth_crap(struct winbindd_domain *domain,
goto done;
}
- result = append_data(state, &info3, name_domain, name_user);
+ result = append_data(state, info3, name_domain, name_user);
if (!NT_STATUS_IS_OK(result)) {
goto done;
}
diff --git a/source3/winbindd/winbindd_rpc.c b/source3/winbindd/winbindd_rpc.c
index 585923410f..f818772ce7 100644
--- a/source3/winbindd/winbindd_rpc.c
+++ b/source3/winbindd/winbindd_rpc.c
@@ -429,7 +429,7 @@ static NTSTATUS query_user(struct winbindd_domain *domain,
POLICY_HND dom_pol, user_pol;
union samr_UserInfo *info = NULL;
uint32 user_rid;
- NET_USER_INFO_3 *user;
+ struct netr_SamInfo3 *user;
struct rpc_pipe_client *cli;
DEBUG(3,("rpc: query_user sid=%s\n", sid_string_dbg(user_sid)));
@@ -449,14 +449,14 @@ static NTSTATUS query_user(struct winbindd_domain *domain,
DEBUG(5,("query_user: Cache lookup succeeded for %s\n",
sid_string_dbg(user_sid)));
- sid_compose(&user_info->user_sid, &domain->sid, user->user_rid);
+ sid_compose(&user_info->user_sid, &domain->sid, user->base.rid);
sid_compose(&user_info->group_sid, &domain->sid,
- user->group_rid);
+ user->base.primary_gid);
- user_info->acct_name = unistr2_to_ascii_talloc(mem_ctx,
- &user->uni_user_name);
- user_info->full_name = unistr2_to_ascii_talloc(mem_ctx,
- &user->uni_full_name);
+ user_info->acct_name = talloc_strdup(mem_ctx,
+ user->base.account_name.string);
+ user_info->full_name = talloc_strdup(mem_ctx,
+ user->base.full_name.string);
TALLOC_FREE(user);
diff --git a/source3/winbindd/winbindd_util.c b/source3/winbindd/winbindd_util.c
index 7933ecf63e..038bafbe4e 100644
--- a/source3/winbindd/winbindd_util.c
+++ b/source3/winbindd/winbindd_util.c
@@ -1272,7 +1272,7 @@ NTSTATUS lookup_usergroups_cached(struct winbindd_domain *domain,
const DOM_SID *user_sid,
uint32 *p_num_groups, DOM_SID **user_sids)
{
- NET_USER_INFO_3 *info3 = NULL;
+ struct netr_SamInfo3 *info3 = NULL;
NTSTATUS status = NT_STATUS_NO_MEMORY;
int i;
size_t num_groups = 0;
@@ -1290,13 +1290,13 @@ NTSTATUS lookup_usergroups_cached(struct winbindd_domain *domain,
return NT_STATUS_OBJECT_NAME_NOT_FOUND;
}
- if (info3->num_groups == 0) {
+ if (info3->base.groups.count == 0) {
TALLOC_FREE(info3);
return NT_STATUS_UNSUCCESSFUL;
}
/* always add the primary group to the sid array */
- sid_compose(&primary_group, &info3->dom_sid.sid, info3->user_rid);
+ sid_compose(&primary_group, info3->base.domain_sid, info3->base.rid);
status = add_sid_to_array(mem_ctx, &primary_group, user_sids,
&num_groups);
@@ -1305,9 +1305,9 @@ NTSTATUS lookup_usergroups_cached(struct winbindd_domain *domain,
return status;
}
- for (i=0; i<info3->num_groups; i++) {
- sid_copy(&group_sid, &info3->dom_sid.sid);
- sid_append_rid(&group_sid, info3->gids[i].g_rid);
+ for (i=0; i < info3->base.groups.count; i++) {
+ sid_copy(&group_sid, info3->base.domain_sid);
+ sid_append_rid(&group_sid, info3->base.groups.rids[i].rid);
status = add_sid_to_array(mem_ctx, &group_sid, user_sids,
&num_groups);
@@ -1319,13 +1319,13 @@ NTSTATUS lookup_usergroups_cached(struct winbindd_domain *domain,
/* Add any Universal groups in the other_sids list */
- for (i=0; i<info3->num_other_sids; i++) {
+ for (i=0; i < info3->sidcount; i++) {
/* Skip Domain local groups outside our domain.
We'll get these from the getsidaliases() RPC call. */
- if (info3->other_sids_attrib[i] & SE_GROUP_RESOURCE)
+ if (info3->sids[i].attributes & SE_GROUP_RESOURCE)
continue;
- status = add_sid_to_array(mem_ctx, &info3->other_sids[i].sid,
+ status = add_sid_to_array(mem_ctx, info3->sids[i].sid,
user_sids, &num_groups);
if (!NT_STATUS_IS_OK(status)) {
TALLOC_FREE(info3);