1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-13 13:18:06 +03:00
Commit Graph

569 Commits

Author SHA1 Message Date
Andrew Bartlett
a5d5b4cf25 Allow non unix accounts to be added to an ldap directory without NUA accounts
already.

Andrew Bartlett
0001-01-01 00:00:00 +00:00
Andrew Bartlett
273d518e52 Patch from ctrlsoft to use the pdb_sethexpwd function in smbpasswd - instead
of implementing it twice inline.

This code is complex - but occasionally I get the feeling that people made
it more complext than it really needed to be...

Andrew Bartlett
0001-01-01 00:00:00 +00:00
Andrew Bartlett
dfa98ae0ac It looks like we never tested the 'cleanup' code, so when I triggered it
(invalid passdb backends smb.conf entry) we picked up a few things :-).

Andrew Bartlett
0001-01-01 00:00:00 +00:00
Andrew Bartlett
c8c490bcb8 Some updates from ctrlsoft <jelmer@nl.linux.org> to return failure if *any* of
the passdb backends fail to load (is this the right way? - I think so).

Also, I've added some more comments, cleaned up some style etc.
0001-01-01 00:00:00 +00:00
Andrew Bartlett
27e34d4e63 Debug fixes from ctrlsoft 0001-01-01 00:00:00 +00:00
Andrew Bartlett
c70b2c4fb7 Convenience function to allow a SID to be specified as a string.
(for use in passdb modules like pdb_xml or a new pdb_ldap that stores sids etc.)

Andrew Bartlett
0001-01-01 00:00:00 +00:00
Andrew Bartlett
c264bf2ec9 Patch from ctrlsoft to make the pluggable passdb subsystem use an lp_list
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
0001-01-01 00:00:00 +00:00
Andrew Bartlett
29490f2147 Add const, kill of useless casts and therefore eliminate warnings.
Andrew Bartlett
0001-01-01 00:00:00 +00:00
Andrew Bartlett
04f9a8ff4c Latest patch from metze <metze@metzemix.de> to move most of samba across
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
0001-01-01 00:00:00 +00:00
Andrew Bartlett
1996bcbe6a Fix comment 0001-01-01 00:00:00 +00:00
Andrew Bartlett
96afea638e Globally replace 'global_sam_sid' with get_global_sam_sid(), a self
initialising function.  This patch thanks to the work of
"Stefan (metze) Metzmacher" <metze@metzemix.de>

This is partly to enable the transition to SIDs in the the passdb.

Andrew Bartlett
0001-01-01 00:00:00 +00:00
Andrew Bartlett
743afd96cb Move the code from lib/util_sid.c that deals with the global_sam_sid into
a file that is linked with the passdb.

This is to avoid linking insanity when this global becomes a self-initing
function.
0001-01-01 00:00:00 +00:00
Simo Sorce
f5c6496c33 change: pdb_getsampwrid() ->pdb_getsampwsid()
passdb interface change, now the passdb modules will be asked for SID not for rid, the modules have been updated with a passthrough function that calls the old getsampwrid() functions.

srv_samr_nt.c functions that made use of the pdb_getsampwrid funcion has been updated to use the SID one.
0001-01-01 00:00:00 +00:00
Andrew Bartlett
bbc6954551 Only reterive the attributes we are actually going to use - rather than
the whole record which could include things like photos's etc.

Andrew Bartlett
0001-01-01 00:00:00 +00:00
Andrew Bartlett
57097bf1ba Remove unused variable, fix functions to match prototypes in the various
structs.

Andrew Bartlett
0001-01-01 00:00:00 +00:00
Andrew Bartlett
2498bc69d4 Some of the updates from ctrlsoft's 'Various' patch:
- 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
0001-01-01 00:00:00 +00:00
Andrew Bartlett
38012edaca Make function match the defintion require for assignment as a function
pointer.
0001-01-01 00:00:00 +00:00
Jim McDonough
37b6bf3aae Looks like abartlet got a bit overexcited about using const...
BOOL const secrets_init(...)

Broke AIX build.
0001-01-01 00:00:00 +00:00
Andrew Bartlett
4f7ba78c9d Updates for sane storage of ldap root DN passwords (tested, with upgrade
from 2.2 format) and LDAP rebind support (untested, I don't have a setup
to match).

Andrew Bartlett
0001-01-01 00:00:00 +00:00
Simo Sorce
be5c3b3f57 so here it is the code to introduce seriously debugggging classes.
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
0001-01-01 00:00:00 +00:00
Andrew Bartlett
7019486eac Remove const from some functions to match the changed prototype in a
previous commit, and remove some unsued variables.

Main change:  Make sure to fill in the username when making a non-unix
account from smbpasswd.
0001-01-01 00:00:00 +00:00
Andrew Bartlett
d78b74b338 Passdb:
Kill off the silly code that attempts to do NT -> Unix username mapping.
This is done well before here, no need to repeat it.

Add some small fixes and extra debugs, trying to track down current build
farm failures.

pdb_unix:

When 'updating' a pdb_unix account, instead add it to the default passdb.
This means that you don't need to specify '-a' to smbpasswd any more when
messing with an existing unix user, the account is simply 'upgraded'.

The idea here is that these accounts are just as 'real' as any other, they
just don't have the extra attributes an smbpasswd file does.

I'm open for debate on the pdb_unix issue, and will remove it if given
good reason.  (without this, an attempt to add an account already in
pdb_unix to smbpasswd would fail, as it would fail to update pdb_unix).

rpc_server/srv_netlog_nt.c

Change a couple of things around, so as to show the client workstation etc.

WRONG_PASSWORD is certainly not the right default error.  Try ACCESS_DENIED
for now.

Andrew Bartlett
0001-01-01 00:00:00 +00:00
Andrew Bartlett
c28668068b A few things in this commit:
cleanup some of the code in net_rpc_join re const warnings and
fstrings.

Passdb:

