BUG-with-fix: smbclient ignores WORKGROUP= in smb.conf

Wayne_Johnson at candle.com Wayne_Johnson at candle.com
Wed Jul 22 21:34:20 GMT 1998




I recently upgraded to 18p8 from 16p11 and found that smbclient now needed
a -W in order to connect properly to our domain (which was not the name
supplied with the -DWORKGROUP= from the make).

Turns out that clientutil.c always uses the value specified by the
WORKGROUP macro and never calls lp_workgroup() to get the value specified
in the smb.conf file, unless WORKGROUP is "".  Apparently lp_workgroup()
already processes the default value, so no default processing is needed in
client.c.

Context diffs for a fix to client.c and clientutil.c:

Index: client.c
===================================================================
RCS file: /cvsroot/samba/source/client.c,v
retrieving revision 1.63.2.11
diff -c -r1.63.2.11 client.c
*** client.c   1998/05/13 02:32:40 1.63.2.11
--- client.c   1998/07/22 21:20:56
***************
*** 3549,3554 ****
--- 3549,3555 ----
    pstring new_name_resolve_order;
    char *p;
    int save_debuglevel = -1;
+   pstring tempworkgroup = "";

  #ifdef KANJI
    pstrcpy(term_code, KANJI);
***************
*** 3703,3709 ****

     break;
        case 'W':
!    pstrcpy(workgroup,optarg);
     break;
        case 'E':
     dbf = stderr;
--- 3704,3710 ----

     break;
        case 'W':
!    pstrcpy(tempworkgroup,optarg);
     break;
        case 'E':
     dbf = stderr;
***************
*** 3786,3793 ****

    interpret_coding_system(term_code);

!   if (*workgroup == 0)
      pstrcpy(workgroup,lp_workgroup());

    load_interfaces();
    get_myname((*myname)?NULL:myname,NULL);
--- 3787,3797 ----

    interpret_coding_system(term_code);

!   if (*tempworkgroup) {
!     pstrcpy(workgroup,tempworkgroup);
!   } else {
      pstrcpy(workgroup,lp_workgroup());
+   }

    load_interfaces();
    get_myname((*myname)?NULL:myname,NULL);
Index: clientutil.c
===================================================================
RCS file: /cvsroot/samba/source/clientutil.c,v
retrieving revision 1.24.2.8
diff -c -r1.24.2.8 clientutil.c
*** clientutil.c    1998/05/12 22:52:02  1.24.2.8
--- clientutil.c    1998/07/22 21:20:58
***************
*** 35,41 ****
  pstring password = "";
  pstring smb_login_passwd = "";
  pstring username="";
! pstring workgroup=WORKGROUP;
  BOOL got_pass = False;
  BOOL no_pass = False;
  BOOL connect_as_printer = False;
--- 35,41 ----
  pstring password = "";
  pstring smb_login_passwd = "";
  pstring username="";
! pstring workgroup="";
  BOOL got_pass = False;
  BOOL no_pass = False;
  BOOL connect_as_printer = False;
***************
*** 664,671 ****
               goto get_pass;
         }

!      DEBUG(0,("Session setup failed for username=%s myname=%s destname=%s
   %s\n",
!         username,myname,desthost,smb_errstr(inbuf)));
       DEBUG(0,("You might find the -U, -W or -n options useful\n"));
       DEBUG(0,("Sometimes you have to use `-n USERNAME' (particularly with
 OS/2)\n"));
       DEBUG(0,("Some servers also insist on uppercase-only passwords\n"));
--- 664,673 ----
               goto get_pass;
         }

!      DEBUG(0,("Session setup failed for workgroup/username=%s/%s
myname=%s\n",
!         workgroup, username, myname));
!      DEBUG(0,("  destname=%s   %s\n",
!         desthost,smb_errstr(inbuf)));
       DEBUG(0,("You might find the -U, -W or -n options useful\n"));
       DEBUG(0,("Sometimes you have to use `-n USERNAME' (particularly with
 OS/2)\n"));
       DEBUG(0,("Some servers also insist on uppercase-only passwords\n"));

[Note: I added the workgroup to the failed error message for debugging
purposes.  Feel free to drop this if it is inappropriate]




More information about the samba mailing list