1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-24 21:34:56 +03:00
Commit Graph

925 Commits

Author SHA1 Message Date
Simo Sorce
ef942172b9 s3:auth check the user is valid first
It makes no sense to go through all the hoops to build samu and
convert it to info3, just to discard them later if the user was
not valid.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
2010-06-07 22:53:06 +10:00
Simo Sorce
1bb0afa662 s3:auth make sure we set the right username
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
2010-06-07 22:53:06 +10:00
Andreas Schneider
9097bdddd0 s3-auth: Moved smbd user functions to a generic place.
Reviewed-by: Simo Sorce <idra@samba.org>
2010-06-04 12:12:37 -04:00
Andrew Bartlett
a6e07c22a3 s3:auth Rename wksta_name -> workstation_name in auth_usersupplied_info 2010-06-01 17:11:25 +10:00
Simo Sorce
471ed70c49 s3:smbd map_username() doesn't need sconn anymore
Signed-off-by: Andreas Schneider <asn@samba.org>
2010-05-31 18:21:29 +02:00
Günther Deschner
3f24f8d2c6 s3-auth: add "system" bool flag to auth_serversupplied_info.
Guenther
2010-05-31 15:30:59 +02:00
Andrew Bartlett
d6fa371b92 s3:ntlmssp Use a TALLOC_CTX for ntlmssp_sign_packet() and ntlmssp_seal_packet()
This ensures the results can't be easily left to leak.

Andrew Bartlett

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Günther Deschner <gd@samba.org>
2010-05-31 15:11:27 +02:00
Andrew Bartlett
ebae21f023 ntlmssp: Make the ntlmssp.h from source3/ a common header
The code is not yet in common, but I hope to fix that soon.

Andrew Bartlett

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Günther Deschner <gd@samba.org>
2010-05-31 15:10:56 +02:00
Andrew Bartlett
723ea68d3b s3:auth Remove AUTH_NTLMSSP_STATE typedef.
typedefs are no longer preferred Samba style.

Andrew Bartlett

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Günther Deschner <gd@samba.org>
2010-05-31 15:10:44 +02:00
Andrew Bartlett
3b706865f6 s3:auth Make AUTH_NTLMSSP_STATE a private structure.
This makes it a little easier for it to writen in terms of GENSEC in future.

Andrew Bartlett

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Günther Deschner <gd@samba.org>
2010-05-31 15:10:33 +02:00
Simo Sorce
33c633df0b s3:auth make it easier to trace auth modules 2010-05-29 17:08:10 -04:00
Simo Sorce
bd38c0d47d s3:auth fix info3 duplication function 2010-05-29 17:08:02 -04:00
Andrew Bartlett
b455c5e155 s3:auth Fix segfault when the user cannot be found by getpwnam()
Add comment to notify when getpwnam() fails.

Reviewed-by: Simo Sorce <idra@samba.org>
2010-05-29 09:22:53 -04:00
Andreas Schneider
93ac516e15 s3-auth: Added a function to get the server_info from the system user.
Signed-off-by: Günther Deschner <gd@samba.org>
2010-05-28 14:31:39 +02:00
Günther Deschner
c5eeb0d155 s3-auth: fix c++ buildwarnings.
Guenther
2010-05-28 02:49:37 +02:00
Simo Sorce
20fb373202 s3:auth remove login_server from server info
It is not used anymore, we have that information in
info3->base.logon_server already
2010-05-27 19:41:07 -04:00
Simo Sorce
3bb819581b Fix Out of memory checks
Günther pushed an older version of the patch "s3:auth add function to copy a
netr_SamInfo3 structure" that was missing these fixes.
2010-05-27 19:23:54 -04:00
Simo Sorce
2a6a696e32 s3:auth add function to convert wbcAuthUserInfo to netr_SamInfo3
Signed-off-by: Günther Deschner <gd@samba.org>
2010-05-28 01:20:09 +02:00
Simo Sorce
606be25ecf s3:auth Free sampass as soon as we have server_info
We don't keep sampass in server_info anymore
So it makes no sense to keep it around.

Signed-off-by: Günther Deschner <gd@samba.org>
2010-05-28 00:56:02 +02:00
Simo Sorce
d9cffc01be s3:auth use info3 in auth_serversupplied_info
Signed-off-by: Günther Deschner <gd@samba.org>
2010-05-28 00:55:53 +02:00
Simo Sorce
6713f3d945 s3:auth add function to copy a netr_SamInfo3 structure
Signed-off-by: Günther Deschner <gd@samba.org>
2010-05-28 00:55:27 +02:00
Simo Sorce
605cfef56c s3:auth: add function to convert samu to netr_SamInfo3
Signed-off-by: Günther Deschner <gd@samba.org>
2010-05-28 00:55:17 +02:00
Roel van Meer
366333c08f Fix bug #7448 - smbd crash when sambaLMPassword and sambaNTPassword entries missing from ldap.
Protect SMBsesskeygen_ntv1() from a NULL pointer.
2010-05-21 14:17:17 -07:00
Andrew Bartlett
cba7f8b827 s3:dom_sid Global replace of DOM_SID with struct dom_sid
This matches the structure that new code is being written to,
and removes one more of the old-style named structures, and
the need to know that is is just an alias for struct dom_sid.

Andrew Bartlett

Signed-off-by: Günther Deschner <gd@samba.org>
2010-05-21 10:39:59 +02:00
Günther Deschner
5ed3654112 s3-rpc_client: move protos to cli_netlogon.h
Guenther
2010-05-18 21:42:37 +02:00
Günther Deschner
1d2dd47d31 s3-crypto: only include crypto headers when crypto is done.
Guenther
2010-05-18 00:44:27 +02:00
Günther Deschner
ca73e03eb7 security: merge builtin rid tables.
Guenther
2010-05-18 00:44:26 +02:00
Günther Deschner
3b529d50be s3-rpc_misc: clean out include/rpc_misc.h.
Well known rids don't really belong into an rpc header, just use the ones
defined in security.idl.

