1
0
mirror of https://github.com/samba-team/samba.git synced 2025-03-03 12:58:35 +03:00

s3-spoolss: stricter name checks when opening back-channel notify connection.

Make sure to always check if the name the client passed in
spoolss_RemoteFindFirstPrinterChangeNotifyEx is not one of our names.

Guenther
This commit is contained in:
Günther Deschner 2010-01-19 00:33:57 +01:00
parent c971c10a63
commit f720f7512e

View File

@ -2340,27 +2340,30 @@ static bool spoolss_connect_to_client(struct rpc_pipe_client **pp_pipe,
NTSTATUS ret;
struct cli_state *the_cli;
struct sockaddr_storage rm_addr;
char addr[INET6_ADDRSTRLEN];
if ( is_zero_addr((struct sockaddr *)client_ss) ) {
DEBUG(2,("spoolss_connect_to_client: resolving %s\n",
remote_machine));
if ( !resolve_name( remote_machine, &rm_addr, 0x20, false) ) {
DEBUG(2,("spoolss_connect_to_client: Can't resolve address for %s\n", remote_machine));
return false;
}
if (ismyaddr((struct sockaddr *)&rm_addr)) {
DEBUG(0,("spoolss_connect_to_client: Machine %s is one of our addresses. Cannot add to ourselves.\n", remote_machine));
return false;
}
print_sockaddr(addr, sizeof(addr), &rm_addr);
} else {
char addr[INET6_ADDRSTRLEN];
rm_addr = *client_ss;
print_sockaddr(addr, sizeof(addr), &rm_addr);
DEBUG(5,("spoolss_connect_to_client: Using address %s (no name resolution necessary)\n",
addr));
}
/* setup the connection */
if (ismyaddr((struct sockaddr *)&rm_addr)) {
DEBUG(0,("spoolss_connect_to_client: Machine %s is one of our addresses. Cannot add to ourselves.\n",
addr));
return false;
}
/* setup the connection */
ret = cli_full_connection( &the_cli, global_myname(), remote_machine,
&rm_addr, 0, "IPC$", "IPC",
"", /* username */
@ -2549,6 +2552,9 @@ WERROR _spoolss_RemoteFindFirstPrinterChangeNotifyEx(pipes_struct *p,
!get_printer_snum(p, r->in.handle, &snum, NULL) )
return WERR_BADFID;
DEBUG(10,("_spoolss_RemoteFindFirstPrinterChangeNotifyEx: "
"client_address is %s\n", p->client_address));
if (!interpret_string_addr(&client_ss, p->client_address,
AI_NUMERICHOST)) {
return WERR_SERVER_UNAVAILABLE;