1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-25 23:21:54 +03:00
Commit Graph

137 Commits

Author SHA1 Message Date
Jim McDonough
a15393a3d9 r53: Remove modifyTimestamp from list of our attributes. We just check it for
cache entry time comparisons in password lockout.  Fixes problems where
pdb_ldap tries to delete the operational attribute modifyTimestamp when
deleting a user account.
(This used to be commit 5ebcb9081e)
2007-10-10 10:51:06 -05:00
Volker Lendecke
9d1a4e8013 Remove some unused code
(This used to be commit 2b757b6adf)
2004-03-31 14:36:25 +00:00
Jim McDonough
2732b702fb Use timegm, or our already existing replacement instead of timezone, as
some platforms (FreeBSD in this case) don't define timezone according to
posix.  This is what I wanted to do anyway.

Spotted by Andrzej Tobola <san@iem.pw.edu.pl>
(This used to be commit bc13e35db0)
2004-03-25 18:25:41 +00:00
Jeremy Allison
a79b205d92 Fix gcc warnings. Fix mkproto with new type.
Jeremy.
(This used to be commit 00fa66df3e)
2004-03-19 01:29:14 +00:00
Jim McDonough
357998ddbd Password lockout for LDAP backend. Caches autolock flag, bad count, and
bad time locally, updating the directory only for hitting the policy limit
or resetting.

This needed to be done at the passdb level rather than auth, because some
of the functions need to be supported from tools such as pdbedit.  It was
done at the LDAP backend level instead of generically after discussion,
because of the complexity of inserting it at a higher level.

The login cache read/write/delete is outside of the ldap backend, so it could
easily be called by other backends.  tdbsam won't call it for obvious
reasons, and authors of other backends need to decide if they want to
implement it.
(This used to be commit 2a679cbc87)
2004-03-18 19:22:51 +00:00
Jim McDonough
3d18997afd Get MungedDial actually working with full TS strings in it for pdb_ldap.
I know this isn't pretty, but neither was our assumption that all strings
from the directory fit inside a pstring.  There was no way this worked
before will all versions of usrmgr (for example, the only version of
mine that has the TS Confic button).
(This used to be commit d275c0e384)
2004-03-11 16:32:19 +00:00
Andrew Bartlett
56bd63b1cd I *hate* global variables...
OK, what was happening here was that we would invalidate global_sam_sid
when we set the sid into secrets.tdb, to force a re-read.

The problem was, we would do *two* writes into the TDB, and the second one
(in the PDC/BDC case) would be of a NULL pointer.  This caused smbd startups
to fail, on a blank TDB.

By using a local variable in the pdb_generate_sam_sid() code, we avoid this
particular trap.

I've also added better debugging for the case where this all matters, which
is particularly for LDAP, where it finds out a domain SID from the sambaDomain
object.

Andrew Bartlett
(This used to be commit 86ad04d26d)
2004-02-25 22:01:02 +00:00
Jim McDonough
041f03151c Try to remove the last vestiges of unknown_3...
Jelmer, can you look at the sql and xml backends please to verify?
(This used to be commit b7706f7e25)
2004-02-12 19:09:21 +00:00
Andrew Bartlett
f125759072 Fix const warning
(This used to be commit 7a36cc4ac0)
2004-02-04 11:41:22 +00:00
Andrew Bartlett
9751ccf2af If we are setting the NT or LM password to NULL, remove the attribute
rather than writing XXXXX

Andrew Bartlett
(This used to be commit ab7dd748a9)
2004-01-30 23:37:38 +00:00
Gerald Carter
29b4959815 isolate ldap debug messages to the common smbldap_XXX() functions
(This used to be commit 7d7a262f45)
2004-01-06 18:26:18 +00:00
Andrew Bartlett
66f039d58c Check the return value of string_to_sid in a few more places. (But
string_to_sid also needs to be less permissive on what it thinks are
valid sids...)

Andrew Bartlett
(This used to be commit 9080c30de8)
2003-12-26 03:14:31 +00:00
Andrew Bartlett
988f561477 Show the error message for failure to set the ldap password.
(For 'ldap password sync = yes')

