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

1292 Commits

Author SHA1 Message Date
Andrew Bartlett
98992b5b4e s3-auth: Only allow LM_KEY cryptography when extra options are set
This crypto is incredibly poor, and can technically be enabled on an otherwise more
secure connection that uses NTLM for the actual authentication leg.  Therefore
disable it by default.

Andrew Bartlett

Signed-off-by: Stefan Metzmacher <metze@samba.org>
2012-02-17 10:48:09 +01:00
Andrew Bartlett
82e3098e84 s3-auth: Inline ntlmssp_server_start() into gensec_ntlmssp3_server_start()
This will help syncing this rotuine up with gensec_ntlmssp_server_start().

Andrew Bartlett

Signed-off-by: Stefan Metzmacher <metze@samba.org>
2012-02-17 10:48:09 +01:00
Andrew Bartlett
9b147ce26d s3-auth Use the common gensec_ntlmssp_update in gensec_ntlmssp3_server
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2012-02-17 10:48:09 +01:00
Andrew Bartlett
9c5b26f864 s3-auth: Use common gensec_ntlmssp server functions for more of gensec_ntlmssp3_server
This is possible because we now supply the auth4_context abstraction that this
code is looking for.

Andrew Bartlett

Signed-off-by: Stefan Metzmacher <metze@samba.org>
2012-02-17 10:48:09 +01:00
Andrew Bartlett
2f74f2f180 s3-auth: Add extra error messages on authentication or authorization failure
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2012-02-17 10:48:09 +01:00
Andrew Bartlett
8adde1b46b s3-auth Hook checking passwords and generating session_info via the auth4_context
This avoids creating a second auth_context, as it is a private pointer
in the auth4_context that has already been passed in, and makes the
gensec_ntlmssp code agnostic to the type of authentication backend
behind it. This will in turn allow the ntlmssp server code to be
further merged.

Andrew Bartlett

Signed-off-by: Stefan Metzmacher <metze@samba.org>
2012-02-17 10:48:09 +01:00
Christopher R. Hertel (crh)
b5b204184a Rename obscure defined constants.
Replaced the undescriptive SMB_PORT1 and SMB_PORT2 defined constants
with the slightly more descriptive names NBT_SMB_PORT and TCP_SMB_PORT.
Also replaced several hard-coded references to the well-known port
numbers (139 and 445, respectively) as appropriate.

Small changes to clarify some comments regarding the two transport
types.

Signed-off-by: Simo Sorce <idra@samba.org>

Autobuild-User: Simo Sorce <idra@samba.org>
Autobuild-Date: Thu Feb 16 08:29:41 CET 2012 on sn-devel-104
2012-02-16 08:29:41 +01:00
Sumit Bose
0f22e35028 s3-auth: On successful user mapping set mapped_to_guest to false.
Autobuild-User: Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date: Mon Feb 13 13:09:10 CET 2012 on sn-devel-104
2012-02-13 13:09:10 +01:00
Andrew Bartlett
89cd086561 s3-auth Add const to make_user_info_map 2012-02-08 16:30:14 +11:00
Stefan Metzmacher
dab7b0e717 s3:auth: fill the sids array of the info3 in wbcAuthUserInfo_to_netr_SamInfo3() (bug #8739)
Originally, only the rid array was filled and foreign domain sids were omitted.

Pair-Programmed-With: Michael Adam <obnox@samba.org>

metze

Autobuild-User: Stefan Metzmacher <metze@samba.org>
Autobuild-Date: Thu Feb  2 12:59:32 CET 2012 on sn-devel-104
2012-02-02 12:59:32 +01:00
Stefan Metzmacher
adbab7710d s3:auth: fix potential gap creation in wbcsids_to_samr_RidWithAttributeArray()
Pair-Programmed-With: Michael Adam <obnox@samba.org>

metze
2012-02-02 11:25:08 +01:00
Stefan Metzmacher
ab364e9874 s3:auth/auth_generic: make use of gensec_spnego in the server
metze
2012-01-31 20:17:09 +01:00
Andrew Bartlett
959d13ac20 s3-auth: Remove duplicate check for NT_STATUS_IS_OK(nt_status)
Autobuild-User: Andrew Bartlett <abartlet@samba.org>
Autobuild-Date: Mon Jan 30 09:38:47 CET 2012 on sn-devel-104
2012-01-30 09:38:46 +01:00
Andrew Bartlett
a647df4607 auth: Make check_password and generate_session_info hook generic
gensec_ntlmssp does not need to know the internal form of the
struct user_info_dc or auth_serversupplied_info.  This will allow the
calling logic to be put in common.

Andrew Bartlett
2012-01-30 08:05:14 +01:00
Simo Sorce
e6c39a292c s3-pdb: Break SECRETS3 dependency on PDB.
This is causing circular depdnendcies that bring libpdb in all code and this is
BAD.

This change 'protects' the sid and guid of the domain by adding a special key
that makes them effectively read only.

Limit this temporarily to the samba 4 build, once it gets some good testing the
samba4 ifdefs can be dropped.

fix pdb dependencies

Signed-off-by: Andreas Schneider <asn@samba.org>
2012-01-27 18:11:10 +01:00
Stefan Metzmacher
633a28b276 s3:auth/auth_generic: for now call sub_set_smb_name() and lp_load()
This matches the auth_ntlmssp case and the smbd/sesssetup.c code.

metze

Autobuild-User: Stefan Metzmacher <metze@samba.org>
Autobuild-Date: Thu Jan 26 17:58:17 CET 2012 on sn-devel-104
2012-01-26 17:58:17 +01:00
Andrew Bartlett
67279780dd s3-gensec: Add hook to allow gensec to know if kerberos is permitted
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2012-01-18 16:23:25 +01:00
Andrew Bartlett
e012ad9d8b s3-librpc Call GSSAPI via the auth_generic layer and gensec
This simplifies a lot of code, as we know we are always dealing with a
struct gensec_security, and allows the gensec module being used to
implement GSSAPI to be swapped when required for AD-server operation.

Andrew Bartlett

Signed-off-by: Stefan Metzmacher <metze@samba.org>
2012-01-18 16:23:22 +01:00
Andrew Bartlett
43092ccf26 s3-auth Match session setup handling of krb5, store the PAC
This will allow non-krb5 services to get the full user groups
without need to do an online s4u2self.

Andrew Bartlett

Signed-off-by: Stefan Metzmacher <metze@samba.org>
2012-01-18 16:23:21 +01:00
Andrew Bartlett
f8c9ae3615 s3-auth Add auth hook for PAC parsing
This will allow gensec_gse to parse the PAC.

This is a copy from source3/rpc_server/dcesrv_generic.c to preserve
behaviour.  A future commit will enable the samlogon cache.

Andrew Bartlett

Signed-off-by: Stefan Metzmacher <metze@samba.org>
2012-01-18 16:23:21 +01:00
Andreas Schneider
103c1cb9bf s3-waf: auth_netlogond depends on tldap.
Autobuild-User: Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date: Thu Jan 12 17:33:10 CET 2012 on sn-devel-104
2012-01-12 17:33:10 +01:00
Andrew Bartlett
a074a5d5fa s3-auth Remove more unused headers
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2012-01-05 17:17:29 +01:00
Andrew Bartlett
6abb880519 s3-auth remove unused ntlmssp.h
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2012-01-05 17:17:29 +01:00
Andrew Bartlett
16e463e169 s3-auth Remove ntlmssp_wrap.h which is no longer required
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2012-01-05 17:17:28 +01:00
Andrew Bartlett
3042e38d51 s3-auth use gensec directly rather than via auth_generic_state
This is possible because the s3 gensec modules are started as
normal gensec modules, so we do not need a wrapper any more.

Andrew Bartlett

Signed-off-by: Stefan Metzmacher <metze@samba.org>
2012-01-05 17:17:28 +01:00
Andrew Bartlett
0c0c23f3fe s3-auth Set remote address for both AD and s3 gensec modes 2012-01-05 17:17:28 +01:00
Andrew Bartlett
e22b1b4f9e s3-auth re-create the auth context in the s3 ntlmssp server module
This removes the abstraction violation in auth_generic.c.

Andrew Bartlett

Signed-off-by: Stefan Metzmacher <metze@samba.org>
2012-01-05 17:17:28 +01:00
Andrew Bartlett
1075efabc7 s3-auth Add TALLOC_CTX * to auth_generic_prepare()
This makes the long term owner of this memory more clear.  So far only the
clear cases have been moved from NULL however.

Andrew Bartlett

Signed-off-by: Stefan Metzmacher <metze@samba.org>
2012-01-05 17:17:28 +01:00
Andrew Bartlett
c579b735d6 s3-auth supply s3 ntlmssp module via gensec_settings
This will allow the supply of multiple modules in future
without duplicating the module selection logic.

Andrew Bartlett

Signed-off-by: Stefan Metzmacher <metze@samba.org>
2012-01-05 17:17:28 +01:00
Andrew Bartlett
e387721bc5 s3-auth Fix talloc parent for s4 event context in auth_samba4 2011-12-28 22:39:19 +11:00
Andrew Bartlett
d76abd1c45 s3-auth: Remove protype for already-removed auth_ntlmssp_start 2011-12-28 22:39:19 +11:00
Andrew Bartlett
5e038432f7 s3-auth split the auth_generic functions into a seperate file
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2011-12-22 19:25:11 +01:00
Andrew Bartlett
c17131685c s3-auth remove auth_ntlmssp_start(), call auth_generic_start() directly
This makes it clear that this can support more than just NTLMSSP.

Andrew Bartlett

Signed-off-by: Stefan Metzmacher <metze@samba.org>
2011-12-22 19:25:10 +01:00
Andrew Bartlett
1100f6eca5 s3-auth rename auth_ntlmssp_prepare() -> auth_generic_prepare()
This function handles more than NTLMSSP now, at least when we are an AD DC
and so changing the name may avoid some confusion in the future.

Andrew Bartlett

Signed-off-by: Stefan Metzmacher <metze@samba.org>
2011-12-22 19:25:10 +01:00
Andrew Bartlett
6391fff9da s3-auth rename auth_ntlmssp_state -> auth_generic_state
This structure handles more than NTLMSSP now, at least when we are an AD DC
and so changing the name may avoid some confusion in the future.

Andrew Bartlett

Signed-off-by: Stefan Metzmacher <metze@samba.org>
2011-12-22 19:25:10 +01:00
Andrew Bartlett
e34989eeb2 s3-auth Restore shortcut for guest security token
This was lost when the server_info and session_info structures were split.

This helps avoid doing lookups for the guest account to determine the
uid/gid and SID values.

Andrew Bartlett

Signed-off-by: Stefan Metzmacher <metze@samba.org>

Autobuild-User: Stefan Metzmacher <metze@samba.org>
Autobuild-Date: Thu Dec 22 15:51:09 CET 2011 on sn-devel-104
2011-12-22 15:51:09 +01:00
Stefan Metzmacher
2202c3ce02 s3:auth: s/Undefined/SMB_SIGNING_DEFAULT/
metze
2011-11-03 16:55:12 +01:00
Günther Deschner
1c72d3b513 s3-waf: convert libcli_netlogon3 into a private library.
Guenther

Autobuild-User: Günther Deschner <gd@samba.org>
Autobuild-Date: Wed Nov  2 18:34:55 CET 2011 on sn-devel-104
2011-11-02 18:34:54 +01:00
Günther Deschner
54f7667f49 s3-waf: move trusts_util.c code into a private library.
Guenther
2011-11-02 16:59:32 +01:00
Simo Sorce
8870daeb8d idl: Improve MS-PAC IDL
Change some misleading variable names to reflect the actual function.
Add missing field name/types previously marked as unkown.

Signed-off-by: Günther Deschner <gd@samba.org>

Autobuild-User: Günther Deschner <gd@samba.org>
Autobuild-Date: Mon Oct 24 19:19:28 CEST 2011 on sn-devel-104
2011-10-24 19:19:28 +02:00
Andrew Bartlett
915fe7981b s3-auth remove auth_ntlmssp_session_info()
Instead, call gensec_session_info() directly.

Andrew Bartlett

Signed-off-by: Stefan Metzmacher <metze@samba.org>
2011-10-21 08:43:02 +02:00
Andrew Bartlett
94799db9b5 s3-auth move the s3 auth context onto gensec_ntlmssp once we start
We do not need it on the auth_ntlmssp_state any longer.

Andrew Bartlett

Autobuild-User: Andrew Bartlett <abartlet@samba.org>
Autobuild-Date: Tue Oct 18 13:54:36 CEST 2011 on sn-devel-104
2011-10-18 13:54:36 +02:00
Stefan Metzmacher
94fbe2e4bd s3:auth_util: add the uid with WBC_ID_TYPE_BOTH also to the group array
This will help with having "sidHistory" support in future.

metze
2011-10-18 13:13:33 +11:00
Andrew Bartlett
e7d5f0a357 gensec: move event context from gensec_*_init() to gensec_update()
This avoids keeping the event context around on a the gensec_security
context structure long term.

In the Samba3 server, the event context we either supply is a NULL
pointer as no server-side modules currently use the event context.

Andrew Bartlett

Signed-off-by: Stefan Metzmacher <metze@samba.org>
2011-10-18 13:13:33 +11:00
Andrew Bartlett
5392491f77 s3-ntlmssp Implement the server-side auth_ntlmssp code as a GENSEC module
This uses the top level gensec_ntlmssp helper functions which are identical
to the parts of ntlmssp_wrap.c that are now not called.

(Includes formatting and correctness fixes from Metze)

Andrew Bartlett

Signed-off-by: Stefan Metzmacher <metze@samba.org>
2011-10-18 13:13:32 +11:00
Andrew Bartlett
0c6e4adcb2 ntlmssp: Move ntlmssp code to auth/ntlmssp
This brings in the code from both libcli/auth and
source4/auth/ntlmssp.

Andrew Bartlett

Signed-off-by: Stefan Metzmacher <metze@samba.org>
2011-10-18 13:13:31 +11:00
Andrew Bartlett
d4d4f4e07f s3-auth Add my copyright
I have done plenty of work here, I deserve some of the blame :-)

