Bug 3188 - pdb_mysql create user problem
pdb_mysql create user problem
Product: Samba 3.0
Classification: Unclassified
Component: pdb_sql
x86 FreeBSD
: P3 normal
: none
Assigned To: pdb_sql maintainers mail alias
Samba QA Contact
Depends on:
  Show dependency treegraph
Reported: 2005-10-18 03:27 UTC by Edy Sulai
Modified: 2006-02-10 08:42 UTC (History)
0 users

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description Edy Sulai 2005-10-18 03:27:13 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 
modifying pdb_mysql.c. 
Now I'm guessing it's a bug in pdb_mysql or pdb_sql. the codes look closely connected.
Comment 1 Florian Effenberger 2005-10-18 04:08:25 UTC
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?
Comment 2 Florian Effenberger 2005-10-18 07:59:16 UTC
From: Edy Sulai <esulai@bmais.or.id> 

The following samba version I tried (each on different server and setup
from scratch):
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.
Comment 3 Florian Effenberger 2005-10-18 08:05:11 UTC
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
#include <mysql/mysql.h>
to read
#include <mysql.h>

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)

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?
Comment 4 Peter Rindfuss 2005-10-19 03:56:31 UTC
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
Comment 5 Florian Effenberger 2005-10-19 11:25:25 UTC
| 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? 
Comment 6 Florian Effenberger 2005-10-20 10:18:53 UTC
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.
Comment 7 Gerald (Jerry) Carter 2006-02-10 08:42:08 UTC
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.