Make the %u and %U substituions in passdb work.
This is done by declaring these paramters to be 'const' and doing
the substitution manually.  I'm told this is us going full circle,
but I can't really see a better way.

Finally these things actually seem to work properly...

Make the lanman code use the pdb's recorded values for homedir etc
rather than the values from lp_*()

Add code to set the plaintext password in the passdb, where it can
decide how to store/set it.  For use with a future 'ldap password
change' option, or somthing like that...

Add pdb_unix, so as to remove the 'not in passdb' special cases from the
local_lookup_*() code.  Quite small, as it uses the new 'struct passwd ->
SAM_ACCOUNT' code that is now in just one place.  (also used by pdb_smbpasswd)

Other:
Fix up the adding of [homes] at session setup time to actually pass
the right string, that is the unix homedir, not the UNC path.

Fix up [homes] so that for winbind users is picks the correct name.
(bad interactions with the default domain code previously)

Change the rpc_server/srv_lsa_nt.c code to match NT when for the
SATUS_NONE_MAPPED reply:  This was only being triggered on
no queries, now it is on the 'no mappings' (ie all mappings failed).
Checked against Win2k.

Policy Question:  Should SID -> unix_user.234/unix_group.364 be
considered a mapping or not?  Currently it isn't.

Andrew Bartlett
0001-01-01 00:00:00 +00:00
Andrew Bartlett
64aaec137e Make --with-ldapsam 'go away'. This is now a standard, stable, feature
and there is no real reason for it to depend on more than the abilty
to compile the code.
0001-01-01 00:00:00 +00:00
Andrew Bartlett
d57a1b4629 A few more trusted domains updates from mimir.
I think we may still need to look at our server enumeration code, but
other than that, its much better in the tree than out.

Andrew Bartlett
0001-01-01 00:00:00 +00:00
Andrew Bartlett
70c6f5fc6d Spelling fixes from vance 0001-01-01 00:00:00 +00:00
Andrew Bartlett
0bdd94cb99 Partly based on the work by mimir (Rafal Szczesniak
<mimir@diament.ists.pwr.wroc.pl>) this patch allows samba to correctly
enumerate its trusted domains - by exaimining the keys in the secrets.tdb file.

This patch has been tested with both NT4 and rpcclient/wbinfo, and adds
some extra functionality to talloc and rpc_parse to allow it to deal with
already unicode strings.

Finally, this cleans up some const warnings that were in net_rpc.c by pushing
another dash of const into the rpc client code.

Andrew Bartlett
0001-01-01 00:00:00 +00:00
Andrew Bartlett
81eaa7924b Fix the compile-bug in pdb_ldap from my last patch.
Andrew Bartlett
0001-01-01 00:00:00 +00:00
Andrew Bartlett
5275c94cdf Better handling of uid/gid -> RID and RID -> uid/gid code.
All uids and gids must create valid RIDs, becouse other code expects this, and
can't handle the failure case. (ACL code in particular)

Allow admins to adjust the base of the RID algorithm, so avoid clashes with
users brought in from NT (for example).

Put all the algorithm code back in one place, so that this change is global.

Better coping with NULL sid pointers - but it still breaks a lot of stuff.

BONUS: manpage entry for new paramater :-)

counter based rids for normal users in tdbsam is disabled for the timebeing,
idra and I will work out some things here soon I hope.

Andrew Bartlett
0001-01-01 00:00:00 +00:00
Andrew Bartlett
c10def37f5 This is the 'multiple pdb backends' patch from ctrlsoft, aka Jelmer Vernooij
<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
0001-01-01 00:00:00 +00:00
Andrew Bartlett
79327a305e Much better support for both non-algorithic RIDs (where the RID is stored in
the passdb) and RIDs not in the passdb, due to being NIS users etc.

The main fix here is to add become_root()/unbecome_root() at critical places.

This (finally) fixes the bug where you could not see local users's names
in a file's security properties as non-root.  Tested.

The similar bug in uid_to_sid is also fixed, but is not (yet) Tested.

Andrew Bartlett
0001-01-01 00:00:00 +00:00
Andrew Bartlett
26842f1ac0 Fix up major logic reversal flaws in pdb_ldap.
WARNING: if you relied on these logic flaws, you will need to manually
edit your ldap backend (for things like account expries etc).

Now correctly retunes the information needed for 'must change at next login'
support.
0001-01-01 00:00:00 +00:00
Jeremy Allison
28ef07424f Fixed up admin user / guest user lookup.
Jeremy.
0001-01-01 00:00:00 +00:00
Tim Potter
a0f7bbad11 Fixed memory leak in make_pdb_context_name()
Some reformatting and spelling fixes.
0001-01-01 00:00:00 +00:00
Jeremy Allison
896d4fac98 Fix from Stefan "metze" Metzmacher <metze@metzemix.de> to prevent us
overwriting an old MACHINE.SID sid.
Jeremy.
0001-01-01 00:00:00 +00:00
Jeremy Allison
ac1baba35d Removed HAVE_LIBDL from most places (except system.c). Added checks for
dlopen & friends into configure.in. This should help building on *BSD
where dl*** calls are in libc.
Jeremy
0001-01-01 00:00:00 +00:00
Andrew Bartlett
8c82a3daf7 Minor fixes:
- Fix warnings in loadparm.c
- Remove the unused 'passdb modules path' paramater

- Make pdb_ldap use $ termination rather than the workstation trust account
  flag becouse some 'machine' accounts appear as normal accounts at creation
  time.  Also covers domains etc.

Andrew Bartlett
0001-01-01 00:00:00 +00:00
Andrew Bartlett
438f028fc4 Don't leak memory on failure. 0001-01-01 00:00:00 +00:00
Andrew Bartlett
56009ffbaa Make sure to initaliase SAM_ACCOUNT pointers to NULL, otherwise pdb_init_sam()
fails.

