r23784: use the GPLv3 boilerplate as recommended by the FSF and the license text
[tprouty/samba.git] / source / client / smbmount.c
index d8254ef23a7abbb47ac7723e55d64ce3a251a12b..b68dbfe346299365c0541f4f8432587e90bbc528 100644 (file)
@@ -5,7 +5,7 @@
    
    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,
@@ -14,8 +14,7 @@
    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"
@@ -26,6 +25,8 @@
 
 extern BOOL in_client;
 extern pstring user_socket_options;
+extern char *optarg;
+extern int optind;
 
 static pstring credentials;
 static pstring my_netbios_name;
@@ -149,8 +150,8 @@ static struct cli_state *do_connection(char *the_service)
        if (have_ip) ip = dest_ip;
 
        /* have to open a new connection */
-       if (!(c=cli_initialise(NULL)) || (cli_set_port(c, smb_port) != smb_port) ||
-           !cli_connect(c, server_n, &ip)) {
+       if (!(c=cli_initialise()) || (cli_set_port(c, smb_port) != smb_port) ||
+           !NT_STATUS_IS_OK(cli_connect(c, server_n, &ip))) {
                DEBUG(0,("%d: Connection to %s failed\n", sys_getpid(), server_n));
                if (c) {
                        cli_shutdown(c);
@@ -211,14 +212,14 @@ static struct cli_state *do_connection(char *the_service)
                c->force_dos_errors = True;
        }
 
-       if (!cli_session_setup(c, username, 
-                              password, strlen(password),
-                              password, strlen(password),
-                              workgroup)) {
+       if (!NT_STATUS_IS_OK(cli_session_setup(c, username, 
+                                              password, strlen(password),
+                                              password, strlen(password),
+                                              workgroup))) {
                /* if a password was not supplied then try again with a
                        null username */
                if (password[0] || !username[0] ||
-                               !cli_session_setup(c, "", "", 0, "", 0, workgroup)) {
+                   !NT_STATUS_IS_OK(cli_session_setup(c, "", "", 0, "", 0, workgroup))) {
                        DEBUG(0,("%d: session setup failed: %s\n",
                                sys_getpid(), cli_errstr(c)));
                        cli_shutdown(c);
@@ -667,6 +668,9 @@ static void usage(void)
 
        printf("Version %s\n\n",SAMBA_VERSION_STRING);
 
+       printf("Please be aware that smbfs is deprecated in favor of "
+              "cifs\n\n");
+
        printf(
 "Options:\n\
       username=<arg>                  SMB username\n\
@@ -712,7 +716,6 @@ static void parse_mount_smb(int argc, char **argv)
        int opt;
        char *opts;
        char *opteq;
-       extern char *optarg;
        int val;
        char *p;
 
@@ -862,12 +865,12 @@ static void parse_mount_smb(int argc, char **argv)
 ****************************************************************************/
  int main(int argc,char *argv[])
 {
-       extern char *optarg;
-       extern int optind;
        char *p;
 
        DEBUGLEVEL = 1;
 
+       load_case_tables();
+
        /* here we are interactive, even if run from autofs */
        setup_logging("mount.smbfs",True);
 
@@ -910,7 +913,7 @@ static void parse_mount_smb(int argc, char **argv)
                pstrcpy(username,getenv("LOGNAME"));
        }
 
-       if (!lp_load(dyn_CONFIGFILE,True,False,False)) {
+       if (!lp_load(dyn_CONFIGFILE,True,False,False,True)) {
                fprintf(stderr, "Can't load %s - run testparm to debug it\n", 
                        dyn_CONFIGFILE);
        }