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

120 Commits

Author SHA1 Message Date
Michael Adam
1194d4f36e r25247: Rename the rpccli_lsa_lookup_sids_all() function to rpccli_lsa_lookup_sids()
and remove the old rpccli_lsa_lookup_sids() function. The old function would
fail due to server limits when requesting to resolve too many sids at once
(20480 for W2k3). The new version passes the list of sids in hunks to the
server. It has up to now been used (and tested) in the winbindd_ads
lookup_groupmem() function, and I think the time has come to replace the actual
function with this correct version.

Michael
2007-10-10 12:30:54 -05:00
Michael Adam
aa603bcc6c r25226: Get rid of more red bars... 2007-10-10 12:30:52 -05:00
Michael Adam
7238884c2c r25225: Add a debug message.
Michael
2007-10-10 12:30:52 -05:00
Michael Adam
b4fff6d09d r25224: Fix a potential segfault in lsa_lookupsids client code due to
uninitialized data.

Michael
2007-10-10 12:30:51 -05:00
Michael Adam
2c68ebd693 r25223: Fix behaviour of rpccli_lsa_lookupsids_all() when
rpccli_lsa_lookupsids_noalloc() returns an error for one hunk
of SIDs: free all allocated arrays and return the error code
returned by the hunk lookup.

Michael
2007-10-10 12:30:51 -05:00
Michael Adam
3b7ed3ea88 r24784: Initialize uninitalized data to prevent segfaults.
Thanks to Volker for the hint!

Michael
2007-10-10 12:30:21 -05:00
Andrew Tridgell
b0132e94fc r23784: use the GPLv3 boilerplate as recommended by the FSF and the license text 2007-10-10 12:28:22 -05:00
Jeremy Allison
407e6e695b r23779: Change from v2 or later to v3 or later.
Jeremy.
2007-10-10 12:28:20 -05:00
Günther Deschner
e9a7512a9f r23627: Allow to pass down the lookup-level to rpccli_lsa_lookup_names().
Guenther
2007-10-10 12:23:38 -05:00
Jeremy Allison
9300b92f7a r23400: Fix lsa crash bug #4683. The "names" enum struct
in a lookup_sidX reply isn't optional - like the
lookup_sidX query it needs to be defined in the
struct.
All this will go away with PIDL (thank goodness....).
Jerry - I think this is a showstopper to be merged
for 3.0.25b.
I'll be watching the build farm to see if anything broke.
Jeremy.
2007-10-10 12:23:13 -05:00
Michael Adam
55ea93d47e r23082: Ooops - that portion of the last checkin was by accident.
Before comitting that, I have to verify that it does not
break anything...

Michael
2007-10-10 12:22:43 -05:00
Michael Adam
374dea8c6f r23081: Reorder the lsa_lookup_sids functions so that the order makes more sense... 2007-10-10 12:22:43 -05:00
Michael Adam
8e60900c5c r23073: In the internal rpccli_lsa_lookup_sids_noalloc(), use a temporary
talloc context for use with the actual rpc query and response.
So the the parent context does not get flooded by the posslibly
large amount of response data (when looking up a lot of sids).

Note: It not possible, to simply use the names and domains arrays
as talloc contexts for the talloc_strdup calls, because from
rpccli_lsa_lookup_sids_all, this is called with names + offset
and domains + offset where names and domains are talloced
arraye for the complete response.
2007-10-10 12:22:18 -05:00
Michael Adam
66ff0bc6c3 r23070: The lsa rpc lookup sids call has a maximum number of SIDS to be
looked up at one time. This limit is at 20480 for w2k3.
Our rpccli_lsa_lookup_sids function ignores this limit, so when
we give the server too long a list of SIDs, then we will get
nothing back. Since typically rpccli_lsa_lookup_sids is given
one SID  (or a small number of SIDS), this did not do harm
up to now. But since I want to use lsa_lookup_sids in a subsequent
modification to winbindd_ads.c:lookup_groupmem to get rid of
a vast number of dn_lookup calls to the server, I had to make
sure we do it correctly.

I have added a function rpccli_lsa_lookup_sids_all function
that has the same prototype but internally splits the list
of SIDs up into hunks of a (conservative, hard coded) 1000
SIDs each for a first go.

If this approach is agreed upon, the new function could replace
the original rpccli_lsa_lookup_sids function.