Andrew Bartlett
0001-01-01 00:00:00 +00:00
Andrew Bartlett
520c8626dc Make ldapsam compile again. 0001-01-01 00:00:00 +00:00
Andrew Bartlett
0f0f87e6c3 Allow a zero rid in pdb_smbpasswd. When given a zero rid the pdb backend
should chose the next available RID.  For smbpasswd it just means using the algorithm, but other backends can do somthing more useful.

Andrew Bartlett
0001-01-01 00:00:00 +00:00
Simo Sorce
aa4b6f8181 second step to gain free uid<->rid mapping
we still need to free gid<->rid mapping and few other stuff
0001-01-01 00:00:00 +00:00
Simo Sorce
9836af7cd6 more verbose checking in talloc and util_pw
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.
0001-01-01 00:00:00 +00:00
Simo Sorce
724390a8da Start to switch away from the alghorithmic uid->rid mapping model 0001-01-01 00:00:00 +00:00
Tim Potter
1f007d3ed4 Renamed get_nt_error_msg() to nt_errstr(). 0001-01-01 00:00:00 +00:00
Andrew Bartlett
764b99a390 I don't need my name on this twice :-) 0001-01-01 00:00:00 +00:00
Jeremy Allison
d08cbcbc5d Remove a stub function I forgot to fill in.
Jeremy.
0001-01-01 00:00:00 +00:00
Jeremy Allison
45bf5f6c05 Removed unused var.
Jeremy.
0001-01-01 00:00:00 +00:00
Jeremy Allison
87e6b08964 Ensure, if we're a PDC or BDC, that the SID stored for the domain name
and the machine name are identical.
Jeremy.
0001-01-01 00:00:00 +00:00
Andrew Tridgell
bcd018f07c rewrote the machine sid storage code to store the SID in secrets.tdb
rather than MACHINE.SID. We try to load MACHINE.SID only if we can't
fetch the SID from secrets.tdb

This also fixes the value of global_sam_sid for the DC/non-DC case
0001-01-01 00:00:00 +00:00
Andrew Tridgell
4cb7b6954b make sure we use consistent keys in secrets.tdb by uppercasing domain
names
0001-01-01 00:00:00 +00:00
Tim Potter
d4d2f3bd89 Compile fixes for the pdb nisplus module. 0001-01-01 00:00:00 +00:00
Jim McDonough
2fdd601f2e Fix SIGSEGV on error message when trying to add a user to smbpasswd file without a unix account. 0001-01-01 00:00:00 +00:00
Andrew Bartlett
cd5234d7dd This patch merges my private LDAP tree into HEAD.
The main change here is to move ldap into the new pluggable passdb subsystem
and to take the LDAP location as a 'location' paramter on the 'passdb backend'
line in the smb.conf.  This is an LDAP URL, parsed by OpenLDAP where supported,
and by hand where it isn't.

It also adds the ldap user suffix and ldap machine suffix smb.conf options,
so that machines added to the LDAP dir don't get mixed in with people.

Non-unix account support is also added.  This means that machines don't need to
be in /etc/passwd or in nss_ldap's scope.

This code has stood up well under my production environment, so it relitivly
well tested.

I'm commiting this now becouse others have shown interest in using it, and
there is no point 'hording' the code :-).

Andrew Bartlett
0001-01-01 00:00:00 +00:00
Andrew Bartlett
4ecc170dcb Fix up the trusted domains secrets code so as to have a slight chance of
working.
0001-01-01 00:00:00 +00:00
Gerald Carter
5b28a7c59c merge from 2.2 0001-01-01 00:00:00 +00:00
Andrew Bartlett
770c8a31d9 The beginning of trusted and trusting domain support from
Rafal Szczesniak <mimir@diament.ists.pwr.wroc.pl>

This adds the 'net' tools to manipulate the trusted domains.

Andrew Bartlett
0001-01-01 00:00:00 +00:00
Andrew Tridgell
b26b6aef64 made the domain secret key in secrets.tdb domain specific. This allows
you to join a 2nd domain then leave the old domain rather than the other way
around
0001-01-01 00:00:00 +00:00
Andrew Bartlett
d6d18b70f0 Add the pdb_plugin module from Jelmer Vernooij <jelmer@nl.linux.org>.
This allow the user to select
'passdb backend = plugin : /path/to/plugin.so : pluging args'

And load any arbitary plugin.  Apparently Jelmer has a mysql plugin in the
works - hence this patch.

We probably need to rework the interface a bit before 3.0 (add versioning of
some kind) but this is a good start.

Andrew Bartlett
0001-01-01 00:00:00 +00:00
Simo Sorce
8bb2a7446e update from 2.2 0001-01-01 00:00:00 +00:00
Andrew Bartlett
86d5326d0d Back out herb's changes (to allow smbpasswd -x to work on accounts outside
/etc/passwd) and replace them with a version that works.  Unfortunetly HEAD and
2.2 have different passdb interfaces and different local_password_change
functions...

Andrew Bartlett
0001-01-01 00:00:00 +00:00
Tim Potter
6a58c9bd06 Removed version number from file header.
Changed "SMB/Netbios" to "SMB/CIFS" in file header.
0001-01-01 00:00:00 +00:00
Herb Lewis
539b025397 merge change from @_2 to allow smbpasswd -x to delete user even if no
entry in /etc/passwd.

There are still differences in the local_password_change function. I'm
not sure which was the latest so I didn't change any thing else. Someone
needs to take a look and sync these up.
0001-01-01 00:00:00 +00:00
Andrew Bartlett
25cadce67b - Provide sid->name lookup support for non-unix accounts.
- Rework the name -> sid lookup function to always try local lookup first (for
local domain names) before trying winbind.  This seems to eliminate my winbind
feedback loop problems.  (I don't use winbind for nsswitch, where there are
almost certainly further issues).

