The Samba-Bugzilla – Bug 3188
pdb_mysql create user problem
Last modified: 2006-02-10 08:42:08 UTC
a few samba version has been tested (namely version 3.0.11 / 3.0.14a /
3.0.20 / 3.0.20a / 3.0.20b). I use pdb_mysql as my password backend
since i have other services rely on mysql database as well. Samba
connects to mysql database and able to do queries on the database.
Everything works fine, except : When creating user (either with
pdbedit -a , smbpasswd or SWAT interface), I always got NULL entry
for almost all samba fields (except acct_ctrl which value is always
16 or 17).
this happens with all of the samba versions I tested. So, based on
the fact, i'm guessing that there is something wrong with
pdb_mysql.c. I was not able to get pdb_mysql working even with
Now I'm guessing it's a bug in pdb_mysql or pdb_sql. the codes look closely connected.
Sorry for that dumb question, but are you sure you are using the new Samba
version? 3.0.20a (the a is important!) and up work fine for me, I can create
users with pdbedit -a. The problem you mentioned is just happening < 3.0.20a for me.
Do you use precompiled binaries?
From: Edy Sulai <firstname.lastname@example.org>
The following samba version I tried (each on different server and setup
version : 3.0.14a , 3.0.20 , 3.0.20a and 3.0.20b.
I did compile from source and FreeBSD precompile binary for 3.0.14a and
FreeBSD 5.4 and Redhat 9 was used for the OS.
All with the same result. NULL entry in mysql database when creating user.
Thanks for your reply. Nothing was dumb. I'm glad to receive reply rather
than no one responding.
Really appreciate it. thanks.
Can't reproduce this. Which version of MySQL do you use? I use 4.1, but it
worked fine with 4.0 as well, IIRC.
My configure command line for Samba is:
./configure --with-pam --with-pam_smbpass --with-quotas --with-sys-quotas
--with-expsam=mysql --with-mysql-prefix=/usr/local/mysql --with-smbmount
In passdb/pdb_mysql.c, I had to moidfy
The dump file I used looks like:
CREATE TABLE smbuser (
logon_time int(9) default NULL,
logoff_time int(9) default NULL,
kickoff_time int(9) default NULL,
pass_last_set_time int(9) default NULL,
pass_can_change_time int(9) default NULL,
pass_must_change_time int(9) default NULL,
username varchar(255) default NULL,
domain varchar(255) default NULL,
nt_username varchar(255) default NULL,
nt_fullname varchar(255) default NULL,
home_dir varchar(255) default NULL,
dir_drive varchar(4) default NULL,
logon_script varchar(255) default NULL,
profile_path varchar(255) default NULL,
acct_desc varchar(255) default NULL,
workstations varchar(255) default NULL,
unknown_str varchar(255) default NULL,
munged_dial varchar(255) default NULL,
uid int(9) NOT NULL auto_increment,
gid int(9) default NULL,
user_sid varchar(255) default NULL,
group_sid varchar(255) default NULL,
lm_pw varchar(255) default NULL,
nt_pw varchar(255) default NULL,
acct_ctrl int(9) default NULL,
unknown_3 int(9) default NULL,
logon_divs int(9) default NULL,
hours_len int(9) default NULL,
unknown_5 int(9) default NULL,
unknown_6 int(9) default '1260',
bad_password_count int(9) default NULL,
logon_count int(9) default NULL,
logon_hours varchar(42) default NULL,
PRIMARY KEY (uid),
KEY username (username)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=4222 ;
I also had to run
echo "/usr/local/mysql/lib/mysql/" >> /etc/ld.so.conf
before running Samba in order to get the libraries right.
Could you try again with these settings?
I could not reproduce the problem with 3.0.20a (Suse 9.3 rpm). pdbedit and
smbpasswd work just fine for me. I will try 3.0.20b later today.
Edy, did you compile yourself or use some binary package? Can you turn on full
mysql logging and report the sql statement resulting from, say, pdbedit -a?
In my case, there is a full-fledged sql INSERT statement setting all values
| it's getting wierder.
| I erased everything on the samba server and start with re-installing the
| OS early today.
| Now, I can't even get pdb_mysql loaded :
| smbd version 3.0.20a started.
| Copyright Andrew Tridgell and the Samba Team 1992-2004
| [2005/10/19 18:37:34, 0] passdb/pdb_interface.c:make_pdb_methods_name(764)
| No builtin nor plugin backend for mysql found
| [2005/10/19 18:37:34, 1] passdb/pdb_interface.c:make_pdb_context_list(872)
| Loading mysql:bmais failed!
| My configure command :
| ./configure --with-quotas --with-expsam=mysql
| --with-mysql-prefix=/usr/local/mysql --with-winbind
| make install did indicate mysql module being installed:
| "Installing bin/mysql.so as /usr/local/samba/lib/pdb/mysql.so"
| where is the location of mysql plugin should be?
| mysql.so is installed on the correct location isn't it?
| my smb.conf already goes with
| "passdb backend = mysql:bmais" (after : can be any identifier right?)
| MySQL version is mysql-max-4.1.13 for FreeBSD
| OS : FreeBSD 5.4
| how do i fix this error?
Edy, please use BugZilla to send in your comments.
> Finally, I got it working on Fedora Core.
> For the last time, pdb_mysql still insert NULL values on FreeBSD system.
> I can't figure out why. Maybe pdb_mysql maintainer can test it out further
> on FreeBSD (version 5.4).
> for now, i'm going to stick with Fedora for samba server.
> Thank you so much for all the help.
See bug 3375. If someone wants to maintain these modules outside
the Samba source tree, that is fine. But the source has been removed
from the upcoming 3.0.22 release.