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

1077 Commits

Author SHA1 Message Date
Jeremy Allison
e28d01b744 Added an NT_USER_TOKEN structure that is copied/passed around associated
with the current user. This will allow se_access_check() to quickly do
a SD check without having to translate uid/gid's to SIDs.
Still needs work on pipe calls.
Jeremy.
-
Jeremy Allison
5e5cc6efe2 Started to canonicalize our handling of uid -> sid code in order to
get ready and fix se_access_check().
Added cannonical lookup_name(), lookup_sid(), uid_to_sid(), gid_to_sid()
functions that look via winbind first the fall back on local lookup.

All Samba should use these rather than trying to call winbindd code
directly.

Added NT_USER_TOKEN struct in user_struct, contains list of NT sids
associated with this user.

se_access_check() should use this (cached) value rather than attempting
to do the same thing itself when given a uid/gid pair.

More work needs to be done to preserve these things accross security
context changes (especially with the tricky pipe problem) but I'm
beginning to see how this will be done..... probably by registering
a new vuid for an authenticated RPC pipe and not treating the
pipe calls specially.

More thoughts needed - but we're almost there...

Jeremy.
-
Jeremy Allison
c55bcec817 Tidyup removing many of the 0xC0000000 | NT_STATUS_XXX stuff (only need NT_STATUS_XXX).
Removed IS_BITS_xxx macros as they were just reproducing "C" syntax in a more
obscure way.
Jeremy.
-
Jeremy Allison
8cfb55e81a Added print job substitutions for %{printername}, %{sharename} and %{portname}
from the NT printer tdb.
Also added checks for time restrictions before allowing a job to print.
Jeremy.
-
Jeremy Allison
902ada6379 Added John Reilly's enumports/addprinter/delprinter scripting code plus the
fix for the Win9x printer drivers.
Changed command names to add "command" string on the end for some consistancy
with the other scripting commands.
Added '%P' option to tdbpack/unpack to store long comment string.
Made port name be "Samba Printer Port" if no enum port script given.
Fixed prs_uint32_pre code to cope with null args.
Jeremy.
-
Jeremy Allison
0ff2ce543e Ok - this is a *BIG* change - but it fixes the problems with static strings
in the RPC code. This change was prompted by trying to save a long (>256)
character comment in the printer properties page.

The new system associates a TALLOC_CTX with the pipe struct, and frees
the pool on return of a complete PDU.

A global TALLOC_CTX is used for the odd buffer allocated in the BUFFERxx
code, and is freed in the main loop.

This code works with insure, and seems to be free of memory leaks and
crashes (so far) but there are probably the occasional problem with
code that uses UNISTRxx structs on the stack and expects them to contain
storage without doing a init_unistrXX().

This means that rpcclient will probably be horribly broken.
A TALLOC_CTX also needed associating with the struct cli_state also,
to make the prs_xx code there work.

The main interface change is the addition of a TALLOC_CTX to the
prs_init calls - used for dynamic allocation in the prs_XXX calls.

Now this is in place it should make dynamic allocation of all RPC
memory on unmarshall *much* easier to fix.

Jeremy.
-
Jeremy Allison
5130dd0f8b Fixed up error checking and move printer file code. Fixed a memory leak.
Jeremy.
-
Jeremy Allison
0bd88d304c Added some error checking and returns to the new 'move' code.
Jeremy.
-
Jean-François Micouleau
ac0a145acc A rather big change set ! (listed in no particular order)
- changed the default forms flag to 2
- all short architecture name are uppercased
- get_short_archi() is now case unsensitive
- the drivers TDB is indexed by archi/version/name
- implemented code to move drivers from the upload area to the download
area. Someone else need to look at that code.
- don't return anymore a default driver if it doesn't exist in the TDB.
Instead return an error.
- cleaned prs_unistr.
- #ifdef out jeremy's new SD parsing in printer_info_2
- removed the unused MANGLE_CODE

- #ifdef out the security checking in update_printer() as it doesn't work
for me.

Zap your ntdrivers.tdb, it won't work anymore.

	J.F.
-
Tim Potter
dcf3249bb9 Fix for mounting a printer as a share. Not that there's anything
specifically wrong with this, but Samba is fooled by the client into
thinking the printer is a file share.  Files copied to the share gather
dust in the spool directory and aren't printed.