Andrew Bartlett
0001-01-01 00:00:00 +00:00
Andrew Bartlett
d1ea20cc23 local_lookup_name() doens't acutally use its 'domain' argument, so drop it and
make its use clearer.
0001-01-01 00:00:00 +00:00
Andrew Bartlett
8ffc024ebc fix typo 0001-01-01 00:00:00 +00:00
Andrew Bartlett
3db417c2eb Add some information tidbits to an error DEBUG(). 0001-01-01 00:00:00 +00:00
Andrew Bartlett
7d576d89d7 Passdb changes:
Modules now name themselves, which should allow for sane behaviour when we get
an 'extern' passdb module (which in turn loads a .so).

Fix up tdbsam for non-unix-accounts.  Not sure if this fixes idra's bug, but
its a start...

Andrew Bartlett
0001-01-01 00:00:00 +00:00
Andrew Bartlett
f556ad67e8 getpwnam -> getpwnam_alloc.
idra has promised not to revert these this time :-)
0001-01-01 00:00:00 +00:00
Simo Sorce
f12361b132 getpwnam_alloc -> getpwnam
same reason as per pdb_tdb.c
there isn't (and will never be probably) another call to any getpw* fn,
let's use getpwnam_alloc only when needed.
0001-01-01 00:00:00 +00:00
Simo Sorce
57a145bff6 hmm, get it right this time. 0001-01-01 00:00:00 +00:00
Simo Sorce
7f7a15e09a fix also the comment. 0001-01-01 00:00:00 +00:00
Simo Sorce
5c0bb0487b replace getpwnam_alloc with plain getpwnam.
We are not going to reuse any getpw* call, so the extra alloc,copy and free
only uses extra memory and extra cpu time for nothing.
0001-01-01 00:00:00 +00:00
Andrew Bartlett
59905d44e5 getpwnam -> getpwnam_alloc 0001-01-01 00:00:00 +00:00
Andrew Bartlett
a96503475d Inititialise the gid to what standard_sub_advanced wants for 'no value'.
Andrew Bartlett
0001-01-01 00:00:00 +00:00
Simo Sorce
e8a891354d fixes from 2.2 0001-01-01 00:00:00 +00:00
Andrew Bartlett
ff354c99c5 This is another *BIG* change...
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.
0001-01-01 00:00:00 +00:00
Andrew Bartlett
799ac01fe0 Kill off another ugly wart from the side of the passdb subsystem.
This time its the pdb_getsampwuid() function - which was only being used by the
SAMR rpc subsystem to gain a 'user session key'.  This 'user session key' is
actually generated at login time, and the other changes here simply move that
data around.

This also means that (when I check some details) we will be able to use the
user session key, even when we are not actually the DC, becouse its one of the
components of the info3 struct returned on logon.

Andrew Bartlett
0001-01-01 00:00:00 +00:00
Andrew Bartlett
6d0b3d051f Fix up an embarrsing bug I introduced when I moved the id21/id23 -> SAM_ACCOUNT
conversion across to the pdb_set...() interface.

Now we only set strings that are non-null.  This allows Win2k to join the
domain again, particularly when using tdbsam.

Andrew Bartlett
0001-01-01 00:00:00 +00:00
Simo Sorce
6b123adda9 fixes (asprintf) from 2.2 0001-01-01 00:00:00 +00:00
Andrew Bartlett
1d86c7f942 A nice *big* change to the fundemental way we do things.
Samba (ab)uses the returns from getpwnam() a lot - in particular it keeps
them around for a long time - often past the next call...

This adds a getpwnam_alloc and a getpwuid_alloc to the collection.

These function as expected, returning a malloced structure that can be
free()ed with passwd_free(&passwd).

This patch also cuts down on the number of calls to getpwnam - mostly by
taking advantage of the fact that the passdb interface is already
case-insensiteve.

With this patch most of the recursive cases have been removed (that I know
of) and the problems are reduced further by not using the sys_ interface
in the new code.  This means that pointers to the cache won't be affected.
(This is a tempoary HACK, I intend to kill the password cache entirly).

The only change I'm a little worried about is the change to
rpc_server/srv_samr_nt.c for private groups.  In this case we are getting
groups from the new group mapping DB.  Do we still need to check for private
groups?  I've toned down the check to a case sensitve match with the new code,
but we might be able to kill it entirly.

I've also added a make_modifyable_passwd() function, that copies a passwd
struct into the form that the old sys_getpw* code provided.  As far as I can
tell this is only actually used in the pass_check.c crazies, where I moved
the final 'special case' for shadow passwords (out of _Get_Pwnam()).

The matching case for getpwent() is dealt with already, in lib/util_getent.c

Also included in here is a small change to register the [homes] share at vuid
creation rather than just in one varient of the session setup.  (This picks
up the SPNEGO cases).  The home directory is now stored on the vuid, and I
am hoping this might provide a saner way to do %H substitions.

TODO:  Kill off remaining Get_Pwnam_Modify calls (they are not needed), change
the remaining sys_getpwnam() callers to use getpwnam_alloc() and move
Get_Pwnam to return an allocated struct.

Andrew Bartlett
0001-01-01 00:00:00 +00:00
Andrew Bartlett
724109a33b For some reason I wasn't thinking about failure cases this morning...
Anyway, this makes it slightly sane, but we may decide to smb_panic() here
instead.

Andrew Bartlett
0001-01-01 00:00:00 +00:00
Martin Pool
e0105974c0 Add constness to parameters 0001-01-01 00:00:00 +00:00
Andrew Bartlett
5b4079f748 Commit the auth associated changes I missed from the last commit.
Also set the default value of all the allocated strings to "" to avoid changing
the interface (becouse pdb_get...() would point to a null string, rather than a
null pointer and parts of samba rely on that).

Andrew Bartlett
0001-01-01 00:00:00 +00:00
Andrew Bartlett
144345b41d Change the passdb interface to use allocated strings.
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
0001-01-01 00:00:00 +00:00
Andrew Bartlett
28d5ab269c Move all the pdb_get...() and pdb_set...() functions to a new file.
This brings passdb.c down to a much more manageable ~1100 lines and makes it a
little easier to comprehend whats going on here.