Andrew Bartlett
2011-10-18 13:13:30 +11:00
Wilco Baan Hofman
c52b571506 Fix uninitialized memory problem in group_sids_to_info3 (fixes bug #8455).
Autobuild-User: Jeremy Allison <jra@samba.org>
Autobuild-Date: Mon Oct 17 23:32:58 CEST 2011 on sn-devel-104
2011-10-17 23:32:58 +02:00
Günther Deschner
234f06eae1 s3-auth: remove dead prototype.
Guenther
2011-10-17 15:56:08 +02:00
Günther Deschner
06aec034ae s3-auth: token_util needs system/passwd.h.
Guenther
2011-10-14 12:07:23 +02:00
Andrew Bartlett
3cdb1fe440 s4-messaging: Pass the loadparm context, not just the messaging path
This will allow the TDB layer to get at the lp_ctx for tdb options.

Andrew Bartlett
2011-10-13 14:06:07 +02:00
Andrew Bartlett
561d834123 auth: move credentials layer to the top level
This will allow gensec_start.c to move to the top level.  This does not change
what code uses the cli_credentials code, but allows the gensec code to be
more broadly.

Andrew Bartlett
2011-10-11 13:41:36 +11:00
Andrew Tridgell
f236c539ad s3-winbindd: add support for idmap type WBC_ID_TYPE_BOTH
this allows the s3 code to understand and cache responses from the s4
winbindd which may include a single SID mapped to both a uid and a gid

Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>

Signed-off-by: Michael Adam <obnox@samba.org>

Autobuild-User: Michael Adam <obnox@samba.org>
Autobuild-Date: Fri Sep 23 01:47:54 CEST 2011 on sn-devel-104
2011-09-23 01:47:54 +02:00
Matthias Dieter Wallnöfer
50310ad75d s4:auth - remove unused variables
Reviewed-by: Jelmer
2011-09-19 16:31:07 +02:00
Volker Lendecke
3dcec44f3e s3: Fix bug 8455 -- Samba PDC is looking up only primary user group
group_sids_to_info3 does a sid_peek_check_rid on the domain sid before adding
the rids to the array. If the domain sid is 0x0, then the check will always
fail.

Autobuild-User: Volker Lendecke <vlendec@samba.org>
Autobuild-Date: Sat Sep 17 00:51:27 CEST 2011 on sn-devel-104
2011-09-17 00:51:27 +02:00
Stefan Metzmacher
935eb48877 s3:auth_server: make use of cli_state_server_challenge()
metze
2011-09-15 12:12:28 +02:00
Stefan Metzmacher
3f00cce9b3 s3:libsmb: pass max_protocol to cli_negprot()
metze
2011-09-15 10:25:17 +02:00
Stefan Metzmacher
9a855dd5d9 s3:auth_server: make use of cli_state_security_mode()
metze
2011-09-13 18:12:23 +02:00
Jeremy Allison
fad5e3be5e Move the talloc_move call until *after* the check on status. Don't want to move something that might be invalid.
Makes the code match what is currently in 3.6.x.

Autobuild-User: Jeremy Allison <jra@samba.org>
Autobuild-Date: Mon Sep 12 22:21:24 CEST 2011 on sn-devel-104
2011-09-12 22:21:24 +02:00
Sumit Bose
81b965af89 s3-auth: fix uninitialized server_info
Signed-off-by: Günther Deschner <gd@samba.org>

Autobuild-User: Günther Deschner <gd@samba.org>
Autobuild-Date: Mon Sep 12 17:44:46 CEST 2011 on sn-devel-104
2011-09-12 17:44:46 +02:00
Stefan Metzmacher
3e227d8544 s3:libsmb: pass CLI_FULL_CONNECTION_* flags via cli_connect_nb()
metze

Autobuild-User: Stefan Metzmacher <metze@samba.org>
Autobuild-Date: Thu Sep  8 10:21:50 CEST 2011 on sn-devel-104
2011-09-08 10:21:50 +02:00
Andrew Bartlett
1dbdddf223 s3-ntlmssp Remove a level of nesting in if/else statement 2011-08-03 18:48:05 +10:00
Andrew Bartlett
7b1d6a6a05 selftest: test plugin_s4_dc against all ncacn_np tests
Changes to the s3 epmapper behaviour seem to have fixed the rest of these
tests.

Andrew Bartlett
2011-08-03 18:48:05 +10:00
Andrew Bartlett
7c4eb9e32e s3-ntlmssp clarify session key behaviour after create_local_token() changes 2011-08-03 18:48:05 +10:00
Andrew Bartlett
3f0b5d05b5 s3-ntlmssp Remove auth_ntlmssp_state_destructor, use the talloc tree instead 2011-08-03 18:48:05 +10:00
Andrew Bartlett
8131dd9df3 s3-auth directly return the result of make_server_info_guest() 2011-08-03 18:48:05 +10:00
Andrew Bartlett
8fca9741fe s3-auth rename auth_ntlmssp_steal_session_info()
There is no longer any theft of memory as the underlying routines now
produce a new auth_session_info for this caller, allocating it
on the supplied memory context.

Andrew Bartlett
2011-08-03 18:48:05 +10:00
Andrew Bartlett
9f663270fd s3-auth Add function to start any GENSEC mech by OID
Signed-off-by: Andrew Tridgell <tridge@samba.org>
2011-08-03 18:48:04 +10:00
Andrew Bartlett
1aced1e989 s3-auth remove sanitized_username from auth_serversupplied_info
This structure element was only written to, not read.

It is filled into the companion structure, auth_session_info()
by create_local_token().

Andrew Bartlett

Signed-off-by: Andrew Tridgell <tridge@samba.org>
2011-08-03 18:48:04 +10:00
Andrew Bartlett
9a45bf3952 s3-auth set session_info->sanitized_username in create_local_token()
Rather than passing this value around the callers, and eventually
setting it in register_existing_vuid(), we simply pass it to
create_local_token().  This also removes the need for
auth_ntlmssp_get_username().

Andrew Bartlett

Signed-off-by: Andrew Tridgell <tridge@samba.org>
2011-08-03 18:48:04 +10:00
Andrew Bartlett
8b983d2326 s3-ntlmssp Split auth_ntlmssp_start into two functions
This helps map on to the GENSEC semantics better, and ensures that the
full set of desired features are set before the mechanism starts.

Andrew Bartlett

Signed-off-by: Andrew Tridgell <tridge@samba.org>
2011-08-03 18:48:04 +10:00
Andrew Bartlett
902df83680 s3-ntlmssp Split calls to gensec plugin into prepare and start
GENSEC has the concept of starting the GENSEC subsystem before starting the
actual mechansim.  Between these two stages is when most context methods
are called, to specify credentials and features.

Andrew Bartlett

Signed-off-by: Andrew Tridgell <tridge@samba.org>
2011-08-03 18:48:04 +10:00
Andrew Bartlett
63cb8059db s3-auth Add hook to start a GENSEC mech to auth_samba4
Signed-off-by: Andrew Tridgell <tridge@samba.org>
2011-08-03 18:48:03 +10:00
Andrew Bartlett
d69843c908 s3-ntlmssp Add hooks to optionally call into GENSEC in auth_ntlmssp
This allows the current behaviour of the NTLMSSP code to be unchanged
while adding a way to hook in an alternate implementation via an auth
module.

Andrew Bartlett

Signed-off-by: Andrew Tridgell <tridge@samba.org>
2011-08-03 18:48:03 +10:00
Andrew Bartlett
6bcaba6f8a s3-auth Allow auth modules to provide an initialised GENSEC context
This will allow auth plugins such as auth_samba4 to provide an initialised
GENSEC context to auth subsystem callers.

Andrew Bartlett

Signed-off-by: Andrew Tridgell <tridge@samba.org>
2011-08-03 18:48:02 +10:00
Andrew Bartlett
c9bde9ae75 s3-auth Use else if in do_map_to_guest_server_info
This means we can't ever call make_server_info_guest() twice.

Andrew Bartlett

Signed-off-by: Andrew Tridgell <tridge@samba.org>
2011-08-03 18:48:02 +10:00
Andrew Bartlett
8a650243b3 s3-auth Move map to guest to directly after the check_password calls
This means we no longer need two different map to guest functions
and have consistent logic with fewer layering violations.

Andrew Bartlett

Signed-off-by: Andrew Tridgell <tridge@samba.org>
2011-08-03 18:48:02 +10:00
Stefan Metzmacher
ec9b6134b7 s3:auth_server: make use of cli_state_protocol()
metze
2011-08-02 04:54:29 +02:00
Jeremy Allison
1832c95910 Fix bug 8314] - smbd crash with unknown user.
All other auth modules code with being called with
auth_method->private_data being NULL, make the auth_server
module cope with this too.

