summaryrefslogtreecommitdiff
path: root/source3/libsmb
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2002-06-25 08:57:24 +0000
committerAndrew Bartlett <abartlet@samba.org>2002-06-25 08:57:24 +0000
commit07465761137adf756d771fa1f8592c294488e779 (patch)
tree19dd710228d65ace7862e07735f56072ed5eccc9 /source3/libsmb
parente3958c21050be094c1aaa4030e54eb7cee74a6f9 (diff)
downloadsamba-07465761137adf756d771fa1f8592c294488e779.tar.gz
samba-07465761137adf756d771fa1f8592c294488e779.tar.bz2
samba-07465761137adf756d771fa1f8592c294488e779.zip
Update cli_full_connection() to take a 'flags' paramater, and try to get a
few more places to use it. Andrew Bartlett (This used to be commit 23689b0746d5ab030d8693abf71dd2e80ec1d7c7)
Diffstat (limited to 'source3/libsmb')
-rw-r--r--source3/libsmb/cliconnect.c41
-rw-r--r--source3/libsmb/trust_passwd.c3
2 files changed, 28 insertions, 16 deletions
diff --git a/source3/libsmb/cliconnect.c b/source3/libsmb/cliconnect.c
index cc9821dc29..c621d9a34e 100644
--- a/source3/libsmb/cliconnect.c
+++ b/source3/libsmb/cliconnect.c
@@ -2,6 +2,7 @@
Unix SMB/CIFS implementation.
client connect/disconnect routines
Copyright (C) Andrew Tridgell 1994-1998
+ Copyright (C) Andrew Barteltt 2001-2002
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -1096,7 +1097,7 @@ static void init_creds(struct ntuser_creds *creds, char* username,
@param dest_host The netbios name of the remote host
@param dest_ip (optional) The the destination IP, NULL for name based lookup
@param port (optional) The destination port (0 for default)
- @param service The share to make the connection to. Should be 'unqualified' in any way.
+ @param service (optional) The share to make the connection to. Should be 'unqualified' in any way.
@param service_type The 'type' of serivice.
@param user Username, unix string
@param domain User's domain
@@ -1104,11 +1105,12 @@ static void init_creds(struct ntuser_creds *creds, char* username,
*/
NTSTATUS cli_full_connection(struct cli_state **output_cli,
- const char *my_name, const char *dest_host,
+ const char *my_name,
+ const char *dest_host,
struct in_addr *dest_ip, int port,
char *service, char *service_type,
char *user, char *domain,
- char *password)
+ char *password, int flags)
{
struct ntuser_creds creds;
NTSTATUS nt_status;
@@ -1123,17 +1125,15 @@ NTSTATUS cli_full_connection(struct cli_state **output_cli,
SMB_ASSERT("output_cli for cli_full_connection was NULL.\n");
}
- *output_cli = NULL;
-
if (!my_name)
my_name = global_myname;
- make_nmb_name(&calling, my_name, 0x0);
- make_nmb_name(&called , dest_host, 0x20);
-
if (!(cli = cli_initialise(NULL)))
return NT_STATUS_NO_MEMORY;
+ make_nmb_name(&calling, my_name, 0x0);
+ make_nmb_name(&called , dest_host, 0x20);
+
if (cli_set_port(cli, port) != port) {
cli_shutdown(cli);
return NT_STATUS_UNSUCCESSFUL;
@@ -1172,6 +1172,12 @@ again:
return NT_STATUS_UNSUCCESSFUL;
}
+ if (flags & CLI_FULL_CONNECTION_DONT_SPNEGO) {
+ cli->use_spnego = False;
+ } else if (flags & CLI_FULL_CONNECTION_USE_KERBEROS) {
+ cli->use_kerberos = True;
+ }
+
if (!cli_negprot(cli)) {
DEBUG(1,("failed negprot\n"));
nt_status = NT_STATUS_UNSUCCESSFUL;
@@ -1182,18 +1188,23 @@ again:
if (!cli_session_setup(cli, user, password, strlen(password)+1,
password, strlen(password)+1,
domain)) {
- DEBUG(1,("failed session setup\n"));
- nt_status = cli_nt_error(cli);
- cli_shutdown(cli);
- if (NT_STATUS_IS_OK(nt_status))
- nt_status = NT_STATUS_UNSUCCESSFUL;
- return nt_status;
+ if (!(flags & CLI_FULL_CONNECTION_ANNONYMOUS_FALLBACK)
+ || cli_session_setup(cli, "", "", 0,
+ "", 0, domain)) {
+ } else {
+ nt_status = cli_nt_error(cli);
+ DEBUG(1,("failed session setup with %s\n", nt_errstr(nt_status)));
+ cli_shutdown(cli);
+ if (NT_STATUS_IS_OK(nt_status))
+ nt_status = NT_STATUS_UNSUCCESSFUL;
+ return nt_status;
+ }
}
if (service) {
if (!cli_send_tconX(cli, service, service_type,
(char*)password, strlen(password)+1)) {
- DEBUG(1,("failed tcon_X\n"));
+ DEBUG(1,("failed tcon_X with %s\n", nt_errstr(nt_status)));
nt_status = cli_nt_error(cli);
cli_shutdown(cli);
if (NT_STATUS_IS_OK(nt_status)) {
diff --git a/source3/libsmb/trust_passwd.c b/source3/libsmb/trust_passwd.c
index fd98e8dca9..7491f15f52 100644
--- a/source3/libsmb/trust_passwd.c
+++ b/source3/libsmb/trust_passwd.c
@@ -77,7 +77,8 @@ NTSTATUS trust_pw_change_and_store_it(struct cli_state *cli, TALLOC_CTX *mem_ctx
new_trust_passwd_hash);
if (NT_STATUS_IS_OK(nt_status)) {
- DEBUG(3,("%s : change_trust_account_password: Changed password.\n", timestring(False)));
+ DEBUG(3,("%s : trust_pw_change_and_store_it: Changed password.\n",
+ timestring(False)));
/*
* Return the result of trying to write the new password
* back into the trust account file.