1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-07 17:18:11 +03:00
Commit Graph

732 Commits

Author SHA1 Message Date
Gerald Carter
a7e2730ec4 r39: * importing .cvsignore files
* updateing WHATSNEW with vl's change
2007-10-10 10:51:05 -05:00
Volker Lendecke
ae6840320f Implement NETLOGON GetDCName client side. You can ask a DC for the name of
a DC it trusts.

Volker
0001-01-01 00:00:00 +00:00
Andrew Bartlett
01fff20e6e Ensure we correctly set cli->nt_pipe_fnum on failure to correctly open the
NT session.

Andrew Bartlett
0001-01-01 00:00:00 +00:00
Gerald Carter
170c443b19 remove unused variable 0001-01-01 00:00:00 +00:00
Gerald Carter
3aac1e549e missed some of Derrel's changes 0001-01-01 00:00:00 +00:00
Gerald Carter
4d68d3d5dd asu/syntax/pc_netlink doesn't fill in the pipe name in the rpc_bind response so dont check for it 0001-01-01 00:00:00 +00:00
Volker Lendecke
e597420421 Add 'net rpc group [add|del]mem' for domain groups and aliases.
Volker
0001-01-01 00:00:00 +00:00
Volker Lendecke
76c75bb8a7 Add 'net rpc group add'. For this parse_samr.c had to be changed: The
group_info4 in set_dom_group_info also has the level in the record
itself. This seems not to be an align. Tested with NT4 usrmgr.exe. It can
still create a domain group on a samba machine.

Volker
0001-01-01 00:00:00 +00:00
Andrew Bartlett
2a2b1f0c87 This adds client-side support for the unicode/SAMR password change scheme.
As well as avoiding DOS charset issues, this scheme returns useful error
codes, that we can map back via the pam interface.

This patch also cleans up the interfaces used for password buffers, to
avoid duplication of code.

Andrew Bartlett
0001-01-01 00:00:00 +00:00
Gerald Carter
1c15bfacb4 BUG 972; check pointer in cli_ds_getprimarydominfo() before trying to copy a structure 0001-01-01 00:00:00 +00:00
Gerald Carter
ba9dc0d9fd fix segfault when sid_ptr == 0 in DsEnumDomainTrusts() reply 0001-01-01 00:00:00 +00:00
Andrew Bartlett
7c34de8096 This merges in my 'always use ADS' patch. Tested on a mix of NT and ADS
domains, this patch ensures that we always use the ADS backend when
security=ADS, and the remote server is capable.

The routines used for this behaviour have been upgraded to modern Samba
codeing standards.

This is a change in behaviour for mixed mode domains, and if the trusted
domain cannot be reached with our current krb5.conf file, we will show
that domain as disconnected.

This is in line with existing behaviour for native mode domains, and for
our primary domain.

As a consequence of testing this patch, I found that our kerberos error
handling was well below par - we would often throw away useful error
values.  These changes move more routines to ADS_STATUS to return
kerberos errors.

Also found when valgrinding the setup, fix a few memory leaks.

While sniffing the resultant connections, I noticed we would query our
list of trusted domains twice - so I have reworked some of the code to
avoid that.

Andrew Bartlett
0001-01-01 00:00:00 +00:00
Andrew Bartlett
da408e0d5a Correctly handle per-pipe NTLMSSP inside a NULL session. Previously we
would attempt to supply a password to the 'inside' NTLMSSP, which the
remote side naturally rejected.

Andrew Bartlett
0001-01-01 00:00:00 +00:00
Andrew Bartlett
06c3f15aa1 rpc_client/cli_lsarpc.c:
rpc_parse/parse_lsa.c:
nsswitch/winbindd_rpc.c:
nsswitch/winbindd.h:
 - Add const

libads/ads_ldap.c:
 - Cleanup function for use

nsswitch/winbindd_ads.c:
 - Use new utility function ads_sid_to_dn
 - Don't search for 'dn=', rather call the ads_search_retry_dn()

nsswitch/winbindd_ads.c:
include/rpc_ds.h:
rpc_client/cli_ds.c:
 - Fixup braindamage in cli_ds_enum_domain_trusts():
    - This function was returning a UNISTR2 up to the caller, and
      was doing nasty (invalid, per valgrind) things with memcpy()
    - Create a new structure that represents this informaiton in a useful way
      and use talloc.

Andrew Bartlett
0001-01-01 00:00:00 +00:00
Andrew Bartlett
48123f7e42 Do not add NTLM2 to the NTLMSSP flags unconditionally - allow the
defaults specified by the caller to prevail.

Don't use NTLM2 for RPC pipes, until we know how it works in signing or sealing.

Call ntlmssp_sign_init() unconditionally in the client - we setup the
session key, why not setup the rest of the data.

Andrew Bartlett
0001-01-01 00:00:00 +00:00
Gerald Carter
5e062f72ba strequal() returns a BOOL, not an int like strcmp(); this fixes a bug in check_bind_response() 0001-01-01 00:00:00 +00:00
Andrew Bartlett
9ecf9408d9 Add support for variable-length session keys in our client code.
This means that we now support 'net rpc join' with KRB5 (des based)
logins.  Now, you need to hack 'net' to do that, but the principal is
important...

When we add kerberos to 'net rpc', it should be possible to still do
user management and the like over RPC.

(server-side support to follow shortly)

Andrew Bartlett
0001-01-01 00:00:00 +00:00
Andrew Bartlett
f3bbc87b0d Changes all over the shop, but all towards:
- NTLM2 support in the server
 - KEY_EXCH support in the server
 - variable length session keys.

In detail:

 - NTLM2 is an extension of NTLMv1, that is compatible with existing
domain controllers (unlike NTLMv2, which requires a DC upgrade).

 * This is known as 'NTLMv2 session security' *

(This is not yet implemented on the RPC pipes however, so there may
well still be issues for PDC setups, particuarly around password
changes.  We do not fully understand the sign/seal implications of
NTLM2 on RPC pipes.)

This requires modifications to our authentication subsystem, as we
must handle the 'challege' input into the challenge-response algorithm
being changed.  This also needs to be turned off for
'security=server', which does not support this.

- KEY_EXCH is another 'security' mechanism, whereby the session key
actually used by the server is sent by the client, rather than being
the shared-secret directly or indirectly.

- As both these methods change the session key, the auth subsystem
needed to be changed, to 'override' session keys provided by the
backend.

- There has also been a major overhaul of the NTLMSSP subsystem, to merge the 'client' and 'server' functions, so they both operate on a single structure.  This should help the SPNEGO implementation.

- The 'names blob' in NTLMSSP is always in unicode - never in ascii.
Don't make an ascii version ever.

- The other big change is to allow variable length session keys.  We
have always assumed that session keys are 16 bytes long - and padded
to this length if shorter.  However, Kerberos session keys are 8 bytes
long, when the krb5 login uses DES.

 * This fix allows SMB signging on machines not yet running MIT KRB5 1.3.1. *

- Add better DEBUG() messages to ntlm_auth, warning administrators of
misconfigurations that prevent access to the privileged pipe.  This
should help reduce some of the 'it just doesn't work' issues.

- Fix data_blob_talloc() to behave the same way data_blob() does when
passed a NULL data pointer.  (just allocate)


REMEMBER to make clean after this commit - I have changed plenty of data structures...
0001-01-01 00:00:00 +00:00
Volker Lendecke
029dcb351b This fixes a bug when establishing trust against a german W2k3 AD server. In
the bind response to WKSSVC it does not send \PIPE\ntsvcs as NT4 (did not
check w2k) but \PIPE\wkssvc. I'm not sure whether we should make this check at
all, so making it a bit more liberal should hopefully not really hurt.

Volker
0001-01-01 00:00:00 +00:00
cvs2svn Import User
e569418861 This commit was manufactured by cvs2svn to create branch 'SAMBA_3_0'. 0001-01-01 00:00:00 +00:00
Jim McDonough
532fab74c1 New files for support of initshutdown pipe. Win2k doesn't respond properly
to all requests on the winreg pipe, so we need to handle this new pipe.

First part of fix for bug #534
0001-01-01 00:00:00 +00:00
Volker Lendecke
198b01fc54 Merge from 3_0:
In cli_lsa_lookup_sids don't leave the domain field uninitialized if
some sid could not be mapped. Otherwise this call is unnecessarily
complicated to call.

Volker
0001-01-01 00:00:00 +00:00
Volker Lendecke
1337338522 In cli_lsa_lookup_sids don't leave the domain field uninitialized if
some sid could not be mapped. Otherwise this call is unnecessarily
complicated to call.