Autobuild-User: Jeremy Allison <jra@samba.org>
Autobuild-Date: Sat Jul 23 02:55:01 CEST 2011 on sn-devel-104
2011-07-23 02:55:01 +02:00
Stefan Metzmacher
ab9d99cece s3:auth_server: make use of cli_state_remote_name()
metze
2011-07-22 17:06:09 +02:00
Stefan Metzmacher
823ce6f50f s3:auth_domain: we already have the dc_name, it's the same as cli->desthost
metze
2011-07-22 17:06:09 +02:00
Stefan Metzmacher
b76951ba8f s3:auth_domain: add some const to sockaddr_storage
metze
2011-07-22 17:06:08 +02:00
Jeremy Allison
fafd386910 Fix const warning.
Autobuild-User: Jeremy Allison <jra@samba.org>
Autobuild-Date: Fri Jul 22 01:58:39 CEST 2011 on sn-devel-104
2011-07-22 01:58:39 +02:00
Andrew Bartlett
57ab47c02e s3-auth fix dummy function in the not-with-kerberos case 2011-07-20 11:40:02 +10:00
Andrew Bartlett
d8cce7d466 s3-auth Replace False with false in auth_util.c
Autobuild-User: Andrew Bartlett <abartlet@samba.org>
Autobuild-Date: Wed Jul 20 02:31:15 CEST 2011 on sn-devel-104
2011-07-20 02:31:15 +02:00
Andrew Bartlett
c2ce806790 s3-auth Replace True with true in auth_util.c 2011-07-20 09:17:15 +10:00
Andrew Bartlett
bdd794cd62 s3-auth Fix spelling 2011-07-20 09:17:15 +10:00
Andrew Bartlett
d2a661a531 s3-auth Remove pointless destructor in make_server_info
All the callers allocate ->info3 as a talloc child already.

As regardes the TALLOC_ZERO(), I added this originally out of parinoia
many years ago.  We do not consistantly zero session keys in memory,
and for NTLMv2 and Kerberos they are random for each sesssion, so
breaking into smbd far enough to read an old session key isn't a
particularly interesting attack, compared with (say) reading the
keytab or the password database.  (NTLM and LM session keys are fixed
derivitives of the passwords however).