Andrew Bartlett
(This used to be commit 5b682aef67)
2003-12-26 00:43:48 +00:00
Gerald Carter
5df2fd4175 support munged dial for ldapsam; patch from Aurlien Degrmont; bug 800
(This used to be commit 1c3c16abc9)
2003-12-04 04:52:00 +00:00
Gerald Carter
36558f8f2b fix more memory leaks in the LDAP backend code; patches from metze
(This used to be commit e079c8842a)
2003-11-14 03:28:03 +00:00
Jeremy Allison
732fecd3a0 Patch from Aurlien Degrmont <adegremont@idealx.com>. "entry" is dependent
on "result", don't free result first.
Jeremy.
(This used to be commit c61a230c5a)
2003-10-31 19:16:59 +00:00
Jeremy Allison
f23c2ff0a0 If nothing to do, return success. Fix from Aur?lien Degr?mont <adegremont@idealx.com>
Jeremy.
(This used to be commit aa668a0206)
2003-10-30 20:09:13 +00:00
Jeremy Allison
bb0598faf5 Put strcasecmp/strncasecmp on the banned list (except for needed calls
in iconv.c and nsswitch/). Using them means you're not thinking about multibyte at
all and I really want to discourage that.
Jeremy.
(This used to be commit d7e35dfb92)
2003-10-22 23:38:20 +00:00
Volker Lendecke
ec6c16d7b1 Make pdb_ldap.c compile with SUN iPlanet headers. Whether this works will be
tested soon, but this fix is somewhat obvious.

Volker
(This used to be commit 227882d6f7)
2003-10-02 09:26:51 +00:00
Jeremy Allison
3a48e4b287 The "unknown_5" 32 bit field in the user structs is actually 2 16-bit
fields, bad_password_count and logon_count. Ensure this is stored/fetched
in the various SAMs. As it replaces the unknown_5 field this fits
exactly into the tdb SAM without any binary problems. It also is added
to the LDAP SAM as two extra attributes. It breaks compatibility with
the experimental SAMs xml and mysql. The maintainers of these SAMs must
fix them so upgrades like this can be done transparently. I will insist
on the "experimental" status until this is solved.
Jeremy.
(This used to be commit cd7bd8c2da)
2003-09-18 23:53:48 +00:00
Gerald Carter
1d0329c768 remove getpwnam() calls from init_sam_from_xxx().
This means that %u & %g will no longer expand, but %U
and %G still do.  The payback is that winbindd local
accounts for users work with 'wbinfo -u' when winbind
is running on a PDC.
(This used to be commit eb02fcf3c2)
2003-09-11 16:52:10 +00:00
Jeremy Allison
ca1c6ebb11 Fix a nasty mess, and also bug #296. passdb/pdb_ldap.c was not converting
to/from utf8 for some calls. The libads code gets this right. Wonder why
the passdb code doesn't use it ?
Jeremy.
(This used to be commit 910d21d316)
2003-09-10 22:33:06 +00:00
Gerald Carter
7f3e60d837 remove 'ldap trust ids' since there was no way for it to work now
(This used to be commit 3724063f15)
2003-08-27 21:17:10 +00:00
Herb Lewis
062f89bc28 get rid of some sompiler warnings on IRIX
(This used to be commit a6a39c61e8)
2003-08-15 01:42:30 +00:00
Gerald Carter
44e6c30f71 fix bug #208; have to get the gid of the user's primary group for %G
(This used to be commit 575483a1ef)
2003-08-06 19:16:17 +00:00
Gerald Carter
3a5dc7c2ec convert snprintf() calls using pstrings & fstrings
to pstr_sprintf() and fstr_sprintf() to try to standardize.
lots of snprintf() calls were using len-1; some were using
len.  At least this helps to be consistent.
(This used to be commit 9f835b85dd)
2003-07-23 12:33:59 +00:00
Tim Potter
80c1f1d865 Fixup a bunch of printf-style functions and debugs to use unsigned long when
displaying pid_t, uid_t and gid_t values.  This removes a whole lot of warnings
on some of the 64-bit build farm machines as well as help us out when 64-bit
uid/gid/pid values come along.
(This used to be commit f93528ba00)
2003-07-22 04:31:20 +00:00
Volker Lendecke
ffbb6ee3b8 Fix two memleaks in pdb_ldap.c.
Whoever put the private.backend_private_data_free_fn thingy into
SAM_ACCOUNT, could you please revisit my change to pdb_get_set.c and
comment on my comment there?

Thanks,

Volker
(This used to be commit 922ec277d1)
2003-07-18 09:05:30 +00:00
Volker Lendecke
658099b695 Fix memleak
(This used to be commit 42a59d6910)
2003-07-16 13:57:53 +00:00
Volker Lendecke
36d1df4413 typo
(This used to be commit 09e00970d4)
2003-07-16 13:35:23 +00:00
Volker Lendecke
cf8628e585 Fix memleaks
(This used to be commit 26134ac302)
2003-07-15 17:00:11 +00:00
Gerald Carter
03d5867d52 moving more code around.
* move rid allocation into IDMAP.  See comments in _api_samr_create_user()
  * add winbind delete user/group functions