Volker
0001-01-01 00:00:00 +00:00
Jeremy Allison
aa7fb71357 Merge Volker's fix.
It's a perfectly valid condition to have zero alias members.

Jeremy.
0001-01-01 00:00:00 +00:00
Volker Lendecke
ccdcd88732 It's a perfectly valid condition to have zero alias members.
Volker
0001-01-01 00:00:00 +00:00
Jim McDonough
3ca8240aff Add client side code to do endpoint map queries. Currently does one
fixed query.  Updates to come soon.
0001-01-01 00:00:00 +00:00
Simo Sorce
c78f2d0bd1 split some security related functions in their own files.
(no need to include all of smbd files to use some basic sec functions)

also minor compile fixes
couldn't compile to test these due to some kerberos problems wirh 3.0,
but on HEAD they're working well, so I suppose it's ok to commit
0001-01-01 00:00:00 +00:00
Simo Sorce
66074d3b09 split some security related functions in their own files.
(no need to include all of smbd files to use some basic sec functions)

also minor compile fixes
0001-01-01 00:00:00 +00:00
Gerald Carter
9d2e585e5e commit sign only patch from Andrew; bug 167; tested using 2k & XP clientspreviously joined to the Samba domain 0001-01-01 00:00:00 +00:00
Gerald Carter
3802f5895e commit sign only patch from Andrew; bug 167; tested using 2k & XP clientspreviously joined to the Samba domain 0001-01-01 00:00:00 +00:00
Tim Potter
e2ab9e54cd Merge from 3.0:
>Fix for #480. Change the interface for init_unistr2 to not take a length
>but a flags field. We were assuming that 2*strlen(mb_string) == length of ucs2-le string.
>This is not the case. Count it after conversion.
>Jeremy.
0001-01-01 00:00:00 +00:00
Jeremy Allison
f82c273a42 Fix for #480. Change the interface for init_unistr2 to not take a length
but a flags field. We were assuming that 2*strlen(mb_string) == length of ucs2-le string.
This is not the case. Count it after conversion.
Jeremy.
0001-01-01 00:00:00 +00:00
Gerald Carter
585764305a fix some warnings found by the Sun C compiler 0001-01-01 00:00:00 +00:00
Gerald Carter
e1fac713e2 fix some warnings found by the Sun C compiler 0001-01-01 00:00:00 +00:00
Gerald Carter
c17a7dc9a1 sync 3.0 into HEAD for the last time 0001-01-01 00:00:00 +00:00
Andrew Bartlett
e10f0529fe - Fix the kerberos downgrade problem:
- When connecting to the NETOGON pipe, we make a call to auth2, in order
   to verify our identity.  This call was being made with negotiation flags
   of 0x1ff.  This caused our account to be downgraded.  If we instead make
   the call with flags > 1ff (such as 0x701ff), then this does not occour.

 - This is *not* related to the use of kerberos for the CIFS-level connection

My theory is that Win2k has a test to see if we are sending *exactly* what
NT4 sent - setting any other flags seems to cause us to remain intact.

Also ensure that we only have 'setup schannel' code in a few places, not
scattered around cmd_netlogon too.

Andrew Bartlett
0001-01-01 00:00:00 +00:00
Gerald Carter
5be5151568 working on fix for BUG #294. Not done yet, but this at least clears
up some of the false positives in "rpcclient -c getdriver".
Also make sure that we ask for version2 and 3 drivers on x86.
0001-01-01 00:00:00 +00:00
Herb Lewis
398bd14fc6 get rid of more compiler warnings 0001-01-01 00:00:00 +00:00
Andrew Bartlett
3547cb3def Change Samba to always use extended security for it's guest logins, (ie,
NTLMSSP with "" username, NULL password), and add --machine-pass (-P) to
all of Samba's clients.

When connecting to an Active Directory DC, you must initiate the CIFS level
session setup with Kerberos, not a guest login.  If you don't, your machine
account is demoted to NT4.

Andrew Bartlett
0001-01-01 00:00:00 +00:00
Tim Potter
4d26feabd7 Memory leak fix for create_rpc_bind_req() 0001-01-01 00:00:00 +00:00
Simo Sorce
3101c236b8 port latest changes from SAMBA_3_0 tree 0001-01-01 00:00:00 +00:00
Jim McDonough
a2bd8f0bfa Update my copyrights according to my agreement with IBM 0001-01-01 00:00:00 +00:00
Gerald Carter
0ab00ccaed working on transtive trusts issue:
* use DsEnumerateDomainTrusts() instead of LDAP search.
    wbinfo -m now lists all trusted downlevel domains and
    all domains in the forest.

Thnigs to do:

  o Look at Krb5 connection trusted domains
  o make sure to initial the trusted domain cache as soon
    as possible
0001-01-01 00:00:00 +00:00
Jeremy Allison
f3f29665bd Save us from possibly uninitialised variable (caught by gcc).
Jeremy.
0001-01-01 00:00:00 +00:00
Gerald Carter
f8abdd23e1 add a few more tidy ups. Now onto winbindd 0001-01-01 00:00:00 +00:00
Gerald Carter
c691c7f7d9 add support for DsEnumerateDomainTrusted for enumerating all the
trusted domains in a forest.
0001-01-01 00:00:00 +00:00
Gerald Carter
e12f6a8c13 domain in schannel bind credentials must be the dest domain, not ours 0001-01-01 00:00:00 +00:00
Andrew Bartlett
fa4d7be161 Schannel, once setup, may be used on *ANY* TCP/IP connection until the
connection that set it up has been shut down.

(Also, pipes still connected, and reconnections to the same pipe (eg SAMR)
may continue to use that session key until their TCP/IP connection is shut
down)

Allow further testing by printing out the session key, and allowing it's input
into rpcclient.

Next step is automatic storage in a TDB.

Andrew Bartlett
0001-01-01 00:00:00 +00:00
Tim Potter
2e5bd16654 Fix out of date comment. 0001-01-01 00:00:00 +00:00
Gerald Carter
e66541d0e1 fix the build. Ifdef out some code 0001-01-01 00:00:00 +00:00
Andrew Bartlett
77c3e69aef In the presense of RPC fragments, schannel is not strictly request/reply,
so the shared sequence number will not be strictly odd/even.

Andrew Bartlett
0001-01-01 00:00:00 +00:00
Gerald Carter
adb98e7b7c trying to get HEAD building again. If you want the code
prior to this merge, checkout HEAD_PRE_3_0_0_BETA_3_MERGE
0001-01-01 00:00:00 +00:00
Andrew Bartlett
6ca77bd28f Fix up our auth_pipe code to always cope with fragmented datagrams,
in both SCHANNEL and NTLMSSP.

(Try not to deal with a general case as individual special cases...)

Andrew Bartlett
0001-01-01 00:00:00 +00:00
Gerald Carter
ff0c71148e fix schannel processing on fragmented PDUs. 'net rpc vampire' works again. 0001-01-01 00:00:00 +00:00
Andrew Bartlett
d941255a97 Fix compile error noticed by Ken Cross, use the utility function instead
of an inline replacement...

Andrew Bartlett
0001-01-01 00:00:00 +00:00
Andrew Bartlett
5472ddc9ea Jeremy requested that I get my NTLMSSP patch into CVS. He didn't request
the schannel code, but I've included that anyway. :-)

This patch revives the client-side NTLMSSP support for RPC named pipes
in Samba, and cleans up the client and server schannel code.  The use of the
new code is enabled by the 'sign', 'seal' and 'schannel' commands in
rpcclient.

The aim was to prove that our separate NTLMSSP client library actually
implements NTLMSSP signing and sealing as per Microsoft's NTLMv1 implementation,
in the hope that knowing this will assist us in correctly implementing
NTLMSSP signing for SMB packets.  (Still not yet functional)

This patch replaces the NTLMSSP implementation in rpc_client/cli_pipe.c with
calls to libsmb/ntlmssp.c.  In the process, we have gained the ability to
use the more secure NT password, and the ability to sign-only, instead of
having to seal the pipe connection.  (Previously we were limited to sealing,
and could only use the LM-password derived key).

Our new client-side NTLMSSP code also needed alteration to cope with our
comparatively simple server-side implementation.  A future step is to replace
it with calls to the same NTLMSSP library.

Also included in this patch is the schannel 'sign only' patch I submitted to
the team earlier.  While not enabled (and not functional, at this stage) the
work in this patch makes the code paths *much* easier to follow.  I have also
included similar hooks in rpccleint to allow the use of schannel on *any* pipe.