Andrew Bartlett
2011-07-20 09:17:15 +10:00
Andrew Bartlett
15123d96ff s3-auth inline make_auth_session_info into only caller 2011-07-20 09:17:15 +10:00
Andrew Bartlett
6622821063 s3-auth Remove seperate guest boolean
Instead, we base our guest calculations on the presence or absense of the
authenticated users group in the token, ensuring that we have only
one canonical source of this important piece of authorization data

Andrew Bartlett

Signed-off-by: Andrew Tridgell <tridge@samba.org>
2011-07-20 09:17:14 +10:00
Andrew Bartlett
9d09b66f41 auth: Set NETLOGON_GUEST and use it to determine guest status
These additional measures should help ensure we do not accidentily upgrade
a guest to an authenticated user in the future.

Andrew Bartlett

Signed-off-by: Andrew Tridgell <tridge@samba.org>
2011-07-20 09:17:14 +10:00
Andrew Bartlett
52b28ec813 auth: Split out make_user_info_SamBaseInfo and add authenticated argument
This will allow the source3 auth code to call this without needing to
double-parse the SIDs

Andrew Bartlett

Signed-off-by: Andrew Tridgell <tridge@samba.org>
2011-07-20 09:17:14 +10:00
Andrew Bartlett
9fcc617ff5 s3-auth Use the common auth_session_info
This patch finally has the same structure being used to describe the
authorization data of a user across the whole codebase.

This will allow of our session handling to be accomplished with common code.

Andrew Bartlett

Signed-off-by: Andrew Tridgell <tridge@samba.org>
2011-07-20 09:17:13 +10:00
Andrew Bartlett
128ae06a61 s3-auth use auth_user_info not netr_SamInfo3 in auth3_session_info
This makes auth3_session_info identical to auth_session_info

The logic to convert the info3 to a struct auth_user_info is
essentially moved up the stack from the named pipe proxy in
source3/rpc_server to create_local_token().

Andrew Bartlett

Signed-off-by: Andrew Tridgell <tridge@samba.org>
2011-07-20 09:17:13 +10:00
Andrew Bartlett
594597eb65 s3-auth reimplement copy_session_info via NDR pull/push
This ensures we do not miss elements.  Pattern copied from auth_netlogond.

Andrew Bartlett

Signed-off-by: Andrew Tridgell <tridge@samba.org>
2011-07-20 09:17:13 +10:00
Andrew Bartlett
9d96b78f31 s3-auth Remove pointless destructor
All the users of this structure allocate info3 on the session_info

Andrew Bartlett

Signed-off-by: Andrew Tridgell <tridge@samba.org>
2011-07-20 09:17:13 +10:00
Andrew Bartlett
86f2a197df s3-auth Avoid redundant copies in create_local_token()
These values were not read before being overwritten again.

Andrew Bartlett

Signed-off-by: Andrew Tridgell <tridge@samba.org>
2011-07-20 09:17:12 +10:00
Andrew Bartlett
4363b71f62 s3-auth Add comments to copy_session_info_serverinfo_guest()
Signed-off-by: Andrew Tridgell <tridge@samba.org>
2011-07-20 09:17:12 +10:00
Andrew Bartlett
74815e08d9 s3-auth inline copy_serverinfo_session_info into only caller
Signed-off-by: Andrew Tridgell <tridge@samba.org>
2011-07-20 09:17:12 +10:00
Andrew Bartlett
140435f399 s3-auth use a cached auth_serversupplied_info in make_server_info_guest()
Signed-off-by: Andrew Tridgell <tridge@samba.org>
2011-07-20 09:17:12 +10:00
Andrew Bartlett
fc19c699a9 s3-auth remove extra from auth3_session_info
Signed-off-by: Andrew Tridgell <tridge@samba.org>
2011-07-20 09:17:12 +10:00
Andrew Bartlett
894fc14a2e s3-auth Clarify inputs and ouptuts by using elements from server_info
This allows us not the put all of these elements into the auth3_session_info
if they are only used as inputs to these functions.

Andrew Bartlett

Signed-off-by: Andrew Tridgell <tridge@samba.org>
2011-07-20 09:17:12 +10:00
Andrew Bartlett
d22ff66afa s3-auth assert that security_token is present in the copy, and explain why nss_token can be skipped
Signed-off-by: Andrew Tridgell <tridge@samba.org>
2011-07-20 09:17:11 +10:00
Andrew Bartlett
eea444f465 s3-auth: Remove unused lm_session_key from auth3_session_info
The long term authorization state needs only the final, negotiated
session key, and not the original LM key that may possibly have been
an input.

The special case of the guest account simply needs both values filled
back in with the zeros to avoid changing behaviour in the cached
server_info.

Signed-off-by: Andrew Tridgell <tridge@samba.org>
2011-07-20 09:17:11 +10:00
Andrew Bartlett
058f5e60c5 s3-auth remove unused copy_serverinfo
Signed-off-by: Andrew Tridgell <tridge@samba.org>
2011-07-20 09:17:11 +10:00
Andrew Bartlett
ec5f1b78af s3-auth Use system boolean in auth_user_info_unix
Signed-off-by: Andrew Tridgell <tridge@samba.org>
2011-07-20 09:17:11 +10:00
Andrew Bartlett
e2049e77e4 s3-auth Use guest boolean in auth_user_info_unix
Signed-off-by: Andrew Tridgell <tridge@samba.org>
2011-07-20 09:17:11 +10:00
Andrew Bartlett
9289537993 s3-auth Use struct auth_user_info_unix for unix_name and sanitized_username
This is closer to the layout of struct auth_session_info in auth.idl

Andrew Bartlett

Signed-off-by: Andrew Tridgell <tridge@samba.org>
2011-07-20 09:17:11 +10:00
Andrew Bartlett
6d741e918f s3-auth Use *unix_token rather than utok in struct auth3_session_info
This brings this structure one step closer to the struct auth_session_info.

A few SMB_ASSERT calls are added in some key places to ensure that
this pointer is initialised, to make tracing any bugs here easier in
future.

NOTE: Many of the users of this structure should be reviewed, as unix
and NT access checks are mixed in a way that should just be done using
the NT ACL.  This patch has not changed this behaviour however.

Andrew Bartlett

Signed-off-by: Andrew Tridgell <tridge@samba.org>
2011-07-20 09:17:10 +10:00
Andrew Bartlett
f16d8f4eb8 s3-auth Use struct auth3_session_info outside the auth subsystem
This seperation between the structure used inside the auth modules and
in the wider codebase allows for a gradual migration from struct
auth_serversupplied_info -> struct auth_session_info (from auth.idl)

The idea here is that we keep a clear seperation between the structure
before and after the local groups, local user lookup and the session
key modifications have been processed, as the lack of this seperation
has caused issues in the past.

Andrew Bartlett

Signed-off-by: Andrew Tridgell <tridge@samba.org>
2011-07-20 09:17:10 +10:00
Andrew Bartlett
d7d8a5ed94 s3-auth Add struct auth3_session_info to aid transition to auth_session info
This will allow a gradual conversion of the required elements from the
current struct auth_serversupplied_info.

This commit adds the structure definition and some helper functions to
copy between the two structures.

At this stage these structures and functions are IDENTICAL to the
existing code, and so show the past history of that code.  The plan is
to slowly modify them over the course of the patch series, so that the
changes being made a clear.

By using a seperate structure to auth_serversupplied_info we can
remove elements that are not needed after the authentication, and we
can choose a layout that best reflects the needs of runtime users,
rather than the internals of the authentication subsystem.

By eventually using the auth_session_info from auth.idl, we will gain
a single session authorization structure across the whole codebase,
allowing more code to be shared, and a much more transparent process
for forwarding authorization credentials over the named pipe proxy.

Andrew Bartlett

Signed-off-by: Andrew Tridgell <tridge@samba.org>
2011-07-20 09:17:10 +10:00
Andrew Bartlett
e244319599 s3-auth Add const to indicate input elements
Signed-off-by: Andrew Tridgell <tridge@samba.org>
2011-07-20 09:17:10 +10:00
Andrew Bartlett
fa18267042 auth: Preserve guest flag on transition via netr_SamInfo3
Signed-off-by: Andrew Tridgell <tridge@samba.org>
2011-07-20 09:17:10 +10:00
Andrew Bartlett
f47662f363 s3-auth Restore nss_token behaviour by reading from server_info
The implementation of copy_serverinfo(), used to copy server_info into
session_info never copied the nss_token variable, and so
17d8f0ad30 introduced this regression.