Michael
2007-10-10 12:22:18 -05:00
Jeremy Allison
8968808c3b r22589: Make TALLOC_ARRAY consistent across all uses.
Jeremy.
2007-10-10 12:19:49 -05:00
Michael Adam
2eec760154 r22537: Use a (more speaking) macro when there is one. 2007-10-10 12:19:43 -05:00
Gerald Carter
50d74ce048 r18747: replace rpccli_lsa_close() with rpccli_lsa_Close() 2007-10-10 12:00:54 -05:00
Jelmer Vernooij
5de76767e8 r18654: Rename "struct uuid" => "struct GUID" for consistency. 2007-10-10 11:52:19 -05:00
Gerald Carter
47f0c71218 r18405: Now that POLICY_HND == struct policy_handle, we can
make rpccli_lsa_close() a real one line wrapper for
rpccli_lsa_Close().

I'm still keeping the wrapper for now because I'm not sure
what we will do about a usable client API.  I don't think
calling the autogenerated client code directly is a good idea
as the IDL is still evolving.
2007-10-10 11:51:22 -05:00
Gerald Carter
2b37079af2 r18404: * swap from POLICY_HND to the struct policy_handle from ndr/misc.h
* move OUR_HANDLE macro to include/rpc_misc.h
2007-10-10 11:51:22 -05:00
Gerald Carter
365c75603d r18397: Change rpccli_lsa_close() as a wrapper for the autogenerated
rpccli_lsa_Close().
2007-10-10 11:51:21 -05:00
Gerald Carter
3da9f80c28 r18271: Big change:
* autogenerate lsa ndr code
* rename 'enum SID_NAME_USE' to 'enum lsa_SidType'
* merge a log more security descriptor functions from
  gen_ndr/ndr_security.c in SAMBA_4_0

The most embarassing thing is the "#define strlen_m strlen"
We need a real implementation in SAMBA_3_0 which I'll work on
after this code is in.
2007-10-10 11:51:18 -05:00
Jeremy Allison
9dafb7f48c r16945: Sync trunk -> 3.0 for 3.0.24 code. Still need
to do the upper layer directories but this is what
everyone is waiting for....

Jeremy.
2007-10-10 11:19:14 -05:00
Jeremy Allison
ee2b2d96b6 r16644: Fix bug #3887 reported by jason@ncac.gwu.edu
by converting the lookup_XX functions to correctly
return SID_NAME_TYPE enums.
Jeremy.
2007-10-10 11:19:05 -05:00
Volker Lendecke
555984ea77 r16335: Fix Klocwork IDs 107 108 109 111 112 113 114 116 117 118 121 2007-10-10 11:17:34 -05:00
Günther Deschner
0fed66926f r15041: Adding rpc client calls to manipulate auditing policies on remote CIFS
servers. Also add a new "net rpc audit" tool. The lsa query infolevels
were taken from samb4 IDL, the lsa policy flags and categories are
partly documented on msdn. I need to cleanup the double
lsa_query_info_policy{2}{_new} calls next.

Guenther
2007-10-10 11:15:59 -05:00
Jeremy Allison
f88f2d9368 r14784: Fix coverity bug #274. Null deref.
Jeremy.
2007-10-10 11:15:48 -05:00
Jeremy Allison
e8e2fc79b4 r13475: Fix erroneous initialization caused by my renaming types.
Jeremy.
2007-10-10 11:10:05 -05:00
Gerald Carter
17e63ac4ed r13316: Let the carnage begin....
Sync with trunk as off r13315
2007-10-10 11:06:23 -05:00
Günther Deschner
8609484ff6 r11854: Remove unused DOM_SID.
Guenther
2007-10-10 11:05:30 -05:00
Jeremy Allison
f313757e36 r11336: Start to get my control back :-). Volker, I think
Andrew Bartlett is right - making lsa code do it the
netlogon way, not vica-versa.
Jeremy.
2007-10-10 11:05:13 -05:00
Gerald Carter
939c3cb5d7 r10656: BIG merge from trunk. Features not copied over
* \PIPE\unixinfo
* winbindd's {group,alias}membership new functions
* winbindd's lookupsids() functionality
* swat (trunk changes to be reverted as per discussion with Deryck)
2007-10-10 11:04:48 -05:00
Gerald Carter
a0ac9a8ffd r7415: * big change -- volker's new async winbindd from trunk 2007-10-10 10:57:08 -05:00
Günther Deschner
5125852939 r7391: - Added client-support for various lsa_query_trust_dom_info-calls and a
rpcclient-tester for some info-levels.

  Jerry, I tried to adopt to prs_pointer() where possible and to not
  interfere with your work for usrmgr.