rpcclient now defaults to not using schannel (or any other extra per-pipe
authenticiation) for any connection.  The 'schannel' command enables schannel
for all pipes until disabled.

This code is also much more secure than the previous code, as changes to our
cli_pipe routines ensure that the authentication footer cannot be removed
by an attacker, and more error states are correctly handled.

(The same needs to be done to our server)

Andrew Bartlett
0001-01-01 00:00:00 +00:00
Jeremy Allison
ff222716a0 Removed strupper/strlower macros that automatically map to strupper_m/strlower_m.
I really want people to think about when they're using multibyte strings.
Jeremy.
0001-01-01 00:00:00 +00:00
Volker Lendecke
e5664adc07 Fix for bug#3. Show comments when doing 'net group -l'.
Volker
0001-01-01 00:00:00 +00:00
Jeremy Allison
bc215612cb Add some basic DEBUG statements at level 10 so we can see what is being
called. This is *essential* (and should be done on all the other cli_XX
rpc calls) to help debug winbindd problems remotely.
Jeremy.
0001-01-01 00:00:00 +00:00
Tim Potter
dd063a298f Merge: clarify secure channel connection comment. 0001-01-01 00:00:00 +00:00
Tim Potter
5cb9b99f0f Clarify a comment: The secure channel connection must be opened on the
same session (TCP connection) as the one the challenge was requested
from.
0001-01-01 00:00:00 +00:00
Tim Potter
a8c11e8556 Fix two bugs that were stopping net rpc vampire from working over secure
channel:

  - If the domain name passed to create_rpc_bind_req() is empty, use
    lp_workgroup()

  - Correctly set the auth_padding field when the send_size is a multiple
    of 8 bytes

I've tested with nt4sp6 and win2ksp0 and it seems to work, although
there are no password hashes transferred from win2k.  The empty
passwords are being protected by the secure channel encryption though.
0001-01-01 00:00:00 +00:00
Volker Lendecke
8de04fcf68 Ok, this is a hack. On a netsec bind reply I did not see anything
useful in the auth verifier yet. So this patch ignores it.

Really checking this would be a lot more intrusive: in rpc_api_pipe we
would have to distinguish between binds and normal requests, or have
more state in the netsec info of cli_state, which is also somewhat
hackish.

Volker
0001-01-01 00:00:00 +00:00
Volker Lendecke
5b3cb7725a This puts real netlogon connection caching to winbind. This becomes
important once we start doing schannel, as there would be a lot more
roundtrips for the second PIPE open and bind. With this patch logging
in to a member server is a matter of two (three if you count the
ack...) packets between us and the DC.

Volker
0001-01-01 00:00:00 +00:00
Andrew Bartlett
97bc047434 Always initialise this - it helps callers who use this in a loop...
Andrew Bartlett
0001-01-01 00:00:00 +00:00
Andrew Bartlett
542a8b1817 Turn down some DEBUG()s and remove some duplicate code spotted by dfenwick.
Andrew Bartlett
0001-01-01 00:00:00 +00:00
Jeremy Allison
30512b7d3e Fixes from Ronan Waide <waider@waider.ie> for large RPC writes.
Jeremy.
0001-01-01 00:00:00 +00:00
Jeremy Allison
a330bf170e Fixes from Ronan Waide <waider@waider.ie> for large RPC writes.
Jeremy.
0001-01-01 00:00:00 +00:00
Tim Potter
aa748e1da5 Minor cleanup of enum domain groups/aliases:
- return NT_STATUS_NO_MEMORY instead of NT_STATUS_UNSUCESSFUL if a
      talloc fails

  - don't try and tallocate memory when the number of entries returned was
    zero

  - rename some cut&pasted variable names in enum domain aliases function
0001-01-01 00:00:00 +00:00
Tim Potter
cb94b2b2d1 Minor cleanup of enum domain groups/aliases:
- return NT_STATUS_NO_MEMORY instead of NT_STATUS_UNSUCESSFUL if a
    talloc fails

  - don't try and tallocate memory when the number of entries returned was
    zero

  - rename some cut&pasted variable names in enum domain aliases function
0001-01-01 00:00:00 +00:00
Andrew Bartlett
f200a5b858 Merge from HEAD - always initailise this to zero - helps callers in loops. 0001-01-01 00:00:00 +00:00
Andrew Bartlett
6da9fd157b Always initialise this, to assist callers doing loops over this call.
Andrew Bartlett
0001-01-01 00:00:00 +00:00
Andrew Bartlett
876e00fd11 Merge from HEAD - save the type of channel used to contact the DC.
This allows us to join as a BDC, without appearing on the network as one
until we have the database replicated, and the admin changes the configuration.

This also change the SID retreval order from secrets.tdb, so we no longer
require a 'net rpc getsid' - the sid fetch during the domain join is sufficient.
Also minor fixes to 'net'.

Andrew Bartlett
0001-01-01 00:00:00 +00:00
Jeremy Allison
942fede9a5 Fixes for multi-PDU schannel - based on Volker's code. This code needs
tidying up. Samsync still doesn't work due to bad parsing of net_io_sam_alias_info
with a blank description. Still working on this....
Jeremy.
0001-01-01 00:00:00 +00:00
Jeremy Allison
ec82e8e9f4 Fixes to make SCHANNEL work against a W2K DC. Still need to fix
multi-PDU encode/decode with SCHANNEL. Also need to test against WNT DC.
Jeremy.
0001-01-01 00:00:00 +00:00
Jeremy Allison
ff66d40970 Fixes to make SCHANNEL work in 3.0 against a W2K DC. Still need to fix
multi-PDU encode/decode with SCHANNEL. Also need to test against WNT DC.
Jeremy.
0001-01-01 00:00:00 +00:00
Andrew Bartlett
6e6b7b79ed Store the type of 'sec channel' that we establish to the DC. If we are a
workstation, we have to use the workstation type, if we have a BDC account,
we must use the BDC type - even if we are pretending to be a workstation
at the moment.

Also actually store and retreive the last change time, so we can do
periodic password changes again (for RPC at least).

And finally, a couple of minor fixes to 'net'.

Andrew Bartlett
0001-01-01 00:00:00 +00:00
Tim Potter
dfa9412da5 Merge: remove unused variables. 0001-01-01 00:00:00 +00:00
Tim Potter
800b79e836 Merge: incorrect arg to debug. 0001-01-01 00:00:00 +00:00
Tim Potter
27a608d6a3 Removed unused variables. 0001-01-01 00:00:00 +00:00
Tim Potter
a4704754d9 Fixed incorrect argument to debug. 0001-01-01 00:00:00 +00:00
Tim Potter
5b1807dddf Merge of samr lookup domain rpc client call from HEAD. 0001-01-01 00:00:00 +00:00
cvs2svn Import User
381649916e This commit was manufactured by cvs2svn to create branch 'SAMBA_3_0'. 0001-01-01 00:00:00 +00:00
Tim Potter
4ccd34ef83 A new RPC pipe! The \pipe\echo named pipe is for testing large RPC
requests and responses and is only compiled in when --enable-developer
is passed to configure.  It includes server and client side code for
generating and responding to functions on this pipe.  The functions are:

 - AddOne: add one to the uint32 argument and return ig
 - EchoData: echo back a variable sized char array to the caller
 - SourceData: request a variable sized char array
 - SinkData: send a variable sized char array and throw it away

There's a win32 implementation of the client and server in the
junkcode CVS repository in the rpcecho-win32 subdirectory.
0001-01-01 00:00:00 +00:00
Volker Lendecke
eaef0d8aef This is the netlogon schannel client code. Try a
rpcclient -S pdc -U% -c "samlogon user password"

and it should work with the schannel. Needs testing against platforms
different from NT4SP6.

Volker
0001-01-01 00:00:00 +00:00
Volker Lendecke
ecd0ee4d24 This is the netlogon schannel client code. Try a
rpcclient -S pdc -U% -c "samlogon user password"

and it should work with the schannel. Needs testing platforms
different from NT4SP6.

Volker
0001-01-01 00:00:00 +00:00
Volker Lendecke
1e03e95545 Auth2, not also Auth3 sends us flags back, although all the callers
ignore it.

Volker
0001-01-01 00:00:00 +00:00
Volker Lendecke
6ac6b0f4c0 Auth2, not also Auth3 sends us flags back, although all the callers
ignore it.