Andrew Bartlett

Signed-off-by: Andrew Tridgell <tridge@samba.org>
2011-07-20 09:17:10 +10:00
Andrew Bartlett
55ad1da888 Add my copyright
Signed-off-by: Andrew Tridgell <tridge@samba.org>
2011-07-20 09:17:09 +10:00
Jeremy Allison
ee34c25c8a First part of fix for bug 8310 - toupper_ascii() is broken on big-endian systems
Remove
int toupper_ascii(int c);
int tolower_ascii(int c);
int isupper_ascii(int c);
int islower_ascii(int c);

and replace with their _m equivalents, as they are identical.
2011-07-19 13:19:29 -07:00
Andreas Schneider
f97bdebbbe s3-auth: Fix account check over ncalrpc. 2011-07-13 14:09:35 +02:00
Stefan Metzmacher
1f50d04a5c s3:auth_server: use cli_echo() to check if the server is alive
This works over port 139 and also 445. send_keepalive() would
only work on port 139.

metze
2011-07-11 18:18:28 +02:00
Stefan Metzmacher
8c29afe14e s3:auth_server: make use of cli_state_is_connected()
metze
2011-07-11 18:18:28 +02:00
Stefan Metzmacher
a7b9c628af s3:auth_server: use cli->is_guestlogin instead of parsing cli->inbuf.
cli->inbuf is not the valid response buffer of the session setup response.

metze
2011-07-08 14:09:07 +02:00
Stefan Metzmacher
ce751946dd s3:auth: remove unused variable
metze
2011-07-08 14:09:06 +02:00
Stefan Metzmacher
f0085eedf0 s3:auth_unix: remove unused var
metze
2011-07-08 13:51:46 +02:00
Andrew Bartlett
6b97a3b1ff s3-build allow_undefined_symbols=False is the default now 2011-07-04 19:03:52 +10:00
Andrew Bartlett
5d4b197418 s3-auth libauth no longer requires undefined symbols 2011-07-04 18:58:32 +10:00
Andreas Schneider
66badc1740 s3-auth: Remove global smbd_server_conn from auth_unix.c.
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
2011-07-04 18:28:04 +10:00
Andreas Schneider
7e46a84bb7 s3-auth: Pass the remote_address down to user_info.
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
2011-07-04 18:28:02 +10:00
Andreas Schneider
45f70db010 s3-auth: Added remote_address to ntlmssp server.
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
2011-07-04 18:28:00 +10:00
Andreas Schneider
6b86590342 s3-auth: Only reload the config file.
We only need to reload the config file. This removes a dependency to
smbd.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
2011-07-04 18:27:53 +10:00
Volker Lendecke
d2b1671fb3 s3: Remove a use of cli_errstr
All code above that might have failed sets result
2011-07-03 11:31:29 +02:00
Andrew Bartlett
a3c9dd3d48 s3-build Prepare to require fully defined modules
This specifies some more deps for our modules, and ensures that the
subsystem that it links against is in fact a library, which will avoid
issues with introducing duplicate symbols.

Andrew Bartlett
2011-07-03 09:20:02 +02:00
Andrew Bartlett
5db74b9607 lib/util Remove samba-util-common!
All of this code is now in common, so we don't need the second
'-common' library any more!

Andrew Bartlett
2011-06-21 09:36:22 +10:00
Volker Lendecke
68a8c58d12 s3: Add debug level 0 warnings to make_new_server_info_guest
I've got a backtrace where this must have failed, but it is not clear why. If
this fails, we should really complain because we can't start up.

Autobuild-User: Volker Lendecke <vlendec@samba.org>
Autobuild-Date: Wed Jun 15 15:20:49 CEST 2011 on sn-devel-104
2011-06-15 15:20:49 +02:00
Volker Lendecke
51567de6d7 s3: Fix the return of make_new_server_info_guest 2011-06-15 14:11:05 +02:00
Andrew Bartlett
74eed8f3ed s3-param Remove special case for global_myname(), rename to lp_netbios_name()
There is no reason this can't be a normal constant string in the
loadparm system, now that we have lp_set_cmdline() to handle overrides
correctly.

Andrew Bartlett
2011-06-09 12:40:09 +02:00
Andrew Bartlett
8d4a8389bb s3-talloc Change TALLOC_MEMDUP() to talloc_memdup()
Using the standard macro makes it easier to move code into common, as
TALLOC_MEMDUP isn't standard talloc.
2011-06-09 12:40:08 +02:00
Andrew Bartlett
ad0a07c531 s3-talloc Change TALLOC_ZERO_P() to talloc_zero()
Using the standard macro makes it easier to move code into common, as
TALLOC_ZERO_P isn't standard talloc.
2011-06-09 12:40:08 +02:00
Andrew Bartlett
3d15137653 s3-talloc Change TALLOC_ARRAY() to talloc_array()
Using the standard macro makes it easier to move code into common, as
TALLOC_ARRAY isn't standard talloc.
2011-06-09 12:40:08 +02:00
Matthias Dieter Wallnöfer
530d1e33f7 s3:auth/auth_samba4.c - remove unused variable
Reviewed-by: Tridge
2011-06-09 09:35:29 +02:00
Andrew Bartlett
a8d1d0c94c s3-auth Use loadparm_init_s3() to get an lp_ctx for auth_samba4
This avoids loading the smb.conf twice.

Andrew Bartlett
2011-06-07 09:11:01 +10:00
Michael Adam
9cc1410718 s3:auth/proto.h: add _AUTH_PROTO_H_ guard 2011-05-31 01:44:27 +02:00
Michael Adam
1b7077204d s3:auth/proto.h: add GPL/Copyright header 2011-05-31 01:44:27 +02:00
Andrew Bartlett
4e374d1679 s3-build: Move user_util.c into it's own subsystem 2011-05-31 00:32:07 +02:00
Volker Lendecke
0969c3398e s3: Use the correct guest_login field in auth_server
Autobuild-User: Volker Lendecke <vlendec@samba.org>
Autobuild-Date: Sun May 29 13:57:21 CEST 2011 on sn-devel-104
2011-05-29 13:57:21 +02:00
Volker Lendecke
8c1bb9b210 s3: Use cli_connect_nb in auth_server 2011-05-29 12:49:34 +02:00
Volker Lendecke
c05802f5a0 s3: Fix a type-punned warning 2011-05-29 12:49:34 +02:00
Volker Lendecke
a036dcd8f0 s3: Check password server loop earlier
We do that in the loop for the ip address anyway
2011-05-29 12:49:33 +02:00
Sean Finney
0f8018676a Fix numerous missing dependencies in WAF build scripts
With the recent consolidation of code between s3 and s4, a number of new
dependencies have been implicitly introduced.  For example, previous s3
code gained an implicit dependency on talloc after the charset related
consolidation (lib/util/charset/charset.h now includes talloc.h).  When
building against the embedded version of talloc this isn't a problem
since the paths are automatically added to the search path, but when
building against the external libraries build failures will occur for
all components that don't directly or indirectly include talloc as
a dependency.

Since charset.h is included from util.h, which in turn is included from
includes.h, this means most of the codebase (s3 and s4) has such an
undeclared dependency.

Therefore, samba-util-common and samba-util have been added as
dependencies to the s3 and s4 code respectively, for all cases where
the source would otherwise fail to build.  Additionally, a few other
dependencies are added in specific wscript_build files to address
similar dependency-related problems.

https://bugzilla.samba.org/show_bug.cgi?id=8128

Signed-off-by: Sean Finney <seanius@seanius.net>
Signed-off-by: Matthias Dieter Wallnöfer <mdw@samba.org>
Signed-off-by: Andrew Bartlett <abartlet@samba.org>

Autobuild-User: Matthias Dieter Wallnöfer <mdw@samba.org>
Autobuild-Date: Wed May 25 19:22:13 CEST 2011 on sn-devel-104
2011-05-25 19:22:13 +02:00
Andrew Bartlett
d17367bd68 build: Add depenencies needed by Samba3 subsystems 2011-05-18 16:12:08 +02:00
Andrew Bartlett
f52c6eeacc s3-auth Add auth_samba4 module
This module makes a direct call into the Samba4 auth stack to
authenticate Samba4 uses in a Samba3 file server.  The direct call
avoids the need to obtain schannel credentials.

