[SCM] Samba Shared Repository - branch v3-2-test updated -
initial-v3-2-test-2112-gd9cec29
Günther Deschner
gd at samba.org
Tue Feb 12 17:27:39 GMT 2008
The branch, v3-2-test has been updated
via d9cec295bf55b3a7e16f548cc4bf64ce474b41e9 (commit)
via a9ff6760901a489ff8877717bdd5a2218154498f (commit)
via 5bfa5cac639fc0821bfe38b4cd1f50b372c2330e (commit)
from c6d9650930510982ef4e4759272dba573fc81067 (commit)
http://gitweb.samba.org/?samba.git;a=shortlog;h=v3-2-test
- Log -----------------------------------------------------------------
commit d9cec295bf55b3a7e16f548cc4bf64ce474b41e9
Author: Günther Deschner <gd at samba.org>
Date: Tue Feb 12 18:21:52 2008 +0100
Use every
commit a9ff6760901a489ff8877717bdd5a2218154498f
Author: Günther Deschner <gd at samba.org>
Date: Tue Feb 12 18:13:30 2008 +0100
Use rpccli_samr_QueryUserInfo in net and winbindd.
Guenther
commit 5bfa5cac639fc0821bfe38b4cd1f50b372c2330e
Author: Günther Deschner <gd at samba.org>
Date: Tue Feb 12 18:04:07 2008 +0100
Use rpccli_samr_QueryUserInfo() in rpcclient.
Guenther
-----------------------------------------------------------------------
Summary of changes:
source/libnet/libnet_join.c | 11 +++--
source/rpcclient/cmd_samr.c | 116 ++++++++++++++++------------------------
source/utils/net_domain.c | 10 +++-
source/utils/net_rpc.c | 83 +++++++++++++++--------------
source/winbindd/winbindd_pam.c | 12 ++--
source/winbindd/winbindd_rpc.c | 18 ++++---
6 files changed, 119 insertions(+), 131 deletions(-)
Changeset truncated at 500 lines:
diff --git a/source/libnet/libnet_join.c b/source/libnet/libnet_join.c
index e6fcc76..996b9e6 100644
--- a/source/libnet/libnet_join.c
+++ b/source/libnet/libnet_join.c
@@ -831,11 +831,12 @@ static NTSTATUS libnet_join_unjoindomain_rpc(TALLOC_CTX *mem_ctx,
NTSTATUS status = NT_STATUS_UNSUCCESSFUL;
char *acct_name;
uint32 user_rid;
- SAM_USERINFO_CTR ctr, *qctr = NULL;
+ SAM_USERINFO_CTR ctr;
SAM_USER_INFO_16 p16;
struct lsa_String lsa_acct_name;
struct samr_Ids user_rids;
struct samr_Ids name_types;
+ union samr_UserInfo *info = NULL;
status = cli_full_connection(&cli, NULL,
r->in.dc_name,
@@ -904,8 +905,10 @@ static NTSTATUS libnet_join_unjoindomain_rpc(TALLOC_CTX *mem_ctx,
goto done;
}
- status = rpccli_samr_query_userinfo(pipe_hnd, mem_ctx,
- &user_pol, 16, &qctr);
+ status = rpccli_samr_QueryUserInfo(pipe_hnd, mem_ctx,
+ &user_pol,
+ 16,
+ &info);
if (!NT_STATUS_IS_OK(status)) {
rpccli_samr_Close(pipe_hnd, mem_ctx, &user_pol);
goto done;
@@ -915,7 +918,7 @@ static NTSTATUS libnet_join_unjoindomain_rpc(TALLOC_CTX *mem_ctx,
ctr.switch_value = 16;
ctr.info.id16 = &p16;
- p16.acb_info = qctr->info.id16->acb_info | ACB_DISABLED;
+ p16.acb_info = info->info16.acct_flags | ACB_DISABLED;
status = rpccli_samr_set_userinfo2(pipe_hnd, mem_ctx, &user_pol, 16,
&cli->user_session_key, &ctr);
diff --git a/source/rpcclient/cmd_samr.c b/source/rpcclient/cmd_samr.c
index c644c15..57f0758 100644
--- a/source/rpcclient/cmd_samr.c
+++ b/source/rpcclient/cmd_samr.c
@@ -32,97 +32,73 @@ static void init_lsa_String(struct lsa_String *name, const char *s)
}
/****************************************************************************
- display sam_user_info_7 structure
+ display samr_user_info_7 structure
****************************************************************************/
-static void display_sam_user_info_7(SAM_USER_INFO_7 *usr)
+static void display_samr_user_info_7(struct samr_UserInfo7 *r)
{
- fstring temp;
-
- unistr2_to_ascii(temp, &usr->uni_name, sizeof(temp));
- printf("\tUser Name :\t%s\n", temp);
+ printf("\tUser Name :\t%s\n", r->account_name.string);
}
/****************************************************************************
- display sam_user_info_9 structure
+ display samr_user_info_9 structure
****************************************************************************/
-static void display_sam_user_info_9(SAM_USER_INFO_9 *usr)
+static void display_samr_user_info_9(struct samr_UserInfo9 *r)
{
- printf("\tPrimary group RID :\tox%x\n", usr->rid_group);
+ printf("\tPrimary group RID :\tox%x\n", r->primary_gid);
}
/****************************************************************************
- display sam_user_info_16 structure
+ display samr_user_info_16 structure
****************************************************************************/
-static void display_sam_user_info_16(SAM_USER_INFO_16 *usr)
+static void display_samr_user_info_16(struct samr_UserInfo16 *r)
{
- printf("\tAcct Flags :\tox%x\n", usr->acb_info);
+ printf("\tAcct Flags :\tox%x\n", r->acct_flags);
}
/****************************************************************************
- display sam_user_info_21 structure
+ display samr_user_info_21 structure
****************************************************************************/
-static void display_sam_user_info_21(SAM_USER_INFO_21 *usr)
+static void display_samr_user_info_21(struct samr_UserInfo21 *r)
{
- fstring temp;
-
- unistr2_to_ascii(temp, &usr->uni_user_name, sizeof(temp));
- printf("\tUser Name :\t%s\n", temp);
-
- unistr2_to_ascii(temp, &usr->uni_full_name, sizeof(temp));
- printf("\tFull Name :\t%s\n", temp);
-
- unistr2_to_ascii(temp, &usr->uni_home_dir, sizeof(temp));
- printf("\tHome Drive :\t%s\n", temp);
-
- unistr2_to_ascii(temp, &usr->uni_dir_drive, sizeof(temp));
- printf("\tDir Drive :\t%s\n", temp);
-
- unistr2_to_ascii(temp, &usr->uni_profile_path, sizeof(temp));
- printf("\tProfile Path:\t%s\n", temp);
-
- unistr2_to_ascii(temp, &usr->uni_logon_script, sizeof(temp));
- printf("\tLogon Script:\t%s\n", temp);
-
- unistr2_to_ascii(temp, &usr->uni_acct_desc, sizeof(temp));
- printf("\tDescription :\t%s\n", temp);
-
- unistr2_to_ascii(temp, &usr->uni_workstations, sizeof(temp));
- printf("\tWorkstations:\t%s\n", temp);
-
- unistr2_to_ascii(temp, &usr->uni_comment, sizeof(temp));
- printf("\tUnknown Str :\t%s\n", temp);
-
- unistr2_to_ascii(temp, &usr->uni_munged_dial, sizeof(temp));
- printf("\tRemote Dial :\t%s\n", temp);
+ printf("\tUser Name :\t%s\n", r->account_name.string);
+ printf("\tFull Name :\t%s\n", r->full_name.string);
+ printf("\tHome Drive :\t%s\n", r->home_directory.string);
+ printf("\tDir Drive :\t%s\n", r->home_drive.string);
+ printf("\tProfile Path:\t%s\n", r->profile_path.string);
+ printf("\tLogon Script:\t%s\n", r->logon_script.string);
+ printf("\tDescription :\t%s\n", r->description.string);
+ printf("\tWorkstations:\t%s\n", r->workstations.string);
+ printf("\tComment :\t%s\n", r->comment.string);
+ printf("\tRemote Dial :\t%s\n", r->parameters.string);
printf("\tLogon Time :\t%s\n",
- http_timestring(nt_time_to_unix(usr->logon_time)));
+ http_timestring(nt_time_to_unix(r->last_logon)));
printf("\tLogoff Time :\t%s\n",
- http_timestring(nt_time_to_unix(usr->logoff_time)));
+ http_timestring(nt_time_to_unix(r->last_logoff)));
printf("\tKickoff Time :\t%s\n",
- http_timestring(nt_time_to_unix(usr->kickoff_time)));
+ http_timestring(nt_time_to_unix(r->acct_expiry)));
printf("\tPassword last set Time :\t%s\n",
- http_timestring(nt_time_to_unix(usr->pass_last_set_time)));
+ http_timestring(nt_time_to_unix(r->last_password_change)));
printf("\tPassword can change Time :\t%s\n",
- http_timestring(nt_time_to_unix(usr->pass_can_change_time)));
+ http_timestring(nt_time_to_unix(r->allow_password_change)));
printf("\tPassword must change Time:\t%s\n",
- http_timestring(nt_time_to_unix(usr->pass_must_change_time)));
+ http_timestring(nt_time_to_unix(r->force_password_change)));
printf("\tunknown_2[0..31]...\n"); /* user passwords? */
- printf("\tuser_rid :\t0x%x\n" , usr->user_rid ); /* User ID */
- printf("\tgroup_rid:\t0x%x\n" , usr->group_rid); /* Group ID */
- printf("\tacb_info :\t0x%08x\n", usr->acb_info ); /* Account Control Info */
+ printf("\tuser_rid :\t0x%x\n" , r->rid); /* User ID */
+ printf("\tgroup_rid:\t0x%x\n" , r->primary_gid); /* Group ID */
+ printf("\tacb_info :\t0x%08x\n", r->acct_flags); /* Account Control Info */
- printf("\tfields_present:\t0x%08x\n", usr->fields_present); /* 0x00ff ffff */
- printf("\tlogon_divs:\t%d\n", usr->logon_divs); /* 0x0000 00a8 which is 168 which is num hrs in a week */
- printf("\tbad_password_count:\t0x%08x\n", usr->bad_password_count);
- printf("\tlogon_count:\t0x%08x\n", usr->logon_count);
+ printf("\tfields_present:\t0x%08x\n", r->fields_present); /* 0x00ff ffff */
+ printf("\tlogon_divs:\t%d\n", r->logon_hours.units_per_week); /* 0x0000 00a8 which is 168 which is num hrs in a week */
+ printf("\tbad_password_count:\t0x%08x\n", r->bad_password_count);
+ printf("\tlogon_count:\t0x%08x\n", r->logon_count);
printf("\tpadding1[0..7]...\n");
- if (usr->ptr_logon_hrs) {
- printf("\tlogon_hrs[0..%d]...\n", usr->logon_hrs.len);
+ if (r->logon_hours.bits) {
+ printf("\tlogon_hrs[0..%d]...\n", r->logon_hours.units_per_week/8);
}
}
@@ -314,7 +290,7 @@ static NTSTATUS cmd_samr_query_user(struct rpc_pipe_client *cli,
NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
uint32 info_level = 21;
uint32 access_mask = MAXIMUM_ALLOWED_ACCESS;
- SAM_USERINFO_CTR *user_ctr;
+ union samr_UserInfo *info = NULL;
fstring server;
uint32 user_rid = 0;
@@ -384,26 +360,26 @@ static NTSTATUS cmd_samr_query_user(struct rpc_pipe_client *cli,
if (!NT_STATUS_IS_OK(result))
goto done;
- ZERO_STRUCT(user_ctr);
-
- result = rpccli_samr_query_userinfo(cli, mem_ctx, &user_pol,
- info_level, &user_ctr);
+ result = rpccli_samr_QueryUserInfo(cli, mem_ctx,
+ &user_pol,
+ info_level,
+ &info);
if (!NT_STATUS_IS_OK(result))
goto done;
- switch (user_ctr->switch_value) {
+ switch (info_level) {
case 7:
- display_sam_user_info_7(user_ctr->info.id7);
+ display_samr_user_info_7(&info->info7);
break;
case 9:
- display_sam_user_info_9(user_ctr->info.id9);
+ display_samr_user_info_9(&info->info9);
break;
case 16:
- display_sam_user_info_16(user_ctr->info.id16);
+ display_samr_user_info_16(&info->info16);
break;
case 21:
- display_sam_user_info_21(user_ctr->info.id21);
+ display_samr_user_info_21(&info->info21);
break;
default:
printf("Unsupported infolevel: %d\n", info_level);
diff --git a/source/utils/net_domain.c b/source/utils/net_domain.c
index c545fd9..820b3ae 100644
--- a/source/utils/net_domain.c
+++ b/source/utils/net_domain.c
@@ -57,11 +57,12 @@ NTSTATUS netdom_leave_domain( TALLOC_CTX *mem_ctx, struct cli_state *cli,
NTSTATUS status = NT_STATUS_UNSUCCESSFUL;
char *acct_name;
uint32 user_rid;
- SAM_USERINFO_CTR ctr, *qctr = NULL;
+ SAM_USERINFO_CTR ctr;
SAM_USER_INFO_16 p16;
struct lsa_String lsa_acct_name;
struct samr_Ids user_rids;
struct samr_Ids name_types;
+ union samr_UserInfo *info = NULL;
/* Open the domain */
@@ -123,7 +124,10 @@ NTSTATUS netdom_leave_domain( TALLOC_CTX *mem_ctx, struct cli_state *cli,
/* Get user info */
- status = rpccli_samr_query_userinfo(pipe_hnd, mem_ctx, &user_pol, 16, &qctr);
+ status = rpccli_samr_QueryUserInfo(pipe_hnd, mem_ctx,
+ &user_pol,
+ 16,
+ &info);
if ( !NT_STATUS_IS_OK(status) ) {
rpccli_samr_Close(pipe_hnd, mem_ctx, &user_pol);
goto done;
@@ -135,7 +139,7 @@ NTSTATUS netdom_leave_domain( TALLOC_CTX *mem_ctx, struct cli_state *cli,
ctr.switch_value = 16;
ctr.info.id16 = &p16;
- p16.acb_info = qctr->info.id16->acb_info | ACB_DISABLED;
+ p16.acb_info = info->info16.acct_flags | ACB_DISABLED;
status = rpccli_samr_set_userinfo2(pipe_hnd, mem_ctx, &user_pol, 16,
&cli->user_session_key, &ctr);
diff --git a/source/utils/net_rpc.c b/source/utils/net_rpc.c
index 403cb19..700e98b 100644
--- a/source/utils/net_rpc.c
+++ b/source/utils/net_rpc.c
@@ -881,6 +881,7 @@ static NTSTATUS rpc_user_rename_internals(const DOM_SID *domain_sid,
SAM_USER_INFO_7 info7;
struct samr_Ids user_rids, name_types;
struct lsa_String lsa_acct_name;
+ union samr_UserInfo *info = NULL;
if (argc != 2) {
d_printf("Old and new username must be specified\n");
@@ -940,8 +941,10 @@ static NTSTATUS rpc_user_rename_internals(const DOM_SID *domain_sid,
}
/* Query user info */
- result = rpccli_samr_query_userinfo(pipe_hnd, mem_ctx, &user_pol,
- info_level, &user_ctr);
+ result = rpccli_samr_QueryUserInfo(pipe_hnd, mem_ctx,
+ &user_pol,
+ info_level,
+ &info);
if (!NT_STATUS_IS_OK(result)) {
goto done;
@@ -1507,24 +1510,24 @@ static NTSTATUS rpc_sh_user_show_internals(TALLOC_CTX *mem_ctx,
int argc, const char **argv)
{
NTSTATUS result;
- SAM_USERINFO_CTR *ctr;
- SAM_USER_INFO_21 *info;
+ union samr_UserInfo *info = NULL;
if (argc != 0) {
d_fprintf(stderr, "usage: %s show <username>\n", ctx->whoami);
return NT_STATUS_INVALID_PARAMETER;
}
- result = rpccli_samr_query_userinfo(pipe_hnd, mem_ctx, user_hnd,
- 21, &ctr);
+ result = rpccli_samr_QueryUserInfo(pipe_hnd, mem_ctx,
+ CONST_DISCARD(struct policy_handle *, user_hnd),
+ 21,
+ &info);
if (!NT_STATUS_IS_OK(result)) {
return result;
}
- info = ctr->info.id21;
-
- d_printf("user rid: %d, group rid: %d\n", info->user_rid,
- info->group_rid);
+ d_printf("user rid: %d, group rid: %d\n",
+ info->info21.rid,
+ info->info21.primary_gid);
return result;
}
@@ -1540,7 +1543,7 @@ static NTSTATUS rpc_sh_user_show(TALLOC_CTX *mem_ctx,
#define FETCHSTR(name, rec) \
do { if (strequal(ctx->thiscmd, name)) { \
- oldval = rpcstr_pull_unistr2_talloc(mem_ctx, &usr->uni_##rec); } \
+ oldval = talloc_strdup(mem_ctx, info->info21.rec.string); } \
} while (0);
#define SETSTR(name, rec, flag) \
@@ -1561,6 +1564,7 @@ static NTSTATUS rpc_sh_user_str_edit_internals(TALLOC_CTX *mem_ctx,
SAM_USER_INFO_21 *usr;
const char *username;
const char *oldval = "";
+ union samr_UserInfo *info = NULL;
if (argc > 1) {
d_fprintf(stderr, "usage: %s <username> [new value|NULL]\n",
@@ -1568,22 +1572,22 @@ static NTSTATUS rpc_sh_user_str_edit_internals(TALLOC_CTX *mem_ctx,
return NT_STATUS_INVALID_PARAMETER;
}
- result = rpccli_samr_query_userinfo(pipe_hnd, mem_ctx, user_hnd,
- 21, &ctr);
+ result = rpccli_samr_QueryUserInfo(pipe_hnd, mem_ctx,
+ CONST_DISCARD(struct policy_handle *, user_hnd),
+ 21,
+ &info);
if (!NT_STATUS_IS_OK(result)) {
return result;
}
- usr = ctr->info.id21;
-
- username = rpcstr_pull_unistr2_talloc(mem_ctx, &usr->uni_user_name);
+ username = talloc_strdup(mem_ctx, info->info21.account_name.string);
FETCHSTR("fullname", full_name);
- FETCHSTR("homedir", home_dir);
- FETCHSTR("homedrive", dir_drive);
+ FETCHSTR("homedir", home_directory);
+ FETCHSTR("homedrive", home_drive);
FETCHSTR("logonscript", logon_script);
FETCHSTR("profilepath", profile_path);
- FETCHSTR("description", acct_desc);
+ FETCHSTR("description", description);
if (argc == 0) {
d_printf("%s's %s: [%s]\n", username, ctx->thiscmd, oldval);
@@ -1646,6 +1650,7 @@ static NTSTATUS rpc_sh_user_flag_edit_internals(TALLOC_CTX *mem_ctx,
const char *oldval = "unknown";
uint32 oldflags, newflags;
bool newval;
+ union samr_UserInfo *info = NULL;
if ((argc > 1) ||
((argc == 1) && !strequal(argv[0], "yes") &&
@@ -1657,17 +1662,17 @@ static NTSTATUS rpc_sh_user_flag_edit_internals(TALLOC_CTX *mem_ctx,
newval = strequal(argv[0], "yes");
- result = rpccli_samr_query_userinfo(pipe_hnd, mem_ctx, user_hnd,
- 21, &ctr);
+ result = rpccli_samr_QueryUserInfo(pipe_hnd, mem_ctx,
+ CONST_DISCARD(struct policy_handle *, user_hnd),
+ 21,
+ &info);
if (!NT_STATUS_IS_OK(result)) {
return result;
}
- usr = ctr->info.id21;
-
- username = rpcstr_pull_unistr2_talloc(mem_ctx, &usr->uni_user_name);
- oldflags = usr->acb_info;
- newflags = usr->acb_info;
+ username = talloc_strdup(mem_ctx, info->info21.account_name.string);
+ oldflags = info->info21.acct_flags;
+ newflags = info->info21.acct_flags;
HANDLEFLG("disabled", DISABLED);
HANDLEFLG("pwnotreq", PWNOTREQ);
@@ -1817,12 +1822,10 @@ static NTSTATUS rpc_group_delete_internals(const DOM_SID *domain_sid,
/* char **names; */
int i;
/* DOM_GID *user_gids; */
- SAM_USERINFO_CTR *user_ctr;
- fstring temp;
struct samr_Ids group_rids, name_types;
struct lsa_String lsa_acct_name;
-
+ union samr_UserInfo *info = NULL;
if (argc < 1) {
d_printf("specify group\n");
@@ -1907,23 +1910,23 @@ static NTSTATUS rpc_group_delete_internals(const DOM_SID *domain_sid,
rids->rids[i]);
goto done;
}
-
- ZERO_STRUCT(user_ctr);
- result = rpccli_samr_query_userinfo(pipe_hnd, mem_ctx, &user_pol,
- 21, &user_ctr);
-
+ result = rpccli_samr_QueryUserInfo(pipe_hnd, mem_ctx,
+ &user_pol,
+ 21,
+ &info);
+
if (!NT_STATUS_IS_OK(result)) {
d_fprintf(stderr, "Unable to lookup userinfo for group member %d\n",
rids->rids[i]);
goto done;
}
-
- if (user_ctr->info.id21->group_rid == group_rid) {
- unistr2_to_ascii(temp, &(user_ctr->info.id21)->uni_user_name,
- sizeof(temp));
- if (opt_verbose)
- d_printf("Group is primary group of %s\n",temp);
+
+ if (info->info21.primary_gid == group_rid) {
+ if (opt_verbose) {
+ d_printf("Group is primary group of %s\n",
+ info->info21.account_name.string);
+ }
group_is_primary = True;
}
diff --git a/source/winbindd/winbindd_pam.c b/source/winbindd/winbindd_pam.c
index 759adb3..dd27ad6 100644
--- a/source/winbindd/winbindd_pam.c
+++ b/source/winbindd/winbindd_pam.c
@@ -1324,12 +1324,10 @@ NTSTATUS winbindd_dual_pam_auth_samlogon(struct winbindd_domain *domain,
struct rpc_pipe_client *samr_pipe;
POLICY_HND samr_domain_handle, user_pol;
- SAM_USERINFO_CTR *user_ctr;
+ union samr_UserInfo *info = NULL;
NTSTATUS status_tmp;
uint32 acct_flags;
- ZERO_STRUCT(user_ctr);
-
status_tmp = cm_connect_sam(contact_domain, state->mem_ctx,
&samr_pipe, &samr_domain_handle);
@@ -1351,8 +1349,10 @@ NTSTATUS winbindd_dual_pam_auth_samlogon(struct winbindd_domain *domain,
goto done;
}
- status_tmp = rpccli_samr_query_userinfo(samr_pipe, state->mem_ctx,
- &user_pol, 16, &user_ctr);
+ status_tmp = rpccli_samr_QueryUserInfo(samr_pipe, state->mem_ctx,
+ &user_pol,
+ 16,
+ &info);
if (!NT_STATUS_IS_OK(status_tmp)) {
DEBUG(3, ("could not query user info on SAMR pipe: %s\n",
@@ -1361,7 +1361,7 @@ NTSTATUS winbindd_dual_pam_auth_samlogon(struct winbindd_domain *domain,
goto done;
}
- acct_flags = user_ctr->info.id16->acb_info;
+ acct_flags = info->info16.acct_flags;
if (acct_flags == 0) {
rpccli_samr_Close(samr_pipe, state->mem_ctx, &user_pol);
diff --git a/source/winbindd/winbindd_rpc.c b/source/winbindd/winbindd_rpc.c
index fa9c1bc..2703f2f 100644
--- a/source/winbindd/winbindd_rpc.c
+++ b/source/winbindd/winbindd_rpc.c
@@ -409,7 +409,7 @@ static NTSTATUS query_user(struct winbindd_domain *domain,
{
NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
POLICY_HND dom_pol, user_pol;
- SAM_USERINFO_CTR *ctr;
+ union samr_UserInfo *info = NULL;
--
Samba Shared Repository
More information about the samba-cvs
mailing list