1
0
mirror of https://github.com/samba-team/samba.git synced 2025-06-24 15:17:06 +03:00

874 Commits

Author SHA1 Message Date
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.
-
Jim McDonough
7b40f6c464 Start of merging HEAD changes. Right now, just move one fn() to eliminate
the prototype at the beginning, and change some comments so diffs to HEAD
aren't filled with useless info.
-
Gerald Carter
daee8d7fee updates for tdbsam code to help make merge into head easier; needs a bit more testing tomorrow but initial results seem ok -
Jeremy Allison
e914230a2d Don't set an iterator to a piece of free'd memory, store it first.
Jeremy.
-
Gerald Carter
8734d91cd7 fix set/getsampwent iterator in tdbsam to use an allocated list -
Volker Lendecke
6c78a096a5 And another build fix.
Volker
-
Volker Lendecke
38c9b775ce Fix the build & get rid of a compiler warning.
Volker
-
Andrew Bartlett
a4392ede33 When we set a domain sid, force get_global_sam_sid() to do it's work again.
This should ensure that the value it returns is always consistant.

Andrew Bartlett
-
Andrew Bartlett
01be89eb43 Add static, and assert that we will never overflow the static fstring
in pdb_encode_acct_ctrl()  (All current callers are fine)

Andrew Bartlett
-
Andrew Bartlett
fcdc5efb1e Make more functions static, and remove duplication in the use of functions
in lib/smbpasswd.c that were exact duplicates of functions in passdb/passdb.c

(These should perhaps be pulled back out to smbpasswd.c, but that can occour
later).

Andrew Bartlett
-
Gerald Carter
e62ef2ba2d move disabling code to context functions instead of backwards compatible wrappers -
Andrew Bartlett
7a36cc4ac0 Fix const warning -
Andrew Bartlett
ab7dd748a9 If we are setting the NT or LM password to NULL, remove the attribute
rather than writing XXXXX

Andrew Bartlett
-
Gerald Carter
52bf070b10 disable any account that doesn't have a password and doesn't had the ACB_PWNOTREQ bit set -
Gerald Carter
9e590d6035 more initialization fixes -