r13394: Fix rpcclient to obey the -W parameter. Not that I *like* the smbclient
authorVolker Lendecke <vlendec@samba.org>
Wed, 8 Feb 2006 19:28:25 +0000 (19:28 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 16:09:58 +0000 (11:09 -0500)
solution, but it does this particular job... :-)

Volker

source/rpcclient/rpcclient.c

index 5e66b18263005613e9090770a1e25e39cfe768ce..3f493ce2c508118da297b4a6d2f5767716bc19ff 100644 (file)
@@ -689,6 +689,7 @@ out_free:
        struct in_addr          server_ip;
        NTSTATUS                nt_status;
        static int              opt_port = 0;
+       fstring new_workgroup;
 
        /* make sure the vars that get altered (4th field) are in
           a fixed location or certain compilers complain */
@@ -755,11 +756,22 @@ out_free:
        if (!init_names())
                return 1;
 
+       /* save the workgroup...
+       
+          FIXME!! do we need to do this for other options as well 
+          (or maybe a generic way to keep lp_load() from overwriting 
+          everything)?  */
+       
+       fstrcpy( new_workgroup, lp_workgroup() );
+
        /* Load smb.conf file */
 
        if (!lp_load(dyn_CONFIGFILE,True,False,False,True))
                fprintf(stderr, "Can't load %s\n", dyn_CONFIGFILE);
 
+       if ( strlen(new_workgroup) != 0 )
+               set_global_myworkgroup( new_workgroup );
+
        /*
         * Get password
         * from stdin if necessary