This patch has the effect of not allowing printers to be mounted as file
shares.  Not sure whether this is the correct solution or not.
{Jeremy,JF,Tridge} please check!
-
Tim Potter
f026a897e9 Run main server loop with sys_select() instead of sys_select_intr(). The
main daemon was not catching sighup and reloading the service file.
-
Jeremy Allison
9157a6ab26 Modified the patch to look in the tdb *first* - thus allowing legacy text
filed to be ignored when an upload is done.
Modified to code to goto err on problems, simplifies it.
Jeremy.
-
Jeremy Allison
1192d867c4 Code from John Reilly <jreilly@hp.com> to add tdb lookups into the Win95
printer driver download if looking for the default driver files fail.
Jeremy.
-
Tim Potter
898a483cda Fixes for various compile warnings on Solaris 8. -
Tim Potter
2abce4dcfa Re-instated lanman printing security checks (oops).
A user can now pause, resume or delete their own job even if they don't
have the Manage Documents privilege.

Added call to se_access_check() for changing printer properties.  The Full
Access privilege is required for the user to perform this.

Several uninitialised variables and memory leaks plugged.

Modified default ACL created on new printers to be Everyone / Print instead
of Everyone / Full Access.  This required some random stuffing around with
the value of the revision field to correspond with the ACL that NT produces
when setting the same permission on the printer.

Fixed dodgy function call in printing/printfsp.c
-
Tim Potter
c1d242f1dd Spelling fixes. -
Tim Potter
e84607eedf Don't check NT permissions when printing from lanman. -
Tim Potter
3c4a5f624b Moved authenticated pipe user details into a current_user struct. -
Tim Potter
55c9bf124d Some more sec_ctx changes. Modified some fields in the pipe_struct
structure so authenticated pipe users can have their unix groups set when
become_authenticated_pipe_user() is called.
-
Jeremy Allison
2aa21db960 Fix a malloc of zero problem.
Jeremy.
-
Jeremy Allison
edaf49c66d lib/util_unistr.c: Off-by-one fix for dos_PutUniStr from John Reilly jreilly@hp.com.
Memory leak fix for new sec_ctx code (sorry Tim :-).
Jeremy.
-
Tim Potter
d0f55e04c9 Added return for become_authenticated_pipe_user() function. -
Tim Potter
3d0f1845c8 Delete OriginalDir stuff. -
Tim Potter
0bcdcd0606 Moved some static functions to sec_ctx.c
Implemented become_root() and friends in terms of push/pop/set security
contexts.
-
Tim Potter
db5e6ad3a6 Call init_sec_ctx() instead of init_uid().
Delete OriginalDir stuff.
-
Tim Potter
87c78d6d5a I've been working on refactoring some of the mess that is the become_user()
code.  This code is now implemented as a stack of security contexts, where
a security context is defined as a set of effective user, group and
supplementary group ids.

The following functions are implemented:

BOOL push_sec_ctx(void);

     Create a new security context on the stack which is the same as the
     current security context.

void set_sec_ctx(uid_t uid, gid_t gid, int ngroups, gid_t *groups);

     Set the current security context to a given set of user and group
     ids.

void set_root_sec_ctx(void);

     Set to uid = gid = 0.  No supplementary groups are set.

BOOL pop_sec_ctx(void);

     Pop a security context from the stack and restore the user and group
     permissions of the previous context.

void init_sec_ctx(void);

     Initialise the security context stack.  This must be called before any
     of the other operations are used or weird things may happen.

The idea is that there is a base security context which is either root or
some authenticated unix user.  Other security contexts can be pushed and
popped as needed for things like changing passwords, or rpc pipe operations
where the rpc pipe user is different from the smb user.
-
Jeremy Allison
711f15ac23 Fixes for IRIX kernel oplocks and systems that don't have nss.h
Jeremy.
-
Jeremy Allison
b737c784e3 Paranoia changes to ensure that anything touched by a signal handler
and the main code is declared as VOLATILE SIG_ATOMIC_T.
Jeremy.
-
Tim Potter
6120d03200 Pass the vuid from the connection_struct to the printing back end functions. -
Andrew Tridgell
9fd67b94a7 open files with O_NONBLOCK when available. This is necessary to
prevent possible deadlocks with kernel leases and harmless when kernel
leases are not used.

