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
- the Free Software Foundation; either version 2 of the License, or
+ the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "includes.h"
+#include "system/passwd.h"
#include <mntent.h>
#include <asm/types.h>
#include <linux/smb_fs.h>
-extern BOOL in_client;
-
static pstring credentials;
static pstring my_netbios_name;
static pstring password;
static pstring service;
static pstring options;
-static struct in_addr dest_ip;
+static struct ipv4_addr dest_ip;
static BOOL have_ip;
static int smb_port = 0;
static BOOL got_user;
struct smbcli_state *c;
struct nmb_name called, calling;
char *server_n;
- struct in_addr ip;
+ struct ipv4_addr ip;
pstring server;
char *share;
!smbcli_connect(c, server_n, &ip)) {
DEBUG(0,("%d: Connection to %s failed\n", sys_getpid(), server_n));
if (c) {
- smbcli_shutdown(c);
+ talloc_free(c);
}
return NULL;
}
char *p;
DEBUG(0,("%d: session request to %s failed (%s)\n",
sys_getpid(), called.name, smbcli_errstr(c)));
- smbcli_shutdown(c);
+ talloc_free(c);
if ((p=strchr_m(called.name, '.'))) {
*p = 0;
goto again;
if (!smbcli_negprot(c)) {
DEBUG(0,("%d: protocol negotiation failed\n", sys_getpid()));
- smbcli_shutdown(c);
+ talloc_free(c);
return NULL;
}
!smbcli_session_setup(c, "", "", 0, "", 0, workgroup)) {
DEBUG(0,("%d: session setup failed: %s\n",
sys_getpid(), smbcli_errstr(c)));
- smbcli_shutdown(c);
+ talloc_free(c);
return NULL;
}
DEBUG(0,("Anonymous login successful\n"));
DEBUG(4,("%d: session setup ok\n", sys_getpid()));
- if (!smbcli_send_tconX(c, share, "?????",
- password, strlen(password)+1)) {
+ if (!smbcli_tconX(c, share, "?????", password, strlen(password)+1)) {
DEBUG(0,("%d: tree connect failed: %s\n",
sys_getpid(), smbcli_errstr(c)));
- smbcli_shutdown(c);
+ talloc_free(c);
return NULL;
}
If we don't do this we will "leak" sockets and memory on
each reconnection we have to make. */
- smbcli_shutdown(c);
+ talloc_free(c);
c = NULL;
if (!closed) {
asprintf(&smbmnt_path, "%s/smbmnt", dyn_BINDIR);
- if (file_exist(smbmnt_path, NULL)) {
+ if (file_exist(smbmnt_path)) {
execv(smbmnt_path, args);
fprintf(stderr,
"smbfs/init_mount: execv of %s failed. Error was %s.",
sscanf(p, "%d", &fd);
close_it = False;
} else if ((p = getenv("PASSWD_FILE")) != NULL) {
- fd = sys_open(p, O_RDONLY, 0);
+ fd = open(p, O_RDONLY, 0);
pstrcpy(spec, p);
if (fd < 0) {
fprintf(stderr, "Error opening PASSWD_FILE %s: %s\n",
} else if(!strcmp(opts, "debug")) {
DEBUGLEVEL = val;
} else if(!strcmp(opts, "ip")) {
- dest_ip = *interpret_addr2(opteq+1);
+ dest_ip = interpret_addr2(opteq+1);
if (is_zero_ip(dest_ip)) {
fprintf(stderr,"Can't resolve address %s\n", opteq+1);
exit(1);
setenv("CLI_FORCE_ASCII", "true", 1);
#endif
- in_client = True; /* Make sure that we tell lp_load we are */
-
if (getenv("USER")) {
pstrcpy(username,getenv("USER"));
pstrcpy(username,getenv("LOGNAME"));
}
- if (!lp_load(dyn_CONFIGFILE,True,False,False)) {
+ if (!lp_load()) {
fprintf(stderr, "Can't load %s - run testparm to debug it\n",
- dyn_CONFIGFILE);
+ lp_config_file());
}
parse_mount_smb(argc, argv);
pstrcpy(workgroup,lp_workgroup());
}
- load_interfaces();
if (!*my_netbios_name) {
pstrcpy(my_netbios_name, myhostname());
}