s3: smbclient: Move cmd_setmode out of clitar.c and back into client.c
[sfrench/samba-autobuild/.git] / source3 / client / smbspool.c
index e16086dd6793ea3ddf520e7583218701da4625fb..7161e86468ec2878d7f281805e1565f22bddcb99 100644 (file)
@@ -151,7 +151,14 @@ main(int argc,                     /* I - Number of command-line arguments */
                perror("ERROR: Unable to open print file");
                goto done;
        } else {
-               copies = atoi(argv[4]);
+               char *p = argv[4];
+               char *endp;
+
+               copies = strtol(p, &endp, 10);
+               if (p == endp) {
+                       perror("ERROR: Unable to determine number of copies");
+                       goto done;
+               }
        }
 
        /*
@@ -245,11 +252,9 @@ main(int argc,                     /* I - Number of command-line arguments */
 
        setup_logging("smbspool", DEBUG_STDOUT);
 
-       lp_set_in_client(True); /* Make sure that we tell lp_load we are */
-
-       load_case_tables();
+       smb_init_locale();
 
-       if (!lp_load(get_dyn_CONFIGFILE(), True, False, False, True)) {
+       if (!lp_load_client(get_dyn_CONFIGFILE())) {
                fprintf(stderr, "ERROR: Can't load %s - run testparm to debug it\n", get_dyn_CONFIGFILE());
                goto done;
        }
@@ -404,7 +409,7 @@ smb_complete_connection(const char *myname,
        /* Start the SMB connection */
        *need_auth = false;
        nt_status = cli_start_connection(&cli, myname, server, NULL, port,
-                                        Undefined, flags);
+                                        SMB_SIGNING_DEFAULT, flags);
        if (!NT_STATUS_IS_OK(nt_status)) {
                fprintf(stderr, "ERROR: Connection failed: %s\n", nt_errstr(nt_status));
                return NULL;
@@ -435,8 +440,8 @@ smb_complete_connection(const char *myname,
                return NULL;
        }
 
-       nt_status = cli_tcon_andx(cli, share, "?????", password,
-                                 strlen(password) + 1);
+       nt_status = cli_tree_connect(cli, share, "?????", password,
+                                    strlen(password) + 1);
        if (!NT_STATUS_IS_OK(nt_status)) {
                fprintf(stderr, "ERROR: Tree connect failed (%s)\n",
                        nt_errstr(nt_status));