Andrew Bartlett
0001-01-01 00:00:00 +00:00
Jeremy Allison
274b04d4a6 Fixed up atomic update code.
Jeremy.
0001-01-01 00:00:00 +00:00
Gerald Carter
999a2f5c84 fixing compile error 0001-01-01 00:00:00 +00:00
Jeremy Allison
676eea502a We should be SHLD not LINK when creating shared libraries.
Tidyup in passdb.c
Jeremy.
0001-01-01 00:00:00 +00:00
Andrew Bartlett
673ece2841 We go to a lot of effort to avoid strcpy() in Samba, but its not much use if
people start doing using strlen(src) in strncpy() :-)

This occured when the talloc based passdb was reverted in favor of a pstring
based one.  In the talloc version this was fine, becouse the buffer was
strlen(src) bytes long.  This no longer applies...

This doesn't seem to have broken anything, but I'm chasing up an oddity with NT
password changing from the last merge.

Test & MERGE for 2.2.3

Andrew Bartlett
0001-01-01 00:00:00 +00:00
Andrew Bartlett
d3dd28f6c4 Actually enforce the passdb API.
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
0001-01-01 00:00:00 +00:00
Simo Sorce
29b3b5e929 ops, froget to set the values.
jerry, can you look at theis where we use standard_sub_advanced() fns?
I think this structure should be backported to 2.2 because we do not know if the SAM_ACCOUNT strings have enough space to contain the "substituted" string.
(Yes, just now we know they are pstrings, but we may change them into alloced one, I'm a strong suported of alloced strings as 1024 bytes are not always enough and are often too much)
0001-01-01 00:00:00 +00:00
Simo Sorce
f796f18a83 port mods from 2.2 0001-01-01 00:00:00 +00:00
Andrew Tridgell
65e857b36e more irix -64 portability fixes 0001-01-01 00:00:00 +00:00
Andrew Bartlett
20d7c5d9b9 Make --with-tdbsam compile again, given the new 'am I setting a default' flags.
Andrew Bartlett
0001-01-01 00:00:00 +00:00
Gerald Carter
a7dc0febe4 removed extern samlogon_user 0001-01-01 00:00:00 +00:00
Gerald Carter
a5f4559b2a remove samlogon_user 0001-01-01 00:00:00 +00:00
Gerald Carter
efcde5d9d8 some merges from 2.2. Still need to merge in changes from pdb_tdb.c
but it will take more time as I don't want to loose any fixes that
are only in HEAD.
0001-01-01 00:00:00 +00:00
Simo Sorce
49f5cb7a3d util_sid.c - respect a const variabile (addedd strdup)
cli_reg.c  - indentation
pdb_ldap.c - some checks on init fns parameters
pdb_tdb.c  - some checks on init fns parameters + make sure we close the db on failure
0001-01-01 00:00:00 +00:00
Andrew Bartlett
30ef625897 Finally remove these files, which moved (by cvs backend magic) to source/auth
at the start of the month.
0001-01-01 00:00:00 +00:00
Gerald Carter
54cbfc7ebc pdb_getsampwnuid() merge from 2.2 0001-01-01 00:00:00 +00:00
Gerald Carter
c6d867b552 removed unused files 0001-01-01 00:00:00 +00:00
Gerald Carter
f0d4379115 moving SAM_ACCOUNT to include a bit field for initialized
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
0001-01-01 00:00:00 +00:00
Jean-François Micouleau
c26623671e Rafal (mimir) patch for trusts r. 0001-01-01 00:00:00 +00:00
Jean-François Micouleau
c99bc30559 update the ldap support code. it compiles.
Ignacio you can update your howto ;-)

samsync: a small patch to try chaning challenges.

	J.F.
0001-01-01 00:00:00 +00:00
Jean-François Micouleau
fef52c4b96 again an intrusive patch:
- removed the ugly as hell sam_logon_in_ssb variable, I changed a bit the
definition of standard_sub_basic() to cope with that.

- removed the smb.conf: 'domain admin group' and 'domain guest group'
parameters ! We're not playing anymore with the user's group RIDs !

- in get_domain_user_groups(), if the user's gid is a group, put it first
in the group RID list.

I just have to write an HOWTO now ;-)

        J.F.
0001-01-01 00:00:00 +00:00
Andrew Bartlett
c76c1f6904 Add a couple of extra debugs for the secrets.tdb stuff 0001-01-01 00:00:00 +00:00
Andrew Tridgell
aff916e543 auto-init secrets.tdb 0001-01-01 00:00:00 +00:00
Jean-François Micouleau
6c87e96149 added a boolean to the group mapping functions to specify if we need or
not the privileges. Usually we don't need them, so the memory is free
early.

lib/util_sid.c: added some helper functions to check an SID.

passdb/passdb.c: renamed local_lookup_rid() to local_lookup_sid() and pass
an RID all the way. If the group doesn't exist on the domain SID,
don't return a faked one as it can collide with a builtin one. Some rpc
structures have been badly designed, they return only rids and force the
client to do subsequent lsa_lookup_sid() on the domain sid and the builtin
sid !

rpc_server/srv_util.c: wrote a new version of get_domain_user_groups().
Only the samr code uses it atm. It uses the group mapping code instead of
a bloody hard coded crap. The netlogon code will use it too, but I have to
do some test first.

	J.F.
0001-01-01 00:00:00 +00:00
Andrew Bartlett
153c4a56b0 This comment no longer applies. 0001-01-01 00:00:00 +00:00
Jean-François Micouleau
bc28a8eebd added a tdb to store the account policy informations.
You can change them with either usermanager->policies->account
or from a command prompt on NT/W2K: net accounts /domain

we can add a rpc accounts to the net command. As the net_rpc.c is still
empty, I did not start. How should I add command to it ? Should I take the
rpcclient/cmd_xxx functions and call them from there ?

