summaryrefslogtreecommitdiff
path: root/source4/libnet
diff options
context:
space:
mode:
authorRafal Szczesniak <mimir@samba.org>2005-07-02 14:33:55 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:19:06 -0500
commit4fa6a156bc087c5d8a9c796b9e93939273006404 (patch)
tree93496a0afc265298b82746389e08259bf0c85fa6 /source4/libnet
parente6b54f7acf45abcbc81d192bf618034a075c4d18 (diff)
downloadsamba-4fa6a156bc087c5d8a9c796b9e93939273006404.tar.gz
samba-4fa6a156bc087c5d8a9c796b9e93939273006404.tar.bz2
samba-4fa6a156bc087c5d8a9c796b9e93939273006404.zip
r8077: Propagate changes in rpc connect routine to functions using it
(it's quite common). rafal (This used to be commit 798b00c24ae30a08ac81342d13130a6a2f9d3a08)
Diffstat (limited to 'source4/libnet')
-rw-r--r--source4/libnet/libnet_join.c36
-rw-r--r--source4/libnet/libnet_passwd.c54
-rw-r--r--source4/libnet/libnet_share.c54
-rw-r--r--source4/libnet/libnet_time.c20
-rw-r--r--source4/libnet/libnet_user.c28
5 files changed, 96 insertions, 96 deletions
diff --git a/source4/libnet/libnet_join.c b/source4/libnet/libnet_join.c
index 65e0006bbe..c76b16e10e 100644
--- a/source4/libnet/libnet_join.c
+++ b/source4/libnet/libnet_join.c
@@ -47,7 +47,7 @@ static NTSTATUS libnet_JoinDomain_samr(struct libnet_context *ctx,
TALLOC_CTX *mem_ctx, union libnet_JoinDomain *r)
{
NTSTATUS status;
- union libnet_rpc_connect c;
+ struct libnet_RpcConnect c;
struct samr_Connect sc;
struct policy_handle p_handle;
struct samr_LookupDomain ld;
@@ -70,14 +70,14 @@ static NTSTATUS libnet_JoinDomain_samr(struct libnet_context *ctx,
int policy_min_pw_len = 0;
/* prepare connect to the SAMR pipe of users domain PDC */
- c.pdc.level = LIBNET_RPC_CONNECT_PDC;
- c.pdc.in.domain_name = r->samr.in.domain_name;
- c.pdc.in.dcerpc_iface_name = DCERPC_SAMR_NAME;
- c.pdc.in.dcerpc_iface_uuid = DCERPC_SAMR_UUID;
- c.pdc.in.dcerpc_iface_version = DCERPC_SAMR_VERSION;
+ c.level = LIBNET_RPC_CONNECT_PDC;
+ c.in.domain_name = r->samr.in.domain_name;
+ c.in.dcerpc_iface_name = DCERPC_SAMR_NAME;
+ c.in.dcerpc_iface_uuid = DCERPC_SAMR_UUID;
+ c.in.dcerpc_iface_version = DCERPC_SAMR_VERSION;
/* 1. connect to the SAMR pipe of users domain PDC (maybe a standalone server or workstation) */
- status = libnet_rpc_connect(ctx, mem_ctx, &c);
+ status = libnet_RpcConnect(ctx, mem_ctx, &c);
if (!NT_STATUS_IS_OK(status)) {
r->samr.out.error_string = talloc_asprintf(mem_ctx,
"Connection to SAMR pipe of PDC of domain '%s' failed: %s\n",
@@ -92,7 +92,7 @@ static NTSTATUS libnet_JoinDomain_samr(struct libnet_context *ctx,
sc.out.connect_handle = &p_handle;
/* 2. do a samr_Connect to get a policy handle */
- status = dcerpc_samr_Connect(c.pdc.out.dcerpc_pipe, mem_ctx, &sc);
+ status = dcerpc_samr_Connect(c.out.dcerpc_pipe, mem_ctx, &sc);
if (!NT_STATUS_IS_OK(status)) {
r->samr.out.error_string = talloc_asprintf(mem_ctx,
"samr_Connect failed: %s\n",
@@ -115,7 +115,7 @@ static NTSTATUS libnet_JoinDomain_samr(struct libnet_context *ctx,
ld.in.domain_name = &d_name;
/* 3. do a samr_LookupDomain to get the domain sid */
- status = dcerpc_samr_LookupDomain(c.pdc.out.dcerpc_pipe, mem_ctx, &ld);
+ status = dcerpc_samr_LookupDomain(c.out.dcerpc_pipe, mem_ctx, &ld);
if (!NT_STATUS_IS_OK(status)) {
r->samr.out.error_string = talloc_asprintf(mem_ctx,
"samr_LookupDomain for [%s] failed: %s\n",
@@ -140,7 +140,7 @@ static NTSTATUS libnet_JoinDomain_samr(struct libnet_context *ctx,
od.out.domain_handle = &d_handle;
/* 4. do a samr_OpenDomain to get a domain handle */
- status = dcerpc_samr_OpenDomain(c.pdc.out.dcerpc_pipe, mem_ctx, &od);
+ status = dcerpc_samr_OpenDomain(c.out.dcerpc_pipe, mem_ctx, &od);
if (!NT_STATUS_IS_OK(status)) {
r->samr.out.error_string = talloc_asprintf(mem_ctx,
"samr_OpenDomain for [%s] failed: %s\n",
@@ -160,7 +160,7 @@ static NTSTATUS libnet_JoinDomain_samr(struct libnet_context *ctx,
cu.out.access_granted = &access_granted;
/* 4. do a samr_CreateUser2 to get an account handle, or an error */
- status = dcerpc_samr_CreateUser2(c.pdc.out.dcerpc_pipe, mem_ctx, &cu);
+ status = dcerpc_samr_CreateUser2(c.out.dcerpc_pipe, mem_ctx, &cu);
if (!NT_STATUS_IS_OK(status) && !NT_STATUS_EQUAL(status, NT_STATUS_USER_EXISTS)) {
r->samr.out.error_string = talloc_asprintf(mem_ctx,
"samr_CreateUser2 for [%s] failed: %s\n",
@@ -179,7 +179,7 @@ static NTSTATUS libnet_JoinDomain_samr(struct libnet_context *ctx,
ln.in.names[0].string = r->samr.in.account_name;
/* 5. do a samr_LookupNames to get the users rid */
- status = dcerpc_samr_LookupNames(c.pdc.out.dcerpc_pipe, mem_ctx, &ln);
+ status = dcerpc_samr_LookupNames(c.out.dcerpc_pipe, mem_ctx, &ln);
if (!NT_STATUS_IS_OK(status)) {
r->samr.out.error_string = talloc_asprintf(mem_ctx,
"samr_LookupNames for [%s] failed: %s\n",
@@ -205,7 +205,7 @@ static NTSTATUS libnet_JoinDomain_samr(struct libnet_context *ctx,
ou.out.user_handle = &u_handle;
/* 6. do a samr_OpenUser to get a user handle */
- status = dcerpc_samr_OpenUser(c.pdc.out.dcerpc_pipe, mem_ctx, &ou);
+ status = dcerpc_samr_OpenUser(c.out.dcerpc_pipe, mem_ctx, &ou);
if (!NT_STATUS_IS_OK(status)) {
r->samr.out.error_string = talloc_asprintf(mem_ctx,
"samr_OpenUser for [%s] failed: %s\n",
@@ -216,7 +216,7 @@ static NTSTATUS libnet_JoinDomain_samr(struct libnet_context *ctx,
pwp.in.user_handle = &u_handle;
- status = dcerpc_samr_GetUserPwInfo(c.pdc.out.dcerpc_pipe, mem_ctx, &pwp);
+ status = dcerpc_samr_GetUserPwInfo(c.out.dcerpc_pipe, mem_ctx, &pwp);
if (NT_STATUS_IS_OK(status)) {
policy_min_pw_len = pwp.out.info.min_password_length;
}
@@ -227,7 +227,7 @@ static NTSTATUS libnet_JoinDomain_samr(struct libnet_context *ctx,
r2.samr_handle.in.account_name = r->samr.in.account_name;
r2.samr_handle.in.newpassword = r->samr.out.join_password;
r2.samr_handle.in.user_handle = &u_handle;
- r2.samr_handle.in.dcerpc_pipe = c.pdc.out.dcerpc_pipe;
+ r2.samr_handle.in.dcerpc_pipe = c.out.dcerpc_pipe;
status = libnet_SetPassword(ctx, mem_ctx, &r2);
@@ -241,7 +241,7 @@ static NTSTATUS libnet_JoinDomain_samr(struct libnet_context *ctx,
qui.in.user_handle = &u_handle;
qui.in.level = 16;
- status = dcerpc_samr_QueryUserInfo(c.pdc.out.dcerpc_pipe, mem_ctx, &qui);
+ status = dcerpc_samr_QueryUserInfo(c.out.dcerpc_pipe, mem_ctx, &qui);
if (!NT_STATUS_IS_OK(status)) {
r->samr.out.error_string
= talloc_asprintf(mem_ctx,
@@ -276,7 +276,7 @@ static NTSTATUS libnet_JoinDomain_samr(struct libnet_context *ctx,
sui.in.info = &u_info;
sui.in.level = 16;
- dcerpc_samr_SetUserInfo(c.pdc.out.dcerpc_pipe, mem_ctx, &sui);
+ dcerpc_samr_SetUserInfo(c.out.dcerpc_pipe, mem_ctx, &sui);
if (!NT_STATUS_IS_OK(status)) {
r->samr.out.error_string
= talloc_asprintf(mem_ctx,
@@ -288,7 +288,7 @@ static NTSTATUS libnet_JoinDomain_samr(struct libnet_context *ctx,
disconnect:
/* close connection */
- talloc_free(c.pdc.out.dcerpc_pipe);
+ talloc_free(c.out.dcerpc_pipe);
return status;
}
diff --git a/source4/libnet/libnet_passwd.c b/source4/libnet/libnet_passwd.c
index bd4d8fc26e..dd2fa91dec 100644
--- a/source4/libnet/libnet_passwd.c
+++ b/source4/libnet/libnet_passwd.c
@@ -35,7 +35,7 @@
static NTSTATUS libnet_ChangePassword_samr(struct libnet_context *ctx, TALLOC_CTX *mem_ctx, union libnet_ChangePassword *r)
{
NTSTATUS status;
- union libnet_rpc_connect c;
+ struct libnet_RpcConnect c;
#if 0
struct policy_handle user_handle;
struct samr_Password hash1, hash2, hash3, hash4, hash5, hash6;
@@ -52,14 +52,14 @@ static NTSTATUS libnet_ChangePassword_samr(struct libnet_context *ctx, TALLOC_CT
uint8_t old_lm_hash[16], new_lm_hash[16];
/* prepare connect to the SAMR pipe of the users domain PDC */
- c.pdc.level = LIBNET_RPC_CONNECT_PDC;
- c.pdc.in.domain_name = r->samr.in.domain_name;
- c.pdc.in.dcerpc_iface_name = DCERPC_SAMR_NAME;
- c.pdc.in.dcerpc_iface_uuid = DCERPC_SAMR_UUID;
- c.pdc.in.dcerpc_iface_version = DCERPC_SAMR_VERSION;
+ c.level = LIBNET_RPC_CONNECT_PDC;
+ c.in.domain_name = r->samr.in.domain_name;
+ c.in.dcerpc_iface_name = DCERPC_SAMR_NAME;
+ c.in.dcerpc_iface_uuid = DCERPC_SAMR_UUID;
+ c.in.dcerpc_iface_version = DCERPC_SAMR_VERSION;
/* 1. connect to the SAMR pipe of users domain PDC (maybe a standalone server or workstation) */
- status = libnet_rpc_connect(ctx, mem_ctx, &c);
+ status = libnet_RpcConnect(ctx, mem_ctx, &c);
if (!NT_STATUS_IS_OK(status)) {
r->samr.out.error_string = talloc_asprintf(mem_ctx,
"Connection to SAMR pipe of PDC of domain '%s' failed: %s\n",
@@ -68,7 +68,7 @@ static NTSTATUS libnet_ChangePassword_samr(struct libnet_context *ctx, TALLOC_CT
}
/* prepare password change for account */
- server.string = talloc_asprintf(mem_ctx, "\\\\%s", dcerpc_server_name(c.pdc.out.dcerpc_pipe));
+ server.string = talloc_asprintf(mem_ctx, "\\\\%s", dcerpc_server_name(c.out.dcerpc_pipe));
account.string = r->samr.in.account_name;
E_md4hash(r->samr.in.oldpassword, old_nt_hash);
@@ -96,7 +96,7 @@ static NTSTATUS libnet_ChangePassword_samr(struct libnet_context *ctx, TALLOC_CT
pw3.in.password3 = NULL;
/* 2. try samr_ChangePasswordUser3 */
- status = dcerpc_samr_ChangePasswordUser3(c.pdc.out.dcerpc_pipe, mem_ctx, &pw3);
+ status = dcerpc_samr_ChangePasswordUser3(c.out.dcerpc_pipe, mem_ctx, &pw3);
if (!NT_STATUS_IS_OK(status)) {
r->samr.out.error_string = talloc_asprintf(mem_ctx,
"samr_ChangePasswordUser3 failed: %s\n",
@@ -139,7 +139,7 @@ ChangePasswordUser2:
pw2.in.lm_verifier = &lm_verifier;
/* 3. try samr_ChangePasswordUser2 */
- status = dcerpc_samr_ChangePasswordUser2(c.pdc.out.dcerpc_pipe, mem_ctx, &pw2);
+ status = dcerpc_samr_ChangePasswordUser2(c.out.dcerpc_pipe, mem_ctx, &pw2);
if (!NT_STATUS_IS_OK(status)) {
r->samr.out.error_string = talloc_asprintf(mem_ctx,
"samr_ChangePasswordUser2 failed: %s\n",
@@ -164,7 +164,7 @@ ChangePasswordUser2:
OemChangePasswordUser2:
/* prepare samr_OemChangePasswordUser2 */
- a_server.string = talloc_asprintf(mem_ctx, "\\\\%s", dcerpc_server_name(c.pdc.out.dcerpc_pipe));
+ a_server.string = talloc_asprintf(mem_ctx, "\\\\%s", dcerpc_server_name(c.out.dcerpc_pipe));
a_account.string = r->samr.in.account_name;
encode_pw_buffer(lm_pass.data, r->samr.in.newpassword, STR_ASCII);
@@ -177,7 +177,7 @@ OemChangePasswordUser2:
oe2.in.hash = &lm_verifier;
/* 4. try samr_OemChangePasswordUser2 */
- status = dcerpc_samr_OemChangePasswordUser2(c.pdc.out.dcerpc_pipe, mem_ctx, &oe2);
+ status = dcerpc_samr_OemChangePasswordUser2(c.out.dcerpc_pipe, mem_ctx, &oe2);
if (!NT_STATUS_IS_OK(status)) {
r->samr.out.error_string = talloc_asprintf(mem_ctx,
"samr_OemChangePasswordUser2 failed: %s\n",
@@ -247,7 +247,7 @@ ChangePasswordUser:
#endif
disconnect:
/* close connection */
- talloc_free(c.pdc.out.dcerpc_pipe);
+ talloc_free(c.out.dcerpc_pipe);
return status;
}
@@ -502,7 +502,7 @@ static NTSTATUS libnet_SetPassword_samr_handle(struct libnet_context *ctx, TALLO
static NTSTATUS libnet_SetPassword_samr(struct libnet_context *ctx, TALLOC_CTX *mem_ctx, union libnet_SetPassword *r)
{
NTSTATUS status;
- union libnet_rpc_connect c;
+ struct libnet_RpcConnect c;
struct samr_Connect sc;
struct policy_handle p_handle;
struct samr_LookupDomain ld;
@@ -515,14 +515,14 @@ static NTSTATUS libnet_SetPassword_samr(struct libnet_context *ctx, TALLOC_CTX *
union libnet_SetPassword r2;
/* prepare connect to the SAMR pipe of users domain PDC */
- c.pdc.level = LIBNET_RPC_CONNECT_PDC;
- c.pdc.in.domain_name = r->samr.in.domain_name;
- c.pdc.in.dcerpc_iface_name = DCERPC_SAMR_NAME;
- c.pdc.in.dcerpc_iface_uuid = DCERPC_SAMR_UUID;
- c.pdc.in.dcerpc_iface_version = DCERPC_SAMR_VERSION;
+ c.level = LIBNET_RPC_CONNECT_PDC;
+ c.in.domain_name = r->samr.in.domain_name;
+ c.in.dcerpc_iface_name = DCERPC_SAMR_NAME;
+ c.in.dcerpc_iface_uuid = DCERPC_SAMR_UUID;
+ c.in.dcerpc_iface_version = DCERPC_SAMR_VERSION;
/* 1. connect to the SAMR pipe of users domain PDC (maybe a standalone server or workstation) */
- status = libnet_rpc_connect(ctx, mem_ctx, &c);
+ status = libnet_RpcConnect(ctx, mem_ctx, &c);
if (!NT_STATUS_IS_OK(status)) {
r->samr.out.error_string = talloc_asprintf(mem_ctx,
"Connection to SAMR pipe of PDC of domain '%s' failed: %s\n",
@@ -537,7 +537,7 @@ static NTSTATUS libnet_SetPassword_samr(struct libnet_context *ctx, TALLOC_CTX *
sc.out.connect_handle = &p_handle;
/* 2. do a samr_Connect to get a policy handle */
- status = dcerpc_samr_Connect(c.pdc.out.dcerpc_pipe, mem_ctx, &sc);
+ status = dcerpc_samr_Connect(c.out.dcerpc_pipe, mem_ctx, &sc);
if (!NT_STATUS_IS_OK(status)) {
r->samr.out.error_string = talloc_asprintf(mem_ctx,
"samr_Connect failed: %s\n",
@@ -551,7 +551,7 @@ static NTSTATUS libnet_SetPassword_samr(struct libnet_context *ctx, TALLOC_CTX *
ld.in.domain_name = &d_name;
/* 3. do a samr_LookupDomain to get the domain sid */
- status = dcerpc_samr_LookupDomain(c.pdc.out.dcerpc_pipe, mem_ctx, &ld);
+ status = dcerpc_samr_LookupDomain(c.out.dcerpc_pipe, mem_ctx, &ld);
if (!NT_STATUS_IS_OK(status)) {
r->samr.out.error_string = talloc_asprintf(mem_ctx,
"samr_LookupDomain for [%s] failed: %s\n",
@@ -567,7 +567,7 @@ static NTSTATUS libnet_SetPassword_samr(struct libnet_context *ctx, TALLOC_CTX *
od.out.domain_handle = &d_handle;
/* 4. do a samr_OpenDomain to get a domain handle */
- status = dcerpc_samr_OpenDomain(c.pdc.out.dcerpc_pipe, mem_ctx, &od);
+ status = dcerpc_samr_OpenDomain(c.out.dcerpc_pipe, mem_ctx, &od);
if (!NT_STATUS_IS_OK(status)) {
r->samr.out.error_string = talloc_asprintf(mem_ctx,
"samr_OpenDomain for [%s] failed: %s\n",
@@ -586,7 +586,7 @@ static NTSTATUS libnet_SetPassword_samr(struct libnet_context *ctx, TALLOC_CTX *
ln.in.names[0].string = r->samr.in.account_name;
/* 5. do a samr_LookupNames to get the users rid */
- status = dcerpc_samr_LookupNames(c.pdc.out.dcerpc_pipe, mem_ctx, &ln);
+ status = dcerpc_samr_LookupNames(c.out.dcerpc_pipe, mem_ctx, &ln);
if (!NT_STATUS_IS_OK(status)) {
r->samr.out.error_string = talloc_asprintf(mem_ctx,
"samr_LookupNames for [%s] failed: %s\n",
@@ -611,7 +611,7 @@ static NTSTATUS libnet_SetPassword_samr(struct libnet_context *ctx, TALLOC_CTX *
ou.out.user_handle = &u_handle;
/* 6. do a samr_OpenUser to get a user handle */
- status = dcerpc_samr_OpenUser(c.pdc.out.dcerpc_pipe, mem_ctx, &ou);
+ status = dcerpc_samr_OpenUser(c.out.dcerpc_pipe, mem_ctx, &ou);
if (!NT_STATUS_IS_OK(status)) {
r->samr.out.error_string = talloc_asprintf(mem_ctx,
"samr_OpenUser for [%s] failed: %s\n",
@@ -623,7 +623,7 @@ static NTSTATUS libnet_SetPassword_samr(struct libnet_context *ctx, TALLOC_CTX *
r2.samr_handle.in.account_name = r->samr.in.account_name;
r2.samr_handle.in.newpassword = r->samr.in.newpassword;
r2.samr_handle.in.user_handle = &u_handle;
- r2.samr_handle.in.dcerpc_pipe = c.pdc.out.dcerpc_pipe;
+ r2.samr_handle.in.dcerpc_pipe = c.out.dcerpc_pipe;
status = libnet_SetPassword(ctx, mem_ctx, &r2);
@@ -631,7 +631,7 @@ static NTSTATUS libnet_SetPassword_samr(struct libnet_context *ctx, TALLOC_CTX *
disconnect:
/* close connection */
- talloc_free(c.pdc.out.dcerpc_pipe);
+ talloc_free(c.out.dcerpc_pipe);
return status;
}
diff --git a/source4/libnet/libnet_share.c b/source4/libnet/libnet_share.c
index 842fd24fe7..4b473436e1 100644
--- a/source4/libnet/libnet_share.c
+++ b/source4/libnet/libnet_share.c
@@ -27,18 +27,18 @@ NTSTATUS libnet_ListShares(struct libnet_context *ctx,
TALLOC_CTX *mem_ctx, struct libnet_ListShares *r)
{
NTSTATUS status;
- union libnet_rpc_connect c;
+ struct libnet_RpcConnect c;
struct srvsvc_NetShareEnumAll s;
uint32_t resume_handle;
struct srvsvc_NetShareCtr0 ctr0;
- c.standard.level = LIBNET_RPC_CONNECT_STANDARD;
- c.standard.in.server_name = r->in.server_name;
- c.standard.in.dcerpc_iface_name = DCERPC_SRVSVC_NAME;
- c.standard.in.dcerpc_iface_uuid = DCERPC_SRVSVC_UUID;
- c.standard.in.dcerpc_iface_version = DCERPC_SRVSVC_VERSION;
+ c.level = LIBNET_RPC_CONNECT_SERVER;
+ c.in.domain_name = r->in.server_name;
+ c.in.dcerpc_iface_name = DCERPC_SRVSVC_NAME;
+ c.in.dcerpc_iface_uuid = DCERPC_SRVSVC_UUID;
+ c.in.dcerpc_iface_version = DCERPC_SRVSVC_VERSION;
- status = libnet_rpc_connect(ctx, mem_ctx, &c);
+ status = libnet_RpcConnect(ctx, mem_ctx, &c);
if (!NT_STATUS_IS_OK(status)) {
r->out.error_string = talloc_asprintf(mem_ctx,
"Connection to SRVSVC pipe of server %s "
@@ -55,7 +55,7 @@ NTSTATUS libnet_ListShares(struct libnet_context *ctx,
ZERO_STRUCT(ctr0);
- status = dcerpc_srvsvc_NetShareEnumAll(c.standard.out.dcerpc_pipe, mem_ctx, &s);
+ status = dcerpc_srvsvc_NetShareEnumAll(c.out.dcerpc_pipe, mem_ctx, &s);
if (!NT_STATUS_IS_OK(status)) {
r->out.error_string = talloc_asprintf(mem_ctx,
@@ -72,7 +72,7 @@ NTSTATUS libnet_ListShares(struct libnet_context *ctx,
r->out.ctr = s.out.ctr;
disconnect:
- talloc_free(c.standard.out.dcerpc_pipe);
+ talloc_free(c.out.dcerpc_pipe);
return status;
}
@@ -82,16 +82,16 @@ NTSTATUS libnet_AddShare(struct libnet_context *ctx,
TALLOC_CTX *mem_ctx, struct libnet_AddShare *r)
{
NTSTATUS status;
- union libnet_rpc_connect c;
+ struct libnet_RpcConnect c;
struct srvsvc_NetShareAdd s;
- c.standard.level = LIBNET_RPC_CONNECT_STANDARD;
- c.standard.in.server_name = r->in.server_name;
- c.standard.in.dcerpc_iface_name = DCERPC_SRVSVC_NAME;
- c.standard.in.dcerpc_iface_uuid = DCERPC_SRVSVC_UUID;
- c.standard.in.dcerpc_iface_version = DCERPC_SRVSVC_VERSION;
+ c.level = LIBNET_RPC_CONNECT_SERVER;
+ c.in.domain_name = r->in.server_name;
+ c.in.dcerpc_iface_name = DCERPC_SRVSVC_NAME;
+ c.in.dcerpc_iface_uuid = DCERPC_SRVSVC_UUID;
+ c.in.dcerpc_iface_version = DCERPC_SRVSVC_VERSION;
- status = libnet_rpc_connect(ctx, mem_ctx, &c);
+ status = libnet_RpcConnect(ctx, mem_ctx, &c);
if (!NT_STATUS_IS_OK(status)) {
r->out.error_string = talloc_asprintf(mem_ctx,
"Connection to SRVSVC pipe of server %s "
@@ -104,7 +104,7 @@ NTSTATUS libnet_AddShare(struct libnet_context *ctx,
s.in.info.info2 = &r->in.share;
s.in.server_unc = talloc_asprintf(mem_ctx, "\\\\%s", r->in.server_name);
- status = dcerpc_srvsvc_NetShareAdd(c.standard.out.dcerpc_pipe, mem_ctx,&s);
+ status = dcerpc_srvsvc_NetShareAdd(c.out.dcerpc_pipe, mem_ctx,&s);
if (!NT_STATUS_IS_OK(status)) {
r->out.error_string = talloc_asprintf(mem_ctx,
@@ -113,7 +113,7 @@ NTSTATUS libnet_AddShare(struct libnet_context *ctx,
r->in.server_name, nt_errstr(status));
}
- talloc_free(c.standard.out.dcerpc_pipe);
+ talloc_free(c.out.dcerpc_pipe);
return status;
}
@@ -123,16 +123,16 @@ NTSTATUS libnet_DelShare(struct libnet_context *ctx,
TALLOC_CTX *mem_ctx, struct libnet_DelShare *r)
{
NTSTATUS status;
- union libnet_rpc_connect c;
+ struct libnet_RpcConnect c;
struct srvsvc_NetShareDel s;
- c.standard.level = LIBNET_RPC_CONNECT_STANDARD;
- c.standard.in.server_name = r->in.server_name;
- c.standard.in.dcerpc_iface_name = DCERPC_SRVSVC_NAME;
- c.standard.in.dcerpc_iface_uuid = DCERPC_SRVSVC_UUID;
- c.standard.in.dcerpc_iface_version = DCERPC_SRVSVC_VERSION;
+ c.level = LIBNET_RPC_CONNECT_SERVER;
+ c.in.domain_name = r->in.server_name;
+ c.in.dcerpc_iface_name = DCERPC_SRVSVC_NAME;
+ c.in.dcerpc_iface_uuid = DCERPC_SRVSVC_UUID;
+ c.in.dcerpc_iface_version = DCERPC_SRVSVC_VERSION;
- status = libnet_rpc_connect(ctx, mem_ctx, &c);
+ status = libnet_RpcConnect(ctx, mem_ctx, &c);
if (!NT_STATUS_IS_OK(status)) {
r->out.error_string = talloc_asprintf(mem_ctx,
"Connection to SRVSVC pipe of server %s "
@@ -144,7 +144,7 @@ NTSTATUS libnet_DelShare(struct libnet_context *ctx,
s.in.server_unc = talloc_asprintf(mem_ctx, "\\\\%s", r->in.server_name);
s.in.share_name = r->in.share_name;
- status = dcerpc_srvsvc_NetShareDel(c.standard.out.dcerpc_pipe, mem_ctx, &s);
+ status = dcerpc_srvsvc_NetShareDel(c.out.dcerpc_pipe, mem_ctx, &s);
if (!NT_STATUS_IS_OK(status)) {
r->out.error_string = talloc_asprintf(mem_ctx,
"srvsvc_NetShareDel on server '%s' failed"
@@ -152,7 +152,7 @@ NTSTATUS libnet_DelShare(struct libnet_context *ctx,
r->in.server_name, nt_errstr(status));
}
- talloc_free(c.standard.out.dcerpc_pipe);
+ talloc_free(c.out.dcerpc_pipe);
return status;
}
diff --git a/source4/libnet/libnet_time.c b/source4/libnet/libnet_time.c
index b8f4cb7a86..63d63e104f 100644
--- a/source4/libnet/libnet_time.c
+++ b/source4/libnet/libnet_time.c
@@ -29,19 +29,19 @@
static NTSTATUS libnet_RemoteTOD_srvsvc(struct libnet_context *ctx, TALLOC_CTX *mem_ctx, union libnet_RemoteTOD *r)
{
NTSTATUS status;
- union libnet_rpc_connect c;
+ struct libnet_RpcConnect c;
struct srvsvc_NetRemoteTOD tod;
struct tm tm;
/* prepare connect to the SRVSVC pipe of a timeserver */
- c.standard.level = LIBNET_RPC_CONNECT_STANDARD;
- c.standard.in.server_name = r->srvsvc.in.server_name;
- c.standard.in.dcerpc_iface_name = DCERPC_SRVSVC_NAME;
- c.standard.in.dcerpc_iface_uuid = DCERPC_SRVSVC_UUID;
- c.standard.in.dcerpc_iface_version = DCERPC_SRVSVC_VERSION;
+ c.level = LIBNET_RPC_CONNECT_SERVER;
+ c.in.domain_name = r->srvsvc.in.server_name;
+ c.in.dcerpc_iface_name = DCERPC_SRVSVC_NAME;
+ c.in.dcerpc_iface_uuid = DCERPC_SRVSVC_UUID;
+ c.in.dcerpc_iface_version = DCERPC_SRVSVC_VERSION;
/* 1. connect to the SRVSVC pipe of a timeserver */
- status = libnet_rpc_connect(ctx, mem_ctx, &c);
+ status = libnet_RpcConnect(ctx, mem_ctx, &c);
if (!NT_STATUS_IS_OK(status)) {
r->srvsvc.out.error_string = talloc_asprintf(mem_ctx,
"Connection to SRVSVC pipe of server '%s' failed: %s\n",
@@ -50,10 +50,10 @@ static NTSTATUS libnet_RemoteTOD_srvsvc(struct libnet_context *ctx, TALLOC_CTX *
}
/* prepare srvsvc_NetrRemoteTOD */
- tod.in.server_unc = talloc_asprintf(mem_ctx, "\\%s", c.standard.in.server_name);
+ tod.in.server_unc = talloc_asprintf(mem_ctx, "\\%s", c.in.domain_name);
/* 2. try srvsvc_NetRemoteTOD */
- status = dcerpc_srvsvc_NetRemoteTOD(c.pdc.out.dcerpc_pipe, mem_ctx, &tod);
+ status = dcerpc_srvsvc_NetRemoteTOD(c.out.dcerpc_pipe, mem_ctx, &tod);
if (!NT_STATUS_IS_OK(status)) {
r->srvsvc.out.error_string = talloc_asprintf(mem_ctx,
"srvsvc_NetrRemoteTOD on server '%s' failed: %s\n",
@@ -88,7 +88,7 @@ static NTSTATUS libnet_RemoteTOD_srvsvc(struct libnet_context *ctx, TALLOC_CTX *
disconnect:
/* close connection */
- talloc_free(c.standard.out.dcerpc_pipe);
+ talloc_free(c.out.dcerpc_pipe);
return status;
}
diff --git a/source4/libnet/libnet_user.c b/source4/libnet/libnet_user.c
index dc049b1261..64122199d7 100644
--- a/source4/libnet/libnet_user.c
+++ b/source4/libnet/libnet_user.c
@@ -27,26 +27,26 @@
NTSTATUS libnet_CreateUser(struct libnet_context *ctx, TALLOC_CTX *mem_ctx, struct libnet_CreateUser *r)
{
NTSTATUS status;
- union libnet_rpc_connect cn;
- union libnet_find_pdc fp;
+ struct libnet_RpcConnect cn;
+ struct libnet_Lookup fp;
struct libnet_rpc_domain_open dom_io;
struct libnet_rpc_useradd user_io;
/* find domain pdc */
- fp.generic.level = LIBNET_FIND_PDC_GENERIC;
- fp.generic.in.domain_name = r->in.domain_name;
+ fp.in.hostname = r->in.domain_name;
+ fp.in.methods = NULL;
- status = libnet_find_pdc(ctx, mem_ctx, &fp);
+ status = libnet_LookupPdc(ctx, mem_ctx, &fp);
if (!NT_STATUS_IS_OK(status)) return status;
/* connect rpc service of remote server */
- cn.standard.level = LIBNET_RPC_CONNECT_PDC;
- cn.standard.in.server_name = fp.generic.out.pdc_name;
- cn.standard.in.dcerpc_iface_name = DCERPC_SAMR_NAME;
- cn.standard.in.dcerpc_iface_uuid = DCERPC_SAMR_UUID;
- cn.standard.in.dcerpc_iface_version = DCERPC_SAMR_VERSION;
+ cn.level = LIBNET_RPC_CONNECT_PDC;
+ cn.in.domain_name = talloc_strdup(mem_ctx, *fp.out.address);
+ cn.in.dcerpc_iface_name = DCERPC_SAMR_NAME;
+ cn.in.dcerpc_iface_uuid = DCERPC_SAMR_UUID;
+ cn.in.dcerpc_iface_version = DCERPC_SAMR_VERSION;
- status = libnet_rpc_connect(ctx, mem_ctx, &cn);
+ status = libnet_RpcConnect(ctx, mem_ctx, &cn);
if (!NT_STATUS_IS_OK(status)) {
r->out.error_string = talloc_asprintf(mem_ctx,
"Connection to SAMR pipe domain '%s' PDC failed: %s\n",
@@ -54,13 +54,13 @@ NTSTATUS libnet_CreateUser(struct libnet_context *ctx, TALLOC_CTX *mem_ctx, stru
return status;
}
- ctx->samr = cn.pdc.out.dcerpc_pipe;
+ ctx->pipe = cn.out.dcerpc_pipe;
/* open connected domain */
dom_io.in.domain_name = r->in.domain_name;
dom_io.in.access_mask = SEC_FLAG_MAXIMUM_ALLOWED;
- status = libnet_rpc_domain_open(ctx->samr, mem_ctx, &dom_io);
+ status = libnet_rpc_domain_open(ctx->pipe, mem_ctx, &dom_io);
if (!NT_STATUS_IS_OK(status)) {
r->out.error_string = talloc_asprintf(mem_ctx,
"Creating user account failed: %s\n",
@@ -74,7 +74,7 @@ NTSTATUS libnet_CreateUser(struct libnet_context *ctx, TALLOC_CTX *mem_ctx, stru
user_io.in.username = r->in.user_name;
user_io.in.domain_handle = dom_io.out.domain_handle;
- status = libnet_rpc_useradd(ctx->samr, mem_ctx, &user_io);
+ status = libnet_rpc_useradd(ctx->pipe, mem_ctx, &user_io);
if (!NT_STATUS_IS_OK(status)) {
r->out.error_string = talloc_asprintf(mem_ctx,
"Creating user account failed: %s\n",