Volker
0001-01-01 00:00:00 +00:00
Tim Potter
67bc6bccc2 SAMR lookupdomain rpc client patches from amber palekar <amber@nu3.net> 0001-01-01 00:00:00 +00:00
Andrew Bartlett
ec071ca3dc (merge from HEAD)
NTLM Authentication:

- Add a 'privileged' mode to Winbindd.  This is achieved by means of a directory
  under lockdir, that the admin can change the group access for.

- This mode is now required to access with 'CRAP' authentication feature.
- This *will* break the current SQUID helper, so I've fixed up our ntlm_auth
  replacement:
 - Update our NTLMSSP code to cope with 'datagram' mode, where we don't get a
   challenge.
 - Use this to make our ntlm_auth utility suitable for use in current Squid 2.5
   servers.
 - Tested - works for Win2k clients, but not Win9X at present.  NTLMSSP updates
   are needed.
 - Now uses fgets(), not x_fgets() to cope with Squid environment (I think
   somthing to do with non-blocking stdin).

- Add much more robust connection code to wb_common.c - it will not connect to
  a server of a different protocol version, and it will automatically try and
  reconnect to the 'privileged' pipe if possible.
  - This could help with 'privileged' idmap operations etc in future.

- Add a generic HEX encode routine to util_str.c,
- fix a small line of dodgy C in StrnCpy_fn()

- Correctly pull our 'session key' out of the info3 from th the DC.  This is
  used in both the auth code, and in for export over the winbind pipe to
  ntlm_auth.

- Given the user's challenge/response and access to the privileged pipe,
  allow external access to the 'session key'.  To be used for MSCHAPv2
  integration.

Andrew Bartlett
0001-01-01 00:00:00 +00:00
Andrew Bartlett
dcdc75ebd8 NTLM Authentication:
- Add a 'privileged' mode to Winbindd.  This is achieved by means of a directory
  under lockdir, that the admin can change the group access for.

- This mode is now required to access with 'CRAP' authentication feature.
- This *will* break the current SQUID helper, so I've fixed up our ntlm_auth
  replacement:
 - Update our NTLMSSP code to cope with 'datagram' mode, where we don't get a
   challenge.
 - Use this to make our ntlm_auth utility suitable for use in current Squid 2.5
   servers.
 - Tested - works for Win2k clients, but not Win9X at present.  NTLMSSP updates
   are needed.
 - Now uses fgets(), not x_fgets() to cope with Squid environment (I think
   somthing to do with non-blocking stdin).

- Add much more robust connection code to wb_common.c - it will not connect to
  a server of a different protocol version, and it will automatically try and
  reconnect to the 'privileged' pipe if possible.
  - This could help with 'privileged' idmap operations etc in future.

- Add a generic HEX encode routine to util_str.c,
- fix a small line of dodgy C in StrnCpy_fn()

- Correctly pull our 'session key' out of the info3 from th the DC.  This is
  used in both the auth code, and in for export over the winbind pipe to
  ntlm_auth.

- Given the user's challenge/response and access to the privileged pipe,
  allow external access to the 'session key'.  To be used for MSCHAPv2
  integration.

Andrew Bartlett
0001-01-01 00:00:00 +00:00
cvs2svn Import User
f0d009c3e9 This commit was manufactured by cvs2svn to create branch 'SAMBA_3_0'. 0001-01-01 00:00:00 +00:00
Martin Pool
8d64419625 Ignore .po and .po32 files. 0001-01-01 00:00:00 +00:00
Tim Potter
c2e9673328 Merge of exit path cleanup for EnumDomainUsers. 0001-01-01 00:00:00 +00:00
Tim Potter
a20aba0999 Merge: const fixes. 0001-01-01 00:00:00 +00:00
Tim Potter
018733eedd More const fixes and flow on fixes from yesterday's const-fest. 0001-01-01 00:00:00 +00:00
Tim Potter
655c1e0351 Merge:
> Exit path cleanup for cli_samr_enum_dom_users()
0001-01-01 00:00:00 +00:00
Tim Potter
0bc1dfc68b Exit path cleanup for cli_samr_enum_dom_users() 0001-01-01 00:00:00 +00:00
Tim Potter
7edaf93796 Merge NTSTATUS vs WERROR return for cli_srvsvc_net_srv_get_info() 0001-01-01 00:00:00 +00:00
Tim Potter
619af61644 Return a WERROR instead of a NTSTATUS like the rest of the srvsvc
rpc calls.
0001-01-01 00:00:00 +00:00
Jeremy Allison
4c3ee228fc Ensure that only parse_prs.c access internal members of the prs_struct.
Needed to move to disk based i/o later.
Jeremy.
0001-01-01 00:00:00 +00:00
Jeremy Allison
a823fee5b4 Ensure that only parse_prs.c access internal members of the prs_struct.
Needed to move to disk based i/o later.
Jeremy.
0001-01-01 00:00:00 +00:00
Andrew Tridgell
f4f1f84a6b initial server side privileges implementation, using a tdb. This needs to be hooked into pdb, and we need some access control on changing privileges. That's next 0001-01-01 00:00:00 +00:00
Andrew Tridgell
3ddb5fb0dd added the 'lsaenumacctwithright' command to rpcclient. This allows you
to lookup what SIDs have a particular privilege (that is how
privileges are stored).
0001-01-01 00:00:00 +00:00
Andrew Bartlett
013fa87473 One more signed/unsigned fix 0001-01-01 00:00:00 +00:00
Jeremy Allison
1e752b48a1 Merge tpot's changes to request the correct sizes for user dispinfo
from HEAD. I had to do this for him as he was *so* tired, the poor
chap, plus he has this bad leg, plus the dog ate his homework etc. etc.
Jeremy.
0001-01-01 00:00:00 +00:00
Tim Potter
2eea2813d9 Pass down max_size parameter to cli_samr_query_dispinfo() instead of
using a hardcoded value later on.

Added a helper function that returns the observed values for
max_entries and max_size for each cli_samr_query_dispinfo() call.
These values were obtained from watching the NT4 user manager
application with ethereal and are the only ones that can enumerate a
60k user domain reliably under Windows 2000.
0001-01-01 00:00:00 +00:00
Jeremy Allison
49739be1e2 Merge tridge's client priv code from HEAD.
Jeremy
0001-01-01 00:00:00 +00:00
Andrew Tridgell
bf99440398 added LsaRemoveAccountRights
this now gives us complete remove privileges control in the client
libs, so we are in good shape for starting on the server side.
0001-01-01 00:00:00 +00:00
Jeremy Allison
30a33920b4 Merging tridge's privillage client changes from HEAD.
Jeremy.
0001-01-01 00:00:00 +00:00
Andrew Tridgell
2e5e659e09 cleaned up the lsa_enum_acct_rights function and added a
lsa_add_acct_rights function.

This allows us to add privileges remotely to accounts using rpcclient.
0001-01-01 00:00:00 +00:00
Tim Potter
648307ab3d Merge: remove dead function. 0001-01-01 00:00:00 +00:00
Andrew Tridgell
e3d00fa47d reverted this patch till I sort out the craziness with UNIHDR 0001-01-01 00:00:00 +00:00
Andrew Tridgell
b9eff31b14 This removes the 3rd argument from init_unistr2(). There were 240
calls to init_unistr2() in the code and every one of them got the 3rd
argument incorrect, so I thought it best just to remove the argument.

The incorrect usage was caused by callers using strlen() to determine
the length of the string. The 3rd argument to init_unistr2() was
supposed to be the character length, not the byte length of the
string, so for non-english this could come out wrong.

I also removed the bogus 'always allocate at least 256 bytes'
hack. There may be some code that relies on this, but if there is then
the code is broken and needs fixing.
0001-01-01 00:00:00 +00:00
Tim Potter
a1c790b5ea Let's clean up client side ntlmssp!
Removed a dead function.
0001-01-01 00:00:00 +00:00
Gerald Carter
7a4c874842 merging some rpcclient and net functionality from HEAD 0001-01-01 00:00:00 +00:00
Andrew Tridgell
65bac11d71 added cli_lsa_enum_account_rights() call. Note that this is in
principal similar to the existing cli_lsa_enum_privsaccount() call,
except that cli_lsa_enum_account_rights() doesn't require a call to
open_account first. There is also the minor matter that
cli_lsa_enum_account_rights() works whereas
cli_lsa_enum_privsaccount() doesn't!

