summaryrefslogtreecommitdiff
path: root/source3/utils/pdbedit.c
AgeCommit message (Collapse)AuthorFilesLines
2002-10-21I was somewhat annoyed by 'pdbedit -a vl' spitting an error messageVolker Lendecke1-1/+7
at me :-) Volker (This used to be commit c4452ef22cf63c73bfb3574a55a4810af511ff20)
2002-10-12Nice *big* patch from metze.Andrew Bartlett1-15/+15
The actual design change is relitivly small however: It all goes back to jerry's 'BOOL store', added to many of the elements in a SAM_ACCOUNT. This ensured that smb.conf defaults did not get 'fixed' into ldap. This was a great win for admins, and this patch follows in the same way. This patch extends the concept - we don't store values back into LDAP unless they have been changed. So if we read a value, but don't update it, or we read a value, find it's not there and use a default, we will not update ldap with that value. This reduced clutter in our LDAP DB, and makes it easier to change defaults later on. Metze's particular problem was that when we 'write back' an unchanged value, we would clear any muliple values in that feild. Now he can still have his mulitivalued 'uid' feild, without Samba changing it for *every* other operation. This also applies to many other attributes, and helps to eliminate a nasty race condition. (Time between get and set) This patch is big, and needs more testing, but metze has tested usrmgr, and I've fixed some pdbedit bugs, and tested domain joins, so it isn't compleatly flawed ;-). The same system will be introduced into the SAM code shortly, but this fixes bugs that people were coming across in production uses of Samba 3.0/HEAD, hence it's inclusion here. Andrew Bartlett (This used to be commit 7f237bde212eb188df84a5d8adb598a93fba8155)
2002-10-05Add more common options to popt_common - and start usingJelmer Vernooij1-19/+7
the ones for debuglevel and configuration file in pdbedit (This used to be commit cb0d03a393d9009c3e16b9d05d88c171de9a9414)
2002-09-26move all the passdb internal interface to NTSTATUSSimo Sorce1-13/+13
only the interface has been fully moved to NTSTATUS not all the plugins make full use of it, but have been all converted. My testings passed completely, however a bit of more testing is welcome Simo. (This used to be commit 102a26e06591928a03b49cd312a65811ed46314f)
2002-08-21pdbedit needs global_myname to be set in order to display theVolker Lendecke1-1/+12
user SIDs correctly. Volker (This used to be commit 287b7bda11100c42f2cdea36a20a81f6ea397f43)
2002-08-15*** empty log message ***Simo Sorce1-87/+175
(This used to be commit cb72eead70509eddaa051571f3eed3c46304b5f8)
2002-08-04passwords where not checked (you cannot check if the same buffer differs ↵Simo Sorce1-6/+18
from itself). they where alo not clean after use! Simo. (This used to be commit 5a257096e9afdcd1dea863dff43952457a74a9f1)
2002-07-28Add the ability to set account policies too.Andrew Bartlett1-7/+25
Andrew Bartlett (This used to be commit 2bf6edf78b64335bf10c10c893d6e8fa0fac708b)
2002-07-24Make it possible to query account policy values from pdbedit (set to come soon).Andrew Bartlett1-11/+29
Update account_pol.c to use just uint32, rather then uint32 for paramaters, int32 for storage. (The int32 functions didn't have seperate return/status values, uint32 functions use a pointer-paramater). Move the #define -> string from a swtich to a table, so we can look it up both ways. Andrew Bartlett (This used to be commit c5b5e3d653f5c38a283d901a409be6603d5103f7)
2002-07-21Fix up dir drive call.Tim Potter1-1/+1
(This used to be commit fe229cc126a4bfdce12882ac7eaa893e00cd506e)
2002-07-21Another smattering of static and constAndrew Bartlett1-1/+1
(This used to be commit 897cc4a610932e596f8a9807213166e380ef0203)
2002-07-14Show the account flags in the 'verbose' listing of pdbedit.Andrew Bartlett1-0/+2
Andrew Bartlett (This used to be commit b5ec92d7a2e5ba33b641267d2319d101d70a0d9a)
2002-06-14Kill useless castAndrew Bartlett1-2/+2
(This used to be commit e2f9dd8b65063a276569d9c33aaf06606003b85c)
2002-06-14Patch from ctrlsoft to make the pluggable passdb subsystem use an lp_listAndrew Bartlett1-10/+12
rather than a string when configuring mulitple backends. Also adjust some of the users of get_global_sam_sid() to cope with the fact that it just might not exist (uninitialised, can't access secrets.tdb). More places need conversion. Add some const and remove silly casts. Andrew Bartlett (This used to be commit c264bf2ec93037d2a9927c00295fa60c88b7219d)
2002-06-13Latest patch from metze <metze@metzemix.de> to move most of samba acrossAndrew Bartlett1-4/+6
to using SIDs instead of RIDs. The new funciton sid_peek_check_rid() takes an 'expected domain sid' argument. The idea here is to prevent mistakes where the SID is implict, but isn't the same one that we have in the struct. Andrew Bartlett (This used to be commit 04f9a8ff4c7982f6597c0f6748f85d66d4784901)
2002-05-24Some of the updates from ctrlsoft's 'Various' patch:Andrew Bartlett1-12/+12
- convert net to popt - convert status to popt - adapt examples/pdb/ to multiple passdb system - add dynamic debug class example to examples/pdb/ and some reformatting to better match the samba coding style. Andrew Bartlett (This used to be commit 2498bc69d4e5c38ec385f640489daa94c508c726)
2002-05-18so here it is the code to introduce seriously debugggging classes.Simo Sorce1-1/+2
this is a first step only passdb stuff has beein "classized". - so what can you do? set debug level to: 1 poasdb:10 that will make all the code run at debug level 1 except the code in passdb/* files that will run at level 10 TODO: fix the man page - also smbcontrol has this nice feature so smbcontrol smbd debug 3 passdb:5 will set every smbd to have a default log level of 3 while passdb stuff will be at level 5 and so no.. minor cosmetic fix to pdbedit is there too (This used to be commit be5c3b3f5781ddc002ffcc98df04ab024dcef4ca)
2002-05-10Allow -c to specify the location of the config file, and fix up some handlingAndrew Bartlett1-13/+15
of non-existant passdb cases. (This used to be commit e56de32f5ce5cb301137497451b0ccd633f09f54)
2002-04-26fix compile errorHerb Lewis1-1/+6
(This used to be commit c64a57a6106bfd766679ac89837881ed9592409b)
2002-04-15Another patch from jelmer:Andrew Bartlett1-31/+37
Doco for pdbedit and (ugly, but the best we could come up with) fix for compiling pdbedit on some non-gcc compilers. Andrew Bartlett (This used to be commit 80adf1dbb56cf8bdbfbcc2c8c7b670c0a23c97f8)
2002-04-13More updates from ctrlsoft. (Jelmer Vernooij <jelmer@nl.linux.org>)Andrew Bartlett1-8/+32
Andrew Bartlett (This used to be commit 012b3326c40ca0f8f4c7673310d73f695cc4f79b)
2002-04-13This is the 'multiple pdb backends' patch from ctrlsoft, aka Jelmer VernooijAndrew Bartlett1-318/+110
<jelmer@nl.linux.org>. This patch also includes major rework of pdbedit to use popt, and the addition of -i paramter (allowing the user to specify which PDBs is being operated on) and -e to export a pdb - useful for backup and testing etc. Use of -i and -e gets us pdb2pdb functionality for transition between backends, much like the sam2sam in TNG. Andrew Bartlett (This used to be commit c10def37f506d3f2bab442418ac08fdb62659b02)
2002-03-19second step to gain free uid<->rid mappingSimo Sorce1-0/+2
we still need to free gid<->rid mapping and few other stuff (This used to be commit aa4b6f8181f34196a28951264dd8b631a5deef7f)
2002-03-18more verbose checking in talloc and util_pwSimo Sorce1-9/+10
fixed tdbsam memory corruption (and segfault) reducing calls to pdb_uid_to_user_rid and countrary to 0 to move to a non alghoritmic rid allocation with some passdb modules. (This used to be commit 9836af7cd623357feaec07bc49cfb78f0aa01fc3)
2002-01-31Initialise some SAM_ACCOUNT structs to NULL, and add some more error checking.Andrew Bartlett1-6/+14
Andrew Bartlett (This used to be commit f3f375dc6b7175d4dd4ce401815e5dfdd9747083)
2002-01-30Removed version number from file header.Tim Potter1-2/+1
Changed "SMB/Netbios" to "SMB/CIFS" in file header. (This used to be commit 6a58c9bd06d0d7502a24bf5ce5a2faf0a146edfa)
2002-01-27Give pdbedit a -D paramater for setting the DEBUGLEVEL (makes debugging passdbAndrew Bartlett1-5/+10
much saner :-). Change to pdb_init_sam()/pdb_free_sam() loop rather than reset based due to the talloc basis. Andrew Bartlett (This used to be commit e40a0a7f27950bd0484fe7d6b67dce45cd75d25c)
2002-01-26Try to get the compiler not to complain about assignments and truth values...Andrew Bartlett1-2/+1
Andrew Bartlett (This used to be commit 6650b21ceabefab037cfd3b135039914fb75e3a9)
2002-01-23getpwnam -> getpwnam_alloc.Andrew Bartlett1-6/+10
idra has promised not to revert these this time :-) (This used to be commit f556ad67e82518f5a024ffe9184ff9430ab5c541)
2002-01-20This is another *BIG* change...Andrew Bartlett1-35/+26
Samba now features a pluggable passdb interface, along the same lines as the one in use in the auth subsystem. In this case, only one backend may be active at a time by the 'normal' interface, and only one backend per passdb_context is permitted outside that. This pluggable interface is designed to allow any number of passdb backends to be compiled in, with the selection at runtime. The 'passdb backend' paramater has been created (and documented!) to support this. As such, configure has been modfied to allow (for example) --with-ldap and the old smbpasswd to be selected at the same time. This patch also introduces two new backends: smbpasswd_nua and tdbsam_nua. These two backends accept 'non unix accounts', where the user does *not* exist in /etc/passwd. These accounts' don't have UIDs in the unix sense, but to avoid conflicts in the algroitmic mapping of RIDs, they use the values specified in the 'non unix account range' paramter - in the same way as the winbind ranges are specifed. While I was at it, I cleaned up some of the code in pdb_tdb (code copied directly from smbpasswd and not really considered properly). Most of this was to do with % macro expansion on stored data. It isn't easy to get the macros into the tdb, and the first password change will 'expand' them. tdbsam needs to use a similar system to pdb_ldap in this regard. This patch only makes minor adjustments to pdb_nisplus and pdb_ldap, becouse I don't have the test facilities for these. I plan to incoroprate at least pdb_ldap into this scheme after consultation with Jerry. Each (converted) passdb module now no longer has any 'static' variables, and only exports 1 init function outside its .c file. The non-unix-account support in this patch has been proven! It is now possible to join a win2k machine to a Samba PDC without an account in /etc/passwd! Other changes: Minor interface adjustments: pdb_delete_sam_account() now takes a SAM_ACCOUNT, not a char*. pdb_update_sam_account() no longer takes the 'override' argument that was being ignored so often (every other passdb backend). Extra checks have been added in some places. Minor code changes: smbpasswd no longer attempts to initialise the passdb at startup, this is now done on first use. pdbedit has lost some of its 'machine account' logic, as this behaviour is now controlled by the passdb subsystem directly. The samr subsystem no longer calls 'local password change', but does the pdb interactions directly. This allow the ACB_ flags specifed to be transferred direct to the backend, without interference. Doco: I've updated the doco to reflect some of the changes, and removed some paramters no longer applicable to HEAD. (This used to be commit ff354c99c585068af6dc1ff35a1f109a806b326b)
2002-01-15Change the passdb interface to use allocated strings.Andrew Bartlett1-1/+1
These strings are allocated using talloc(), either using its own memory context stored on the SAM_ACCOUNT or one supplied by the caller. The pdb_init_sam() and pdb_free_sam() function have been modifed so that a call to pdb_free_sam() will either clean up (remove hashes from memory) and destroy the TALLOC_CTX or just clean up depending on who supplied it. The pdb_init_sam and pdb_free_sam functions now also return an NTSTATUS, and I have modified the 3 places that actually checked these returns. The only nasty thing about this patch is the small measure needed to maintin interface compatability - strings set to NULL are actually set to "". This is becouse there are too many places in Samba that do strlen() on these strings without checking if they are NULL pointers. A supp patch will follow to set all strings to "" in pdb_default_sam(). Andrew Bartlett (This used to be commit 144345b41d39a6f68d01f62b7aee64ca0d328085)
2002-01-07merge changes from 2.2 branch to prevent smb.conf from changing debug levelHerb Lewis1-0/+4
of commands when specified on command line. (This used to be commit 39d6b31e14144a3ff4b992d4286b706147e58566)
2002-01-02Actually enforce the passdb API.Andrew Bartlett1-2/+2
Thou shalt not reference SAM_ACCOUNT members directly - always use pdb_get/pdb_set. This is achived by making the whole of SAM_ACCOUNT have a .private member, where the real members live. This caught a pile of examples, and these have beeen fixed. The pdb_get..() functions are 'const' (have been for some time) and this required a few small changes to constify other functions. I've also added some debugs to the pdb get and set, they can be removed if requested. I've rewritten the copy_id2x_to_sam_pass() functions to use the new passdb interface, but I need the flags info to do it properly. The pdb_free_sam() funciton now blanks out the LM and NT hashes, and as such I have removed many extra 'samr_clear_sam_passwd(smbpass)' calls as a result. Finally, any and all testing is always appriciated - but the basics seem to work. Andrew Bartlett (This used to be commit d3dd28f6c443187b8d820d5a39c7c5b3be2fa95c)
2001-12-31reverted to 1.24 and manually merged in changes from 2.2Gerald Carter1-194/+71
(This used to be commit 466f515240aaeca7b0fe2b7b3474ab23cab687cc)
2001-12-31fix compile errorGerald Carter1-1/+3
(This used to be commit c946c6bbc8192f5f0f3706d1b4a6cca0a994f36b)
2001-12-31some merges from 2.2. Still need to merge in changes from pdb_tdb.cGerald Carter1-74/+199
but it will take more time as I don't want to loose any fixes that are only in HEAD. (This used to be commit efcde5d9d8ce44c0613764504d797be54ba21473)
2001-12-27moving SAM_ACCOUNT to include a bit field for initializedGerald Carter1-9/+9
members (such as uid and gid). This way we will be able to keep ourselves from writing out default smb.conf settings when the admin doesn't want to, That part is not done yet. Tested compiles with ldap/tdb/smbpasswd. Tested connection with smbpasswd backend. oh...and smbpasswd doesn'y automatically expire accounts after 21 days from the last password change either now. Just ifdef'd out that code in build_sam_account(). Will merge updates into 2.2 as they are necessary. jerry (This used to be commit f0d43791157d8f04a13a07d029f203ad4384d317)
2001-11-25Minor typosVolker Lendecke1-2/+2
(This used to be commit 1c9d951f86609b08e5660b0fc966c5e5058a3ce2)
2001-11-23Removed TimeInit() call from every client program (except for one placeTim Potter1-2/+0
in smbd/process.c where the timezone is reinitialised. Was replaced with check for a static is_initialised boolean. (This used to be commit 8fc772c9e5770cd3a8857670214dcff033ebae32)
2001-11-19Store some path names in global variables initialized to configureMartin Pool1-3/+2
default, rather than in preprocessor macros. (This used to be commit 79ec88f0da40faebe1e587f1b3e87b5f2b184f58)
2001-11-04Fix up pdbedit so that it at least compiles without warnings.Andrew Bartlett1-92/+61
- Basic functionality intact - Now adds machine accounts without a uid. (using the machine uid range to avoid conflict with real uid based accounts) (This used to be commit 09d2e05d26f71b10ccabe4c6fa168a4923697bae)
2001-11-03Added NT_USER_TOKEN into server_info to fix extra groups problem.Jeremy Allison1-4/+4
Got "medieval on our ass" about const warnings (as many as I could :-). Jeremy. (This used to be commit ee5e7ca547eff016818ba5c43b8ea0c9fa69b808)
2001-10-29clear errno before a call, tdbsam will not update it.Simo Sorce1-1/+1
just a hack to make things work. (This used to be commit fd1bc3557a7ba57a983a29d36ce0461085fb6682)
2001-10-02Removed 'extern int DEBUGLEVEL' as it is now in the smb.h header.Tim Potter1-1/+0
(This used to be commit 2d0922b0eabfdc0aaf1d0797482fef47ed7fde8e)
2001-09-30Don't try to write the LM password in the NT password feild.Andrew Bartlett1-1/+0
(This used to be commit 90dcbe16be065e2113fba1d3cee28f40be1bb86c)
2001-09-29Fix up a number of intertwined issues:Andrew Bartlett1-18/+18
The big one is a global change to allow us to NULLify the free'ed pointer to a former passdb object. This was done to allow idra's SAFE_FREE() macro to do its magic, and to satisfy the input test in pdb_init_sam() for a NULL pointer to start with. This NULL pointer test was what was breaking the adding of accounts up until now, and this code has been reworked to avoid duplicating work - I hope this will avoid a similar mess-up in future. Finally, I fixed a few nasty bugs where the pdb_ fuctions's return codes were being ignored. Some of these functions malloc() and are permitted to fail. Also, this caught a nasty bug where pdb_set_lanman_password(sam, NULL) acheived precisely didilly-squat, just returning False. Now that we check the returns this bug was spotted. This could allow different LM and NT passwords. - the pdbedit code needs to start checking these too, but I havn't had a chance to fix it. I have also fixed up where some of the password changing code was using the pdb_set functions to store *internal* data. I assume this is from a previous lot of mass conversion work... Most likally (and going on past experience) I have missed somthing, probably in the LanMan password change code which I havn't yet been able to test, but this lot is in much better shape than it was before. If all this is too much to swallow (particularly for 2.2.2) then just adding a sam_pass = NULL to the particular line of passdb.c should do the trick for the ovbious bug. Andrew Bartlett (This used to be commit 762c8758a7869809d89b4da9c2a5249678942930)
2001-09-27Removed smbpasswd_XX call (how did this get re-added, I removed allJeremy Allison1-1/+1
these yesterday ?). Jeremy. (This used to be commit e25dc68843ed10d8454cb8166c39ff4b2e6a4159)
2001-09-27Sync 2.2.2 and HEAD (I will keep these the same if it kills me :-).Jeremy Allison1-127/+103
Jeremy. (This used to be commit 76fac3eb945c7ced28c5685849d3616bb7c89ca2)
2001-09-27Major update to pdbedit's import and export code, in line with reqests for itAndrew Bartlett1-81/+83
to use the pdb_ formatting functions. Similarly, it now uses pdb_set...() rather than accessing passdb members directly. Andrew Bartlett (This used to be commit e3b7cac47f4fd9dff289a367ef6649b14c117d17)
2001-09-26Fix up pdbedit to initialise its structures with the standard functions,Andrew Bartlett1-40/+52
therfore ensuring sensible defaults for some values, notably account expriries which mean 'locked out' if == 0. This NEEDS to be merged into 2.2.2 or people can get wrongly initilaised TDB records. (which will only fail on future versions of samba). Andrew Bartlett (This used to be commit f0f315f31533bb5dc47d27cd6823ad0b146f1ff9)