Guenther
2010-05-18 00:44:26 +02:00
Andrew Bartlett
468fb4fee4 s3:auth Make get_ntlm_challenge more like Samba4
This helps with the upcoming NTLMSSP merge, and allows errors to be returned.

Andrew Bartlett
2010-05-13 10:12:26 +10:00
Günther Deschner
c6ebab846d s3: only include gen_ndr headers where needed.
This shrinks include/includes.h.gch by the size of 7 MB and reduces build time
as follows:

ccache build w/o patch
real    4m21.529s
ccache build with patch
real    3m6.402s

pch build w/o patch
real    4m26.318s
pch build with patch
real    3m6.932s

Guenther
2010-05-06 00:22:59 +02:00
Volker Lendecke
b1a27e81d7 s3: Apply some const 2010-04-12 21:42:54 +02:00
Matthias Dieter Wallnöfer
1a27343366 s3/s4:netlogon IDL - fix up "struct netr_SamInfo6" regarding the "forest" attribute
According to MS-NRPC 2.2.1.4.13 this should be the DNS domainname, not the
forest one.
2010-04-12 18:49:01 +02:00
Volker Lendecke
8e95db9eea s3: Move serverinfo_to_SamInfoX to auth/server_info.c 2010-04-11 22:59:47 +02:00
Volker Lendecke
b8829e74fd s3: Move [make|free]_user_info to auth/user_info.c 2010-04-11 22:59:47 +02:00
Volker Lendecke
18909879cc s3: Move make_server_info_sam to auth/server_info_sam.c 2010-04-11 22:59:47 +02:00
Volker Lendecke
2b1a50c2e5 s3: Move sanitize_username to lib/util_str.c 2010-04-11 22:59:47 +02:00
Volker Lendecke
80708b75f8 s3: Move make_server_info to auth/server_info.c 2010-04-11 22:59:46 +02:00
Volker Lendecke
5792ccc7c8 s3: Move check_sam_security to auth/check_sam.c 2010-04-11 22:59:46 +02:00
Volker Lendecke
04f9e33de1 s3: Make check_sam_security public 2010-04-11 22:59:46 +02:00
Volker Lendecke
a0c175eca9 s3: Replace "auth_context" by "challenge" in need_to_increment_bad_pw_count args 2010-04-11 22:59:45 +02:00
Volker Lendecke
19c0086553 s3: Replace "auth_context" by "challenge" in sam_password_ok args 2010-04-11 22:59:45 +02:00
Volker Lendecke
7ba21a339c s3: Move user_in_group() and create_token_from_username() to token_utils.c
Goal is to be able to call check_sam_security from winbind
2010-04-11 22:59:45 +02:00
Volker Lendecke
b0d65f827e s3: Use talloc_stackframe() in user_in_group 2010-04-11 13:53:21 +02:00
Volker Lendecke
9655f63642 s3: Use talloc_stackframe() in user_in_group_sid 2010-04-11 13:53:21 +02:00
Volker Lendecke
9cf448a30e s3: Use talloc_stackframe() in create_token_from_username 2010-04-11 13:53:21 +02:00
Volker Lendecke
3c169c0475 s3: Fix a memleak in user_in_group_sid 2010-04-11 13:53:20 +02:00
Volker Lendecke
a2d1e5e0f7 s3: Remove the make_auth_methods routine
This was just TALLOC_ZERO_P
2010-04-11 13:53:19 +02:00
Volker Lendecke
bc619586f2 s3: Fix a typo 2010-04-11 13:53:19 +02:00
Volker Lendecke
c5c40f2648 s3: Make "auth_context" its own talloc parent
Remove "mem_ctx" from "struct auth_context"
2010-04-11 13:53:19 +02:00
Volker Lendecke
e35a2f89b2 s3: Fix some nonempty lines 2010-04-11 13:53:18 +02:00
Volker Lendecke
bfeab64ebf s3: Fix a typo 2010-04-09 16:49:49 +02:00
Stefan Metzmacher
dee63fe4ca s3:ntlmssp: use client.netbios_name instead of workstation
metze

Signed-off-by: Günther Deschner <gd@samba.org>
2010-03-24 17:34:56 +01:00
Stefan Metzmacher
ca2a5693bf s3:ntlmssp: rename void *auth_context; into void *callback_private;
metze

Signed-off-by: Günther Deschner <gd@samba.org>
2010-03-24 17:34:55 +01:00
Stefan Metzmacher
eb17809812 s3:ntlmssp: pass names to ntlmssp_server_start() and store them in ntlmssp_state
Inspired by the NTLMSSP merge work by Andrew Bartlett.

metze

Signed-off-by: Günther Deschner <gd@samba.org>
2010-03-24 17:34:54 +01:00
Stefan Metzmacher
eca118614c s3:ntlmssp: replace server_role by a server.is_standalone in ntlmssp_state
Inspired by the NTLMSSP merge work by Andrew Bartlett.

metze

Signed-off-by: Günther Deschner <gd@samba.org>
2010-03-24 17:34:54 +01:00
Jeremy Allison
12f97c0576 Fix valgrind error when running under share level security. plaintext_password
is a data blob with a data pointer pointing to an allocation of length zero.

Jeremy.
2010-03-22 13:05:29 -07:00
Volker Lendecke
48d6ed7cac s3: Fix some nonempty blank lines 2010-02-20 18:59:30 +01:00
Volker Lendecke
185815a647 s3: Remove some calls to memset -- reduces text size by some bytes for me 2010-01-24 14:52:33 +01:00
Michael Adam
8573471154 s3:auth: fix account unlock regression introduced with fix for bug #4347
By an oversight, the patchset for #4347 made the unlocking of a locked
account after the lockout duration ineffective.
Thanks to Björn for finding this!

Michael
2010-01-14 15:48:09 +01:00
Michael Adam
444ecac2d2 s3:auth: add comment to nulling out stolen sampass
Adding this comment makes me think, I could also
have changed make_server_info_sam() talloc_move
instead of talloc_steal, but that would have
changed the signature... Well the comment is a
first step. :-)