this call can be used to find what privileges an account or group
has. This is a first step towards proper privileges support in Samba.
0001-01-01 00:00:00 +00:00
Tim Potter
056bdfbce7 Added comment about a SMB_ASSERT() 0001-01-01 00:00:00 +00:00
Richard Sharpe
9a38e37811 Make sure that those cleanups actually went in. 0001-01-01 00:00:00 +00:00
Richard Sharpe
fd847aa936 Now that I am running config.developer, I decided to get rif of some warnings:
1. reboot in parse_reg and cli_reg was shadowing a definition on FreeBSD
   4.3 from system includes.

2. Added a bit of const to places.

3. Made sure internal functions were declared where needed.
0001-01-01 00:00:00 +00:00
Gerald Carter
f8a915b14d [merge] make sure to update print queue cache during timeout_processing() to send notify events; CR 1491 0001-01-01 00:00:00 +00:00
Gerald Carter
142c5029c7 [merge] make sure to updatre print queue cache during timeout_processing() to send notify events; CR 1491 0001-01-01 00:00:00 +00:00
Andrew Bartlett
a4f7777ca0 Merge from HEAD - idra's fix for the fact that the shutdown command takes two 1
byte boolean flags, not a 16 bit bitmask.

Andrew Bartlett
0001-01-01 00:00:00 +00:00
Andrew Bartlett
3a7458f947 Merge from HEAD - make Samba compile with -Wwrite-strings without additional
warnings.  (Adds a lot of const).

Andrew Bartlett
0001-01-01 00:00:00 +00:00
Andrew Bartlett
92a777d0ea BIG patch...
This patch makes Samba compile cleanly with -Wwrite-strings.
 - That is, all string literals are marked as 'const'.  These strings are
always read only, this just marks them as such for passing to other functions.

What is most supprising is that I didn't need to change more than a few lines of code (all
in 'net', which got a small cleanup of net.h and extern variables).  The rest
is just adding a lot of 'const'.

As far as I can tell, I have not added any new warnings - apart from making all
of tdbutil.c's function const (so they warn for adding that const string to
struct).

Andrew Bartlett
0001-01-01 00:00:00 +00:00
Simo Sorce
c5892b656d the shutdown call does not have a 16 bit flags, but 2 byte representing booleans
this commit change the structure and code to reflect this

some test revelead I'm right.

some other revelead currently the abort shutdown does not work against my test machine even if it returns successfully ... need investigation
0001-01-01 00:00:00 +00:00
Simo Sorce
ea2154b269 fix rpcclient querygroup command (from 2.2 and head) 0001-01-01 00:00:00 +00:00
Simo Sorce
8877ff2482 make querygroup in rpcclient working, same fix as per 2.2 tree 0001-01-01 00:00:00 +00:00
Jeremy Allison
ddd7099595 Ensure callid is not used uninitialized.
Jeremy.
0001-01-01 00:00:00 +00:00
Gerald Carter
481a8a8aa9 fix cli_ds_getprimarydominfo(); merge from SAMBA_3_0 0001-01-01 00:00:00 +00:00
Gerald Carter
e6184bbd8f * finializnig RedHat package for alpha21 release
* fix cli_ds_getprimarydominfo() (bad memcpy() )
0001-01-01 00:00:00 +00:00
Tim Potter
e643003dd4 Merge from appliance:
>Fix memory leak in cli_ds_getprimarydominfo()
0001-01-01 00:00:00 +00:00
Tim Potter
ca689916da Merge from appliance:
>Fix memory leak in cli_ds_getprimarydominfo()
0001-01-01 00:00:00 +00:00
Tim Potter
fdce4be719 A cool idea from mbp: create a big shared library of all Samba objects
which we can use to link against Samba unit test programs.  Now we can
compile and link unit tests without having to create 4MB executables
for each program

It's called libbigballofmud.so both to discourage casual usage and
also to reflect what the dependencies within Samba have become.
0001-01-01 00:00:00 +00:00
Jeremy Allison
f755711df8 Removed global_myworkgroup, global_myname, global_myscope. Added liberal
dashes of const. This is a rather large check-in, some things may break.
It does compile though :-).
Jeremy.
0001-01-01 00:00:00 +00:00
Jeremy Allison
82b8f749a3 Removed global_myworkgroup, global_myname, global_myscope. Added liberal
dashes of const. This is a rather large check-in, some things may break.
It does compile though :-).
Jeremy.
0001-01-01 00:00:00 +00:00
Jim McDonough
f6e21ba4c7 Sync with HEAD to get enumprinterkey api. 0001-01-01 00:00:00 +00:00
Jeremy Allison
121c456d43 Merge Jim's new rpc client code to 3.0.
Jeremy.
0001-01-01 00:00:00 +00:00
Jim McDonough
1fd6d34526 What is wrong with you, Jim? Check in the final version, not an interim one... 0001-01-01 00:00:00 +00:00
Jim McDonough
d423e6424b Allow multiple fragment RPC's to be sent. 0001-01-01 00:00:00 +00:00
Jeremy Allison
10024ed06e Merge of scalable printing code fix... Needs testing.
Also tidied up some of Richard's code (I don't think he uses the compiler
flags -g -Wall -Wshadow -Wstrict-prototypes -Wpointer-arith -Wcast-qual like
I do :-) :-).
Jeremy.
0001-01-01 00:00:00 +00:00
Jeremy Allison
d030df7643 Merge of scalable printing code fix... Needs testing.
Jeremy.
0001-01-01 00:00:00 +00:00
Tim Potter
f56ce473b6 Client side functions for enumprinterkey. 0001-01-01 00:00:00 +00:00
Tim Potter
62ab0f8cbe Display pipe name in rpc bind failure debug. 0001-01-01 00:00:00 +00:00
Tim Potter
70838b33a6 Display pipe name in rpc bind failure debug. 0001-01-01 00:00:00 +00:00
Tim Potter
bd64de3716 Tidyup of some DCERPC pipe connection debugs. The new LSA_DS stuff
generates some errors we haven't seen before which are inappropriately
logged at level 0.
0001-01-01 00:00:00 +00:00
Tim Potter
40d5112048 Tidyup of some DCERPC pipe connection debugs. The new LSA_DS stuff
generates some errors we haven't seen before which are inappropriately
logged at level 0.
0001-01-01 00:00:00 +00:00
Tim Potter
41a22b3a00 Fix a silly memset typo.
Change a int* to a uint32* in the cli_spoolss_enum_ports() function.
0001-01-01 00:00:00 +00:00
Tim Potter
4663d79d3e Fix a silly memset typo.
Change a int* to a uint32* in the cli_spoolss_enum_ports() function.
0001-01-01 00:00:00 +00:00
Tim Potter
e28a719f04 Zero tallocated memory in decode_printer_info, decode_driver_info,
decode_port_info and decode_printerdriver functions.
0001-01-01 00:00:00 +00:00
Tim Potter
bf2d9dd5ba Zero tallocated memory in decode_printer_info, decode_driver_info,
decode_port_info and decode_printerdriver functions.
0001-01-01 00:00:00 +00:00
Tim Potter
1094e1ffde Merge of SMB_ASSERT. 0001-01-01 00:00:00 +00:00
Tim Potter
b5111f47b5 Do a SMB_ASSERT() in cli_nt_session_open() when the pipe index is out
of range instead of silently failing.
0001-01-01 00:00:00 +00:00
Gerald Carter
09c6f6329d merge from APP_HEAD of winbindd's domain local group fix 0001-01-01 00:00:00 +00:00
Gerald Carter
764b58e2c0 merge from APP_HEAD
* s/driverlocation/comment
* detect native mode domain and enumerate local groups

Also