alse changed the SAM_UNK_INFO_3 parser, it's an NTTIME. This one is more
for jeremy ;-)

        J.F.
0001-01-01 00:00:00 +00:00
Jean-François Micouleau
6533339887 added mapping of primary gid to rid thru the group mapping code.
and cleanup and comments in passdb/passdb.c


	J.F.
0001-01-01 00:00:00 +00:00
Jean-François Micouleau
3f0a9ef2b8 Changed again how the privilege list is handled in the group mapping code.
This time it's a PRIVILEGE_SET struct instead of a simple uint32 array. It
makes much more sense. Also added a uint32 systemaccount to the GROUP_MAP
struct as some privilege showing in USRMGR.EXE are not real privs but a
bitmask flag. I guess it's an heritage from NT 3.0 ! I could setup an NT
3.1 box to verify, but I'm too lazy (yes I still have my CDs).

Added 3 more LSA calls: SetSystemAccount, AddPrivileges and
RemovePrivileges, we can manage all this privilege from UserManager.

Time to change the NT_USER_TOKEN struct and add checks in all the rpc
functions. Fun, fun, fun.

        J.F.
0001-01-01 00:00:00 +00:00
Herb Lewis
5f625f2877 add .po32 files to ignore list 0001-01-01 00:00:00 +00:00
Andrew Tridgell
8712ac8499 unable to open smbpasswd on initial create should only be a warning 0001-01-01 00:00:00 +00:00
Tim Potter
091f01f34a Ignore *.po files. 0001-01-01 00:00:00 +00:00
Volker Lendecke
6dda341bc8 Don't close tdb twice. 0001-01-01 00:00:00 +00:00
Andrew Tridgell
058a5aee90 added "net join" command
this completes the first stage of the smbd ADS support
0001-01-01 00:00:00 +00:00
Andrew Bartlett
8d31eae52a This is another rather major change to the samba authenticaion
subystem.

The particular aim is to modularized the interface - so that we
can have arbitrary password back-ends.

This code adds one such back-end, a 'winbind' module to authenticate
against the winbind_auth_crap functionality.  While fully-functional
this code is mainly useful as a demonstration, because we don't get
back the info3 as we would for direct ntdomain authentication.

This commit introduced the new 'auth methods' parameter, in the
spirit of the 'auth order' discussed on the lists.  It is renamed
because not all the methods may be consulted, even if previous
methods fail - they may not have a suitable challenge for example.

Also, we have a 'local' authentication method, for old-style
'unix if plaintext, sam if encrypted' authentication and a
'guest' module to handle guest logins in a single place.

While this current design is not ideal, I feel that it does
provide a better infrastructure than the current design, and can
be built upon.

The following parameters have changed:
 - use rhosts =

  This has been replaced by the 'rhosts' authentication method,
 and can be specified like 'auth methods = guest rhosts'

 - hosts equiv =

  This needs both this parameter and an 'auth methods' entry
  to be effective.  (auth methods = guest hostsequiv ....)

 - plaintext to smbpasswd =

  This is replaced by specifying 'sam' rather than 'local'
  in the auth methods.

The security = parameter is unchanged, and now provides defaults
for the 'auth methods' parameter.

The available auth methods are:

guest
rhosts
hostsequiv
sam (passdb direct hash access)
unix (PAM, crypt() etc)
local (the combination of the above, based on encryption)
smbserver (old security=server)
ntdomain (old security=domain)
winbind (use winbind to cache DC connections)


Assistance in testing, or the production of new and interesting
authentication modules is always appreciated.

Andrew Bartlett
0001-01-01 00:00:00 +00:00
Andrew Bartlett
e8e73f7f0f Kill off that crazy copy_sam_passwd(). You simply can't do that if the
structre contains pointers (well not if you intend of free those pointers
at some stage)

There is no reason (given the new passdb interface) that you can't modify a
SAM_ACCOUNT in any case.

Andrew Bartlett
0001-01-01 00:00:00 +00:00
Jean-François Micouleau
f29774e589 Changed how the privileges are stored in the group mapping code. It's now
an array of uint32. That's not perfect but that's better.

Added more privileges too.

Changed the local_lookup_rid/name functions in passdb.c to check if the
group is mapped. Makes the LSA rpc calls return correct groups

Corrected the return code in the LSA server code enum_sids.

Only enumerate well known aliases if they are mapped to real unix groups.
Won't confuse user seeing groups not available.

Added a short/long view to smbgroupedit.

now decoding rpc calls to add/remove privileges to sid.

        J.F.
0001-01-01 00:00:00 +00:00
Jeremy Allison
9148bb9eaa Tidyups when I was doing the big merge...
Jeremy.
0001-01-01 00:00:00 +00:00
Andrew Bartlett
80667cb0dd Minor updates. A small dose of const. 0001-01-01 00:00:00 +00:00
Andrew Bartlett
3235880b41 Remove built-in support for clear-text kerberos authentication.
This should remove some confusion from the ./configure, but does not affect the
'real' kerberos support currently residing in smbd/sesssetup.c.

This code is vunerable to a spoofed KDC, and is best replaced by --with-pam and
the pam_krb5 module.  This module includes measures to prevent such spoofing.

Andrew Bartlett
0001-01-01 00:00:00 +00:00
Volker Lendecke
7d70b30dbd As pdb_ldap.c does not compile in HEAD anyway, a not-compiled merge
from 2_2.

Volker
0001-01-01 00:00:00 +00:00
Jeremy Allison
970ec14b4b Added debug in truncate, fixed warning with gcc3.
Jeremy.
0001-01-01 00:00:00 +00:00
Andrew Bartlett
39f9c78d07 UGLY HACK to get machines to join tdbsam domains again.
The problem is that we don't use the bitmap field, and so have to guess what
feilds to change.  NT4 sets the RID to NULL in its reply, (as a no-change
value) and we were attempting to set that as a RID.

jfm:  Can you get me the info on that bitmap, so I can construct a proper fix
to all this?

