bug in net command

Herb Lewis hlewis at panasas.com
Mon Aug 6 19:00:41 GMT 2007


If you run the net rpc info command without specifying a username
you will get a segfault in cli_init_credswhen the following executes
because username is 0

  if (!*username) {

#0  0x80d0c05 in cli_init_creds (cli=0x843f000, username=0x0, 
domain=0x843c380 "QA-2K-MM", password=0x843c910 "") at 
freebsd_46_i386/debug/build/samba/source/libsmb/clientgen.c:250

it was passed in a couple levels up as opt_user_name which is
initialized to NULL. Not sure it the best fix is to just add the
following lines to fix in all potential similar cases or if we
really inteded something else.

===================================================================
--- branches/SAMBA_3_0_25/source/utils/net.c    (revision 24252)
+++ branches/SAMBA_3_0_25/source/utils/net.c    (working copy)
@@ -999,6 +999,10 @@
                 opt_user_name = getenv("LOGNAME");
         }

+       if (!opt_user_name {
+               opt_user_name = "";
+       }
+
         if (!opt_workgroup) {
                 opt_workgroup = smb_xstrdup(lp_workgroup());
         }



More information about the samba-technical mailing list