* Added sendfile stats from SAMBA_2_2
0001-01-01 00:00:00 +00:00
Gerald Carter
29159c9737 * merge native_mode flag in winbindd_domain struct from app-head
* add some files missing from a previous commit
0001-01-01 00:00:00 +00:00
Gerald Carter
dd948a302a merge native_mode flag in winbindd_domain struct from app-head 0001-01-01 00:00:00 +00:00
Gerald Carter
028477e352 merge of working dsrolegetprimdominfo() client code from APP_HEAD 0001-01-01 00:00:00 +00:00
cvs2svn Import User
7950dfc795 This commit was manufactured by cvs2svn to create branch 'SAMBA_3_0'. 0001-01-01 00:00:00 +00:00
Gerald Carter
f70caa25e4 merge of working dsrolegetprimdominfo() client code from APP_HEAD 0001-01-01 00:00:00 +00:00
Gerald Carter
1cfd2ee433 merge of new client side support the Win2k LSARPC UUID in rpcbind
from APP_HEAD
0001-01-01 00:00:00 +00:00
Gerald Carter
38c9e42998 merge of new client side support the Win2k LSARPC UUID in rpcbind
from APP_HEAD
0001-01-01 00:00:00 +00:00
Gerald Carter
9d9f7bbf87 remove files not in HEAD 0001-01-01 00:00:00 +00:00
Gerald Carter
65e7b5273b sync'ing up for 3.0alpha20 release 0001-01-01 00:00:00 +00:00
Gerald Carter
b5227f0a64 change notify merge from APP_HEAD 0001-01-01 00:00:00 +00:00
Tim Potter
d30da51956 Return WERR_UNKNOWN_LEVEL for unknown info levels. 0001-01-01 00:00:00 +00:00
Tim Potter
1338f623c2 Return WERR_UNKNOWN_LEVEL for getprinterdriver level 6 as we don't
know how to decode a printer driver into a DRIVER_INFO_6 structure.
0001-01-01 00:00:00 +00:00
Tim Potter
0379a32d82 cli_spoolss_enumprinterdrivers:
Return WERR_UNKNOWN_LEVEL if we can't decode the returned buffer.
0001-01-01 00:00:00 +00:00
Tim Potter
f0c6303beb Conver cli_spoolss routines to use REGISTRY_VALUE and REGVAL_CTR code. Nice one jerry!
(Hey I thought I checked this in already?)
0001-01-01 00:00:00 +00:00
Tim Potter
f7641c8fd1 Change JOB_INFO_CTR to return a pointer to an array rather than array of pointers.
Implemented client function for deleteprinterdataex.
0001-01-01 00:00:00 +00:00
Tim Potter
1f629aa54e Return data from enumprinterdataex by deep copying on passed in tdb context. 0001-01-01 00:00:00 +00:00
Tim Potter
62a6078253 Implemented some more client side spoolss functions:
- getprinterdataex(), setprinterdataex(), enumprinterdataex()

Pass data type down to setprinterdata() fn instead of hardcoding REG_SZ
0001-01-01 00:00:00 +00:00
Jean-François Micouleau
4d38caca40 added cli_net_auth_3 client code.
changed cli_nt_setup_creds() to call cli_net_auth_2 or cli_net_auth_3 based on a switch.
pass also the negociation flags all the way.
all the places calling cli_nt_setup_creds() are still using cli_net_aut2(), it's just for future use and for rpcclient.

in the future we will be able to call auth_2 or auth_3 as we want.

	J.F.
0001-01-01 00:00:00 +00:00
Tim Potter
e09007dd5d Don't try to convert enumprinters name to a unc name. 0001-01-01 00:00:00 +00:00
Tim Potter
d6b10fe969 Pass the object name down to the enum_printers rpc. By default this is the
server name and everything works as advertised.  See the MSDN doco for details.
0001-01-01 00:00:00 +00:00
Tim Potter
b8dba26978 Moved calculation of secure channel type into a new function. 0001-01-01 00:00:00 +00:00
Andrew Tridgell
e4cb106d2e added a 'net rpc samdump' command for dumping the whole sam via
samsync operations (as a BDC)
0001-01-01 00:00:00 +00:00
Shirish Kalele
b0bd42c946 The "max data count" value in SMB transacts indicates how much the other end can
send us. As it stands, we incorrectly set it to the number of bytes we are
sending. Correcting this by setting a static value of 1024 (This could even be
something larger). Improves RPC client performance.
0001-01-01 00:00:00 +00:00
Jelmer Vernooij
3823a2ff5a Sync 3.0 branch with HEAD 0001-01-01 00:00:00 +00:00
cvs2svn Import User
6938b5b98a This commit was manufactured by cvs2svn to create branch 'SAMBA_3_0'. 0001-01-01 00:00:00 +00:00
Jim McDonough
c3b05b21a0 Add lsa 0x2e (queryinfo2) client side 0001-01-01 00:00:00 +00:00
Jim McDonough
ed2370b91f Add client side support for samr connect4 (0x3e). Seems to have one
additional parm compared to samr connect, but I've only seen 0x00000002
in that field...
0001-01-01 00:00:00 +00:00
Tim Potter
fe43c2ac2d Merge of incomplete rffpcnex testing code from APPLIANCE_HEAD. 0001-01-01 00:00:00 +00:00
Andrew Tridgell
e358d7b24c This fixes a number of ADS problems, particularly with netbiosless
setups.

- split up the ads structure into logical pieces. This makes it much
  easier to keep things like the authentication realm and the server
  realm separate (they can be different).

- allow ads callers to specify that no sasl bind should be performed
(used by "net ads info" for example)

- fix an error with handing ADS_ERROR_SYSTEM() when errno is 0

- completely rewrote the code for finding the LDAP server. Now try DNS
  methods first, and try all DNS servers returned from the SRV DNS
  query, sorted by closeness to our interfaces (using the same sort code
  as we use in replies from WINS servers). This allows us to cope with
  ADS DCs that are down, and ensures we don't pick one that is on the
  other side of the country unless absolutely necessary.

- recognise dnsRecords as binary when displaying them

- cope with the realm not being configured in smb.conf (work it out
  from the LDAP server)

- look at the trustDirection when looking up trusted domains and don't
  include trusts that trust our domains but we don't trust
  theirs.

- use LDAP to query the alternate (netbios) name for a realm, and make
  sure that both and long and short forms of the name are accepted by
  winbindd. Use the short form by default for listing users/groups.

- rescan the list of trusted domains every 5 minutes in case new trust
  relationships are added while winbindd is running

- include transient trust relationships (ie. C trusts B, B trusts A,
  so C trusts A) in winbindd.

- don't do a gratuituous node status lookup when finding an ADS DC (we
  don't need it and it could fail)

- remove unused sid_to_distinguished_name function

- make sure we find the allternate name of our primary domain when
  operating with a netbiosless ADS DC (using LDAP to do the lookup)

- fixed the rpc trusted domain enumeration to support up to approx
  2000 trusted domains (the old limit was 3)

- use the IP for the remote_machine (%m) macro when the client doesn't
  supply us with a name via a netbios session request (eg. port 445)

- if the client uses SPNEGO then use the machine name from the SPNEGO
  auth packet for remote_machine (%m) macro

- add new 'net ads workgroup' command to find the netbios workgroup
  name for a realm
0001-01-01 00:00:00 +00:00
Tim Potter
cb946b5dad Moved rpc client routines from libsmb back to rpc_client where they belong. 0001-01-01 00:00:00 +00:00
Andrew Tridgell
03ac082dcb updated the 3.0 branch from the head branch - ready for alpha18 0001-01-01 00:00:00 +00:00
Jeremy Allison
3603cd4947 Proper merge of all the working printing stuff from APPLIANCE_HEAD.
Now let's keep this in sync !
Jeremy.
0001-01-01 00:00:00 +00:00
Simo Sorce
897e64d2e0 more debug classess activated 0001-01-01 00:00:00 +00:00
Jim McDonough
18854bcd2d Add user name to netsessenum RPC to stop 1783 messages 0001-01-01 00:00:00 +00:00
Jeremy Allison
3c05f7c06f More cleanup work preparing for SMB signing.
Jeremy.
0001-01-01 00:00:00 +00:00
Tim Potter
ca61f68d5c Cleaned up srvsvc constants a bit. 0001-01-01 00:00:00 +00:00
Andrew Bartlett
00ef4aad88 Remove unused files.
The size of samba going down for once :-)

Andrew Bartlett
0001-01-01 00:00:00 +00:00
Gerald Carter
32dc5dbbfb WERROR merge from SAMBA_2_2 0001-01-01 00:00:00 +00:00
Tim Potter
1f007d3ed4 Renamed get_nt_error_msg() to nt_errstr(). 0001-01-01 00:00:00 +00:00
Gerald Carter
5760315c1d syncing up printing code with SAMBA_2_2 (already done some merges
in the reverse).

  * add in new printer change notify code from SAMBA_2_2

  * add in se_map_standard() from 2.2 in _spoolss_open_printer_ex()

  * sync up the _print_queue_struct in smb.h (why did someone change the
    user/file names in fs_user/fs_file (or vice-versa) ? )

  * sync up some cli_spoolss_XXX functions