Thanks!
0001-01-01 00:00:00 +00:00
Andrew Bartlett
be04aad90d Fixup for accounts without a local /etc/passwd entry.
- Now perfectly valid.
0001-01-01 00:00:00 +00:00
Andrew Bartlett
514c91b16b Various post AuthRewrite cleanups, fixups and tidyups.
Zero out some of the plaintext passwords for paranoia

Fix up some of the other passdb backends with the change to *uid_t rather than
uid_t.

Make some of the code in srv_netlog_nt.c clearer, is passing an array around,
so pass its lenght in is definition, not as a seperate paramater.

Use sizeof() rather than magic numbers, it makes things easier to read.

Cope with a PAM authenticated user who is not in /etc/passwd - currently by
saying NO_SUCH_USER, but this can change in future.

Andrew Bartlett
0001-01-01 00:00:00 +00:00
Andrew Bartlett
f70fb819b2 This is a farily large patch (3300 lines) and reworks most of the AuthRewrite
code.

In particular this assists tpot in some of his work, becouse it provides the
connection between the authenticaion and the vuid generation.

Major Changes:
	- Fully malloc'ed structures.
	  - Massive rework of the code so that all structures are made and destroyed
	    using malloc and free, rather than hanging around on the stack.
	- SAM_ACCOUNT unix uids and gids are now pointers to the same, to allow them
	   to be declared 'invalid' without the chance that people might get ROOT by
	   default.

	- kill off some of the "DOMAIN\user" lookups.  These can be readded at a more
	  appropriate place (probably domain_client_validate.c) in the future. They
	  don't belong in session setups.

	- Massive introduction of DATA_BLOB structures, particularly for passwords.

	- Use NTLMSSP flags to tell the backend what its getting, rather than magic
	  lenghths.

	- Fix winbind back up again, but tpot is redoing this soon anyway.

	- Abstract much of the work in srv_netlog_nt back into auth helper functions.

This is a LARGE change, and any assistance is testing it is appriciated.

Domain logons are still broken (as far as I can tell) but other functionality
seems
intact.

Needs testing with a wide variety of MS clients.

Andrew Bartlett
0001-01-01 00:00:00 +00:00
Andrew Bartlett
3b5e72bda3 Small 'const' updates ahead of some AuthRewrite merging. 0001-01-01 00:00:00 +00:00
Andrew Bartlett
cea6b6cb22 Fix up smbpasswd -e/-d so that it doesn't change the password under you any
more.

(Previously it set them to 'XXXX' or similar when only the flags were being
changed - a bug I must have introduced when I reworked the passdb end of things
a few weeks back.)

Adds a new local flag:  LOCAL_SET_PASSWORD to specify that the password is
actually to be changed.

Andrew Bartlett
0001-01-01 00:00:00 +00:00
Andrew Bartlett
c95f5aeb93 This commit is number 4 of 4.
In particular this commit focuses on:

Actually adding the 'const' to the passdb interface, and the flow-on changes.

Also kill off the 'disp_info' stuff, as its no longer used.

While these changes have been mildly tested, and are pretty small, any
assistance in this is appreciated.

----

These changes introduces a large dose of 'const' to the Samba tree.
There are a number of good reasons to do this:

	- I want to allow the SAM_ACCOUNT structure to move from wasteful
	pstrings and fstrings to  allocated strings.  We can't do that if
	people are modifying these outputs, as they may well make
	assumptions about getting pstrings and fstrings

	- I want --with-pam_smbpass to compile with a slightly sane
	volume of warnings, currently its  pretty bad, even in 2.2
	where is compiles at all.

	- Tridge assures me that he no longer opposes 'const religion'
	based on the ability to  #define const the problem away.

	- Changed Get_Pwnam(x,y) into two variants (so that the const
	parameter can work correctly): - Get_Pwnam(const x) and
	Get_Pwnam_Modify(x).

	- Reworked smbd/chgpasswd.c to work with these mods, passing
	around a 'struct passwd' rather  than the modified username

---

This finishes this line of commits off, your tree should now compile again :-)

Andrew Bartlett
0001-01-01 00:00:00 +00:00
Andrew Bartlett
e7634f81c5 This commit is number 3 of 4.
In particular this commit focuses on:

Changing the Get_Pwnam code so that it can work in a const-enforced
environment.

While these changes have been mildly tested, and are pretty small, any
assistance in this is appreciated.

----

These changes allow for 'const' in the Samba tree.

There are a number of good reasons to do this:

	- I want to allow the SAM_ACCOUNT structure to move from wasteful
	pstrings and fstrings to  allocated strings.  We can't do that if
	people are modifying these outputs, as they may well make
	assumptions about getting pstrings and fstrings

	- I want --with-pam_smbpass to compile with a slightly sane
	volume of warnings, currently its  pretty bad, even in 2.2
	where is compiles at all.

	- Tridge assures me that he no longer opposes 'const religion'
	based on the ability to  #define const the problem away.

	- Changed Get_Pwnam(x,y) into two variants (so that the const
	parameter can work correctly): - Get_Pwnam(const x) and
	Get_Pwnam_Modify(x).

	- Reworked smbd/chgpasswd.c to work with these mods, passing
	around a 'struct passwd' rather  than the modified username
0001-01-01 00:00:00 +00:00
Andrew Bartlett
8f607810eb This commit is number 2 of 4.
In particular this commit focuses on:

The guts of the moving about inside passdb.

While these changes have been mildly tested, and are pretty small, any
assistance in this is appreciated.

----

These changes allow for the introduction of  a large dose of 'const' to
the Samba tree.

