mirror of
https://github.com/samba-team/samba.git
synced 2025-12-04 08:23:50 +03:00
server_cryptkey() now calling cli_connectserverlist(). stupid microsoft
idiotic *SMBSERVER connectionism added to cli_connect_serverlist(). also added check for protocol < LANMAN2.
This commit is contained in:
@@ -2728,7 +2728,7 @@ BOOL cli_connect_serverlist(struct cli_state *cli, char *p)
|
|||||||
extern pstring scope;
|
extern pstring scope;
|
||||||
fstring remote_machine;
|
fstring remote_machine;
|
||||||
struct in_addr dest_ip;
|
struct in_addr dest_ip;
|
||||||
struct nmb_name calling, called;
|
struct nmb_name calling, called, stupid_smbserver_called;
|
||||||
BOOL connected_ok = False;
|
BOOL connected_ok = False;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -2763,19 +2763,28 @@ BOOL cli_connect_serverlist(struct cli_state *cli, char *p)
|
|||||||
|
|
||||||
make_nmb_name(&calling, global_myname , 0x0 , scope);
|
make_nmb_name(&calling, global_myname , 0x0 , scope);
|
||||||
make_nmb_name(&called , remote_machine, 0x20, scope);
|
make_nmb_name(&called , remote_machine, 0x20, scope);
|
||||||
|
/* stupid microsoft destruction of the ability of netbios
|
||||||
|
* to provide multiple netbios servers on one host.
|
||||||
|
*/
|
||||||
|
make_nmb_name(&stupid_smbserver_called , "*SMBSERVER", 0x20, scope);
|
||||||
|
|
||||||
pwd_set_nullpwd(&cli->pwd);
|
pwd_set_nullpwd(&cli->pwd);
|
||||||
|
|
||||||
if (!cli_establish_connection(cli, remote_machine, &dest_ip,
|
if (!cli_establish_connection(cli, remote_machine, &dest_ip,
|
||||||
&calling, &called,
|
&calling, &called,
|
||||||
"IPC$", "IPC",
|
"IPC$", "IPC",
|
||||||
|
False, True) &&
|
||||||
|
!cli_establish_connection(cli, remote_machine, &dest_ip,
|
||||||
|
&calling, &stupid_smbserver_called,
|
||||||
|
"IPC$", "IPC",
|
||||||
False, True))
|
False, True))
|
||||||
{
|
{
|
||||||
cli_shutdown(cli);
|
cli_shutdown(cli);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!IS_BITS_SET_ALL(cli->sec_mode, 1))
|
if (cli->protocol < PROTOCOL_LANMAN2 ||
|
||||||
|
!IS_BITS_SET_ALL(cli->sec_mode, 1))
|
||||||
{
|
{
|
||||||
DEBUG(1,("cli_connect_serverlist: machine %s isn't in user level security mode\n",
|
DEBUG(1,("cli_connect_serverlist: machine %s isn't in user level security mode\n",
|
||||||
remote_machine));
|
remote_machine));
|
||||||
|
|||||||
@@ -909,81 +909,11 @@ support for server level security
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
struct cli_state *server_cryptkey(void)
|
struct cli_state *server_cryptkey(void)
|
||||||
{
|
{
|
||||||
struct cli_state *cli;
|
if (cli_connect_serverlist(server_client(), lp_passwordserver()))
|
||||||
fstring desthost;
|
{
|
||||||
struct in_addr dest_ip;
|
return server_client();
|
||||||
extern fstring local_machine;
|
|
||||||
char *p;
|
|
||||||
BOOL connected_ok = False;
|
|
||||||
struct nmb_name calling, called;
|
|
||||||
|
|
||||||
cli = server_client();
|
|
||||||
|
|
||||||
if (!cli_initialise(cli))
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
p = lp_passwordserver();
|
|
||||||
while(p && next_token( &p, desthost, LIST_SEP, sizeof(desthost))) {
|
|
||||||
standard_sub_basic(desthost);
|
|
||||||
strupper(desthost);
|
|
||||||
|
|
||||||
if(!resolve_name( desthost, &dest_ip, 0x20)) {
|
|
||||||
DEBUG(1,("server_cryptkey: Can't resolve address for %s\n",desthost));
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ismyip(dest_ip)) {
|
|
||||||
DEBUG(1,("Password server loop - disabling password server %s\n",desthost));
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (cli_connect(cli, desthost, &dest_ip)) {
|
|
||||||
DEBUG(3,("connected to password server %s\n",desthost));
|
|
||||||
connected_ok = True;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
return NULL;
|
||||||
if (!connected_ok) {
|
|
||||||
DEBUG(0,("password server not available\n"));
|
|
||||||
cli_shutdown(cli);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
make_nmb_name(&calling, local_machine, 0x0 , scope);
|
|
||||||
make_nmb_name(&called , desthost , 0x20, scope);
|
|
||||||
|
|
||||||
if (!cli_session_request(cli, &calling, &called)) {
|
|
||||||
/* try with *SMBSERVER if the first name fails */
|
|
||||||
cli_shutdown(cli);
|
|
||||||
make_nmb_name(&called , "*SMBSERVER", 0x20, scope);
|
|
||||||
if (!cli_initialise(cli) ||
|
|
||||||
!cli_connect(cli, desthost, &dest_ip) ||
|
|
||||||
!cli_session_request(cli, &calling, &called)) {
|
|
||||||
DEBUG(1,("%s rejected the session\n",desthost));
|
|
||||||
cli_shutdown(cli);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
DEBUG(3,("got session\n"));
|
|
||||||
|
|
||||||
if (!cli_negprot(cli)) {
|
|
||||||
DEBUG(1,("%s rejected the negprot\n",desthost));
|
|
||||||
cli_shutdown(cli);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (cli->protocol < PROTOCOL_LANMAN2 ||
|
|
||||||
!(cli->sec_mode & 1)) {
|
|
||||||
DEBUG(1,("%s isn't in user level security mode\n",desthost));
|
|
||||||
cli_shutdown(cli);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
DEBUG(3,("password server OK\n"));
|
|
||||||
|
|
||||||
return cli;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
|
|||||||
Reference in New Issue
Block a user