0001-01-01 00:00:00 +00:00
Gerald Carter
50fa21c995 merge from 2.2 0001-01-01 00:00:00 +00:00
Tim Potter
6a58c9bd06 Removed version number from file header.
Changed "SMB/Netbios" to "SMB/CIFS" in file header.
0001-01-01 00:00:00 +00:00
Martin Pool
92a3ab274e Add prs_dump_before to dump everything from the start of the prs
buffer up to the current position, and use this to dump pipe buffers
just before parsing.
0001-01-01 00:00:00 +00:00
Martin Pool
93fadcd111 Also capture received data 0001-01-01 00:00:00 +00:00
Martin Pool
9973b22b34 struct cli_state remembers the pipe name that it's talking to, if any,
so that we can print it in later debug messages.

Call prs_dump to dump out requests sent by the client at sufficiently
high debug levels.
0001-01-01 00:00:00 +00:00
Andrew Bartlett
d870edce76 A farily large commit:
- Move rpc_client/cli_trust.c to smbd/change_trust_pw.c
  - It hasn't been used by anything else since smbpasswd lost its -j

 - Add a TALLOC_CTX to the auth subsytem.  These are only valid for the length
   of the calls to the individual modules, if you want a longer context hide it
   in your private data.

   Similarly, all returns (like the server_info) should still be malloced.

 - Move the 'ntdomain' module (security=domain in oldspeak) over to use the new
   libsmb domain logon code.  Also rework much of the code to use some better
   helper functions for the connection - getting us much better error returns
   (the new code is NTSTATUS).

   The only remaining thing to do is to figure out if tpot's 0xdead 0xbeef for
   the LUID feilds is sufficient, or if we should do random LUIDs as per the old
   code.

   Similarly, I'll move winbind over to this when I get a chance.

This leaves the SPOOLSS code and some cli_pipe code as the only stuff still in
rpc_client, at least as far as smbd is concerned.

While I've given this a basic rundown, any testing is as always appriciated.

Andrew Bartlett
0001-01-01 00:00:00 +00:00
Andrew Tridgell
435fdf276a added internal sasl/gssapi code. This means we are no longer dependent on cyrus-sasl which makes the code much less fragile. Also added code to auto-determine the server name or realm 0001-01-01 00:00:00 +00:00
Andrew Bartlett
575897e879 OK. Smbpasswd -j is DEAD.
This moves the rest of the functionality into the 'net rpc join' code.

Futhermore, this moves that entire area over to the libsmb codebase, rather
than the crufty old rpc_client stuff.

I have also fixed up the smbpasswd -a -m bug in the process.

We also have a new 'net rpc changetrustpw' that can be called from a
cron-job to regularly change the trust account password, for sites
that run winbind but not smbd.

With a little more work, we can kill rpc_client from smbd entirly!
(It is mostly the domain auth stuff - which I can rework - and the
spoolss stuff that sombody else will need to look over).

Andrew Bartlett
0001-01-01 00:00:00 +00:00
Tim Potter
4215048f7b I think the lookup_pdc_name() should be called lookup_dc_name() and the
name_status_find() call here should look up a #1c name instead of #1d.
This fixes some bugs currently with BDC authentication in winbindd and in
smbd as you can't query the #1d name with the ip address of a BDC.

Who is Uncle Tom Cobbley anyway?
0001-01-01 00:00:00 +00:00
Andrew Bartlett
8d31eae52a This is another rather major change to the samba authenticaion
subystem.

The particular aim is to modularized the interface - so that we
can have arbitrary password back-ends.

This code adds one such back-end, a 'winbind' module to authenticate
against the winbind_auth_crap functionality.  While fully-functional
this code is mainly useful as a demonstration, because we don't get
back the info3 as we would for direct ntdomain authentication.

This commit introduced the new 'auth methods' parameter, in the
spirit of the 'auth order' discussed on the lists.  It is renamed
because not all the methods may be consulted, even if previous
methods fail - they may not have a suitable challenge for example.

Also, we have a 'local' authentication method, for old-style
'unix if plaintext, sam if encrypted' authentication and a
'guest' module to handle guest logins in a single place.

While this current design is not ideal, I feel that it does
provide a better infrastructure than the current design, and can
be built upon.

The following parameters have changed:
 - use rhosts =

  This has been replaced by the 'rhosts' authentication method,
 and can be specified like 'auth methods = guest rhosts'

 - hosts equiv =

  This needs both this parameter and an 'auth methods' entry
  to be effective.  (auth methods = guest hostsequiv ....)

 - plaintext to smbpasswd =

  This is replaced by specifying 'sam' rather than 'local'
  in the auth methods.

The security = parameter is unchanged, and now provides defaults
for the 'auth methods' parameter.

The available auth methods are:

guest
rhosts
hostsequiv
sam (passdb direct hash access)
unix (PAM, crypt() etc)
local (the combination of the above, based on encryption)
smbserver (old security=server)
ntdomain (old security=domain)
winbind (use winbind to cache DC connections)


Assistance in testing, or the production of new and interesting
authentication modules is always appreciated.

Andrew Bartlett
0001-01-01 00:00:00 +00:00
Jeremy Allison
6bf2505cce I *love* removing code :-). Removed 4 files that weren't being used.
All this stuff was being pulled in due to *one* unneeded call to
fetch a domain SID which smbpasswd already puts in the database...
Jeremy.
0001-01-01 00:00:00 +00:00
Tim Potter
5c3521c937 Removed duplicate debug. 0001-01-01 00:00:00 +00:00
Jeremy Allison
ee5e7ca547 Added NT_USER_TOKEN into server_info to fix extra groups problem.
Got "medieval on our ass" about const warnings (as many as I could :-).
Jeremy.
0001-01-01 00:00:00 +00:00
Andrew Bartlett
f70fb819b2 This is a farily large patch (3300 lines) and reworks most of the AuthRewrite
code.

In particular this assists tpot in some of his work, becouse it provides the
connection between the authenticaion and the vuid generation.

Major Changes:
	- Fully malloc'ed structures.
	  - Massive rework of the code so that all structures are made and destroyed
	    using malloc and free, rather than hanging around on the stack.
	- SAM_ACCOUNT unix uids and gids are now pointers to the same, to allow them
	   to be declared 'invalid' without the chance that people might get ROOT by
	   default.

	- kill off some of the "DOMAIN\user" lookups.  These can be readded at a more
	  appropriate place (probably domain_client_validate.c) in the future. They
	  don't belong in session setups.

	- Massive introduction of DATA_BLOB structures, particularly for passwords.

	- Use NTLMSSP flags to tell the backend what its getting, rather than magic
	  lenghths.

	- Fix winbind back up again, but tpot is redoing this soon anyway.

	- Abstract much of the work in srv_netlog_nt back into auth helper functions.

This is a LARGE change, and any assistance is testing it is appriciated.

Domain logons are still broken (as far as I can tell) but other functionality
seems
intact.

Needs testing with a wide variety of MS clients.

Andrew Bartlett
0001-01-01 00:00:00 +00:00
Tim Potter
27cd7ac857 Don't accidentally return success when sending a broken NET_SAMLOGON
request.  This exposes a domain authentication bug with win2k where a rpc
fault is returned but not propagated up as an error.
0001-01-01 00:00:00 +00:00
Tim Potter
26fa0374bb Fixed typo in debug message. 0001-01-01 00:00:00 +00:00
Andrew Tridgell
5296b20ad8 the next step in the intl changeover. This should get us compiling agian,
and also completes the switch to lang_tdb.c. SWAT should now work
with a po file in the lib/ directory

also removed useless SYSLOG defines in many files
0001-01-01 00:00:00 +00:00
Tim Potter
2d0922b0ea Removed 'extern int DEBUGLEVEL' as it is now in the smb.h header. 0001-01-01 00:00:00 +00:00
Tim Potter
e0bdcbc599 Converted cli_net_auth2() and cli_nt_setup_creds() to return NTSTATUS. 0001-01-01 00:00:00 +00:00
Simo Sorce
549fe42bd4 move to SAFE_FREE() 0001-01-01 00:00:00 +00:00
Andrew Bartlett
7f04a139b2 Fix up workstaion and kickoff time checks, moved to auth_smbpasswd.c where
they can have general effect.

Fixed up workstaion support in the rest of samba, so that we can do these
checks.

Pass through the workstation for cli_net_logon(), if supplied.
0001-01-01 00:00:00 +00:00
Andrew Tridgell
dcd6e735f7 the next stage in the NTSTATUS/WERROR change. smbd and nmbd now compile, but the client code still needs some work 0001-01-01 00:00:00 +00:00
Andrew Tridgell
1d36250e33 converted another bunch of stuff to NTSTATUS 0001-01-01 00:00:00 +00:00
Tim Potter
031a19639c More status32 conversions. 0001-01-01 00:00:00 +00:00
Tim Potter
ea8c0a75af Fixed typo in debug message. 0001-01-01 00:00:00 +00:00
Tim Potter
7d5440a7ae Set secure channel type depending on server role. 0001-01-01 00:00:00 +00:00
Andrew Bartlett
ea1c547ac8 This patch does a number of things, mostly smaller than they look :-)
In particuar, it moves the domain_client_validate stuff out of
auth_domain.c to somwhere where they (I hope) they can be shared
with winbind better.  (This may need some work)

