Problems with smbpasswd-program

Gerald Carter cartegw at Eng.Auburn.EDU
Mon May 11 17:40:49 GMT 1998

Andrew Perrin - Demography wrote:
> Looks suspiciously similar to our problem:
> #@boserup:/usr/LOCAL/samba/bin>./smbpasswd aperrin
> ..
> New SMB password:
> Retype new SMB password:
> startsmbpwent: opening file /usr/LOCAL/samba/private/smbpasswd
> /smbpasswd: Failed to open password file
> /usr/LOCAL/samba/private/smbpasswd.
> /smbpasswd: Error 0
> using 1.9.19-prealpha on Solaris 2.6.  It will work the first time 
> (i.e., when there's no smbpasswd file) but always bombs subsequent 
> times.

Can someone ( Luke, Jeremy, etc... ) verify / discredit the following

------- smbpasswd .c ------------------------------------

   * Open the smbpaswd file.
  vp = startsmbpwent(True);
  if (!vp && errno == ENOENT) {
          fp = fopen(lp_smb_passwd_file(), "w");
          if (fp) {
                  fprintf(fp, "# Samba SMB password file\n");
                  vp = startsmbpwent(True);
  if (!fp) {
          err = errno;
          fprintf(stderr, "%s: Failed to open password file %s.\n",
                  prog_name, lp_smb_passwd_file());
          errno = err;


It really appears that fp is set ( call to fopen() ) only if the call to
startsmbpwent() fails ( returns a NULL pointer ).  Therefore if
startsmbpwent() returns a valid point meaning the SMB_PASSWD_FILE was
opened, fopen never gets called and thus smbpasswd will exit complaining
that it could not open the password file.

Does that makes sense?  This observation is from looking at the code not
running it.  I'm guessingh the call to 

	"if (!fp)..." 

should be 

	"if (!vp)..."

                            Gerald ( Jerry ) Carter	
Engineering Network Services                           Auburn University 
jerry at   

       "...a hundred billion castaways looking for a home."
                                  - Sting "Message in a Bottle" ( 1979 )

More information about the samba-ntdom mailing list