Michael
2010-01-12 16:19:56 +01:00
Volker Lendecke
3ea64e0ad8 s3: Replace most calls to sid_append_rid() by sid_compose() 2010-01-10 20:56:16 +01:00
Volker Lendecke
081573091b s3: Remove the typedef for "auth_serversupplied_info" 2010-01-10 20:56:16 +01:00
Volker Lendecke
9bb4766bba s3: Remove the typedef for "auth_usersupplied_info" 2010-01-10 20:56:16 +01:00
Michael Adam
dc68982711 s3:auth: don't update the bad pw count if pw is among last 2 history entries
This conforms to the behaviour of Windows 2003:
http://www.microsoft.com/technet/prodtechnol/windowsserver2003/technologies/security/bpactlck.mspx

This is supposed to fixes Bug #4347 .

Michael
2010-01-07 16:51:18 +01:00
Michael Adam
46111dc4e4 s3:auth:check_sam_security: introduce a bool var to control pad_pw_count incrementation
This is a preparatory patch for the last part in fixing bug #4347 .

Michael
2010-01-07 16:51:18 +01:00
Michael Adam
7248873b48 s3:auth:check_sam_security: improve calling and logging of pdb_update_sam_account
Log what went wrongl, and also call pdb_update_sam_account inside
become_root/unbecome_root: do the logging outside.

Michael
2010-01-07 11:07:57 +01:00
Michael Adam
5ad1b7e0c5 s3:auth:check_sam_security: fix a leading tab/ws mixup
Michael
2010-01-07 11:07:57 +01:00
Michael Adam
970317c413 s3:auth:check_sam_security: create (and use) a common exit point
for use after sam_password_ok() has been called.

Michael
2010-01-07 11:07:56 +01:00
Michael Adam
de4fb80bee s3:auth:check_sam_security: null out sampass after it has been stolen.
So that a later talloc_free would not harm. I could have used
talloc_move instead of talloc steal in make_server_info_sam(),
but this would have required a change of the signature.

Michael
2010-01-07 11:07:56 +01:00
Michael Adam
3634859450 s3:auth:sam_password_ok: take username, acct_ctrl and nt/lm hashes, not sampass
This is in preparation to extending check_sam_security to also check
against the password history before updating the bad password count.
This way, sam_password_ok can more easily be reused for that purpose.

Michael
2010-01-07 11:07:56 +01:00
Michael Adam
c0f404a2e4 s3:auth: use data_blob_null instead of data_blob(NULL, 0) in sam_password_ok()
This way it is more explicit that there is no allocated data here
that may leak.

Michael
2010-01-07 11:07:56 +01:00
Michael Adam
0172587d8d s3:auth:sam_password_ok: fix allocation of a data blob.
data_blob(mem_ctx, 16) does not use mem_ctx as a talloc ctx but
copies 16 bytes from mem_ctx into the newly allocated data blob.
This can not have been intentional. A blank uint8_t array of
length 16 is allocated by passing NULL instead of mem_ctx.
And using data_blob_talloc(mem_ctx, NULL, 16) adds the allocated
blank 16 byte array to mem_ctx - so this is what must have been
intended.

Michael
2010-01-07 11:07:56 +01:00
Michael Adam
7ac18c743b s3:auth:sam_password_ok: enhance readability (imho) by adding some pointers
and removing bool variables and several checks.

Michael
2010-01-07 11:07:55 +01:00
Michael Adam
b5fcb34d6c s3:check_sam_security: untangle assignment from statement
Michael
2010-01-07 11:07:55 +01:00
Stefan Metzmacher
c9b6ad2500 s3:ntlmssp: change get_challange() to return NTSTATUS
metze
2009-12-29 17:06:22 +01:00
Andrew Bartlett
802e9328ed s3:ntlmssp: only include ntlmssp.h where actually needed
Andrew Bartlett
2009-12-22 21:07:53 +01:00
Karolin Seeger
71018ebe53 s3:auth: Fix typo in debug message.
Karolin
2009-12-07 14:38:18 +01:00
Michael Adam
0ac3c1693c s3:fix a comment typo
Michael
2009-11-14 01:28:58 +01:00
Michael Adam
2e3d9abeaf s3:is_trusted_domain: shortcut if domain name == global_sam_name
A domain can't have a trust with itself.
This saves some roundtrips to the ldap server for ldapsam.

Michael
2009-11-14 01:28:57 +01:00
Michael Adam
144c23893e s3:is_trusted_domain: shortcut if domain name is NULL or empty
This saves some roundtrips to LDAP in an ldapsm setup.

Michael
2009-11-14 01:28:57 +01:00
Björn Jacke
ec49f28a52 s3/pam: move variable declaration into belonging ifdef section
This fixes a unused variable 'addr' warning on some platforms
2009-11-13 23:32:04 +01:00
Jeremy Allison
5363d6e62c Ensure all callers to the rpc_client/cli_pipe functions correctly
initialize return variables.
Jeremy.
2009-11-12 13:56:33 -08:00
Günther Deschner
463b1eb2b5 s3-passdb: cleanup some callers of pdb_get_trusteddom_pw().
Guenther
2009-11-03 22:10:31 +01:00
Günther Deschner
ebe0e64ba9 s3: use enum netr_SchannelType all over the place.
Guenther
2009-10-13 10:21:46 +02:00
Günther Deschner
799f8d7e13 schannel: fully share schannel sign/seal between s3 and 4.
Guenther
2009-09-16 01:55:06 +02:00
Günther Deschner
d3af0346c8 s3-dcerpc: use dcerpc_AuthLevel and remove duplicate set of flags.
Guenther
2009-09-15 17:49:34 +02:00
Günther Deschner
bea8e5fa60 s3-rpc_client: add dcerpc_transport_t to cli_rpc_pipe_open_schannel().
Guenther
2009-09-11 09:59:04 +02:00
Jeremy Allison
da9356711b Implement Metze's suggestion of trying getpwuid(0) then getpwnam(root).
Jeremy.
2009-08-22 09:40:58 -07:00
Jeremy Allison
47c7063dc6 Try and fix the buildfarm by using getpwnam(root) instead
of getpwuid(0) if DEVELOPER is defined. I'm hoping the
build farm defines DEVELOPER...
Jeremy.
2009-08-21 21:08:02 -07:00
Michael Adam
6afb02cb53 s3: fix bug #6650, authentication at member servers when winbindd is not running
Authentication of domain users on the member server fails when winbindd
is not running. This is because the is_trusted_domain() check  behaves
differently when winbindd is running and when it isn't:
Since wb_is_trusted_domain() calls wbcDomainInfo(), and this will also
give a result for our own domain, this succeeds for the member
server's own domain when winbindd is running. When winbindd is not
running, is_trusted_domain() checks (and possibly updates) the trustdom
cache, and this does the lsa_EnumTrustDom() rpc call to the DC which
does not return its own domain.