The main purpose of this patch was however to improve some of the
internal documentation and to correctly place become_root()/unbecome_root()
calls within the code.

Finally this patch moves some more of auth.c into other files, auth_unix.c
in this case.

Andrew Bartlett
0001-01-01 00:00:00 +00:00
Tim Potter
b196a52483 Use new client error api. 0001-01-01 00:00:00 +00:00
Tim Potter
688da3c41d Use the new client error api. 0001-01-01 00:00:00 +00:00
Tim Potter
589aaa5fb1 Removed nt_error field from cli_state as it was not used anywhere. 0001-01-01 00:00:00 +00:00
Andrew Bartlett
b30b6202f3 This is my 'Authentication Rewrite' version 1.01, mostly as submitted to
samba-technical a few weeks ago.

The idea here is to standardize the checking of user names and passwords,
thereby ensuring that all authtentications pass the same standards.  The
interface currently implemented in as

nt_status = check_password(user_info, server_info)

where user_info contains (mostly) the authentication data, and server_info
contains things like the user-id they got, and their resolved user name.

The current ugliness with the way the structures are created will be killed
the next revision, when they will be created and malloced by creator functions.

This patch also includes the first implementation of NTLMv2 in HEAD, but which
needs some more testing.  We also add a hack to allow plaintext passwords to be
compared with smbpasswd, not the system password database.

Finally, this patch probably reintroduces the PAM accounts bug we had in
2.2.0, I'll fix that once this hits the tree.  (I've just finished testing
it on a wide variety of platforms, so I want to get this patch in).
0001-01-01 00:00:00 +00:00
Tim Potter
2e33940360 Held a shoot-out between NT_STATUS_NO_PROBLEMO and NT_STATUS_NOPROBLEMO.
According to the incorruptible judges find and grep, the latter won.

Mmm - procrastination.  (-:
0001-01-01 00:00:00 +00:00
Andrew Bartlett
cf1d1cd9d6 This fixes security=domain, which has been broke since the big charset
changeover.  For my own sainity I have created a new function to fill out both
the header and buffer for a string in an RPC struct.  This DOES NOT take a
length argument, only the actual string to be placed.

The RPC code is currently littered with code that does init_uni_hdr() followed
immidiatly by init_unistr2(), and often the length argument is wrong.  (It was
for the code I changed, even before the charset stuff).  Another bug where we
made strings AT LEAST MAX_UNICODE_LEN long hid this bug.

This works for loopback connections to Samba, and can't be any more broke than
it was before :-).  (We had double and revese conversions, fun...).

In particular this makes us multibyte complient.

In any case, if there are no objections I will slowly convert other bits of
code to the same system.
0001-01-01 00:00:00 +00:00
Andrew Tridgell
c41fc06376 strchr and strrchr are macros when compiling with optimisation in gcc, so we can't redefine them. damn. 0001-01-01 00:00:00 +00:00
Andrew Tridgell
debb471267 The big character set handling changeover!
This commit gets rid of all our old codepage handling and replaces it with
iconv. All internal strings in Samba are now in "unix" charset, which may
be multi-byte. See internals.doc and my posting to samba-technical for
a more complete explanation.
0001-01-01 00:00:00 +00:00
Jeremy Allison
2999eab5ab Use a logical cli_read(), removed the cli_read_one() hack.
Jeremy.
0001-01-01 00:00:00 +00:00
Tim Potter
f179e0ff61 Use cli_read_one() for reading DCE/RPC reply fragments. We need to check
for and ignore ERRmoredata errors as the client library doesn't support
32-bit error messages.

Added some annotations for the RPC pipe code to make it a bit clearer
maybe.
0001-01-01 00:00:00 +00:00
Tim Potter
3e3b9bc538 Fixed some return code checks for cli_initialise() from False to NULL.
Spotted by Joe Doran <joed@interlude.eu.org>
0001-01-01 00:00:00 +00:00
Tim Potter
b49c4cd441 Removed irritating and unecessary debug message. 0001-01-01 00:00:00 +00:00
Tim Potter
d1e5d5d62f Broke out change trust account password routines into separate file
since they're only used in one place anyway (timeout_processing() in
process.c)
0001-01-01 00:00:00 +00:00
Tim Potter
657804f3be Added a SMB_ASSERT() so that two cli_state structures aren't opened
on different pipes.  This seriously confuses NT.  Unfortunately HEAD
branch is limited to one rpc pipe per connection as the fnum is stored
inside the cli_state structure.  It should really be broken out into
it's own structure so multiple pipes can be opened on one TCP/IP socket.

What a good idea!  But look over here! I've already done it in another
workarea but it will require a day or two to refactor some of the internal
samba rpc client stuff (i.e netlogon requests) so it will remain uncommitted
for another while.
0001-01-01 00:00:00 +00:00
Andrew Tridgell
5d899e51a4 fixed some uninitialised variables 0001-01-01 00:00:00 +00:00
Gerald Carter
0feaac00a1 few cleanups to bring in line with 2.2 0001-01-01 00:00:00 +00:00
Gerald Carter
83d6bc4454 added getdriver and enumdrivers commands. Also fixed
enumprinters so that it works as well.  Couple of other
misc fixes while we're working on rpcclient.
0001-01-01 00:00:00 +00:00
Jeremy Allison
be9933ce35 Removed JRATEST line.
Jeremy.
0001-01-01 00:00:00 +00:00
Jeremy Allison
0be41d5158 Merge of new 2.2 code into HEAD (Gerald I hate you :-) :-). Allows new SAMR
RPC code to merge with new passdb code.
Currently rpcclient doesn't compile. I'm working on it...
Jeremy.
0001-01-01 00:00:00 +00:00
Jeremy Allison
0cd37c831d Serious (and I *mean* serious) attempt to fix little/bigendian RPC issues.
We were reading the endainness in the RPC header and then never propagating
it to the internal parse_structs used to parse the data.
Also removed the "align" argument to prs_init as it was *always* set to
4, and if needed can be set differently on a case by case basis.
Now ready for AS/U testing when Herb gets it set up :-).
Jeremy.
0001-01-01 00:00:00 +00:00
Jeremy Allison
0e6a34510e Sync up handle creation with 2.2 branch. We can now join AS/U domains and
authenticate against them. Big/little endian issues fixed.
Jeremy.
0001-01-01 00:00:00 +00:00
Jeremy Allison
70beabf73b Ooops - forgot to check the rpcclient and smbcacls compile with the new
code :-(.
Jeremy.
0001-01-01 00:00:00 +00:00
Jeremy Allison
14d5997dc8 Move to talloc control of SPOOL_XXX structs. Move to talloc control of
security descriptors and pointers. Syncup with 2.2 tree.
Jeremy.
0001-01-01 00:00:00 +00:00
Jeremy Allison
f0d11b6997 rpc_client/cli_netlogon.c: Fixed incorrect printf.
Added Solaris ACL support.
Jeremy.
0001-01-01 00:00:00 +00:00
Jeremy Allison
bda1d6d4a4 This patch (donated by Marc Jacobsen of HP) should make Sun and HP very happy :-).
Probably Veritas too... :-).
It allows Samba as a domain member to authenticate against an AS/U server such
as the older HP PDC product or PD Netlink. It does this by trying a netlogon
with info level 3 and then falling back to info level 2 if the PDC returns
invalid info level.
Jeremy.
0001-01-01 00:00:00 +00:00
Andrew Tridgell
ba3ce3404e pipe opening now works with unicode 0001-01-01 00:00:00 +00:00
Jeremy Allison
3ded1e6bd5 configure configure.in smbd/posix_acls.c smbd/dosmode.c: Fix for zero permission W2K profiles.
libsmb/cliconnect.c rpc_client/cli_login.c smbd/reply.c: codepage fixes from Tim.
Jeremy.
0001-01-01 00:00:00 +00:00
Tim Potter
79045bd72a Merge of i18n fixes from appliance branch. Samba can now talk to a network
with a PDC that has international netbios name and domain name.  There's
still quite a bit of i18n stuff to fix though...
0001-01-01 00:00:00 +00:00