[SCM] Samba Shared Repository - branch v3-2-test updated -
initial-v3-2-test-2115-gd493f98
Günther Deschner
gd at samba.org
Tue Feb 12 17:58:43 GMT 2008
The branch, v3-2-test has been updated
via d493f98cd1da5e8a5995e3adea2f28b434baae99 (commit)
via bdc49185036060ebb9c727767dce52e4b01bd8b4 (commit)
from daec00fd62999d4f8d74dc4cdd2fba686433ad01 (commit)
http://gitweb.samba.org/?samba.git;a=shortlog;h=v3-2-test
- Log -----------------------------------------------------------------
commit d493f98cd1da5e8a5995e3adea2f28b434baae99
Author: Günther Deschner <gd at samba.org>
Date: Tue Feb 12 01:31:32 2008 +0100
Remove unused marshalling for SAMR_SET_USERINFO2.
Guenther
commit bdc49185036060ebb9c727767dce52e4b01bd8b4
Author: Günther Deschner <gd at samba.org>
Date: Tue Feb 12 00:51:51 2008 +0100
Remove all callers of rpccli_samr_setuserinfo2 and replace with
rpccli_samr_SetUserInfo (see the opcode mixup in rpc_samr.h).
Guenther
-----------------------------------------------------------------------
Summary of changes:
source/include/rpc_samr.h | 17 --------
source/libnet/libnet_join.c | 40 +++++++-----------
source/rpc_client/cli_samr.c | 43 --------------------
source/rpc_parse/parse_samr.c | 87 -----------------------------------------
source/utils/net_domain.c | 40 +++++++-----------
source/utils/net_rpc.c | 39 ++++++++----------
source/utils/net_rpc_join.c | 14 +++----
7 files changed, 56 insertions(+), 224 deletions(-)
Changeset truncated at 500 lines:
diff --git a/source/include/rpc_samr.h b/source/include/rpc_samr.h
index fa3feae..a11106f 100644
--- a/source/include/rpc_samr.h
+++ b/source/include/rpc_samr.h
@@ -553,23 +553,6 @@ typedef struct sam_userinfo_ctr_info
} SAM_USERINFO_CTR;
-/* SAMR_Q_SET_USERINFO2 - set sam info */
-typedef struct q_samr_set_user_info2
-{
- POLICY_HND pol; /* policy handle associated with user */
- uint16 switch_value; /* 0x0010 */
-
- SAM_USERINFO_CTR *ctr;
-
-} SAMR_Q_SET_USERINFO2;
-
-/* SAMR_R_SET_USERINFO2 - set sam info */
-typedef struct r_samr_set_user_info2
-{
- NTSTATUS status; /* return status */
-
-} SAMR_R_SET_USERINFO2;
-
/* SAMR_Q_SET_USERINFO - set sam info */
typedef struct q_samr_set_user_info
{
diff --git a/source/libnet/libnet_join.c b/source/libnet/libnet_join.c
index 996b9e6..4b8826a 100644
--- a/source/libnet/libnet_join.c
+++ b/source/libnet/libnet_join.c
@@ -598,11 +598,7 @@ static NTSTATUS libnet_join_joindomain_rpc(TALLOC_CTX *mem_ctx,
struct lsa_String lsa_acct_name;
uint32 user_rid;
uint32 acb_info = ACB_WSTRUST;
- uint32 fields_present;
uchar pwbuf[532];
- SAM_USERINFO_CTR ctr;
- SAM_USER_INFO_25 p25;
- const int infolevel = 25;
struct MD5Context md5ctx;
uchar md5buffer[16];
DATA_BLOB digested_session_key;
@@ -610,6 +606,7 @@ static NTSTATUS libnet_join_joindomain_rpc(TALLOC_CTX *mem_ctx,
union lsa_PolicyInformation *info = NULL;
struct samr_Ids user_rids;
struct samr_Ids name_types;
+ union samr_UserInfo user_info;
if (!r->in.machine_password) {
r->in.machine_password = talloc_strdup(mem_ctx, generate_random_str(DEFAULT_TRUST_ACCOUNT_PASSWORD_LENGTH));
@@ -773,19 +770,18 @@ static NTSTATUS libnet_join_joindomain_rpc(TALLOC_CTX *mem_ctx,
;;
}
- ZERO_STRUCT(ctr);
- ZERO_STRUCT(p25);
+ ZERO_STRUCT(user_info.info25);
- fields_present = ACCT_NT_PWD_SET | ACCT_LM_PWD_SET |
- SAMR_FIELD_ACCT_FLAGS;
- init_sam_user_info25P(&p25, fields_present, acb_info, (char *)pwbuf);
+ user_info.info25.info.fields_present = ACCT_NT_PWD_SET |
+ ACCT_LM_PWD_SET |
+ SAMR_FIELD_ACCT_FLAGS;
+ user_info.info25.info.acct_flags = acb_info;
+ memcpy(&user_info.info25.password.data, pwbuf, sizeof(pwbuf));
- ctr.switch_value = infolevel;
- ctr.info.id25 = &p25;
-
- status = rpccli_samr_set_userinfo2(pipe_hnd, mem_ctx, &user_pol,
- infolevel, &cli->user_session_key,
- &ctr);
+ status = rpccli_samr_SetUserInfo(pipe_hnd, mem_ctx,
+ &user_pol,
+ 25,
+ &user_info);
if (!NT_STATUS_IS_OK(status)) {
goto done;
}
@@ -831,8 +827,6 @@ 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;
- SAM_USER_INFO_16 p16;
struct lsa_String lsa_acct_name;
struct samr_Ids user_rids;
struct samr_Ids name_types;
@@ -914,14 +908,12 @@ static NTSTATUS libnet_join_unjoindomain_rpc(TALLOC_CTX *mem_ctx,
goto done;
}
- ZERO_STRUCT(ctr);
- ctr.switch_value = 16;
- ctr.info.id16 = &p16;
-
- p16.acb_info = info->info16.acct_flags | ACB_DISABLED;
+ info->info16.acct_flags |= ACB_DISABLED;
- status = rpccli_samr_set_userinfo2(pipe_hnd, mem_ctx, &user_pol, 16,
- &cli->user_session_key, &ctr);
+ status = rpccli_samr_SetUserInfo(pipe_hnd, mem_ctx,
+ &user_pol,
+ 16,
+ info);
rpccli_samr_Close(pipe_hnd, mem_ctx, &user_pol);
diff --git a/source/rpc_client/cli_samr.c b/source/rpc_client/cli_samr.c
index 3649c51..caf58d3 100644
--- a/source/rpc_client/cli_samr.c
+++ b/source/rpc_client/cli_samr.c
@@ -513,46 +513,3 @@ NTSTATUS rpccli_samr_set_userinfo(struct rpc_pipe_client *cli, TALLOC_CTX *mem_c
return result;
}
-
-/* Set userinfo2 */
-
-NTSTATUS rpccli_samr_set_userinfo2(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,
- const POLICY_HND *user_pol, uint16 switch_value,
- DATA_BLOB *sess_key, SAM_USERINFO_CTR *ctr)
-{
- prs_struct qbuf, rbuf;
- SAMR_Q_SET_USERINFO2 q;
- SAMR_R_SET_USERINFO2 r;
- NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
-
- DEBUG(10,("cli_samr_set_userinfo2\n"));
-
- if (!sess_key->length) {
- DEBUG(1, ("No user session key\n"));
- return NT_STATUS_NO_USER_SESSION_KEY;
- }
-
- ZERO_STRUCT(q);
- ZERO_STRUCT(r);
-
- /* Marshall data and send request */
-
- init_samr_q_set_userinfo2(&q, user_pol, sess_key, switch_value, ctr);
-
- CLI_DO_RPC(cli, mem_ctx, PI_SAMR, SAMR_SET_USERINFO2,
- q, r,
- qbuf, rbuf,
- samr_io_q_set_userinfo2,
- samr_io_r_set_userinfo2,
- NT_STATUS_UNSUCCESSFUL);
-
- /* Return output parameters */
-
- if (!NT_STATUS_IS_OK(result = r.status)) {
- goto done;
- }
-
- done:
-
- return result;
-}
diff --git a/source/rpc_parse/parse_samr.c b/source/rpc_parse/parse_samr.c
index 954a60d..5cfd1ed 100644
--- a/source/rpc_parse/parse_samr.c
+++ b/source/rpc_parse/parse_samr.c
@@ -2117,90 +2117,3 @@ bool samr_io_r_set_userinfo(const char *desc, SAMR_R_SET_USERINFO * r_u,
return True;
}
-
-/*******************************************************************
-inits a SAMR_Q_SET_USERINFO2 structure.
-********************************************************************/
-
-void init_samr_q_set_userinfo2(SAMR_Q_SET_USERINFO2 * q_u,
- const POLICY_HND *hnd, DATA_BLOB *sess_key,
- uint16 switch_value, SAM_USERINFO_CTR * ctr)
-{
- DEBUG(5, ("init_samr_q_set_userinfo2\n"));
-
- q_u->pol = *hnd;
- q_u->switch_value = switch_value;
- q_u->ctr = ctr;
-
- q_u->ctr->switch_value = switch_value;
-
- switch (switch_value) {
- case 18:
- SamOEMhashBlob(ctr->info.id18->lm_pwd, 16, sess_key);
- SamOEMhashBlob(ctr->info.id18->nt_pwd, 16, sess_key);
- dump_data(100, sess_key->data, sess_key->length);
- dump_data(100, ctr->info.id18->lm_pwd, 16);
- dump_data(100, ctr->info.id18->nt_pwd, 16);
- break;
- }
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-bool samr_io_q_set_userinfo2(const char *desc, SAMR_Q_SET_USERINFO2 * q_u,
- prs_struct *ps, int depth)
-{
- if (q_u == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "samr_io_q_set_userinfo2");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!smb_io_pol_hnd("pol", &q_u->pol, ps, depth))
- return False;
-
- if(!prs_uint16("switch_value", ps, depth, &q_u->switch_value))
- return False;
- if(!samr_io_userinfo_ctr("ctr", &q_u->ctr, ps, depth))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-inits a SAMR_R_SET_USERINFO2 structure.
-********************************************************************/
-
-void init_samr_r_set_userinfo2(SAMR_R_SET_USERINFO2 * r_u, NTSTATUS status)
-{
- DEBUG(5, ("init_samr_r_set_userinfo2\n"));
-
- r_u->status = status; /* return status */
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-bool samr_io_r_set_userinfo2(const char *desc, SAMR_R_SET_USERINFO2 * r_u,
- prs_struct *ps, int depth)
-{
- if (r_u == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "samr_io_r_set_userinfo2");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!prs_ntstatus("status", ps, depth, &r_u->status))
- return False;
-
- return True;
-}
diff --git a/source/utils/net_domain.c b/source/utils/net_domain.c
index 820b3ae..69994b5 100644
--- a/source/utils/net_domain.c
+++ b/source/utils/net_domain.c
@@ -57,8 +57,6 @@ 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;
- SAM_USER_INFO_16 p16;
struct lsa_String lsa_acct_name;
struct samr_Ids user_rids;
struct samr_Ids name_types;
@@ -134,15 +132,13 @@ NTSTATUS netdom_leave_domain( TALLOC_CTX *mem_ctx, struct cli_state *cli,
}
/* now disable and setuser info */
-
- ZERO_STRUCT(ctr);
- ctr.switch_value = 16;
- ctr.info.id16 = &p16;
- p16.acb_info = info->info16.acct_flags | ACB_DISABLED;
+ info->info16.acct_flags |= ACB_DISABLED;
- status = rpccli_samr_set_userinfo2(pipe_hnd, mem_ctx, &user_pol, 16,
- &cli->user_session_key, &ctr);
+ status = rpccli_samr_SetUserInfo(pipe_hnd, mem_ctx,
+ &user_pol,
+ 16,
+ info);
rpccli_samr_Close(pipe_hnd, mem_ctx, &user_pol);
@@ -234,11 +230,7 @@ NTSTATUS netdom_join_domain( TALLOC_CTX *mem_ctx, struct cli_state *cli,
uint32 user_rid;
uint32 acb_info = ACB_WSTRUST;
uint32 acct_flags;
- uint32 fields_present;
uchar pwbuf[532];
- SAM_USERINFO_CTR ctr;
- SAM_USER_INFO_25 p25;
- const int infolevel = 25;
struct MD5Context md5ctx;
uchar md5buffer[16];
DATA_BLOB digested_session_key;
@@ -246,6 +238,7 @@ NTSTATUS netdom_join_domain( TALLOC_CTX *mem_ctx, struct cli_state *cli,
uint32_t access_granted = 0;
struct samr_Ids user_rids;
struct samr_Ids name_types;
+ union samr_UserInfo info;
/* Open the domain */
@@ -371,19 +364,18 @@ NTSTATUS netdom_join_domain( TALLOC_CTX *mem_ctx, struct cli_state *cli,
}
/* Set password and account flags on machine account */
+ ZERO_STRUCT(info.info25);
+ info.info25.info.fields_present = ACCT_NT_PWD_SET |
+ ACCT_LM_PWD_SET |
+ SAMR_FIELD_ACCT_FLAGS;
+ info.info25.info.acct_flags = acb_info;
+ memcpy(&info.info25.password.data, pwbuf, sizeof(pwbuf));
- ZERO_STRUCT(ctr);
- ZERO_STRUCT(p25);
-
- fields_present = ACCT_NT_PWD_SET | ACCT_LM_PWD_SET |
- SAMR_FIELD_ACCT_FLAGS;
- init_sam_user_info25P(&p25, fields_present, acb_info, (char *)pwbuf);
- ctr.switch_value = infolevel;
- ctr.info.id25 = &p25;
-
- status = rpccli_samr_set_userinfo2(pipe_hnd, mem_ctx, &user_pol,
- infolevel, &cli->user_session_key, &ctr);
+ status = rpccli_samr_SetUserInfo(pipe_hnd, mem_ctx,
+ &user_pol,
+ 25,
+ &info);
if ( !NT_STATUS_IS_OK(status) ) {
d_fprintf( stderr, "Failed to set password for machine account (%s)\n",
diff --git a/source/utils/net_rpc.c b/source/utils/net_rpc.c
index 700e98b..4e3eedc 100644
--- a/source/utils/net_rpc.c
+++ b/source/utils/net_rpc.c
@@ -1548,9 +1548,8 @@ do { if (strequal(ctx->thiscmd, name)) { \
#define SETSTR(name, rec, flag) \
do { if (strequal(ctx->thiscmd, name)) { \
- init_unistr2(&usr->uni_##rec, argv[0], UNI_STR_TERMINATE); \
- init_uni_hdr(&usr->hdr_##rec, &usr->uni_##rec); \
- usr->fields_present |= SAMR_FIELD_##flag; } \
+ init_lsa_String(&(info->info21.rec), argv[0]); \
+ info->info21.fields_present |= SAMR_FIELD_##flag; } \
} while (0);
static NTSTATUS rpc_sh_user_str_edit_internals(TALLOC_CTX *mem_ctx,
@@ -1560,8 +1559,6 @@ static NTSTATUS rpc_sh_user_str_edit_internals(TALLOC_CTX *mem_ctx,
int argc, const char **argv)
{
NTSTATUS result;
- SAM_USERINFO_CTR *ctr;
- SAM_USER_INFO_21 *usr;
const char *username;
const char *oldval = "";
union samr_UserInfo *info = NULL;
@@ -1594,22 +1591,23 @@ static NTSTATUS rpc_sh_user_str_edit_internals(TALLOC_CTX *mem_ctx,
goto done;
}
- ZERO_STRUCTP(usr);
-
if (strcmp(argv[0], "NULL") == 0) {
argv[0] = "";
}
+ ZERO_STRUCT(info->info21);
+
SETSTR("fullname", full_name, FULL_NAME);
- SETSTR("homedir", home_dir, HOME_DIRECTORY);
- SETSTR("homedrive", dir_drive, HOME_DRIVE);
+ SETSTR("homedir", home_directory, HOME_DIRECTORY);
+ SETSTR("homedrive", home_drive, HOME_DRIVE);
SETSTR("logonscript", logon_script, LOGON_SCRIPT);
SETSTR("profilepath", profile_path, PROFILE_PATH);
- SETSTR("description", acct_desc, DESCRIPTION);
+ SETSTR("description", description, DESCRIPTION);
- result = rpccli_samr_set_userinfo2(
- pipe_hnd, mem_ctx, user_hnd, 21,
- &pipe_hnd->cli->user_session_key, ctr);
+ result = rpccli_samr_SetUserInfo(pipe_hnd, mem_ctx,
+ CONST_DISCARD(struct policy_handle *, user_hnd),
+ 21,
+ info);
d_printf("Set %s's %s from [%s] to [%s]\n", username,
ctx->thiscmd, oldval, argv[0]);
@@ -1644,8 +1642,6 @@ static NTSTATUS rpc_sh_user_flag_edit_internals(TALLOC_CTX *mem_ctx,
int argc, const char **argv)
{
NTSTATUS result;
- SAM_USERINFO_CTR *ctr;
- SAM_USER_INFO_21 *usr;
const char *username;
const char *oldval = "unknown";
uint32 oldflags, newflags;
@@ -1684,14 +1680,15 @@ static NTSTATUS rpc_sh_user_flag_edit_internals(TALLOC_CTX *mem_ctx,
goto done;
}
- ZERO_STRUCTP(usr);
+ ZERO_STRUCT(info->info21);
- usr->acb_info = newflags;
- usr->fields_present = SAMR_FIELD_ACCT_FLAGS;
+ info->info21.acct_flags = newflags;
+ info->info21.fields_present = SAMR_FIELD_ACCT_FLAGS;
- result = rpccli_samr_set_userinfo2(
- pipe_hnd, mem_ctx, user_hnd, 21,
- &pipe_hnd->cli->user_session_key, ctr);
+ result = rpccli_samr_SetUserInfo(pipe_hnd, mem_ctx,
+ CONST_DISCARD(struct policy_handle *, user_hnd),
+ 21,
+ info);
if (NT_STATUS_IS_OK(result)) {
d_printf("Set %s's %s flag from [%s] to [%s]\n", username,
diff --git a/source/utils/net_rpc_join.c b/source/utils/net_rpc_join.c
index 0e9e603..f94e08e 100644
--- a/source/utils/net_rpc_join.c
+++ b/source/utils/net_rpc_join.c
@@ -154,8 +154,8 @@ int net_rpc_join_newstyle(int argc, const char **argv)
uchar pwbuf[516];
SAM_USERINFO_CTR ctr;
SAM_USER_INFO_24 p24;
- SAM_USER_INFO_16 p16;
uchar md4_trust_password[16];
+ union samr_UserInfo set_info;
/* Misc */
@@ -365,17 +365,15 @@ int net_rpc_join_newstyle(int argc, const char **argv)
seems to cope with either value so don't bomb out if the set
userinfo2 level 0x10 fails. -tpot */
- ZERO_STRUCT(ctr);
- ctr.switch_value = 16;
- ctr.info.id16 = &p16;
-
- init_sam_user_info16(&p16, acb_info);
+ set_info.info16.acct_flags = acb_info;
/* Ignoring the return value is necessary for joining a domain
as a normal user with "Add workstation to domain" privilege. */
- result = rpccli_samr_set_userinfo2(pipe_hnd, mem_ctx, &user_pol, 16,
- &cli->user_session_key, &ctr);
+ result = rpccli_samr_SetUserInfo(pipe_hnd, mem_ctx,
+ &user_pol,
+ 16,
+ &set_info);
rpccli_samr_Close(pipe_hnd, mem_ctx, &user_pol);
cli_rpc_pipe_close(pipe_hnd); /* Done with this pipe */
--
Samba Shared Repository
More information about the samba-cvs
mailing list