In case of winbindd not running, before 3.4, the domain part was _silently_
mapped to the workgroup in auth_util.c:make_user_info_map(),
which effectively did nothing in the member case.

But then the parameter "map untrusted to domain" was introduced
and the mapping was made to the workstation name instead of
the workgroup name by default unless "map untrusted to domain = yes".
(Commits
 d8c54fddda,
 5cd4b7b7c0, and
 fbca269239)
This was ok as long as winbindd was running, but with winbindd not running,
these changes actually uncovered the above logic bug in the check.

So the correct check is to treat the workgroup as trusted / or known
in the member case. This is most easily achieved by not comparing the
domain name against get_global_sam_name() which is the host name unless
for a DC but against my_sam_name() which is the workgroup for a DC and for
a member, too. (These names are not very intuitive...)

I admit that this is a very long commit message for a one-liner, but this has
needed some tracking down, and I think the change deserves some justification.

Michael
2009-08-21 12:41:31 -07:00
Jeremy Allison
8c347ed177 Fix bug #6647 - get_root_nt_token: getpwnam("root") failed!
Not all systems may have a "root" user, but all must have a passwd
entry for a uid of zero.
Jeremy.
2009-08-19 16:55:26 -07:00
Jeremy Allison
5d05d22999 Added prefer_ipv4 bool parameter to resolve_name().
W2K3 DC's can have IPv6 addresses but won't serve
krb5/ldap or cldap on those addresses. Make sure when
we're asking for DC's we prefer IPv4.
If you have an IPv6-only network this prioritizing code
will be a no-op. And if you have a mixed network then you
need to prioritize IPv4 due to W2K3 DC's.
Jeremy.
2009-07-28 11:51:58 -07:00
Jeremy Allison
9f0bdd4e17 Remove an unused talloc context.
Jeremy.
2009-07-16 18:12:17 -07:00
Jeremy Allison
74c405db40 Tidyup prompted by #6554 - Wrong deallocation in sam_account_ok.
Jeremy.
2009-07-16 09:54:14 -07:00
Stefan Metzmacher
75d03970b7 s3:smbd: move more session specific globals to struct smbd_server_connection
metze
2009-06-03 17:54:37 +02:00
Stefan Metzmacher
e16e7146b3 s3:smbd: move negprot related globals to struct smbd_server_connection
metze
2009-06-03 17:54:37 +02:00
Steven Danneman
fbca269239 s3/auth map NULL domains to our global sam name
This is an addendum to d8c54fdd, which made make_user_info_map() match
Windows behavior by mapping untrusted domains given to smbd on the wire
with the users credentials to smbd's global sam name.

This fix was being circumvented in the case where the client passed
a NULL domain.  Vista clients do this.  In that case smbd was always
remapping the name to the machine workgroup.  The NULL domain case
should also be mapped to the global sam name.

Removing the code in this patch, causes us to fall down to the logic
added in d8c54fdd and properly map the domain.
2009-05-28 13:21:15 -07:00
Dan Sledz
c71d4530b4 s3 auth: Make debug message louder and more useful 2009-05-12 17:13:40 -07:00
Jeremy Allison
b4c9cfb2af Fix a bunch of compiler warnings about wrong format types.
Should make Solaris 10 builds look cleaner.
Jeremy.
2009-05-11 21:56:57 -07:00
Günther Deschner
2d5e0eadb8 s3-auth: use full 16byte session key in make_user_info_netlogon_interactive().
Patch from Jeremy.

With this patch, I was able to join Windows 7 RC to a Samba3 DC, and login into a
Samba 3 Domain.

There are still two registry settings required:

        HKLM\System\CCS\Services\LanmanWorkstation\Parameters
	            DWORD  DomainCompatibilityMode = 1
		    DWORD  DNSNameResolutionRequired = 0

Do *not* modify the other netlogon registry parameters that were passed around,
they weaken security.

Guenther
(cherry picked from commit b5097d54cb)
2009-05-07 19:25:46 +02:00
Jeremy Allison
d47669684d Fix bug #6291 - force user stop working.
A previous fix broke the invariant that *uid is always
initialized on return from create_token_from_username().
Restore it.
Jeremy.
2009-04-28 11:07:51 -07:00
Andrew Bartlett
8ee7b4ce29 s3:auth Fix segfault: Always initialise returned session keys 2009-04-19 21:50:13 +02:00
Andrew Bartlett
baf7274fed Make Samba3 use the new common libcli/auth code
This is particuarly in the netlogon client (but not server at this
stage)
2009-04-14 16:23:44 +10:00
Andrew Bartlett
f28f113d8e Rework Samba3 to use new libcli/auth code (partial)
This commit is mostly to cope with the removal of SamOemHash (replaced
by arcfour_crypt()) and other collisions (such as changed function
arguments compared to Samba3).

We still provide creds_hash3 until Samba3 uses the credentials code in
netlogon server

