safe_strcpy() -> fstrcpy() fix, and a cleanup to how rpcclient calls the
authorAndrew Bartlett <abartlet@samba.org>
Fri, 7 Mar 2003 09:25:48 +0000 (09:25 +0000)
committerAndrew Bartlett <abartlet@samba.org>
Fri, 7 Mar 2003 09:25:48 +0000 (09:25 +0000)
IP address resolving code.

source/rpcclient/cmd_reg.c
source/rpcclient/rpcclient.c

index 19c0e7f71f02e7f313c3546cdd3ad83fbc67ce35..8943331dabeca5994f3fd1a6ad4e5e5ea5af515c 100644 (file)
@@ -914,7 +914,7 @@ static NTSTATUS cmd_reg_shutdown(struct cli_state *cli, TALLOC_CTX *mem_ctx,
                switch (opt)
                {
                        case 'm':
-                               safe_strcpy(msg, optarg, sizeof(msg)-1);
+                               fstrcpy(msg, optarg);
                                /*fprintf (stderr, "[%s|%s]\n", optarg, msg);*/
                                break;
 
index 127506fb39babdfeaac8a3c3cea19f589a7383f4..c3b2cd4ea1b825e551969068ac49b5c4a8c5b4ea 100644 (file)
@@ -592,6 +592,8 @@ out_free:
                { NULL }
        };
 
+       ZERO_STRUCT(server_ip);
+
        setlinebuf(stdout);
 
        /* Parse options */
@@ -674,13 +676,6 @@ out_free:
        if (!init_names())
                return 1;
 
-       /* Resolve the IP address */
-
-       if (!opt_ipaddr && !resolve_name(server, &server_ip, 0x20))  {
-               fprintf(stderr, "Unable to resolve %s\n", server);
-               return 1;
-       }
-       
        /*
         * Get password
         * from stdin if necessary
@@ -697,7 +692,7 @@ out_free:
                get_username(username);
                
        nt_status = cli_full_connection(&cli, global_myname(), server, 
-                                       &server_ip, 0,
+                                       opt_ipaddr ? &server_ip : NULL, 0,
                                        "IPC$", "IPC",  
                                        username, domain,
                                        password, 0, NULL);