1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-21 01:59:07 +03:00

1088 Commits

Author SHA1 Message Date
Jeremy Allison
e2b0b9fb72 r2312: Fix for bugid #1667, smbpasswd file could be left locked on
some error exits.
Jeremy.
2007-10-10 10:52:39 -05:00
Volker Lendecke
67d8bc4853 r1906: Revert lukeh's change for primary uid/gid change. This creates a recursion
loop between uid_to_sid -> getsampwnam -> uid_to_sid. It needs further
inspection.

Volker
2007-10-10 10:52:23 -05:00
Jeremy Allison
dae084d713 r1871: Patch from Luke Howard <lukeh@PADL.COM> to correctly use
uid_to_sid() and gid_to_sid() in pdb_set_sam_sids().
Jeremy.
2007-10-10 10:52:22 -05:00
Jeremy Allison
f44b4ba381 r1869: Rename "fallback_XXXX" mapping to "algorithmic_XXX" as
that's what it actually does, and "fallback_" is just
confusing.
Jeremy.
2007-10-10 10:52:22 -05:00
Jeremy Allison
dac72638fb r1810: Patch from Richard Renard <rrenard@idealx.com> to store
logon hours attributes in an LDAP database.
Jeremy.
2007-10-10 10:52:21 -05:00
Jeremy Allison
a1bb6fbbe4 r1733: Fix hashed password history for LDAP backends.
Jeremy.
2007-10-10 10:52:20 -05:00
Jeremy Allison
82e4036aaa r1661: Changed the password history format so that each history entry
consists of a 16 byte salt, followed by the 16 byte MD5 hash of
the concatination of the salt plus the NThash of the historical
password. Allows these to be exposed in LDAP without security issues.
Jeremy.
2007-10-10 10:52:17 -05:00
Jeremy Allison
4fd619d7e1 r1610: Patch from Richard Renard <rrenard@idealx.com>. Ensure we
save the password as it is being changed into the password
history list.
Jeremy.
2007-10-10 10:52:16 -05:00
Jeremy Allison
14bd2a9ffc r1539: If a account was locked out by an admin (and has a bad password count of zero)
leave it locked out until an admin unlocks it (but log a message).
Jeremy.
2007-10-10 10:52:14 -05:00
Andrew Bartlett
36741d3cf5 r1492: Rework our random number generation system.
On systems with /dev/urandom, this avoids a change to secrets.tdb for every fork().

For other systems, we now only re-seed after a fork, and on startup.
No need to do it per-operation.  This removes the 'need_reseed'
parameter from generate_random_buffer().

Andrew Bartlett
2007-10-10 10:52:13 -05:00
Jeremy Allison
8ee6060977 r1412: Fix password history list in tdbsam. Fix some memory leaks. Add
my (C) to a header file that was at least 50% mine :-).
Jeremy.
2007-10-10 10:52:10 -05:00
Jeremy Allison
9ac4945012 r1394: Const fix.
Jeremy.
2007-10-10 10:52:10 -05:00
Jeremy Allison
ac846420d0 r1392: Added password history code to tdbsam backend. Not yet tested (ie. may
core dump) but compiles and links correctly. I will run the full set of
tests on the ldap sam and the tdb sam for password history tomorrow.
Jeremy.
2007-10-10 10:52:09 -05:00
Jeremy Allison
dd54b2a3c4 r1388: Adding password history code for ldap backend, based on a patch from
"Jianliang Lu" <j.lu@tiesse.com>. Multi-string attribute changed to
linearised pstring due to ordering issues. A few other changes to
fix race conditions. I will add the tdb backend code next. This code
compiles but has not yet been tested with password history policy
set to greater than zero. Targeted for 3.0.6.
Jeremy.
2007-10-10 10:52:09 -05:00
Volker Lendecke
c0bf8425f4 r1108: Index: pdb_ldap.c
===================================================================
--- pdb_ldap.c	(revision 1095)
+++ pdb_ldap.c	(working copy)
@@ -1134,6 +1134,19 @@
 	return NT_STATUS_OK;
 }