Andrew Bartlett
2009-04-14 16:23:35 +10:00
Günther Deschner
01a942d8ab s3-auth: rename static smb_create_user(). Sorry...
Guenther
2009-04-01 21:44:14 +02:00
Steven Danneman
61bedb4263 s3: fix guest auth when winbindd is running
This fix is very subtle.  If a server is configured with "security = share"
and "guest ok = yes" and winbindd is running authorization will fail during
tree connect.

This is due to our inability to map the guest sid S-1-5-21-X-501 to a uid
through sid_to_uid().  Winbindd is unaware of the hard coded mapping
between this sid and whatever uid the name in lp_guestaccount() is assigned.
So sid_to_uid() fails and we exit create_token_from_username() without
ever calling pdb_getsampwsid() which IS aware of the hard coded mapping.

This patch just reorganizes the code, moving sid_to_uid() down to the
block of code in which it is needed, avoiding this early failure.
2009-02-26 19:47:43 -08:00
Tim Prouty
662f996b15 s3: Fix 'assignment differ in signedness' warning 2009-02-25 00:14:23 -08:00
Dan Sledz
aeab22b55c s3: Rename auth_onefs_wb and pdb_onefs_sam
auth_onefs_wb.c -> auth_wbc.c
pdb_onefs_sam.c -> pdb_wbc_sam.c

No changes to functionality
2009-02-24 16:08:06 -08:00
Tim Prouty
1ff9696306 Revert "s3 auth: Add parameter that forces every user through an NSS lookup"
After the discussion on samba-technical, it was decided that the best
answer for now was to revert this change.  The right way to do this is
to rewrite the token api to use opaque tokens with pluggable modules.

This reverts commit 8e19a28805.
2009-02-21 14:00:14 -08:00
Volker Lendecke
4a2e2c0c12 Fix the build on Solaris 2009-02-21 18:55:35 +01:00
Volker Lendecke
a3127ea9d7 Fix some nonempty blank lines 2009-02-21 14:04:16 +01:00
Volker Lendecke
4aed9abbf8 Remove the static "chal" from ntlmssp.c:get_challenge() 2009-02-21 14:04:14 +01:00
Dan Sledz
c383022f89 Introduce a new authentication backend auth_onefs_wb
This new backend is custom tailored to onefs' unique requirements:
1) No fallback logic
2) Does not validate the domain of the user
3) Handles unencrypted passwords
2009-02-20 19:39:07 -08:00
Zach Loafman
8e19a28805 s3 auth: Add parameter that forces every user through an NSS lookup
When set to yes, "force username map" forces every user, even AD
users, through an NSS lookup. This allows the token to be overridden
with information from NSS in certain broken environments.
2009-02-16 00:29:21 -08:00
Stefan Metzmacher
e7f7ed8bf6 s3:auth: only create_local_token() should add S-1-22-X-Y sids
metze
2009-02-13 10:40:37 +01:00
Stefan Metzmacher
f14e4d4e54 s3:auth: add S-1-22-X-Y sids to the local token
metze
2009-02-13 10:40:37 +01:00
Steven Danneman
5cd4b7b7c0 s3: Added new parameter "map untrusted to domain"
When enabled this reverts smbd to the legacy domain remapping behavior when
a user provides an untrusted domain

This partially reverts d8c54fdd
2009-02-12 13:55:44 -08:00
Dan Sledz
d8c54fddda s3: Change behavior when seeing an unknown domain.
After a lot of testing against various Windows servers (W2K, W2K3, W2K8),
within an AD domain it seems that unknown domains will only be translated
to the local account domain, not the netbios name of the member server's
domain.  This makes samba act more like Windows.
2009-02-11 19:39:18 -08:00
Dan Sledz
4e69f23857 Fix double free caused by incorrect talloc_steal usage. 2009-02-11 19:39:14 -08:00
todd stecher
9d4d2f70cb S3: Fixes for coverity issues. 2009-02-10 14:43:14 -08:00
Volker Lendecke
1cbc58d3be Fix some nonempty blank lines 2009-02-10 21:55:13 +01:00
Volker Lendecke
9b3cce096c Fix a valgrind error: rpc_bind talloc_move()s the auth struct 2009-02-04 18:11:46 +01:00
Volker Lendecke
8eb562a81d Ensure null termination of the password in mymachinepw, remove a debug 2009-02-04 18:11:46 +01:00
todd stecher
989ad44d32 Memory leaks and other fixes found by Coverity 2009-01-21 17:13:03 -08:00
Volker Lendecke
2bb1266796 Fix a typo 2009-01-21 11:21:00 +01:00
Volker Lendecke
d7d251f8c7 Fix some nonempty blank lines 2009-01-20 23:10:16 +01:00
Volker Lendecke
bb8ca0fdbf Make cli_negprot return NTSTATUS instead of bool 2008-12-19 10:28:30 +01:00
Jeremy Allison
15e1fd7c54 Fix bug #1254 - write list not working under share-level security
A somewhat more elegant fix than I could use for 3.2.x or 3.0.x.
Turns out the only part of check_user_ok() that needs to change
for share level security is the VUID cache pieces, so I can just
always use check_user_ok() for all lp_security() cases.
Jeremy
2008-12-04 11:20:57 -08:00
Volker Lendecke
3c98d5bd98 Make memcache_add_talloc NULL out the source pointer
This is an orthogonality measure to make clear this pointer now belongs to the
cache.
(cherry picked from commit e6080c6e87d6fe3995b121a772bf3f6343fa666f)
2008-11-14 20:27:46 +01:00
Jeremy Allison
8962be69c7 Make us clean under valgrind --leak-check=full by using talloc_autofree_context() instead of NULL.
Remove the code in memcache that does a TALLOC_FREE on stored pointers. That's a disaster waiting
to happen. If you're storing talloc'ed pointers, you can't know their lifecycle and they should
be deleted when their parent context is deleted, so freeing them at some arbitrary point later
will be a double-free.
Jeremy.
2008-11-06 20:48:13 -08:00
Jeremy Allison
8b4b5c3a92 Add wrapper str_list_make_v3() to replace the old S3 behavior of
str_list_make(). From Dan Sledz <dan.sledz@isilon.com>:
In samba 3.2 passing NULL or an empty string returned NULL.
In master, it now returns a list of length 1 with the first string set
to NULL (an empty list).
Jeremy.
2008-11-06 18:53:00 -08:00
Jelmer Vernooij
d6a5476ee7 Use sockaddr_storage only where we rely on the size, use sockaddr
otherwise (to clarify we can also pass in structs smaller than
sockaddr_storage, such as sockaddr_in).
2008-10-23 19:53:15 +02:00
Jelmer Vernooij
aa982895e5 Add data_blob_string_const_null() function that includes the terminating
null byte and use it in Samba 3.

