1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-23 09:57:40 +03:00

72 Commits

Author SHA1 Message Date
Andrew Bartlett
897cc4a610 Another smattering of static and const -
Andrew Bartlett
4687fac69d This makes smbcacls a bit easier to use and debug.
Allow connection in the form of //server/share instead of just \\server\share
and show the reason for failure from cli_full_connection().

Andrew Bartlett
-
Andrew Bartlett
23689b0746 Update cli_full_connection() to take a 'flags' paramater, and try to get a
few more places to use it.

Andrew Bartlett
-
Andrew Bartlett
c205b18bd6 Remove the password length paramater from cli_full_connection - it really
didn't make any sense, and its was always just strlen(password) anyway.

This fixes it to be strlen(password)+1

Andrew Bartlett
-
Andrew Bartlett
fa67e4626b Given Jeremy's positive response, and a lack of one from tpot, I'll commit
this:

More code cleanup - this lot a bit more dodgy than the last:

The aim is to trim pwd_cache down to size.  Its overly complex, and a
pain to deal with.  With a header comment like this:

'obfusticaion is planned'

I think it deserved to die (at least partly).

This was being done to allow 'cli_establish_connection' to die - its
functionality has been replaced by cli_full_connection(), which does
not duplicate code everywhere for creating names etc.

This also removes the little 'init' fucntions for the various pipes,
becouse they were only used in one place, and even then it was dodgy.

(I've reworked smbcacls not to use anonymous connections any more, as
this will (should) fail with a 'restrict anonymous' PDC).

This allowed me to remove cli_pipe_util.c, which was calling
cli_establish_connection.

tpot:  I'm not sure what direction you were going with the client stuff,
and you may well have been wanting the init functions.  If thats the case,
give me a yell and I'll reimplement them against cli_full_connection.

Andrew Bartlett
-
Tim Potter
245468dbab The cli_lsa_lookup_{names,sids} functions were returning useless
information when one or more of the names/sids being queried were not
resolvable.  We now return a list the same length as the parameters passed
instead of an array of just the resolvable names/sids.
-
Tim Potter
84c811ca57 int -> uint32 fixes from andreas -
Tim Potter
6a58c9bd06 Removed version number from file header.
Changed "SMB/Netbios" to "SMB/CIFS" in file header.
-
Andrew Bartlett
5dfba2cf53 Back out some of the less well thought out ideas from last weeks work on
winbind default domains, particulary now I understand whats going on a lot
better.  This ensures that the RPC client code does as little 'magic' as
possible - this is up to the application/user.  (Where - for to name->sid code
- it was all along).  This leaves the change that allows the sid->name code to
return domains and usernames in seperate paramaters.

Andrew Bartlett
-
Andrew Bartlett
e870f0e727 This patch makes the 'winbind use default domain' code interact better with
smbd, and also makes it much cleaner inside winbindd.

It is mostly my code, with a few changes and testing performed by Alexander
Bokovoy <a.bokovoy@sam-solutions.net>.  ab has tested it in security=domain and
security=ads, but more testing is always appricatiated.

The idea is that we no longer cart around a 'domain\user' string, we keep them
seperate until the last moment - when we push that string into a pwent on onto
the socket.

This removes the need to be constantly parsing that string - the domain prefix
is almost always already provided, (only a couple of functions actually changed
arguments in all this).

Some consequential changes to the RPC client code, to stop it concatonating the
two strings (it now passes them both back as params).

I havn't changed the cache code, however the usernames will no longer have a
double domain prefix in the key string.  The actual structures are unchanged
 - but the meaning of 'username' in the 'rid' will have changed.  (The cache is
invalidated at startup, so on-disk formats are not an issue here).

Andrew Bartlett
-
Jeremy Allison
7b8fb8d85c Fixup JF's weird SID return :-).
Jeremy
-
Tim Potter
9712d3f15a Renamed sid field in SEC_ACE to trustee to be more in line with MS's
definitions.
-
Andrew Tridgell
e2ba2383c9 fix a bunch of places where we can double-free a cli structure -
Tim Potter
778f5f77a6 Got medieval on another pointless extern. Removed extern struct ipzero
and replaced with two functions:

	void zero_ip(struct in_adder *ip);
	BOOL is_zero_ip(struct in_addr ip);