- Add "net rpc trustdom vampire"-tool.

  This allows to retrieve Interdomain Trust(ed)-Relationships from
  NT4-Servers including cleartext-passwords (still stored in the local
  secrets.tdb).

  The net-hook was done in cooperation with Lars Mueller
  <lmuelle@suse.de>.

  To vampire trusted domains simply call:

        net rpc trustdom vampire -S nt4dc -Uadmin%pass

Guenther
2007-10-10 10:57:07 -05:00
Gerald Carter
efb3ac4c69 r6228: remove BUFHDR2 and clean up LsaEnumTrustedDomains()
Tested client and server code.
2007-10-10 10:56:30 -05:00
Gerald Carter
0e29dc8aa3 r6071: * clean up UNISTR2_ARRAY ( really just an array of UNISTR4 + count )
* add some backwards compatibility to 'net rpc rights list'
* verify privilege name in 'net rpc rights privileges <name>' in order
  to give back better error messages.
2007-10-10 10:56:20 -05:00
Gerald Carter
277203b535 r5726: merge LsaLookupPrivValue() code from trunk 2007-10-10 10:55:57 -05:00
Gerald Carter
d25fc84bc2 r4849: * finish SeAddUsers support in srv_samr_nt.c
* define some const SE_PRIV structure for use when
  you need a SE_PRIV* to a privilege
* fix an annoying compiler warngin in smbfilter.c
* translate SIDs to names in 'net rpc rights list accounts'
* fix a seg fault in cli_lsa_enum_account_rights caused by
  me forgetting the precedence of * vs. []
2007-10-10 10:53:59 -05:00
Gerald Carter
bf4385c79a r4821: finish off 'net rpc rights [list|grant|revoke]'
one small todo item is to add a 'accounts' sub option
to 'net rpc list' so enumerate all privileged SIDs
and their associated rights.
2007-10-10 10:53:56 -05:00
Gerald Carter
4b351f2fcc r4736: small set of merges from rtunk to minimize the diffs 2007-10-10 10:53:52 -05:00
Gerald Carter
77c10ff9aa r4724: Add support for Windows privileges in Samba 3.0
(based on Simo's code in trunk).  Rewritten with the
following changes:

* privilege set is based on a 32-bit mask instead of strings
  (plans are to extend this to a 64 or 128-bit mask before
   the next 3.0.11preX release).
* Remove the privilege code from the passdb API
  (replication to come later)
* Only support the minimum amount of privileges that make
  sense.
* Rewrite the domain join checks to use the SeMachineAccountPrivilege
  instead of the 'is a member of "Domain Admins"?' check that started
  all this.

Still todo:

* Utilize the SePrintOperatorPrivilege in addition to the 'printer admin'
  parameter
* Utilize the SeAddUserPrivilege for adding users and groups
* Fix some of the hard coded _lsa_*() calls
* Start work on enough of SAM replication to get privileges from one
  Samba DC to another.
* Come up with some management tool for manipultaing privileges
  instead of user manager since it is buggy when run on a 2k client
  (haven't tried xp).  Works ok on NT4.
2007-10-10 10:53:51 -05:00
Volker Lendecke
93eab05020 r4561: This looks a lot larger than it is, this is to reduce the clutter on future
patches.

Pass down the pipe_idx down to all functions in cli_pipe where nt_pipe_fnum is
referenced. First step towards having multiple pipes on a cli_struct. The idea
is to not have a single nt_pipe_fnum but an array for the pipes we support.

Volker
2007-10-10 10:53:47 -05:00
Jeremy Allison
620f2e608f r4088: Get medieval on our ass about malloc.... :-). Take control of all our allocation
functions so we can funnel through some well known functions. Should help greatly with
malloc checking.
HEAD patch to follow.
Jeremy.
2007-10-10 10:53:32 -05:00
Gerald Carter
911a28361b r196: merging struct uuid from trunk 2007-10-10 10:51:13 -05: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
-
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
-
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
-
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
-
Tim Potter
a20aba0999 Merge: const fixes. -
Jeremy Allison
49739be1e2 Merge tridge's client priv code from HEAD.
Jeremy
-