+static void append_attr(char ***attr_list, const char *new_attr)
+{
+	int i;
+
+	for (i=0; (*attr_list)[i] != NULL; i++)
+		;
+
+	(*attr_list) = Realloc((*attr_list), sizeof(**attr_list) * (i+2));
+	SMB_ASSERT((*attr_list) != NULL);
+	(*attr_list)[i] = strdup(new_attr);
+	(*attr_list)[i+1] = NULL;
+}
+
 /**********************************************************************
 Get SAM_ACCOUNT entry from LDAP by username.
 *********************************************************************/
@@ -1149,6 +1162,7 @@
 	int rc;

 	attr_list = get_userattr_list( ldap_state->schema_ver );
+	append_attr(&attr_list, MODIFY_TIMESTAMP_STRING);
 	rc = ldapsam_search_suffix_by_name(ldap_state, sname, &result, attr_list);
 	free_attr_list( attr_list );

@@ -1194,6 +1208,7 @@
 	switch ( ldap_state->schema_ver ) {
 		case SCHEMAVER_SAMBASAMACCOUNT:
 			attr_list = get_userattr_list(ldap_state->schema_ver);
+			append_attr(&attr_list, MODIFY_TIMESTAMP_STRING);
 			rc = ldapsam_search_suffix_by_sid(ldap_state, sid, result, attr_list);
 			free_attr_list( attr_list );

Index: login_cache.c
===================================================================
--- login_cache.c	(revision 1095)
+++ login_cache.c	(working copy)
@@ -95,10 +95,13 @@
 			&entry->bad_password_count,
 			&entry->bad_password_time) == -1) {
 		DEBUG(7, ("No cache entry found\n"));
+		SAFE_FREE(entry);
 		SAFE_FREE(databuf.dptr);
 		return NULL;
 	}

+	SAFE_FREE(databuf.dptr);
+
 	DEBUG(5, ("Found login cache entry: timestamp %12u, flags 0x%x, count %d, time %12u\n",
 		  (unsigned int)entry->entry_timestamp, entry->acct_ctrl,
 		  entry->bad_password_count, (unsigned int)entry->bad_password_time));
2007-10-10 10:51:55 -05:00
Volker Lendecke
5070c1b68f r989: Calling sid_to_gid from within winbind makes no sense, as this calls
winbind_sid_to_gid. For the consistency check, local_sid_to_gid must set the
name_type it found.

Volker
2007-10-10 10:51:52 -05:00
Andrew Bartlett
d626b5c6d4 r936: Fix a rather weird error that crippled my site, when we upgraded to
Samba 3.0.4.

If we fail a query for the members of the 'administrators' group (and we may well just have the IDL wrong), this destroys later parts of the domain logon process.

For reasons I can't understand, the client-side 'heck, what happened'
bailout causes the connection to the DC to be dropped, and causes the
mandetory profile not to be loaded.  (This also only occours after a reboot)

Return the members of 'administrators', and it all works fine.

The reason we hit this is because we run winbindd (to support
pam_winbind) on our DC, and the winbindd lookup in sid_to_gid was
messing things up.  As we don't care what type of thing this is,
provided it exists in the group mapping db, we should not bother
winbindd here.

Andrew Bartlett
2007-10-10 10:51:50 -05:00
Jeremy Allison
455ed258b3 r910: Fix for bug #1385 found by Jason Mader <jason@ncac.gwu.edu>.
Don't use non-consts in a structure initialization.
Jeremy.
2007-10-10 10:51:48 -05:00
Jeremy Allison
d97b9146a1 r801: Fix from "Jianliang Lu" <j.lu@tiesse.com> to return correct group
types.
Jeremy.
2007-10-10 10:51:46 -05:00
Jeremy Allison
538b66f4e9 r788: Inspired by patch from "Jianliang Lu" <j.lu@tiesse.com>. Correct
sid type is WKN_GROUP, not alias. Added some more known types.
Jeremy.
2007-10-10 10:51:38 -05:00
Richard Sharpe
5d7ee320cc r505: Break out algorithmic_gid_to_sid so that those of us who need it can use it. 2007-10-10 10:51:26 -05:00
Richard Sharpe
b1825184d3 r501: Fix a small cut-n-pasteo ... 2007-10-10 10:51:26 -05:00
Stefan Metzmacher
908d8a4125 r340: fix a segfault in the login_cache code...
metze
2007-10-10 10:51:20 -05:00
Volker Lendecke
f35e353454 r316: Fix split_domain_name. This defaulted to get_myname() instead of
get_global_sam_name().