This matches the behaviour prior to my data_blob changes.
2008-10-13 05:20:26 +02:00
Jelmer Vernooij
218f482fbf Use common strlist implementation in Samba 3 and Samba 4. 2008-10-12 00:56:56 +02:00
Jelmer Vernooij
cb78d4593b Cope with changed signature of http_timestring(). 2008-10-11 23:57:44 +02:00
Volker Lendecke
439086099a Add netlogond auth method
This authenticates against a local running samba4 using SamLogonEx. We retrieve
the machine password using samba4's mymachinepwd script and store the schannel
key for re-use in secrets.tdb.
2008-10-06 09:54:17 +02:00
Jeremy Allison
f6c883b4b0 Simply our main loop processing. A lot :-). Correctly use events for all the previous "special" cases.
A step on the way to adding signals to the events and being able to merge the S3 event system with
the S4 one.
Jeremy.
2008-10-03 14:18:35 -07:00
Simo Sorce
3fa16da8c7 Revert "Split lookup_name() and create a new functiong called"
This reverts commit 8594edf666.
(This used to be commit ad462e2e2d)
2008-09-03 14:36:43 -04:00
Simo Sorce
a1de4e988d Merge branch 'v3-devel' of ssh://git.samba.org/data/git/samba into v3-devel
(This used to be commit e038f1cf9f)
2008-08-26 18:56:49 -04:00
Günther Deschner
ab5076d9fd auth: Fix build warning.
Guenther
(This used to be commit 4661ef625a)
2008-08-25 11:36:56 +02:00
Simo Sorce
5e7655fa27 Split lookup_name() and create a new functiong called
lookup_domain_name(). This new function accept separated
strings for domain and name.
(This used to be commit 8594edf666)
2008-08-17 19:54:41 -04:00
Jeremy Allison
8bda4e059e Fix show-stopper for 3.2. Smbd depends on group SID
position zero being the primary group sid. Authenicating
via winbindd call returned a non-sorted sid list. This
fixes is for both a winbindd call and a pac list from
an info3 struct. Without this we mess up the
primary group associated with created files. Found by
Herb.
Jeremy.
(This used to be commit cb925dec85)
2008-08-14 21:52:11 -07:00
Jeremy Allison
9ab5cffcfa Make it clear that this is a temporary context byusing a talloc stackframe instead.
Jeremy
(This used to be commit 7f7dd5e888)
2008-08-14 14:36:02 -07:00
Tim Prouty
f18076cb32 Removed redundant logging from create_builtin_users and create_builtin_administrators
The Debug messages in create_builtin_users and create_builtin_users have now
been encapsulated in add_sid_to_builtin.
(This used to be commit ca153139b1)
2008-07-30 15:00:49 -07:00
Tim Prouty
097b27dbcc Enabled domain groups to be added to builtin groups at domain join time
Previously this was done at token creation time if the Administrators and Users
builtins hadn't been created yet.  A major drawback to this approach is that if
a customer is joined to a domain and decides they want to join a different
domain, the domain groups from this new domain will not be added to the
builtins.

It would be ideal if these groups could be added exclusively at domain join
time, but we can't rely solely on that because there are cases where winbindd
must be running to allocate new gids for the builtins.  In the future if there
is a way to allocate gids for builtins without running winbindd, this code
can be removed from create_local_nt_token.

