1
0
mirror of https://github.com/samba-team/samba.git synced 2025-03-27 22:50:26 +03:00

s3: Add "client_id" to pipes_struct

This commit is contained in:
Volker Lendecke 2010-08-16 11:01:26 +02:00
parent 6d10684556
commit 4b5e252354
11 changed files with 42 additions and 28 deletions

View File

@ -131,7 +131,7 @@ struct pipe_auth_data {
struct pipes_struct {
struct pipes_struct *next, *prev;
char client_address[INET6_ADDRSTRLEN];
struct client_address *client_id;
struct auth_serversupplied_info *server_info;
struct messaging_context *msg_ctx;

View File

@ -4535,12 +4535,13 @@ NTSTATUS rpc_pipe_open_ncalrpc(TALLOC_CTX *mem_ctx, const char *socket_path,
struct rpc_pipe_client **presult);
struct pipes_struct *make_internal_rpc_pipe_p(TALLOC_CTX *mem_ctx,
const struct ndr_syntax_id *syntax,
const char *client_address,
struct client_address *client_id,
struct auth_serversupplied_info *server_info,
struct messaging_context *msg_ctx);
NTSTATUS rpc_pipe_open_internal(TALLOC_CTX *mem_ctx,
const struct ndr_syntax_id *abstract_syntax,
struct auth_serversupplied_info *serversupplied_info,
struct client_address *client_id,
struct messaging_context *msg_ctx,
struct rpc_pipe_client **presult);
NTSTATUS rpc_connect_spoolss_pipe(connection_struct *conn,
@ -4752,6 +4753,7 @@ struct tsocket_address;
NTSTATUS np_open(TALLOC_CTX *mem_ctx, const char *name,
const struct tsocket_address *local_address,
const struct tsocket_address *remote_address,
struct client_address *client_id,
struct auth_serversupplied_info *server_info,
struct messaging_context *msg_ctx,
struct fake_file_handle **phandle);

View File

@ -613,6 +613,7 @@ bool nt_printing_tdb_migrate(struct messaging_context *msg_ctx)
status = rpc_pipe_open_internal(tmp_ctx,
&ndr_table_spoolss.syntax_id,
server_info,
NULL,
msg_ctx,
&spoolss_pipe);
if (!NT_STATUS_IS_OK(status)) {

View File

@ -114,7 +114,7 @@ static int close_internal_rpc_pipe_hnd(struct pipes_struct *p)
struct pipes_struct *make_internal_rpc_pipe_p(TALLOC_CTX *mem_ctx,
const struct ndr_syntax_id *syntax,
const char *client_address,
struct client_address *client_id,
struct auth_serversupplied_info *server_info,
struct messaging_context *msg_ctx)
{
@ -157,7 +157,7 @@ struct pipes_struct *make_internal_rpc_pipe_p(TALLOC_CTX *mem_ctx,
DLIST_ADD(InternalPipes, p);
strlcpy(p->client_address, client_address, sizeof(p->client_address));
p->client_id = client_id;
p->endian = RPC_LITTLE_ENDIAN;
@ -469,6 +469,7 @@ static struct dcerpc_binding_handle *rpcint_binding_handle(struct pipes_struct *
NTSTATUS rpc_pipe_open_internal(TALLOC_CTX *mem_ctx,
const struct ndr_syntax_id *abstract_syntax,
struct auth_serversupplied_info *serversupplied_info,
struct client_address *client_id,
struct messaging_context *msg_ctx,
struct rpc_pipe_client **presult)
{
@ -482,8 +483,16 @@ NTSTATUS rpc_pipe_open_internal(TALLOC_CTX *mem_ctx,
result->abstract_syntax = *abstract_syntax;
result->transfer_syntax = ndr_transfer_syntax;
if (client_id == NULL) {
static struct client_address unknown;
strlcpy(unknown.addr, "<UNKNOWN>", sizeof(unknown.addr));
unknown.name = "<UNKNOWN>";
client_id = &unknown;
}
result->pipes_struct = make_internal_rpc_pipe_p(
result, abstract_syntax, "", serversupplied_info, msg_ctx);
result, abstract_syntax, client_id, serversupplied_info,
msg_ctx);
if (result->pipes_struct == NULL) {
TALLOC_FREE(result);
return NT_STATUS_NO_MEMORY;

View File

@ -406,6 +406,7 @@ NTSTATUS _netr_NetrEnumerateTrustedDomains(struct pipes_struct *p,
status = rpc_pipe_open_internal(p->mem_ctx, &ndr_table_lsarpc.syntax_id,
p->server_info,
p->client_id,
p->msg_ctx,
&cli);
if (!NT_STATUS_IS_OK(status)) {
@ -631,7 +632,7 @@ static NTSTATUS get_md4pw(struct samr_Password *md4pw, const char *mach_acct,
ZERO_STRUCT(user_handle);
status = rpc_pipe_open_internal(mem_ctx, &ndr_table_samr.syntax_id,
server_info, msg_ctx,
server_info, NULL, msg_ctx,
&cli);
if (!NT_STATUS_IS_OK(status)) {
goto out;
@ -1035,7 +1036,7 @@ static NTSTATUS netr_set_machine_account_password(TALLOC_CTX *mem_ctx,
ZERO_STRUCT(user_handle);
status = rpc_pipe_open_internal(mem_ctx, &ndr_table_samr.syntax_id,
server_info, msg_ctx,
server_info, NULL, msg_ctx,
&cli);
if (!NT_STATUS_IS_OK(status)) {
goto out;

View File

@ -537,6 +537,7 @@ static struct np_proxy_state *make_external_rpc_pipe_p(TALLOC_CTX *mem_ctx,
NTSTATUS np_open(TALLOC_CTX *mem_ctx, const char *name,
const struct tsocket_address *local_address,
const struct tsocket_address *remote_address,
struct client_address *client_id,
struct auth_serversupplied_info *server_info,
struct messaging_context *msg_ctx,
struct fake_file_handle **phandle)
@ -564,26 +565,13 @@ NTSTATUS np_open(TALLOC_CTX *mem_ctx, const char *name,
} else {
struct pipes_struct *p;
struct ndr_syntax_id syntax;
const char *client_address;
if (!is_known_pipename(name, &syntax)) {
TALLOC_FREE(handle);
return NT_STATUS_OBJECT_NAME_NOT_FOUND;
}
if (tsocket_address_is_inet(remote_address, "ip")) {
client_address = tsocket_address_inet_addr_string(
remote_address,
talloc_tos());
if (client_address == NULL) {
TALLOC_FREE(handle);
return NT_STATUS_NO_MEMORY;
}
} else {
client_address = "";
}
p = make_internal_rpc_pipe_p(handle, &syntax, client_address,
p = make_internal_rpc_pipe_p(handle, &syntax, client_id,
server_info, msg_ctx);
handle->type = FAKE_FILE_TYPE_NAMED_PIPE;
@ -930,6 +918,7 @@ NTSTATUS rpc_connect_spoolss_pipe(connection_struct *conn,
status = rpc_pipe_open_internal(conn,
&ndr_table_spoolss.syntax_id,
conn->server_info,
&conn->sconn->client_id,
conn->sconn->msg_ctx,
&conn->spoolss_pipe);
if (!NT_STATUS_IS_OK(status)) {

View File

@ -2451,9 +2451,9 @@ WERROR _spoolss_RemoteFindFirstPrinterChangeNotifyEx(struct pipes_struct *p,
return WERR_BADFID;
DEBUG(10,("_spoolss_RemoteFindFirstPrinterChangeNotifyEx: "
"client_address is %s\n", p->client_address));
"client_address is %s\n", p->client_id->addr));
if (!interpret_string_addr(&client_ss, p->client_address,
if (!interpret_string_addr(&client_ss, p->client_id->addr,
AI_NUMERICHOST)) {
return WERR_SERVER_UNAVAILABLE;
}
@ -6111,7 +6111,7 @@ static WERROR update_printer(struct pipes_struct *p,
{
/* add_printer_hook() will call reload_services() */
if (!add_printer_hook(tmp_ctx, p->server_info->ptok,
printer, p->client_address,
printer, p->client_id->addr,
p->msg_ctx)) {
result = WERR_ACCESS_DENIED;
goto done;
@ -7420,7 +7420,7 @@ static WERROR spoolss_addprinterex_level_2(struct pipes_struct *p,
if (*lp_addprinter_cmd() ) {
if ( !add_printer_hook(p->mem_ctx, p->server_info->ptok,
info2, p->client_address,
info2, p->client_id->addr,
p->msg_ctx) ) {
return WERR_ACCESS_DENIED;
}

View File

@ -262,6 +262,7 @@ static WERROR winreg_printer_openkey(TALLOC_CTX *mem_ctx,
status = rpc_pipe_open_internal(mem_ctx,
&ndr_table_winreg.syntax_id,
server_info,
NULL,
msg_ctx,
&pipe_handle);
if (!NT_STATUS_IS_OK(status)) {

View File

@ -2236,6 +2236,7 @@ static bool api_RNetShareAdd(struct smbd_server_connection *sconn,
status = rpc_pipe_open_internal(mem_ctx, &ndr_table_srvsvc.syntax_id,
conn->server_info,
&conn->sconn->client_id,
conn->sconn->msg_ctx,
&cli);
if (!NT_STATUS_IS_OK(status)) {
@ -2343,7 +2344,8 @@ static bool api_RNetGroupEnum(struct smbd_server_connection *sconn,
status = rpc_pipe_open_internal(
talloc_tos(), &ndr_table_samr.syntax_id,
conn->server_info, conn->sconn->msg_ctx, &samr_pipe);
conn->server_info, &conn->sconn->client_id,
conn->sconn->msg_ctx, &samr_pipe);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(0, ("api_RNetUserEnum: Could not connect to samr: %s\n",
nt_errstr(status)));
@ -2525,7 +2527,8 @@ static bool api_NetUserGetGroups(struct smbd_server_connection *sconn,
status = rpc_pipe_open_internal(
talloc_tos(), &ndr_table_samr.syntax_id,
conn->server_info, conn->sconn->msg_ctx, &samr_pipe);
conn->server_info, &conn->sconn->client_id,
conn->sconn->msg_ctx, &samr_pipe);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(0, ("api_RNetUserEnum: Could not connect to samr: %s\n",
nt_errstr(status)));
@ -2681,7 +2684,8 @@ static bool api_RNetUserEnum(struct smbd_server_connection *sconn,
status = rpc_pipe_open_internal(
talloc_tos(), &ndr_table_samr.syntax_id,
conn->server_info, conn->sconn->msg_ctx, &samr_pipe);
conn->server_info, &conn->sconn->client_id,
conn->sconn->msg_ctx, &samr_pipe);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(0, ("api_RNetUserEnum: Could not connect to samr: %s\n",
nt_errstr(status)));
@ -2924,6 +2928,7 @@ static bool api_SetUserPassword(struct smbd_server_connection *sconn,
status = rpc_pipe_open_internal(mem_ctx, &ndr_table_samr.syntax_id,
conn->server_info,
&conn->sconn->client_id,
conn->sconn->msg_ctx,
&cli);
if (!NT_STATUS_IS_OK(status)) {
@ -3141,6 +3146,7 @@ static bool api_SamOEMChangePassword(struct smbd_server_connection *sconn,
status = rpc_pipe_open_internal(mem_ctx, &ndr_table_samr.syntax_id,
conn->server_info,
&conn->sconn->client_id,
conn->sconn->msg_ctx,
&cli);
if (!NT_STATUS_IS_OK(status)) {
@ -3695,6 +3701,7 @@ static bool api_RNetServerGetInfo(struct smbd_server_connection *sconn,
status = rpc_pipe_open_internal(mem_ctx, &ndr_table_srvsvc.syntax_id,
conn->server_info,
&conn->sconn->client_id,
conn->sconn->msg_ctx,
&cli);
if (!NT_STATUS_IS_OK(status)) {
@ -4118,6 +4125,7 @@ static bool api_RNetUserGetInfo(struct smbd_server_connection *sconn,
status = rpc_pipe_open_internal(mem_ctx, &ndr_table_samr.syntax_id,
conn->server_info,
&conn->sconn->client_id,
conn->sconn->msg_ctx,
&cli);
if (!NT_STATUS_IS_OK(status)) {

View File

@ -69,6 +69,7 @@ NTSTATUS open_np_file(struct smb_request *smb_req, const char *name,
status = np_open(fsp, name,
conn->sconn->local_address,
conn->sconn->remote_address,
&conn->sconn->client_id,
conn->server_info,
conn->sconn->msg_ctx,
&fsp->fake_file_handle);

View File

@ -61,6 +61,7 @@ static NTSTATUS open_internal_samr_pipe(TALLOC_CTX *mem_ctx,
status = rpc_pipe_open_internal(mem_ctx,
&ndr_table_samr.syntax_id,
server_info,
NULL,
winbind_messaging_context(),
&cli);
if (!NT_STATUS_IS_OK(status)) {
@ -133,6 +134,7 @@ static NTSTATUS open_internal_lsa_pipe(TALLOC_CTX *mem_ctx,
status = rpc_pipe_open_internal(mem_ctx,
&ndr_table_lsarpc.syntax_id,
server_info,
NULL,
winbind_messaging_context(),
&cli);
if (!NT_STATUS_IS_OK(status)) {