Error case: Adding a domain user to a XP local group did a lsalookupname on
the user without domain prefix, and this then failed.

Jerry: This is a must-fix before 3.0.3.

Volker
2007-10-10 10:51:18 -05:00
Gerald Carter
911a28361b r196: merging struct uuid from trunk 2007-10-10 10:51:13 -05:00
Volker Lendecke
6e18bed170 r145: pdb_create_alias now returns NTSTATUS. More of this to follow.
Volker
2007-10-10 10:51:11 -05:00
Gerald Carter
b393469d95 r116: volker's patch for local group and group nesting 2007-10-10 10:51:10 -05:00
Jim McDonough
5ebcb9081e 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.
2007-10-10 10:51:06 -05:00
Jeremy Allison
85d9c92fd5 r48: Fix types for debug message parameters.
Jeremy.
2007-10-10 10:51:05 -05:00
Gerald Carter
a7e2730ec4 r39: * importing .cvsignore files
* updateing WHATSNEW with vl's change
2007-10-10 10:51:05 -05:00
Volker Lendecke
aa220cffa7 Apply some const -
Volker Lendecke
2b757b6adf Remove some unused code -
Jim McDonough
bc13e35db0 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>
-
Jeremy Allison
00fa66df3e Fix gcc warnings. Fix mkproto with new type.
Jeremy.
-
Jim McDonough
2a679cbc87 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.
-
Jim McDonough
d275c0e384 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).
-
Volker Lendecke
7ed61edbbe Get us a little closer to Windows LSA semantics.
A windows DC does not reply to DCNAME\\Administrator, only to
DOMAIN\\Administrator. Fix that.

Without winbind we are wrong as domain members, we should forward the request
DOMAIN\\Username to the DC on behalf of the asking client. Winbind fixes that
nicely.

Volker
-
Volker Lendecke
f6bb3304fc And another little const -
Andrew Bartlett
191b43159e Fix bug in previous global_sam_sid() commit. I broke the 'read from
MACHINE.SID' file functionality.

Also, before we print out the results of 'net getlocalsid' and 'net
getdomainsid', ensure we have tried to read that file, or have
generated one.

Andrew Bartlett
-
Andrew Bartlett
86ad04d26d 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
-
Andrew Bartlett
9ffc490fce Found by Fabien Chevalier <fabien.chevalier@supelec.fr> and
JustFillBug <mozbugbox@yahoo.com.au> on the Samba lists - a 'max
password age' of zero should be considered as 'never expire'.

For the timebeing we just set it like -1, but we might revisit this
for closer-to-ms behaviour.

Andrew Bartlett
-
Jim McDonough
84fe24e64e handle both 0 and -1 as disabling reset count and lockout duration -
Jim McDonough
9a79f9fbcb Clean up bad pw count and autolock flag update fn()s -
Jim McDonough
600fcd534b Add bad pw count and autolock flag update fn()s -
Jim McDonough
557f598c63 Add functions to get/set bad password time -
Jim McDonough
730c07cac2 Move tdbsam versioning/upgrade code into 3.0 -
Jim McDonough
b7706f7e25 Try to remove the last vestiges of unknown_3...
Jelmer, can you look at the sql and xml backends please to verify?
-
Gerald Carter
cfe80f0df7 abartlet's pdb_set/changed flag fix for NULL passwords -
Gerald Carter
ee8f142b87 stupid cut-n=paste error; my fault -
Jim McDonough
1976843345 More sync between passdb on 3.0 and HEAD.
Replace unknown_3 with fields_present.  Also causes rpc_samr structure field changes.
-