I'm checking this in to sync up with everyone.  But I'm going to split
the add a separate winbindd_allocate_rid() function for systems
that have an 'add user script' but need idmap to give them a RID.
Life would be so much simplier without 'enable rid algorithm'.
The current RID allocation is horrible due to this one fact.
Tested idmap_tdb but not idmap_ldap yet.  Will do that tomorrow.

Nothing has changed in the way a samba domain is represented, stored,
or search in the directory so things should be ok with previous installations.

going to bed now.
(This used to be commit 0463045cc7)
2003-07-11 05:33:40 +00:00
Gerald Carter
0b18acb841 and so it begins....
* remove idmap_XX_to_XX calls from smbd.  Move back to the
  the winbind_XXX and local_XXX calls used in 2.2

* all uid/gid allocation must involve winbindd now

* move flags field around in winbindd_request struct

* add WBFLAG_QUERY_ONLY option to winbindd_sid_to_[ug]id()
  to prevent automatic allocation for unknown SIDs

* add 'winbind trusted domains only' parameter to force a domain member
  server to use matching users names from /etc/passwd for its domain
  (needed for domain member of a Samba domain)

* rename 'idmap only' to 'enable rid algorithm' for better clarity
  (defaults to "yes")

code has been tested on

  * domain member of native mode 2k domain
  * ads domain member of native mode 2k domain
  * domain member of NT4 domain
  * domain member of Samba domain
  * Samba PDC running winbindd with trusts

Logons tested using 2k clients and smbclient as domain users
and trusted users. Tested both 'winbind trusted domains only = [yes|no]'

This will be a long week of changes.  The next item on the list is
winbindd_passdb.c & machine trust accounts not in /etc/passwd (done
via winbindd_passdb)
(This used to be commit 8266dffab4)
2003-07-07 05:11:10 +00:00
Andrew Bartlett
cd2c5e1f63 Fix ldapsam_getsampwsid to correctly only say 'no such user' when indeed there
is no such user...

Thanks to jerry for spotting this.

Also clean up the function a bit, to avoid this happening again...

Andrew Bartlett
(This used to be commit d9a6859e2b)
2003-07-06 06:18:54 +00:00
Andrew Bartlett
85921dbd6f Add some debug statments to our vampire code - try to make it easier to track
down failures.

Add a 'auto-add on modify' feature to guestsam

Fix some segfault bugs on no-op idmap modifications, and on new idmappings that
do not have a DN to tack onto.

Make the 'private data' a bit more robust.

Andrew Bartlett
(This used to be commit 6c48309cda)
2003-07-05 10:39:41 +00:00
Andrew Bartlett
a3ddfa5069 Fixes to our LDAP/vampire codepaths:
- Try better to add the appropriate mapping between UID and SIDs, based
   on Get_Pwnam()
 - Look for previous users (lookup by SID) and correctly modify the existing
   entry in that case
 - Map the root user to the Admin SID as a 'well known user'
 - Save the LDAPMessage result on the SAM_ACCOUNT for use in the next 'update'
   call on that user.  This means that VL's very nice work on atomic LDAP
   updates now really gets used properly!
 - This also means that we know the right DN to update, without the extra
   round-trips to the server.

Andrew Bartlett
(This used to be commit c7118cb31d)
2003-07-05 09:46:12 +00:00
Andrew Bartlett
4168d61fb2 This patch cleans up some of our ldap code, for better behaviour:
We now always read the Domain SID out of LDAP.  If the local secrets.tdb
is ever different to LDAP, it is overwritten out of LDAP.   We also
store the 'algorithmic rid base' into LDAP, and assert if it changes.
(This ensures cross-host synchronisation, and allows for possible
integration with idmap).  If we fail to read/add the domain entry, we just
fallback to the old behaviour.

We always use an existing DN when adding IDMAP entries to LDAP, unless
no suitable entry is available.  This means that a user's posixAccount
will have a SID added to it, or a user's sambaSamAccount will have a UID
added.  Where we cannot us an existing DN, we use
'sambaSid=S-x-y-z,....' as the DN.

The code now allows modifications to the ID mapping in many cases.

Likewise, we now check more carefully when adding new user entires to LDAP,
to not duplicate SIDs (for users, at this stage), and to add the sambaSamAccount
onto the idmap entry for that user, if it is already established (ensuring
we do not duplicate sambaSid entries in the directory).

The allocated UID code has been expanded to take into account the space
between '1000 - algorithmic rid base'.  This much better fits into what
an NT4 does - allocating in the bottom part of the RID range.

On the code cleanup side of things, we now share as much code as
possible between idmap_ldap and pdb_ldap.