There are a number of good reasons to do this:

	- I want to allow the SAM_ACCOUNT structure to move from wasteful
	pstrings and fstrings to  allocated strings.  We can't do that if
	people are modifying these outputs, as they may well make
	assumptions about getting pstrings and fstrings

	- I want --with-pam_smbpass to compile with a slightly sane
	volume of warnings, currently its  pretty bad, even in 2.2
	where is compiles at all.

	- Tridge assures me that he no longer opposes 'const religion'
	based on the ability to  #define const the problem away.

	- Changed Get_Pwnam(x,y) into two variants (so that the const
	parameter can work correctly): - Get_Pwnam(const x) and
	Get_Pwnam_Modify(x).

	- Reworked smbd/chgpasswd.c to work with these mods, passing
	around a 'struct passwd' rather  than the modified username

passdb/

	- Kill off disp_info stuff, it isn't used any more - Kill off
	support for writing to the old smbpasswd format, it isn't relevent
	to Samba 3.0

	- Move around and modify the pdb_...() helper functions, adding
	one that sets the last changed  time to 'now' and that sets the
	must change time appropriately.

	- Remove the ugly forced update of the LCT- value in
	pdb_smbpasswd.  - Remove the implicit modification of the ACB
	flags when both NT and LM passwords are set.

	- Removed substation in pdb_getsampwnam output, as a single
	password change will render them  inoperable in any case (they
	will be substituted and stored)

	- Added a default RID to the init_sam_from_pw() function, based on
	our rid algorithm.

	- Added checks that an smbpasswd stored user has a uid-based RID.

	- Fail to store tdb based users without a RID

lib/
    - Change the substituion code to use global_myname if there is
      no connection (and therefore no called name) at the present time.
0001-01-01 00:00:00 +00:00
Andrew Bartlett
a8971a5448 This commit is number 1 of 4.
In particular this commit focusses on:

Adding the new 'pass changed now' helper function.

While these changes have been mildly tested, and are pretty small, any
assistance in this is appreciated.
0001-01-01 00:00:00 +00:00
Jeremy Allison
8d23a7441b Merge the become_XXX -> change_to_XXX fixes from 2.2.2 to HEAD.
Ensure make_conection() can only be called as root.
Jeremy.
0001-01-01 00:00:00 +00:00
Gerald Carter
96c9df577b merge from 2.2 0001-01-01 00:00:00 +00:00
Jeremy Allison
29730027d8 Fixes from John Trostel (modified somewhat by me) to ensure that all lookup_XX
functions correctly deal with the SID_NAME_TYPE. One fix for connection user
lookup in LSA.
Jeremy.
0001-01-01 00:00:00 +00:00
Tim Potter
5805cfef78 Added a comment about not changing the magic timestamp values without
knowing what you are doing!
0001-01-01 00:00:00 +00:00
Jeremy Allison
a71d9d98b0 Ensure accessing NT member servers works with a Samba PDC. Don't
change these timestamp settings without good reason.
Remove CLEAR_IF_FIRST flag is tdb is read-only.
Jeremy.
0001-01-01 00:00:00 +00:00
Andrew Tridgell
ead3d41f1a set ACB_PWNOEXP by default on new accounts. 0001-01-01 00:00:00 +00:00
Jeremy Allison
9333bbeb76 Fixed up the change password bug when not using PAM.
The problem is we were trying to use mask_match as a generic
wildcard matcher for UNIX strings (like the password prompts).
We can't do that - we need a unix_wild_match (re-added into lib/util.c)
as the ms_fnmatch semantics for empty strings are completely wrong.
This caused partial reads to be accepted as correct passwd change
responses when they were not....
Also added paranioa test to stop passwd change being done as root
with no %u in the passwd program string.
Jeremy.
0001-01-01 00:00:00 +00:00
Jeremy Allison
94403d8417 Fixed the bug with member servers in a Samba PDC hosted domain not allowing
other access. Problem was max time was being set to 0xffffffff, instead of
0x7fffffff.
Jeremy.
0001-01-01 00:00:00 +00:00
Tim Potter
2d0922b0ea Removed 'extern int DEBUGLEVEL' as it is now in the smb.h header. 0001-01-01 00:00:00 +00:00
Andrew Tridgell
11075f5434 - fix handling of 0 last_change_time and must_change_time
- move the arbitrary 21 day timeout to local.h
0001-01-01 00:00:00 +00:00
Andrew Bartlett
6b45e342fd This is the passdb section of the previously mentioned commit.
Of particular note is the change to pdb_free_sam() to take its sam argument by
reference, allowing it to be NULLified by the SAFE_FREE() macro, and the
changed to local_password_change() both to make it work and to remove the
duplicate code that caused so much breakage over the last few days.

 - Small change in behaviour:  when LOCAL_ADD_USER is set, the user doesn't
actually exist locally but does exist in the passdb we don't attempt to do a
GetPwnam().  (How the entry got there is another matter, and most passdbs won't
allow this anyway).

Andrew Bartlett
0001-01-01 00:00:00 +00:00
Andrew Bartlett
1f83184f88 How the heck I missed this I don't know, but somehow I got a copy-and-paste
error in here...

Now you can change local passwords again.  There is stil somthing broken about
remote (via windows/sampasswd) password changing.

I shall have to revise my testing, I honestly don't know how this slipped
through the net.

MERGE for 2.2.2.

Sorry,
Andrew Bartlett
0001-01-01 00:00:00 +00:00
Jeremy Allison
65bf4a36ef Merge HEAD and 2.2 - try frantically to keep in sync.
Jeremy.
0001-01-01 00:00:00 +00:00
Andrew Bartlett
a41fb44f5e Fix memory leak in get_sampwd_entries(), reindent for clarity.
- call pdb_reset_sam() after each getent call.

Fix bug in get_group_alias_entries(), were if num_entries was zero this caused
talloc() to return NULL, failing a test below with NT_STATUS_NO_MEMORY.

Fix pdb_reset_sam() to correctly initalise the sam structure.

Move default value code into a single place, likewise for sam freeing code.
 - should make things easier if we decide to malloc other strings, or get more
 non-zero default values.

Finally, add a function in init a sam struct from a getpwnam() return.

Andrew Bartlett
0001-01-01 00:00:00 +00:00