basically we don't ever want smbd to block
-
Andrew Tridgell
fabe1f350e added support for kernel level share modes. These are a (small) hack,
I suspect we will either get rid of them or do them properly at some
stage.
-
Andrew Tridgell
b1441d9622 allow the notify implementation to choose the select timeout change -
Tim Potter
efe7f818c9 ZERO_STRUCT() of info3 structure before using it. -
Christopher R. Hertel
50599b0fa2 Removed a patch that Andrew had added because 'insure' was incorrectly
reporting a memory leak in the cache module.  I've modified the cache
code to prevent insure getting confused, so the patch can now be removed.
-
Andrew Tridgell
9f542484d1 use DN_ATTRIB kernel change notify attribute -
Andrew Tridgell
20a06b7fb7 always use the DN_CREATE mask (NT expects file creation always to
cause a notify)
-
Andrew Tridgell
c6be511fcc enable the Linux change notify code and change some notify debug code -
Andrew Tridgell
44766c39e0 totally rewrote the async signal, notification and oplock notification
handling in Samba. This was needed due to several limitations and
races in the previous code - as a side effect the new code is much
cleaner :)

in summary:

- changed sys_select() to avoid a signal/select race condition. It is a
  rare race but once we have signals doing notification and oplocks it
  is important.

- changed our main processing loop to take advantage of the new
  sys_select semantics

- split the notify code into implementaion dependent and general
  parts. Added the following structure that defines an implementation:

struct cnotify_fns {
	void * (*register_notify)(connection_struct *conn, char *path, uint32 flags);
	BOOL (*check_notify)(connection_struct *conn, uint16 vuid, char *path, uint32 flags, void *data, time_t t);
	void (*remove_notify)(void *data);
};


then I wrote two implementations, one using hash/poll (like our old
code) and the other using the new Linux kernel change notify. It
should be easy to add other change notify implementations by creating
a sructure of the above type.

- fixed a bug in change notify where we were returning the wrong error
  code.

- rewrote the core change notify code to be much simpler

- moved to real-time signals for leases and change notify

Amazingly, it all seems to work. I was very surprised!
-
Andrew Tridgell
02577ab7d2 fixed comments at top of module -
Andrew Tridgell
1bb0aad4f6 split all the change notify code out into a separate module
smbd/notify.c. All the data structures are now private to that
module.

this is in preparation for Linux kernel support for change notify
(coming soon to a CVS tree near you)
-
Andrew Tridgell
cc0e919fdc a better test for oplocks being enabled in this kernel -
Andrew Tridgell
afa98d511f fixed Linux capabilities handling
I used a trick where CAP_LEASE isn't claimed until it is needed. This
means we avoid a system call per setreuid(), and never call capset()
unless a user tries to get a oplock on a file that they don't own
-
Andrew Tridgell
b28cc4163b Linux kernel oplocks now seem to work, but need a _lot_ of testing
I had to modify sys_select() to not loop on EINTR. I added a wrapper
called sys_select_intr() which gives the old behaviour.
-
Andrew Tridgell
3253085d98 a first pass at Linux kernel oplocks support -
Andrew Tridgell
b5ceab8102 continued the split of the kernel level oplocks code into a more
modular form. In this pass I added oplock_irix.c and added a "struct
kernel_oplocks" that describes a kernel oplock implementation.
-
Jeremy Allison
cc447fbe3c (Correct) fix for desired_access being zero in map_share_mode().
Jeremy.
-
Jeremy Allison
e1b1b6fb67 Luke, I am moving the code back into passdb/passdb.c, this the correct
place to do this, not in smbd/passwd.c

Please don't change this without asking first, I have run this past
Andrew so talk to him (I'm on vacation next week).

I also removed the g_newXXX macros. There are essentially a private C extension,
not used anywhere else in the code, and add no functionality over malloc(XX)
and make the code harder to understand (everyone knows what malloc does).

Jeremy.
-
Andrew Tridgell
70dcc791b4 clean up oplock capability code ready for Linux code -
Andrew Tridgell
6b888d600d split some of the irix kernel oplocks code into a function -
Luke Leighton
2f056c2aad free NET_USER_INFO_3 gids when vuser invalidated. -