We also no longer use the race-prone 'enumerate all users' method for
finding the next RID to allocate.  Instead, we just start at the bottom
of the range, and increment again if the user already exists.  The first
time this is run, it may well take a long time, but next time will just
be able to use the next Rid.

Thanks to metze and AB for double-checking parts of this.

Andrew Bartlett
(This used to be commit 9c595c8c23)
2003-07-04 13:29:42 +00:00
Andrew Bartlett
eb61c82382 Patch to move functions directly from pdb_ldap.c into lib/smbldap.c
The functions are unchanged.  Next step is to make idmap_ldap use them.

Andrew Bartlett
(This used to be commit 57617a0f8c)
2003-06-25 12:51:58 +00:00
Andrew Bartlett
137265b806 Fix pdb_ldap segfaults, and wrong default values for ldapsam_compat.
Reviewed by vl, metze.

Andrew Bartlett
(This used to be commit 9804ad458a)
2003-06-24 14:23:34 +00:00
Simo Sorce
f5974dfaae Found out a good number of NT_STATUS_IS_ERR used the wrong way.
As abartlet rememberd me NT_STATUS_IS_ERR != !NT_STATUS_IS_OK

This patch will cure the problem.
Working on this one I found 16 functions where I think NT_STATUS_IS_ERR() is
used correctly, but I'm not 100% sure, coders should check the use of
NT_STATUS_IS_ERR() in samba is ok now.

Simo.
(This used to be commit c501e84d41)
2003-06-22 10:09:52 +00:00
Andrew Bartlett
f70cc4cdc1 This patch works towards to goal of common code shared between idmap_ldap
and pdb_ldap.

So far, it's just a function rename, so that the next patch can be a very
simple matter of copying functions, without worrying about what changed
in the process.

Also removes the 'static' pointers for the rebind procedures, replacing them
with a linked list of value/key lookups.  (Only needed on older LDAP client
libs)

Andrew Bartlett
(This used to be commit f93167a7e1)
2003-06-21 00:45:03 +00:00
Simo Sorce
75a5c0b307 Ok, this patch removes the privilege stuff we had in, unused, for some time.
The code was nice, but put in the wrong place (group mapping) and not
supported by most of the code, thus useless.

We will put back most of the code when our infrastructure will be changed
so that privileges actually really make sense to be set.

This is a first patch of a set to enhance all our mapping code cleaness and
stability towards a sane next beta for 3.0 code base

Simo.
(This used to be commit e341e7c49f)
2003-06-18 15:24:10 +00:00
Andrew Bartlett
ed9c090737 Try to fix memory leaks found by valgrind in pdb_ldap code.
Andrew Bartlett
(This used to be commit decadfcc82)
2003-06-07 03:22:37 +00:00
Gerald Carter
e485bc7e3e support LDAP_EXOP_MODIFY_PASSWORD (not experiemental in OpenLDAP 2.1)
(This used to be commit 50fdc93822)
2003-06-06 22:50:54 +00:00
Gerald Carter
711f8d0a13 * break out more common code used between pdb_ldap and idmap_ldap
* remove 'winbind uid' and 'winbind gid' parameters (replaced
  by current idmap parameter)
* create the sambaUnixIdPool entries automatically in the 'ldap
  idmap suffix'
* add new 'ldap idmap suffix' and 'ldap group suffix' parametrer
* "idmap backend = ldap" now accepts 'ldap:ldap://server/' format
  (parameters are passed to idmap init() function
(This used to be commit 1665926281)
2003-06-06 13:48:39 +00:00
Gerald Carter
3bdfd57a2d working draft of the idmap_ldap code.
Includes sambaUnixIdPool objectclass

Still needs cleaning up wrt to name space.
More changes to come, but at least we now have a
a working distributed winbindd solution.
(This used to be commit 8241758544)
2003-06-05 02:34:30 +00:00
Gerald Carter
1a6f9e5a86 cut-n-paste error
(This used to be commit eb567e803e)
2003-05-27 22:36:07 +00:00
Gerald Carter
52f92cf577 fix bug 118; replace hard coded 'next[User|Group]Rid' attribute names
(This used to be commit f7ebb3c9e5)
2003-05-27 16:55:53 +00:00
Gerald Carter
52ae1c4b2d fix bug #108; sambaSambaAccount string attributes are case insensitive; don't try to change a string that only differs in case
(This used to be commit 01ef083520)
2003-05-22 17:07:41 +00:00
Andrew Bartlett
90d24ee9a6 Well spotted typo by Marco Berger <MARCOB@voelcker.com>
Andrew Bartlett
(This used to be commit f16b0e025e)
2003-05-16 14:15:09 +00:00