Andrew Bartlett

Pair-Programmed-With: Andrew Tridgell <tridge@samba.org>
2011-05-08 19:00:28 +02:00
Günther Deschner
27022587e3 s3-libsmb: move protos to libsmb/proto.h
Guenther
2011-05-06 16:37:18 +02:00
Jeremy Allison
7d6ebe0de7 More const fixes. Remove CONST_DISCARD. 2011-05-06 01:44:07 +02:00
Jeremy Allison
02af307585 More simple const fixes. 2011-05-05 23:56:07 +02:00
Günther Deschner
58db720e27 s3-auth: run minimal_includes.pl
Guenther
2011-05-05 02:05:26 +02:00
Jeremy Allison
a2915089de Remove obvious use of safe_strcpy + safe_strcat -> strlcpy + strlcat. 2011-05-04 12:12:14 -07:00
Andrew Tridgell
1d165c0803 s3-include: use new roles.h
Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
2011-05-03 07:37:07 +02:00
Volker Lendecke
ddfeccc6e4 s3: Use wbcSidsToUnixIds in create_local_token
Signed-off-by: Jeremy Allison <jra@samba.org>
2011-04-13 14:13:25 -07:00
Andrew Bartlett
48646ee69a s3-auth: Make server_info const in create_local_token()
Andreas Schneider <asn@samba.org> correctly points out that this input
parameter should now be const, and that found a bug where I used then
used it incorrectly as a talloc context.

Andrew Bartlett

Autobuild-User: Andrew Bartlett <abartlet@samba.org>
Autobuild-Date: Wed Apr  6 00:33:31 CEST 2011 on sn-devel-104
2011-04-06 00:33:31 +02:00
Andrew Bartlett
ff9b6682a0 s3-auth Rename user_session_key -> session_key to match auth_session_info 2011-04-05 06:32:07 +10:00
Andrew Bartlett
17d8f0ad30 s3-auth use create_local_token() to transform server_info -> session_info
Before a auth_serversupplied_info struct can be used for
authorization, the local groups and privileges must be calculated.
create_local_token() now copies the server_info, and then sets the
calulated token and unix groups.

Soon, it will also transform the result into an expanded struct
auth_session_info.  Until then, the variable name (server_info vs
session_info provides a clue to the developer about what information
has been entered in the structure).

By moving the calls to create_local_token within the codebase, we
remove duplication, and ensure that the session key (where modified)
is consistently copied into the new structure.

Andrew Bartlett
2011-04-05 06:32:07 +10:00
Andrew Bartlett
77e67163da s3-auth consolidate create_local_token() into make_server_info_krb5()
This ensures that all callers don't need to each add builtin groups
and privileges to the user's token

Andrew Bartlett
2011-04-04 19:48:58 +10:00
Günther Deschner
fbd0ff69ec s3: try to fix the build on some non-linux buildfarm machines.
Guenther

Autobuild-User: Günther Deschner <gd@samba.org>
Autobuild-Date: Wed Mar 30 11:39:31 CEST 2011 on sn-devel-104
2011-03-30 11:39:31 +02:00
Günther Deschner
c2d6260f10 s3: only include lib/privileges.h where needed.
This finally removes the global lsa.h inclusion.

Guenther
2011-03-30 01:13:10 +02:00
Günther Deschner
4bd5f51c43 s3-prototyes: user_in_netgroup and user_in_list moved to auth, out of smbd.
Guenther
2011-03-30 01:13:09 +02:00
Günther Deschner
7e73214ebf s3-auth: use auth.h where needed.
Guenther
2011-03-30 01:13:09 +02:00
Günther Deschner
1b6767d262 s3-auth: move auth prototypes to auth/proto.h.
Guenther
2011-03-30 01:13:09 +02:00
Günther Deschner
34a335a87d s3: auth also needs parts of smbd.
Guenther
2011-03-30 01:13:08 +02:00
Günther Deschner
235f148590 s3-passdb: use passdb headers where needed.
Guenther
2011-03-30 01:13:08 +02:00
Günther Deschner
2f36ef7225 s3-passdb: add passdb.h where needed.
Guenther
2011-03-30 01:13:07 +02:00
Günther Deschner
03e6082e3c s3: create_builtin_users/administrators belongs to passdb not auth.
Guenther
2011-03-30 01:13:07 +02:00
Günther Deschner
0e771263ee s3-includes: only include system/filesys.h when needed.
Guenther
2011-03-30 01:13:07 +02:00
Günther Deschner
49fcf653b1 s3-includes: only include system/passwd.h when needed.
Guenther
2011-03-30 01:13:07 +02:00
Günther Deschner
d85f140826 s3-winbind: remove global inclusion of libwbclient.
Guenther
2011-03-30 01:13:06 +02:00
Günther Deschner
96487959e9 lib/util/util_pw: share more code between lib/util/util_pw.c and source3/lib/username.c
Guenther
2011-03-30 01:13:06 +02:00
Günther Deschner
64421129b6 lib/util/util_pw: share sys_get{pw,gr} group of calls.
Guenther
2011-03-30 01:13:06 +02:00
Volker Lendecke
a414356075 s3: Fix Coverity ID 2188: MISSING_BREAK
Autobuild-User: Volker Lendecke <vlendec@samba.org>
Autobuild-Date: Sun Mar 27 23:11:10 CEST 2011 on sn-devel-104
2011-03-27 23:11:10 +02:00
Volker Lendecke
ba92c45787 s3: Fix Coverity ID 2189: MISSING_BREAK 2011-03-27 22:22:12 +02:00
Volker Lendecke
429e84f0d4 s3: Fix a (invalid) uninitialized variable warning
Autobuild-User: Volker Lendecke <vlendec@samba.org>
Autobuild-Date: Wed Mar 23 11:13:14 CET 2011 on sn-devel-104
2011-03-23 11:13:14 +01:00
Volker Lendecke
920b2fddc6 s3: Fix Coverity ID 1018, CHECKED_RETURN 2011-03-16 21:14:58 +01:00
Volker Lendecke
16b007c223 Quite some callers of sid_split_rid do not care about the rid 2011-03-10 18:48:34 +01:00
Volker Lendecke
dcbfb6fc0b s3: Fix a memory leak in check_sam_security_info3
Abartlet, this commit makes check_sam_security_info3 use talloc_tos() and also
cleans up the temporary talloc stackframe.

The old code created a temporary talloc context off "mem_ctx" but failed to
clean up the tmp_ctx in all but one return paths.

talloc_stackframe()/talloc_tos() is designed as a defense against exactly this
error: Even if we failed to free the frame when returning from the routine, it
would be cleaned up very soon, in our main event loop.

Please check this patch!

Thanks,

Volker

Autobuild-User: Volker Lendecke <vlendec@samba.org>
Autobuild-Date: Sat Mar  5 14:08:37 CET 2011 on sn-devel-104
2011-03-05 14:08:37 +01:00
Andreas Schneider
bf18403c81 s3-rpc_client: Move client pipe functions to own header. 2011-02-28 18:15:04 +01:00
Günther Deschner
67e72f5204 s3-waf: move some parts of auth to AUTH_COMMON to avoid duplicate symbols with winbindd.
Guenther

Autobuild-User: Günther Deschner <gd@samba.org>
Autobuild-Date: Wed Feb 23 02:16:23 CET 2011 on sn-devel-104
2011-02-23 02:16:23 +01:00
Günther Deschner
28b4b05938 s3-includes: move some chgpasswd related defines to the locations where they are used.
Guenther
2011-02-22 21:52:19 +01:00
Stefan Metzmacher
d7fa349052 s3:auth: change num_groups to from size_t to uint32_t
This will help with the change from UNIX_USER_TOKEN to security_unix_token

metze
2011-02-22 16:20:11 +11:00
Andrew Bartlett
2e69e89456 s3-auth Rename auth_serversupplied_info varaiables: server_info -> session_info
These variables, of type struct auth_serversupplied_info were poorly
named when added into 2001, and in good consistant practice, this has
extended all over the codebase in the years since.

