error reporting in smbpasswd

Gerald Carter gcarter at valinux.com
Wed Oct 4 04:25:47 GMT 2000


Tavis,

Do you have an existing patch against 2.0.7?  I don't think
smbpasswd shoudl have changed much in 2.2/HEAD.



Cheers, jerry




Tavis Barr wrote:
> 
> I recently was having problems with smbpasswd not working 
> and reporting "out of memory" upon failing.  The problem 
> in fact turned out to be the permissions on /dev/tty, which 
> in turn caused the C library function getpass() to 
> fail, which in turn caused smbpasswd to fail.
> 
> The problem is that there is sort of a generic failure 
> point in the xstrdup() routine (in smbpasswd.c), which 
> checks to make sure that the pointer it creates is 
> non empty, and fails if it is empty, guessing
> that it is out of memory.  However, there are 
> about five places where this routine is called, each 
> of them could potentially pass a null argument 
> to xstrdup() because something had already 
> gone wrong, causing strdup() to report an out of 
> memory error when the problem was something completely 
> different.
> 
> A few changes might be helpful:
> 
> *two error checks with an exit in getpass(), once 
> after each password retrieval function, specifying 
> which function call failed to return correctly
> 
> * In the two places where xstrdup() is called under 
> the condition !user_name, it might be better to check 
> for the existence of pwd->pwname and not just pwd.
> 
> I'm sorry I don't have diffs but I don't know which 
> CVS tree would be changed anyway.  If you feel these 
> are stupid suggestions feel free to ignore them.  I'm 
> only making them because I had to spend several hours
> going through the source to figure out the cause of 
> an error that might have only taken a few minutes 
> to diagnose with a more accurate error message.

-- 
----------------------------------------------------------------------
   /\  Gerald (Jerry) Carter                     Professional Services
 \/    http://www.valinux.com  VA Linux Systems    gcarter at valinux.com
       http://www.samba.org       SAMBA Team           jerry at samba.org
       http://www.eng.auburn.edu/~cartegw

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





More information about the samba-technical mailing list