summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2008-02-08 14:48:55 +0100
committerGünther Deschner <gd@samba.org>2008-02-08 15:30:35 +0100
commit210a4ab76f9b576b6834106146fcd86ba73acd22 (patch)
tree5ae1c0403a98990f30172bc1796902982d69c529
parent406ee0effc4e7975cbd763297b5d774971eb1fdf (diff)
downloadsamba-210a4ab76f9b576b6834106146fcd86ba73acd22.tar.gz
samba-210a4ab76f9b576b6834106146fcd86ba73acd22.tar.bz2
samba-210a4ab76f9b576b6834106146fcd86ba73acd22.zip
Use rpccli_samr_LookupNames() in libnetjoin.
Guenther (This used to be commit e62bfd2deea81f188cd4b5274218c3df64782aa7)
-rw-r--r--source3/libnet/libnet_join.c44
1 files changed, 24 insertions, 20 deletions
diff --git a/source3/libnet/libnet_join.c b/source3/libnet/libnet_join.c
index 07d4960ffd..6d9cc1fbc4 100644
--- a/source3/libnet/libnet_join.c
+++ b/source3/libnet/libnet_join.c
@@ -595,11 +595,8 @@ static NTSTATUS libnet_join_joindomain_rpc(TALLOC_CTX *mem_ctx,
POLICY_HND sam_pol, domain_pol, user_pol, lsa_pol;
NTSTATUS status = NT_STATUS_UNSUCCESSFUL;
char *acct_name;
- const char *const_acct_name;
struct lsa_String lsa_acct_name;
uint32 user_rid;
- uint32 num_rids, *name_types, *user_rids;
- uint32 flags = 0x3e8;
uint32 acb_info = ACB_WSTRUST;
uint32 fields_present;
uchar pwbuf[532];
@@ -611,6 +608,8 @@ static NTSTATUS libnet_join_joindomain_rpc(TALLOC_CTX *mem_ctx,
DATA_BLOB digested_session_key;
uchar md4_trust_password[16];
union lsa_PolicyInformation *info = NULL;
+ struct samr_Ids user_rids;
+ struct samr_Ids name_types;
if (!r->in.machine_password) {
r->in.machine_password = talloc_strdup(mem_ctx, generate_random_str(DEFAULT_TRUST_ACCOUNT_PASSWORD_LENGTH));
@@ -693,7 +692,6 @@ static NTSTATUS libnet_join_joindomain_rpc(TALLOC_CTX *mem_ctx,
acct_name = talloc_asprintf(mem_ctx, "%s$", r->in.machine_name);
strlower_m(acct_name);
- const_acct_name = acct_name;
init_lsa_String(&lsa_acct_name, acct_name);
@@ -726,20 +724,22 @@ static NTSTATUS libnet_join_joindomain_rpc(TALLOC_CTX *mem_ctx,
}
}
- status = rpccli_samr_lookup_names(pipe_hnd, mem_ctx,
- &domain_pol, flags, 1,
- &const_acct_name,
- &num_rids, &user_rids, &name_types);
+ status = rpccli_samr_LookupNames(pipe_hnd, mem_ctx,
+ &domain_pol,
+ 1,
+ &lsa_acct_name,
+ &user_rids,
+ &name_types);
if (!NT_STATUS_IS_OK(status)) {
goto done;
}
- if (name_types[0] != SID_NAME_USER) {
+ if (name_types.ids[0] != SID_NAME_USER) {
status = NT_STATUS_INVALID_WORKSTATION;
goto done;
}
- user_rid = user_rids[0];
+ user_rid = user_rids.ids[0];
status = rpccli_samr_OpenUser(pipe_hnd, mem_ctx,
&domain_pol,
@@ -829,12 +829,12 @@ static NTSTATUS libnet_join_unjoindomain_rpc(TALLOC_CTX *mem_ctx,
POLICY_HND sam_pol, domain_pol, user_pol;
NTSTATUS status = NT_STATUS_UNSUCCESSFUL;
char *acct_name;
- uint32 flags = 0x3e8;
- const char *const_acct_name;
uint32 user_rid;
- uint32 num_rids, *name_types, *user_rids;
SAM_USERINFO_CTR ctr, *qctr = NULL;
SAM_USER_INFO_16 p16;
+ struct lsa_String lsa_acct_name;
+ struct samr_Ids user_rids;
+ struct samr_Ids name_types;
status = cli_full_connection(&cli, NULL,
r->in.dc_name,
@@ -873,22 +873,26 @@ static NTSTATUS libnet_join_unjoindomain_rpc(TALLOC_CTX *mem_ctx,
acct_name = talloc_asprintf(mem_ctx, "%s$", r->in.machine_name);
strlower_m(acct_name);
- const_acct_name = acct_name;
- status = rpccli_samr_lookup_names(pipe_hnd, mem_ctx,
- &domain_pol, flags, 1,
- &const_acct_name,
- &num_rids, &user_rids, &name_types);
+ init_lsa_String(&lsa_acct_name, acct_name);
+
+ status = rpccli_samr_LookupNames(pipe_hnd, mem_ctx,
+ &domain_pol,
+ 1,
+ &lsa_acct_name,
+ &user_rids,
+ &name_types);
+
if (!NT_STATUS_IS_OK(status)) {
goto done;
}
- if (name_types[0] != SID_NAME_USER) {
+ if (name_types.ids[0] != SID_NAME_USER) {
status = NT_STATUS_INVALID_WORKSTATION;
goto done;
}
- user_rid = user_rids[0];
+ user_rid = user_rids.ids[0];
status = rpccli_samr_OpenUser(pipe_hnd, mem_ctx,
&domain_pol,