-
Tim Potter
8fc772c9e5 Removed TimeInit() call from every client program (except for one place
in smbd/process.c where the timezone is reinitialised.  Was replaced with
check for a static is_initialised boolean.
-
Martin Pool
79ec88f0da Store some path names in global variables initialized to configure
default, rather than in preprocessor macros.
-
Simo Sorce
67db8f03c5 move to SAFE_FREE() -
Andrew Tridgell
f41c3bb80f declare dbf in one spot -
Andrew Tridgell
1af8bf34f1 replaced stdio in many parts of samba with a XFILE. XFILE is a cut-down
replacemnt of stdio that doesn't suffer from the 8-bit filedescriptor
limit that we hit with nasty consequences on some systems

I would eventually prefer us to have a configure test to see if we need
to replace stdio, but for now this code needs to be tested widely so
I'm enabling it by default.
-
Andrew Tridgell
5bb7e4f0f6 it now all compiles - so try enabling it by default and see what explodes on the build farm -
Andrew Tridgell
1d36250e33 converted another bunch of stuff to NTSTATUS -
Andrew Tridgell
22b372f8a7 fixed handling of 139/445 in clients -
Andrew Tridgell
c41fc06376 strchr and strrchr are macros when compiling with optimisation in gcc, so we can't redefine them. damn. -
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.
-
Tim Potter
69d90a8af1 Removed bogus server_n local variable in connect_one() function. -
Tim Potter
9874df0c22 Added some missing entries to usage().
Added -d option to set debug level.
-
Andrew Tridgell
674ee2f1d1 next_token() was supposed to be a reentrant replacement for strtok(),
but the code suffered from bitrot and is not now reentrant. That means
we can get bizarre behaviour
i've fixed this by making next_token() reentrant and creating a
next_token_nr() that is a small non-reentrant wrapper for those lumps
of code (mostly smbclient) that have come to rely on the non-reentrant
behaviour
-
Jeremy Allison
87f647715d Warning fix from Andrew Bartlett.
Jeremy.
-
Jeremy Allison
66f959e0ff rpc_server/srv_srvsvc_nt.c: Don't test an uint32 for < 0.
utils/smbcacls.c: Set enum correctly.
Jeremy.
-
Jeremy Allison
0ae0d024f5 Fixup smbcacls. Don't return memory already freed, don't free memory allocated
with talloc.
Jeremy.
-
Andrew Tridgell
5d899e51a4 fixed some uninitialised variables -
Gerald Carter
0a6ceed279 rpcclient merge from 2.2 (including Jeremy's non-void return fix) -
Jeremy Allison
fc76681812 Merge of Andrew's changes in 2.2.
Jeremy.
-
Jeremy Allison
493d2c316a Added SMB_ prefix to enums that clash with Solaris ACL definitions.
Jeremy.
-
Jeremy Allison
70beabf73b Ooops - forgot to check the rpcclient and smbcacls compile with the new
code :-(.
Jeremy.
-
Andrew Tridgell
b0b49a4b28 make sure denied aces are first -
Andrew Tridgell
703d9f5cb3 cast the qsort -
Andrew Tridgell
61293979ce - fixed the sort_acl bug, sorting now works right
- don't allow setting of duplicate ACEs
- fixed a ACE delete bug
-
Andrew Tridgell
5934137741 don't crash on null acl sort -
Andrew Tridgell
48ab6297a1 - workaround filer lsa lookup bug for unknown sids
- add \ at start of name if not needed (another filer workaround)
-
Andrew Tridgell
c0f57c3fe6 cope with filer/NT/samba all in one binary. yeah.
we now don't open rw for acls
-
Andrew Tridgell
f191271986 don't need _uni hack now -
Tim Potter
394e17645b Some systems don't support SEC_RIGHTS_MAXIMUM_ALLOWED for lsa_open_policy()
but NT sends 0x2000000 so we might as well do it too.
-
Tim Potter
b4773618ac Return appropriate exit codes for various situations:
0 for success
    1 if operation failed
    2 command line parse error
-
Tim Potter
01a89978ff Don't call string_to_sid after cli_lsa_lookup_names() fails.
Can't use space as a ACL separator as it breaks NT user/group names that
contain spaces (i.e most of the default ones).

The MSDN is contradictory over the exact ordering of ACE entries in an ACL.
However NT4 gives a "The information may have been modified by a computer
running Windows NT 5.0" if denied ACEs do not appear before allowed ACEs.
Sort ACE list before calling cli_set_secdesc().
-
Tim Potter
935b77573e Some systems seem to only accept a ntcreate&x with a unicode filename
despite samba negotiating ascii filenames.  Retry with unicode pathnames
if the ascii version fails.

Convert all forward slashes to backslashes in the filename argument.
-
Tim Potter
e21f2ef4fb Cleaned up SidToString() and StringToSid() exit paths.
Can now use user%password format in $USER environment variable.  -U option
is now optional.
-
Jeremy Allison
12f88c9ba7 Added -C username and -G username that allow a user (usually Administrator)
to change the ownership or group ownership of a file to any arbitrary user
from the UNIX command line.
This will show the people who quote NT manuals at us about how this is
"impossible" how their operating system really works :-).
Jeremy.
-
Jeremy Allison
0a40bc83e1 Fixed memory leaks in lsa_XX calls. Fixed memory leaks in smbcacls. Merged
in fixes from appliance-head and 2.2. Fixed multiple connection.tdb open
problem.
Jeremy.
-
Tim Potter
5e547ddcb5 Renamed parameters and variables called acl to the_acl as it conflicts
with a Solaris system call.
-