The structure is also not ideal for it's current purpose.  Originally
intended to convey the results of the authentication modules, it
really describes all the essential attributes of a session.  This
rename will reduce the volume of a future patch to replaced these with
a struct auth_session_info, with auth_serversupplied_info confined to
the lower levels of the auth subsystem, and then eliminated.

(The new structure will be the output of create_local_token(), and the
change in struct definition will ensure that this is always run, populating
local groups and privileges).

Andrew Bartlett

Signed-off-by: Stefan Metzmacher <metze@samba.org>
2011-02-22 16:20:10 +11:00
Volker Lendecke
3e4da94669 s3: NO_SUCH_USER is a lot more likely than NO_MEMORY 2011-02-20 10:23:29 +01:00
Volker Lendecke
51b84a9ed7 s3: Convert init_system_info to NTSTATUS 2011-02-20 10:23:29 +01:00
Andrew Tridgell
c8b2b10976 s3-waf: use SAMBA3_*() build rules in source3/build
this brings the s3 waf build much closer to the proposed s3build top
level build, using the same bld.SAMBA3_*() rules

There are a few renames of subsystems in here, with a 3 suffix where
it would create a conflict.

Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
2011-02-18 16:46:41 +11:00
Andrew Bartlett
1354d3dc74 s3-auth Fix memory leak in security=share and force user =
In these cases, the server_info was not stolen onto a long term memory
context, and so remained on the NULL context where it was created.

Andrew Bartlett

Autobuild-User: Andrew Bartlett <abartlet@samba.org>
Autobuild-Date: Wed Feb 16 01:08:19 CET 2011 on sn-devel-104
2011-02-16 01:08:19 +01:00
Andrew Bartlett
cc77ea720b s3-auth Remove unused pam_handle
Signed-off-by: Andrew Tridgell <tridge@samba.org>
2011-02-10 06:51:07 +01:00
Andrew Bartlett
2b05ba77b4 s3-auth Rename cryptic 'ptok' to security_token
This will allow the auth_serversupplied_info struct to be migrated
to auth_session_info easier.

Adnrew Bartlett

Signed-off-by: Andrew Tridgell <tridge@samba.org>
2011-02-10 06:51:06 +01:00
Günther Deschner
34722c72f6 pam: share pam errors in a common location.
Guenther
2011-02-08 14:05:36 +01:00
Volker Lendecke
40a46a9cca s3: Use the right credentials in check_netlogond_security
Autobuild-User: Volker Lendecke <vlendec@samba.org>
Autobuild-Date: Sun Feb  6 20:43:03 CET 2011 on sn-devel-104
2011-02-06 20:43:03 +01:00
Volker Lendecke
d515c6cd5c s3: Fix auth_netlogond to cope with netlogon_creds_CredentialState
Autobuild-User: Volker Lendecke <vlendec@samba.org>
Autobuild-Date: Sun Feb  6 17:30:48 CET 2011 on sn-devel-104
2011-02-06 17:30:48 +01:00
Volker Lendecke
843825f567 s3: Fetch the machinepw via ldapi in pdb_ads 2011-02-06 16:44:56 +01:00
Günther Deschner
f60398d7b2 s3-winbindd: let winbind try to use samlogon validation level 6. (bug #7945)
The benefit of this that it makes us more robust to secure channel resets
triggered from tools outside the winbind process. Long term we need to have a
shared tdb secure channel store though as well.

Guenther

Signed-off-by: Stefan Metzmacher <metze@samba.org>

Autobuild-User: Stefan Metzmacher <metze@samba.org>
Autobuild-Date: Fri Feb  4 18:11:04 CET 2011 on sn-devel-104
2011-02-04 18:11:04 +01:00
Günther Deschner
ac4127a9f4 s3-auth: add copy_netr_SamBaseInfo().
Guenther

Signed-off-by: Stefan Metzmacher <metze@samba.org>
2011-02-04 16:57:32 +01:00
Volker Lendecke
9b94f36605 s3: Make sure we call wbcAuthenticateUserEx correctly
There are cases where we fill in params.password.response.lm_data with non-NULL
where params.password.response.lm_length is 0. wbcAuthenticateUserEx does not
like that.

I haven't been able to reproduce this with smbclient yet, I've seen it with a
proprietary smb client implementation.

Autobuild-User: Volker Lendecke <vlendec@samba.org>
Autobuild-Date: Mon Jan 17 16:30:11 CET 2011 on sn-devel-104
2011-01-17 16:30:11 +01:00
Volker Lendecke
d3abc90401 s3: Avoid a few calls to cli_errstr
Autobuild-User: Volker Lendecke <vlendec@samba.org>
Autobuild-Date: Mon Jan 17 08:47:25 CET 2011 on sn-devel-104
2011-01-17 08:47:25 +01:00
Volker Lendecke
d096de56b1 s3: Remove unused "retry" from cli_full_connection 2010-12-20 17:10:58 +01:00
Volker Lendecke
660190632e s3: Always retry the DC connection in auth_domain
The only condition that cli_full_connection marks as non-retryable is the basic
name lookup and TCP connect. To me this is pretty fishy. For example if the
negprot fails, this is supposed to be more retryable than a NetBIOS name lookup
failure? I'd rather think the opposite is true.

Jeremy, this is code from 2002, 389a16d9d5. If you have any comments from
back then, let me know :-)

Volker
2010-12-20 17:10:57 +01:00
Volker Lendecke
c6b5136f02 s3: Fix bug 7066 -- wbcAuthenticateEx gives unix times
We might eventually want to change this, but right now we get unix times
out of the winbind pipe struct
2010-12-19 23:25:06 +01:00
Günther Deschner
133a2ffd00 s3-waf: avoid module name uppercasing.
This finally allows mixed case module names like the classic build
(./configure --shared_modules=charset_CP850)

Guenther

Autobuild-User: Günther Deschner <gd@samba.org>
Autobuild-Date: Wed Dec  1 18:39:14 CET 2010 on sn-devel-104
2010-12-01 18:39:14 +01:00
Günther Deschner
33c82cd5dd s3-waf: convert TOKEN_UTIL into a subsystem.
Guenther
2010-11-30 18:12:29 +01:00
Jeremy Allison
a95970d3b7 Fix memleak I accidently introduced when reading from tdb.
Autobuild-User: Jeremy Allison <jra@samba.org>
Autobuild-Date: Wed Nov 10 01:56:21 UTC 2010 on sn-devel-104
2010-11-10 01:56:21 +00:00
Jeremy Allison
3878fa4c43 Ensure we check the return from make_user_info before dereferencing the value returned by it.
Jeremy.
2010-11-10 01:14:17 +00:00
Jeremy Allison
9997ee813b Remove fstring from map_username. Create a more sane interface than the called-parameter-is-modified.
Jeremy.
2010-11-10 01:14:17 +00:00
Volker Lendecke
c83a40ddbf s3: Quieten a bogus error message
This happens if you set "auth methods = winbind" without a fallback method.

The return NT_STATUS_LOGON_FAILURE; is not strictly require here, because we
fall through to the equivalent statement a few lines down, but it makes the
code a bit clearer IMO.

Autobuild-User: Volker Lendecke <vlendec@samba.org>
Autobuild-Date: Tue Nov  9 20:15:59 UTC 2010 on sn-devel-104
2010-11-09 20:15:59 +00:00
Volker Lendecke
097be4b101 s3: Make proper use of sid_check_is_in_xx routines
Autobuild-User: Volker Lendecke <vlendec@samba.org>
Autobuild-Date: Fri Nov  5 15:35:59 UTC 2010 on sn-devel-104
2010-11-05 15:35:59 +00:00
Volker Lendecke
26b2a132ff s3: Fix a typo 2010-11-05 15:54:05 +01:00
Jeremy Allison
e1cfca1e2e Make getpwnam_alloc() static to lib/username.c, and ensure all username lookups go
through Get_Pwnam_alloc(), which is the correct wrapper function. We were using
it *some* of the time anyway, so this just makes us properly consistent.

Jeremy.

Autobuild-User: Jeremy Allison <jra@samba.org>
Autobuild-Date: Wed Oct 20 16:02:12 UTC 2010 on sn-devel-104
2010-10-20 16:02:12 +00:00
Günther Deschner
4a2e47b74a s3-waf: move RPC_CLIENT_SCHANNEL into a subsystem.
Guenther
2010-10-20 16:21:12 +02:00
Andreas Schneider
f22e6cf3b7 s3-rpc_server: Make auth_serversupplied_info const. 2010-10-15 11:34:03 +00:00
Andrew Bartlett
170b345e0c s3-auth Use security_token_debug() from common code
This prints the security token including the privileges as strings
instead of just a bitmap.

