[Samba] Fix for smbpasswd Samba 2.2.4 on Solaris only taking 8 character passwords

Andrew Gray grayaw at egr.unlv.edu
Tue Jun 18 10:30:08 GMT 2002

But it doesn't under Solaris.  getpass() on Solaris only takes the first 8
characters.  In the man page under Solaris for getpass() it specifically
mentions getpassphrase():

Standard C Library Functions                          getpass(3C)

     getpass, getpassphrase - read a string of characters without

     #include <unistd.h>

     char *getpass(const char *prompt);

     char *getpassphrase(const char *prompt);

     The getpass() function opens the process's controlling  ter-
     minal,  writes  to  that  device  the null-terminated string
     prompt, disables echoing, reads a string of characters up to
     the  next  newline  character  or EOF, restores the terminal
     state and closes the terminal.

     The function  getpassphrase()  is  identical  to  getpass(),
     except  that  it  will read and return a string of up to 256
     characters in length.

     Upon successful completion, getpass() returns a pointer to a
     null-terminated  string  of at most PASS_MAX bytes that were
     read from the terminal device. If an error  is  encountered,
     the  terminal  state  is  restored  and  a  null  pointer is

Grepping the includes for PASS_MAX yields:
limits.h:#define        PASS_MAX        8       /* max # of characters in a
password */

Andrew Gray
Systems Administrator
University of Nevada, Las Vegas
College of Engineering

----- Original Message -----
From: "Jeremy Allison" <jra at samba.org>
To: "Andrew Bartlett" <abartlet at samba.org>
Cc: "Jeremy Allison" <jra at samba.org>; "Andrew Gray" <grayaw at egr.unlv.edu>;
"Gerald Carter" <jerry at samba.org>; <samba at lists.samba.org>
Sent: Tuesday, June 18, 2002 10:19 AM
Subject: Re: [Samba] Fix for smbpasswd Samba 2.2.4 on Solaris only taking 8
character passwords

> On Wed, Jun 19, 2002 at 12:28:27AM +1000, Andrew Bartlett wrote:
> >
> > Should we try to use a system getpassphrase() instead of our own
> > getpass(), if available?
> No, the whole getpassphrase() thing is a hack. getpass()
> should cope with arbitrary length strings.
> Jeremy.

More information about the samba mailing list