- Made create_builtin_users and create_builtin_administrators non-static so
they can be called from libnet
- Added a new function to libnet_join that will make a best effort to add
domain administrators and domain users to BUILTIN\Administrators and
BUILTIN\Users, respectively.  If the builtins don't exist yet, winbindd must be
running to allocate new gids, but if the builtins already exist, the domain
groups will be added even if winbindd is not running.  In the case of a
failure the error will be logged, but the join will not be failed.
- Plumbed libnet_join_add_dom_rids_to_builtins into the join post processing.
(This used to be commit e92faf5996)
2008-07-30 14:06:36 -07:00
Tim Prouty
bbb02aa8e9 Refactored the code that adds Domain Admins to BUILTIN\Administrators to use the new helper functions.
- Modified create_builtin_administrators and add_builtin_administrators to take
in the domain sid to reduce the number of times it needs to be looked up.
- Changed create_builtin_administrators to call the new helper functions.
- Changed create_local_nt_token to call the new version of
create_builtin_administrators and handle the new error that can be returned.
- Made it more explicit that add_builtin_administrators is only called when
winbindd can't be pinged.
(This used to be commit f6411ccb4a)
2008-07-30 14:06:15 -07:00
Tim Prouty
fb41bb762f Refactored the code that adds Domain Users to BUILTIN\Users to use the new helper functions.
- Modified create_builtin_users to take in the domain sid to reduce the number
of times it needs to be looked up.
- Changed create_builtin_users to call the new helper functions.
- Changed create_local_nt_token to call the new version of create_builtin_users
and handle the new error that can be returned.
(This used to be commit 8d75d40b9f)
2008-07-30 14:06:00 -07:00
Tim Prouty
f738f9f7c9 Helper functions to enable domain groups to be added to builtin groups at domain join time
Added two new helper functions which wrap the raw pdb alias functions so they
can be more conveniently called while adding domain groups to builtin groups.
(This used to be commit 668ef31455)
2008-07-30 14:03:13 -07:00
Zach Loafman
06d0790c07 Fix various build warnings
This fixes various build warnings on our platform. I'm sure I haven't
caught them all, but it's a start.
(This used to be commit 6b73f259cb)
2008-07-22 15:00:48 +02:00
Volker Lendecke
99526d391d Refactoring: Change calling conventions for cli_rpc_pipe_open_schannel
Pass in ndr_syntax_id instead of pipe_idx, return NTSTATUS
(This used to be commit 1fcfca007f)
2008-07-20 17:37:14 +02:00
Volker Lendecke
1335da2a7c Refactoring: Change calling conventions for cli_rpc_pipe_open_noauth
Pass in ndr_syntax_id instead of pipe_idx, return NTSTATUS
(This used to be commit 9abc9dc4dc)
2008-07-20 17:37:11 +02:00
Jeremy Allison
799252f635 Fix the non-LDAP, non-krb5 build, fix gcc -O3 warnings.
Jeremy.
(This used to be commit 9e2ab30d3c)
2008-06-26 19:46:18 -07:00
Volker Lendecke
d331624fdf Add server_info to pipes_struct
(This used to be commit d621867bb8)
2008-06-26 13:13:22 +02:00
Jeremy Allison
da70f8ab1e Fix for bug #5551, smbd recursing back into winbindd from a winbindd call.
Jeremy.
(This used to be commit a07fe72538)
2008-06-24 18:01:59 -07:00
Jeremy Allison
ee6b168e6e Fix bug #5555. Don't return NT_STATUS_PASSWORD_MUST_CHANGE error on machine account logon.
Jeremy.
(This used to be commit 10da498a23)
2008-06-24 16:37:15 -07:00
Volker Lendecke
40f5eab5eb Wrap the unix token info in a unix_user_token in auth_serversupplied_info
No functional change, this is a preparation for more current_user ref removal
(This used to be commit dcaedf345e)
2008-06-19 18:51:37 +02:00
Volker Lendecke
4f0626ee09 Fix security=server, bug 5502
This has brown paper bag quality and is definitely needed for 3.2.0.

Thanks to Orion Poplawski for reporting this!

Volker
(This used to be commit 3b31f8cce3)
2008-05-30 11:46:34 +02:00
Volker Lendecke
87803073ec Make sure we have serversupplied_info->sanitized_username everywhere
(This used to be commit 88423a17b9)
2008-05-11 00:25:55 +02:00
Volker Lendecke
b446bb05d0 Add function make_serverinfo_from_username()
This will be used for 'security=share' and 'force user'
(This used to be commit 88e43097ca)
2008-05-10 11:17:00 +02:00
Volker Lendecke
0283e95a7c Add a mem_ctx argument to make_server_info_guest()
(This used to be commit e4a9492967)
2008-05-10 11:16:59 +02:00
Volker Lendecke
505205b1cb Make copy_serverinfo non-static, add mem_ctx
(This used to be commit a3651ced9e)
2008-05-10 11:16:59 +02:00
Volker Lendecke
64ddd381b7 Rename server_info->was_mapped to server_info->nss_token
"nss_token" from my point of view much better reflects what this flag actually
represents
(This used to be commit b121a5acb2)
2008-05-07 14:47:29 +02:00
Volker Lendecke
bec1dfab27 Remove "userdom_struct user" from "struct user_struct"
(This used to be commit 420de03523)
2008-05-05 18:28:59 +02:00
Volker Lendecke
a683625d7f Fix a typo
(This used to be commit 964bd02220)
2008-05-05 18:28:59 +02:00
Volker Lendecke
dd11f1d8a8 Remove unused set_current_user_guest()
(This used to be commit a33e8d2ffa)
2008-05-05 18:28:59 +02:00
Gerald W. Carter
d6aa45d29c BUG 5429: Clarify log msgs re: failure to create BUILTIN\{Administrators,Users}
Raise the debug msgs from Lvl 0 in the create_builtin_XX() functions
to prevent unnecessary panic from people reading the logs.
(This used to be commit 2983b9dc79)
2008-04-30 09:43:00 -05:00
Michael Adam
b64be89a6d auth: add SeDiskOperatorsPrivilege to get_root_nt_token to fix registry shares.
Michael
(This used to be commit 6bb107b17d)
2008-04-15 20:41:14 +02:00
Karolin Seeger
a8124367b4 Fix typos.
Karolin
(This used to be commit 6cee347035)
2008-04-09 16:14:04 +02:00
Günther Deschner
bea4541e11 Use sid_array_from_info3 in lookup_usergroups_cached().
Guenther
(This used to be commit 65b4cb20ea)
2008-04-04 02:53:40 +02:00
Günther Deschner
99d3590455 Fix NETLOGON credential chain with Windows 2008 all over the place.
In order to avoid receiving NT_STATUS_DOWNGRADE_DETECTED from a w2k8
netr_ServerAuthenticate2 reply, we need to start with the AD netlogon negotiate
flags everywhere (not only when running in security=ads). Only for NT4 we need
to do a downgrade to the returned negotiate flags.

Tested with w2k8, w2ksp4, w2k3r2 and nt4sp6.

Guenther
(This used to be commit 0970369ca0)
2008-04-02 11:12:47 +02:00
Günther Deschner
5b8591c05f Add debug statement in auth_winbind to display wbcAuthenticateUserEx error code.
Guenther
(This used to be commit 0ad00a452f)
2008-03-26 01:29:56 +01:00
Günther Deschner
e3731bd148 Fix crash bug in check_sam_security() when make_server_info_sam() did a
talloc_steal and talloc_free on the sam account already.

