Bug 7543 - pdbedit -i terminates before fully reading smbpasswd
Summary: pdbedit -i terminates before fully reading smbpasswd
Status: NEW
Alias: None
Product: Samba 3.4
Classification: Unclassified
Component: Client Tools (show other bugs)
Version: 3.4.7
Hardware: All Linux
: P3 normal
Target Milestone: ---
Assignee: Holger Hetterich
QA Contact: Samba QA Contact
Depends on:
Reported: 2010-07-01 08:27 UTC by Mark Orenstein
Modified: 2010-12-13 08:57 UTC (History)
1 user (show)

See Also:

proposal fix (1.34 KB, patch)
2010-12-07 16:11 UTC, Holger Hetterich
vl: review-

Note You need to log in before you can comment on or make changes to this bug.
Description Mark Orenstein 2010-07-01 08:27:23 UTC
Importing an smbpasswd file to tdbsam.  smbpasswd file is many years old and has gone through many samba versions.  It works with samba.  pdbedit -i reported the following valid error "build_sam_account: smbpasswd database is corrupt!  username LYDON170$ with uid 2046 is not in unix passwd database!".  The problem is that pdbedit does not process smbpasswd entries beyond the one in error.  My opinion is that pdbedit should continue importing entries beyond the one in error because samba recognized these entries.
Comment 1 Karolin Seeger 2010-07-06 05:27:32 UTC
As Samba3 requires corresponding Unix accounts, I think it is perfectly fine to stop importing when the Unix account is missing. Then you can choose whether you either create the account or cleanup the smbpasswd file. Otherwise, you would create a corrupt database.

Marking bug report as invalid.

Please feel free to re-open if you like to discuss this further.

Comment 2 Mark Orenstein 2010-07-06 07:33:24 UTC
I agree that the entry in the smbpasswd file without a valid Unix account should not be imported.  However, especially because Samba 3 operates correctly with entries further down in the smbpasswd file, I feel the pdbedit should continue scanning and importing valid entries further down in the smbpasswd file.
Comment 3 Volker Lendecke 2010-07-06 07:43:25 UTC
True. We should continue with accounts further down.

Comment 4 Karolin Seeger 2010-07-08 04:04:20 UTC
Updating component.
Comment 5 Holger Hetterich 2010-12-07 16:11:44 UTC
Created attachment 6124 [details]
proposal fix

This just changes the DEBUG 0 message to a warning for the end user and returns true, because the caller might need to continue.
It fixes this bug for me and also bso#7838. 

But I have no oversight in possible side effects. Volker can you please check?
Comment 6 Holger Hetterich 2010-12-07 16:46:34 UTC
on comment#2. The proposal does import an account without a valid unix account, at least it puts out a warning and doesn't terminate. I think about a better patch that differs between 'invalid account' and 'account without a unix account'.
Comment 7 Volker Lendecke 2010-12-08 02:26:43 UTC
Comment on attachment 6124 [details]
proposal fix

Sorry, this is the wrong level to fix this. Changing behaviour so deep inside pdb_getsampwxxx is way too scary for me. I haven't looked at pdbedit, but such patch must change things at a higher level.
Comment 8 Holger Hetterich 2010-12-08 03:19:21 UTC
I agree Volker, I am working on a more high level solution.