1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-27 03:21:53 +03:00

Add client side support for samr connect4 (0x3e). Seems to have one

additional parm compared to samr connect, but I've only seen 0x00000002
in that field...
(This used to be commit ed2370b91f)
This commit is contained in:
Jim McDonough 2002-08-12 08:25:02 +00:00
parent 3773419cdf
commit 4a822be1d3
2 changed files with 69 additions and 0 deletions

View File

@ -72,6 +72,53 @@ NTSTATUS cli_samr_connect(struct cli_state *cli, TALLOC_CTX *mem_ctx,
return result;
}
/* Connect to SAMR database */
NTSTATUS cli_samr_connect4(struct cli_state *cli, TALLOC_CTX *mem_ctx,
uint32 access_mask, POLICY_HND *connect_pol)
{
prs_struct qbuf, rbuf;
SAMR_Q_CONNECT4 q;
SAMR_R_CONNECT4 r;
NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
ZERO_STRUCT(q);
ZERO_STRUCT(r);
/* Initialise parse structures */
prs_init(&qbuf, MAX_PDU_FRAG_LEN, mem_ctx, MARSHALL);
prs_init(&rbuf, 0, mem_ctx, UNMARSHALL);
/* Marshall data and send request */
init_samr_q_connect4(&q, cli->desthost, access_mask);
if (!samr_io_q_connect4("", &q, &qbuf, 0) ||
!rpc_api_pipe_req(cli, SAMR_CONNECT4, &qbuf, &rbuf))
goto done;
/* Unmarshall response */
if (!samr_io_r_connect4("", &r, &rbuf, 0))
goto done;
/* Return output parameters */
if (NT_STATUS_IS_OK(result = r.status)) {
*connect_pol = r.connect_pol;
#ifdef __INSURE__
connect_pol->marker = malloc(1);
#endif
}
done:
prs_mem_free(&qbuf);
prs_mem_free(&rbuf);
return result;
}
/* Close SAMR handle */
NTSTATUS cli_samr_close(struct cli_state *cli, TALLOC_CTX *mem_ctx,

View File

@ -6718,6 +6718,28 @@ BOOL samr_io_r_connect(char *desc, SAMR_R_CONNECT * r_u,
return True;
}
/*******************************************************************
inits a SAMR_Q_CONNECT4 structure.
********************************************************************/
void init_samr_q_connect4(SAMR_Q_CONNECT4 * q_u,
char *srv_name, uint32 access_mask)
{
int len_srv_name = strlen(srv_name);
DEBUG(5, ("init_samr_q_connect\n"));
/* make PDC server name \\server */
q_u->ptr_srv_name = len_srv_name > 0 ? 1 : 0;
init_unistr2(&q_u->uni_srv_name, srv_name, len_srv_name + 1);
/* Only value we've seen, possibly an address type ? */
q_u->unk_0 = 2;
/* example values: 0x0000 0002 */
q_u->access_mask = access_mask;
}
/*******************************************************************
reads or writes a structure.
********************************************************************/