Guenther
(This used to be commit dbc7237a8a)
2008-03-20 00:54:20 +01:00
Volker Lendecke
6b2da4d2f4 Fix bug 5317
Thanks to oster@cs.usask.ca
(This used to be commit f18a805759)
2008-03-14 22:23:44 +01:00
Volker Lendecke
1ebfc66b2c Use a separate tdb for mutexes
Another preparation to convert secrets.c to dbwrap: The dbwrap API does not
provide a sane tdb_lock_with_timeout abstraction. In the clustered case the DC
mutex is needed per-node anyway, so it is perfectly fine to use a local mutex
only.
(This used to be commit f94a63cd8f)
2008-03-10 21:08:45 +01:00
Günther Deschner
23cd8e5ea7 Be more verbose why create local token has failed during
NTLMSSP and Kerberos session setup

Guenther
(This used to be commit 18b8c2c19e)
2008-03-06 12:27:11 +01:00
Günther Deschner
7dfeae6073 Use netr_SamInfo3 in remaining places.
Guenther
(This used to be commit 92fca97951)
2008-02-17 02:12:01 +01:00
Günther Deschner
c52dcc7b92 Use netr_SamInfo3 in make_server_info_info3().
Guenther
(This used to be commit 5866c11b28)
2008-02-17 02:11:59 +01:00
Jeremy Allison
4f1cc7b495 Allow auth_ntlmssp_end() to ignore null pointers passed in.
Jeremy.
(This used to be commit b7628f3a47)
2008-02-14 18:05:37 -08:00
Stefan Metzmacher
b397b5cb8f auth_winbind: use wbcAuthenticateUserEx()
smbd doesn't need $(WBCOMMON_OBJ) anymore,
it works with any libwbclient.so now
and may talk to an older winbindd.

metze
(This used to be commit e3435930a3)
2008-02-13 13:30:16 +01:00
Karolin Seeger
95eb2f2eba Fix typo.
Karolin
(This used to be commit 906e19bad4)
2008-02-05 16:23:09 +01:00
Volker Lendecke
2762b9a975 Always pass a TALLOC_CTX to str_list_make and str_list_copy
(This used to be commit e2c9fc4cf5)
2008-02-04 20:57:49 +01:00
Volker Lendecke
b47672656b tiny simplification
(This used to be commit 22e49ef2c0)
2008-02-04 19:41:04 +01:00
Andreas Schneider
691c4b1a41 Windows 2008 (Longhorn) auth2 flag fixes.
Interop fixes for AD specific flags. Original patch from Todd Stetcher.
(This used to be commit 5aadfcdaac)
2008-01-23 14:55:22 -08:00
Jeremy Allison
b47d491489 Fix CID 460 - resource leak on error.
Jeremy.
(This used to be commit d61831164b)
2008-01-08 18:48:04 -08:00
Michael Adam
f3603d5a5a Convert add_sid_to_array() add_sid_to_array_unique() to return NTSTATUS.
Michael
(This used to be commit 6b2b9a60ef)
2008-01-09 01:47:10 +01:00
Jeremy Allison
99e349b35d More logical operations on booleans. IBM checker.
Jeremy.
(This used to be commit e289a0c859)
2008-01-04 23:24:15 -08:00
Volker Lendecke
99bd615a80 Fix a panic
get_root_nt_token asks for "struct nt_user_token". talloc_get_type is not smart
enough to see that this is the same as NT_USER_TOKEN... :-)
(This used to be commit 22a98bf7b8)
2007-12-29 21:42:56 +01:00
Volker Lendecke
245537f9bd Convert get_root_nt_token to memcache
(This used to be commit fada689893)
2007-12-28 17:24:39 +01:00
Volker Lendecke
533d6f617e Remove static zeros
(This used to be commit dbcc213710)
2007-12-28 17:02:34 +01:00
James Peach
4dc0c1b88b Fix "may be used uninitialized" compiler warnings.
(This used to be commit 22ac34a329)
2007-12-22 14:10:06 -08:00
Gerald (Jerry) Carter
59ce7650f2 De-couple smbd from staticly linking against winbindd client files.
Implements a wrapper layer in winbind_util.c which are just stubs
if compiled --without-winbind.  When building with winbindd, it
is now required to build the libwbclient DSO first (in the Makefile)
and then either set LD_LIBRARY_PATH or /etc/ld.so.conf to pick up the
library PATH.
(This used to be commit 42787bccff)
2007-12-21 11:59:56 -06:00
Volker Lendecke
e518e19bc0 Remove Get_Pwnam and its associated static variable
All callers are replaced by Get_Pwnam_alloc
(This used to be commit 735f593154)
2007-12-19 21:09:10 +01:00
Jeremy Allison
5bfe3c49a1 Correctly define prototypes for accessor functions.
Jeremy.
(This used to be commit 299ea5d122)
2007-12-17 17:13:31 -08:00
Jeremy Allison
2b0a570c77 More static fstring removal.
Jeremy.
(This used to be commit dcf624aa02)
2007-12-17 17:02:48 -08:00
Michael Adam
3fa2183941 Reformat: Remove trailing spaces.
Michael
(This used to be commit 5249b3d204)
2007-12-17 13:25:49 +01:00
Michael Adam
720c65faed Fix flags in caller of lookup_name() in create_builtin_administrators().
Michael
(This used to be commit 46bfbf5c8a)
2007-12-17 13:06:09 +01:00
Jeremy Allison
26daf2b479 Remove another static string and static passwd.
Jeremy.
(This used to be commit 2a700c5a57)
2007-12-16 18:32:03 -08:00
Volker Lendecke
900288a2b8 Replace sid_string_static by sid_string_dbg in DEBUGs
(This used to be commit bb35e794ec)
2007-12-15 22:09:36 +01:00
Volker Lendecke
105635e23c Use sid_string_talloc where we have a tmp talloc ctx
(This used to be commit f00ab810d2)
2007-12-15 22:09:35 +01:00
Michael Adam
0d8146d5de Fix typo in debug statement.
Michael
(This used to be commit da23684261)
2007-12-13 14:38:05 +01:00