spoolss: fix segfault when "default devmode" is disabled
[kai/samba.git] / source3 / client / client.c
index e31cd6b85a45ff9f377f18fb43711523625f03d0..f8cc27d63a60944777487a75e0f4b5a0282b5b2c 100644 (file)
@@ -1086,7 +1086,10 @@ static int do_get(const char *rname, const char *lname_in, bool reget)
        }
 
        if (lowercase) {
-               strlower_m(lname);
+               if (!strlower_m(lname)) {
+                       d_printf("strlower_m %s failed\n", lname);
+                       return 1;
+               }
        }
 
        status = cli_resolve_path(ctx, "", auth_info, cli, rname, &targetcli,
@@ -1296,7 +1299,9 @@ static NTSTATUS do_mget(struct cli_state *cli_state, struct file_info *finfo,
 
        string_replace(finfo->name,'\\','/');
        if (lowercase) {
-               strlower_m(finfo->name);
+               if (!strlower_m(finfo->name)) {
+                       return NT_STATUS_INVALID_PARAMETER;
+               }
        }
 
        if (!directory_exist(finfo->name) &&
@@ -1752,7 +1757,8 @@ static int do_allinfo(const char *name)
        }
 
        status = cli_ntcreate(cli, name, 0,
-                             CREATE_ACCESS_READ, 0,
+                             SEC_FILE_READ_DATA | SEC_FILE_READ_ATTRIBUTE |
+                             SEC_STD_SYNCHRONIZE, 0,
                              FILE_SHARE_READ|FILE_SHARE_WRITE
                              |FILE_SHARE_DELETE,
                              FILE_OPEN, 0x0, 0x0, &fnum);
@@ -4964,6 +4970,7 @@ static char **remote_completion(const char *text, int len)
 
        info.matches[0] = SMB_STRNDUP(info.matches[1], info.samelen);
        info.matches[info.count] = NULL;
+       TALLOC_FREE(ctx);
        return info.matches;
 
 cleanup:
@@ -5401,6 +5408,7 @@ static int do_message_op(struct user_auth_info *a_info)
                                                       poptGetArg(pc));
                }
 
+
                switch (opt) {
                case 'M':
                        /* Messages are sent to NetBIOS name type 0x3
@@ -5501,7 +5509,7 @@ static int do_message_op(struct user_auth_info *a_info)
        }
 
        if ( override_logfile )
-               setup_logging( lp_logfile(), DEBUG_FILE );
+               setup_logging( lp_logfile(talloc_tos()), DEBUG_FILE );
 
        if (!lp_load_client(get_dyn_CONFIGFILE())) {
                fprintf(stderr, "%s: Can't load %s - run testparm to debug it\n",
@@ -5540,7 +5548,7 @@ static int do_message_op(struct user_auth_info *a_info)
        }
 
        if(new_name_resolve_order)
-               lp_set_name_resolve_order(new_name_resolve_order);
+               lp_set_cmdline("name resolve order", new_name_resolve_order);
 
        if (!tar_type && !query_host && !service && !message) {
                poptPrintUsage(pc, stderr, 0);
@@ -5548,6 +5556,7 @@ static int do_message_op(struct user_auth_info *a_info)
        }
 
        poptFreeContext(pc);
+       popt_burn_cmdline_password(argc, argv);
 
        DEBUG(3,("Client started (version %s).\n", samba_version_string()));