Andrew Bartlett

Signed-off-by: Andrew Tridgell <tridge@samba.org>
2010-10-14 02:35:04 +00:00
Andrew Bartlett
58cf83732a s3-auth use security_token_has_sid() from the common code
The wrapper call is left here to avoid changing semantics for
the NULL parameter case.

Andrew Bartlett

Signed-off-by: Andrew Tridgell <tridge@samba.org>
2010-10-14 02:35:04 +00:00
Andrew Bartlett
f768b32e37 libcli/security Provide a common, top level libcli/security/security.h
This will reduce the noise from merges of the rest of the
libcli/security code, without this commit changing what code
is actually used.

This includes (along with other security headers) dom_sid.h and
security_token.h

Andrew Bartlett

Autobuild-User: Andrew Bartlett <abartlet@samba.org>
Autobuild-Date: Tue Oct 12 05:54:10 UTC 2010 on sn-devel-104
2010-10-12 05:54:10 +00:00
Günther Deschner
4e9508172d s3-waf: slowly getting modules to match how they look like in old build.
Guenther

Autobuild-User: Günther Deschner <gd@samba.org>
Autobuild-Date: Fri Oct  8 09:31:01 UTC 2010 on sn-devel-104
2010-10-08 09:31:01 +00:00
Günther Deschner
9d3046f098 s3-waf: add AUTH_SCRIPT module to AUTH subsystem (which is build as shared
module by default).

Guenther
2010-09-28 20:03:54 +02:00
Günther Deschner
2a1891a9d6 s3-waf: fix dependencies in most of our module subsystems.
Guenther
2010-09-28 09:41:54 +02:00
Günther Deschner
07697fa053 s3-auth_util: make sure the system server info actually contains S-1-5-18.
Without this, all security descriptor checks for the winreg spoolss backend fail
and make our spoolss system in its current shape basically unusable.

Andreas, please check.

Guenther
2010-09-28 09:40:57 +02:00
Günther Deschner
fa8971d90f s3-waf: move auth subsystem to auth/wscript_build.
Guenther
2010-09-27 00:39:37 +02:00
Volker Lendecke
86919606c7 s3: Remove talloc_autofree_context() from get_root_nt_token()
The memcache_add_talloc() later on steals it anyway
2010-09-26 03:29:27 +02:00
Volker Lendecke
6ee0d866c2 s3: Lift talloc_autofree_context() from make_auth_context_fixed() 2010-09-26 01:12:37 +02:00
Volker Lendecke
242e329610 s3: Lift talloc_autofree_context() from make_auth_context_subsystem() 2010-09-26 01:12:37 +02:00
Volker Lendecke
2d8be31e88 s3: Lift talloc_autofree_context() from make_auth_context_text_list() 2010-09-26 01:12:37 +02:00
Volker Lendecke
61861e4b7d s3: Lift talloc_autofree_context() from make_auth_context() 2010-09-26 01:12:37 +02:00
Volker Lendecke
b12744513e s3: Fix a memleak in make_new_server_info_system() 2010-09-26 01:12:37 +02:00
Volker Lendecke
15a3afbd19 s3: Remove talloc_autofree_context() from init_system_info() 2010-09-26 01:12:37 +02:00
Volker Lendecke
e4591eb8c1 s3: Fix a typo 2010-09-25 15:45:09 -07:00
Günther Deschner
102a70e809 s3-util: use shared dom_sid_dup.
Guenther
2010-09-20 14:05:07 -07:00
Günther Deschner
4dbd743e46 s3-util_sid: use shared dom_sid_compare_auth and dom_sid_equal_X functions.
Guenther
2010-09-20 14:04:37 -07:00
Andrew Bartlett
6832d5e933 libcli/auth/ntlmssp Be clear about talloc parents for session keys
The previous API was not clear as to who owned the returned session key.
This fixes a valgrind-found use-after-free in the NTLMSSP key derivation code,
and avoids making allocations - we steal and zero instead.

Andrew Bartlett

Signed-off-by: Andrew Tridgell <tridge@samba.org>
2010-09-16 21:09:17 +10:00
Andrew Bartlett
2387e3bcfe s3-privs Call security_token_set_privilege() rather than manual assignment
This avoids as much direct modifiction of the bitmask as possible.

Andrew Bartlett

Signed-off-by: Andrew Tridgell <tridge@samba.org>
2010-09-11 18:46:09 +10:00
Andrew Bartlett
b29b6c13a3 s3-privs Inline dump_se_priv into callers now that it's just a uint64_t
The previous 128 bit structure needed this helper function.

Andrew Bartlett

Signed-off-by: Andrew Tridgell <tridge@samba.org>
2010-09-11 18:46:07 +10:00
Andrew Bartlett
d1bb21b0d5 s3:auth Remove NT_USER_TOKEN
The all UPPER case typedef is no longer the preferred Samba style
and this makes it easier to see that this is the IDL-derivied structure

Andrew Bartlett

Signed-off-by: Andrew Tridgell <tridge@samba.org>
2010-09-11 18:46:06 +10:00
Andrew Bartlett
4bfc8d3b1a s3-auth Change struct nt_user_token -> struct security_token
This common structure is defined in security.idl

Andrew Bartlett

Signed-off-by: Andrew Tridgell <tridge@samba.org>
2010-09-11 18:46:05 +10:00
Andrew Bartlett
4bf783d4d6 s3-auth Change type of num_sids to uint32_t
size_t is overkill here, and in struct security_token in the num_sids
is uint32_t.

This includes a change to the prototype of add_sid_to_array()
and add_sid_to_array_unique(), which has had a number of
consequnetial changes as I try to sort out all the callers using
a pointer to the number of sids.

Andrew Bartlett

Signed-off-by: Andrew Tridgell <tridge@samba.org>
2010-09-11 18:46:05 +10:00
Andreas Schneider
669213e812 s3-auth: Added get_server_info_system function. 2010-09-09 16:00:07 +02:00
Günther Deschner
7afa6675ee s3-auth: fix uninitialized error code in get_guest_info3().
Guenther
2010-09-01 10:51:13 +02:00
Günther Deschner
95f9542e05 s3-auth: remove global include of krb5pac.h.
Guenther
2010-08-31 23:17:40 +02:00
Günther Deschner
d5436c650c s3-auth: remove unused variable in check_sam_security().
Guenther
2010-08-31 23:17:39 +02:00
Andrew Bartlett
eee63b7e75 s3-auth Rename NT_USER_TOKEN privileges -> privilege_mask
This is closer to the struct security_token from security.idl

Andrew Bartlett
2010-08-31 11:25:41 +10:00
Andrew Bartlett
8c15cf54ae s3-auth Rename NT_USER_TOKEN user_sids -> sids
This is closer to the struct security_token from security.idl
2010-08-31 10:20:14 +10:00
Andreas Schneider
20e7b4ec74 s3-auth: The unlock of the account is now done by the get_sampwnam call.
Signed-off-by: Simo Sorce <idra@samba.org>
2010-08-30 10:43:54 -04:00
Andreas Schneider
9dd7e7fc2d s3-auth: Use SamInfo3_for_guest to create guest server_info.
Signed-off-by: Simo Sorce <idra@samba.org>
2010-08-30 10:43:20 -04:00
Simo Sorce
08a8e25d6b s3-auth: add helper to get server_info out of kerberos info
Signed-off-by: Günther Deschner <gd@samba.org>
2010-08-30 14:24:30 +02:00
Simo Sorce
b9772a4886 s3-auth: Add helper function to retrieve the unix user from a kerberos ticket
Signed-off-by: Günther Deschner <gd@samba.org>
2010-08-30 14:17:06 +02:00
Volker Lendecke
291526b9cf s3: Remove a use of smbd_server_fd
This disables different socket options per user for ntlmssp authentiation, a
change in behaviour which is exotic enough I believe.
2010-08-29 21:55:23 +02:00
Volker Lendecke
520c5aae40 s3: Remove smbd_server_conn() from check_unix_security 2010-08-28 11:12:13 +02:00
Volker Lendecke
92fd03c5f0 s3: Lift smbd_server_fd() from pass_check() 2010-08-28 11:12:13 +02:00