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

419 Commits

Author SHA1 Message Date
Rusty Russell
868d77bc5b tdb_chainlock: check returns for 0, not -1.
TDB2 returns a negative error number on failure.  This is compatible
if we always check for != 0 instead of == -1.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2011-06-20 11:18:35 +02:00
Rusty Russell
6bc59d77b6 tdb_store: check returns for 0, not -1.
TDB2 returns a negative error number on failure.  This is compatible
if we always check for != 0 instead of == -1.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2011-06-20 11:18:35 +02:00
Rusty Russell
058c4f8492 tdb_fetch_compat: use instead of tdb_fetch.
This is a noop for tdb1.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2011-06-20 11:18:35 +02:00
Günther Deschner
d8cfca3a9b s3: only include tdb headers where needed.
Guenther
2011-05-06 10:48:10 +02:00
Günther Deschner
ab36d597e7 s3-messages: make ndr_messaging.h part of messages.h.
Guenther
2011-03-30 01:13:09 +02:00
Günther Deschner
b2af281e50 s3-messages: only include messages.h where needed.
Guenther
2011-03-30 01:13:09 +02:00
Günther Deschner
3061f44fc9 s3-auth: printing needs auth.h
Guenther
2011-03-30 01:13:09 +02:00
Günther Deschner
84815d38d2 s3: printing needs parts of smbd.
Guenther
2011-03-30 01:13:08 +02:00
Günther Deschner
0e771263ee s3-includes: only include system/filesys.h when needed.
Guenther
2011-03-30 01:13:07 +02:00
Günther Deschner
89ca4875cd s3-includes: only include system/syslog.h when needed.
Guenther
2011-03-30 01:13:06 +02:00
Simo Sorce
1d33474dad s3:printing Make print_queue_receive public
Signed-off-by: Günther Deschner <gd@samba.org>
2011-03-29 16:03:49 +02:00
Günther Deschner
8643683dd8 s3-server_id: only include server_id where needed.
Guenther
2011-03-02 12:12:31 +01:00
Jeremy Allison
87c4ceaf7c Fix compiler warning on casting -1 to uint32. 2011-02-28 14:56:03 -08:00
Günther Deschner
5a0cf0c77e s3-printing: fix pcacp prototypes and includes.
Guenther
2011-02-22 21:52:18 +01:00
Günther Deschner
66e040ee0a s3-printing: isolate print notification prototypes better.
Guenther
2011-02-22 21:52:18 +01:00
Volker Lendecke
c85607d8ec s3: Fix a typo 2011-02-22 19:18:50 +01:00
Volker Lendecke
7a194c6e5e s3: Make "unpack_pjob" static
Autobuild-User: Volker Lendecke <vlendec@samba.org>
Autobuild-Date: Wed Oct 20 16:51:04 UTC 2010 on sn-devel-104
2010-10-20 16:51:04 +00:00
Andreas Schneider
bbf2cd50b0 s3-printing: Make auth_serversupplied_info const. 2010-09-09 16:00:08 +02:00
Andreas Schneider
555b175212 s3-printing: Added function to update the queue. 2010-08-18 11:43:18 +02:00
Andreas Schneider
7e9d6021c9 s3-printing: Rename jobs_changed functions to jobs_added. 2010-08-18 11:43:17 +02:00
Volker Lendecke
a847f13d7b s3: Use pipe_struct->client_id->name for pjob.clientmachine 2010-08-18 11:18:24 +02:00
Volker Lendecke
29093bc000 s3: Move initializing pjob.clientname to print_job_start() 2010-08-18 11:18:23 +02:00
Volker Lendecke
c360822226 s3: Directly call write_data from print_job_write() 2010-08-17 15:31:49 +02:00
Volker Lendecke
3aba8e9b7e s3: Remove unused "pos" arg from print_job_write 2010-08-17 15:31:49 +02:00
Volker Lendecke
d418f9f11a s3-printing: Lift the use of smbd_server_fd from job_submit.
Signed-off-by: Andreas Schneider <asn@samba.org>
2010-08-16 14:02:19 +02:00
Volker Lendecke
ef208c5571 s3: Lift the server_messaging_context from print_job_endpage 2010-08-08 18:09:38 +02:00
Volker Lendecke
d1f3a2efb7 s3: Lift the server_messaging_context from print_job_write 2010-08-08 18:09:37 +02:00
Volker Lendecke
ae1600b995 s3: Lift the server_messaging_context from print_job_delete1 2010-08-08 18:09:37 +02:00
Volker Lendecke
de10824872 s3: Lift the server_messaging_context from print_job_set_name 2010-08-08 18:09:37 +02:00
Volker Lendecke
3b5b74c7dd s3: Lift the server_messaging_context from print_queue_update_with_lock 2010-08-08 18:09:37 +02:00
Volker Lendecke
c2894503d1 s3: Lift the server_messaging_context from print_queue_update_internal 2010-08-08 18:09:37 +02:00
Volker Lendecke
2b13864569 s3: Lift the server_messaging_context from traverse_fn_delete 2010-08-08 18:09:37 +02:00
Volker Lendecke
8b6d88854c s3: Lift the server_messaging_context from print_unix_job 2010-08-08 18:09:37 +02:00
Volker Lendecke
0b423493c3 s3: Lift the server_messaging_context from pjob_delete 2010-08-08 18:09:37 +02:00
Volker Lendecke
6806ae7290 s3: Lift the server_messaging_context from pjob_store 2010-08-08 18:09:36 +02:00
Volker Lendecke
9ff35d0690 s3: Lift the server_messaging_context from pjob_store_notify 2010-08-08 18:09:36 +02:00
Volker Lendecke
b71debcca0 s3: Lift the server_messaging_context from notify_job_submitted 2010-08-08 18:09:35 +02:00
Volker Lendecke
aa5fd419b2 s3: Lift the server_messaging_context from notify_job_name 2010-08-08 18:09:35 +02:00
Volker Lendecke
06cf2ae6ea s3: Lift the server_messaging_context from notify_job_username 2010-08-08 18:09:35 +02:00
Volker Lendecke
7a9f94dae8 s3: Lift the server_messaging_context from notify_job_total_pages 2010-08-08 18:09:35 +02:00
Volker Lendecke
bd6626c40c s3: Lift the server_messaging_context from notify_job_total_bytes 2010-08-08 18:09:35 +02:00
Volker Lendecke
edbed43119 s3: Lift the server_messaging_context from notify_job_status 2010-08-08 18:09:35 +02:00
Volker Lendecke
21811fe72d s3: Lift the server_messaging_context from notify_printer_status 2010-08-08 18:09:35 +02:00
Volker Lendecke
c6e6aee0a0 s3: Lift the server_messaging_context from print_queue_status 2010-08-08 18:09:34 +02:00
Volker Lendecke
a36103ca05 s3: Lift the server_messaging_context from get_stored_queue_info 2010-08-08 18:09:34 +02:00
Volker Lendecke
c50c973036 s3: Lift the server_messaging_context from print_job_end 2010-08-08 18:09:34 +02:00
Volker Lendecke
a4c27786ff s3: Lift the server_messaging_context from print_queue_length 2010-08-08 18:09:33 +02:00
Volker Lendecke
31d23c83fe s3: Lift the server_messaging_context from print_queue_update 2010-08-08 18:09:33 +02:00
Volker Lendecke
bc760e79c8 s3: Lift the smbd_messaging_context from start_background_queue 2010-08-08 18:09:33 +02:00
Volker Lendecke
75b4dfd14d s3: Lift the smbd_messaging_context from smbd_setup_sig_hup_handler 2010-08-08 18:09:33 +02:00
Volker Lendecke
cc280f0cd1 s3: Lift the smbd_messaging_context from print_queue_purge 2010-08-08 16:03:27 +02:00
Volker Lendecke
9723f33ef5 s3: Lift the smbd_messaging_context from print_queue_resume 2010-08-08 16:03:27 +02:00
Volker Lendecke
5f9165a7ea s3: Lift the smbd_messaging_context from print_queue_pause 2010-08-08 16:03:26 +02:00
Volker Lendecke
9441e8c52c s3: Lift the smbd_messaging_context from print_job_start 2010-08-08 16:03:26 +02:00
Volker Lendecke
bff871384a s3: Lift the smbd_messaging_context from print_job_checks 2010-08-08 16:03:26 +02:00
Volker Lendecke
7df0e672f2 s3: Lift the smbd_messaging_context from print_job_resume 2010-08-08 16:03:26 +02:00
Volker Lendecke
2811c258f6 s3: Lift the smbd_messaging_context from print_job_pause 2010-08-08 16:03:26 +02:00
Volker Lendecke
8dcbeecd6d s3: Lift the smbd_messaging_context from print_job_delete 2010-08-08 16:03:26 +02:00
Volker Lendecke
39ce462043 s3: Lift the smbd_messaging_context from print_time_access_check 2010-08-08 16:03:25 +02:00
Volker Lendecke
be7fd4ae50 s3: Lift the smbd_messaging_context from print_access_check 2010-08-08 16:03:25 +02:00
Günther Deschner
0f8e032628 s3-netlogon: remove global include of netlogon.h.
This reduces precompiled headers by another 4 MB and also slightly speeds up the
build.

Guenther
2010-08-06 15:46:16 +02:00
Günther Deschner
813fbbd68c s3-build: avoid to globally include printing and spoolss headers.
This shrinks precompiled headers by 3MB and will slightly speed up any build.

Guenther
2010-07-31 00:50:31 +02:00
Andreas Schneider
b95d5563dd s3-printing: Added automatic migration of printing tdbs.
Signed-off-by: Jim McDonough <jmcd@samba.org>
2010-07-27 10:27:15 -04:00
Simo Sorce
f5a2f8fa2b s3-printing: Removed unused function print_job_fd().
Signed-off-by: Jim McDonough <jmcd@samba.org>
2010-07-27 10:27:14 -04:00
Simo Sorce
628f9bee05 s3-spoolss: Use WERROR for print_job_delete.
And also check for PJOB_SMBD_SPOOLING in print_job_write.

Signed-off-by: Jim McDonough <jmcd@samba.org>
2010-07-27 10:27:13 -04:00
Simo Sorce
660506d359 s3-printing: Handled case when smbd spools a file on behalf of spoolss. 2010-07-27 10:27:13 -04:00
Simo Sorce
94ee35f9cc s3-printing: Made print_job_start more robust.
Explicitly return ntstatus errors instead of relying on elusive errno.
Split the function to make it easier to follow.

Signed-off-by: Jim McDonough <jmcd@samba.org>
2010-07-27 10:27:13 -04:00
Simo Sorce
38d6274864 s3-smbd: Added code to print via spoolss. 2010-07-27 10:27:12 -04:00
Simo Sorce
017a305fed s3-printing: Convert print_time_access_check.
use spoolss_PrintInfo2 and winreg calls

Signed-off-by: Jim McDonough <jmcd@samba.org>
2010-07-27 10:27:10 -04:00
Simo Sorce
5604a78f09 s3-spoolss: Migrated NT_DEVICEMODE to spoolss_DeviceMode.
Signed-off-by: Jim McDonough <jmcd@samba.org>
2010-07-27 10:27:06 -04:00
Volker Lendecke
7f0e6df883 s3: Pass the new server_id through reinit_after_fork 2010-07-04 17:29:23 +02:00
Volker Lendecke
eb50f77154 s3: Fix some nested extern warnings 2010-07-04 16:41:14 +02:00
Volker Lendecke
b01958b0bd s3: Remove serverid_[de]register_self
This removes some deep references to procid_self()
2010-07-04 16:41:14 +02:00
Volker Lendecke
3f7e2222f4 s3: Remove the pointless PRINTERNAME macro 2010-06-13 12:40:27 +02:00
Andreas Schneider
0962763822 s3:misc make use of server_[event/messaging]_context directly
Untangle these functions from smbd specific dependencies so they can be freely
used in multiple servers.
2010-06-10 17:30:45 -04:00
Simo Sorce
d9cffc01be s3:auth use info3 in auth_serversupplied_info
Signed-off-by: Günther Deschner <gd@samba.org>
2010-05-28 00:55:53 +02:00
Günther Deschner
c6ebab846d s3: only include gen_ndr headers where needed.
This shrinks include/includes.h.gch by the size of 7 MB and reduces build time
as follows:

ccache build w/o patch
real    4m21.529s
ccache build with patch
real    3m6.402s

pch build w/o patch
real    4m26.318s
pch build with patch
real    3m6.932s

Guenther
2010-05-06 00:22:59 +02:00
Günther Deschner
1691eb73da s3-spoolss: add support for SetJobInfo level 1 (for jobfile rename).
Guenther
2010-04-28 00:10:40 +02:00
Günther Deschner
2b7002f385 s3-lanman: remove unsupported print_job_set_place().
Guenther
2010-04-28 00:10:40 +02:00
Jeremy Allison
92332fb236 Second part of bug #7288 - SMB job IDs in CUPS job names wrong.
Forgot to delete the overload of the smbjob bool.

Jeremy.
2010-03-25 18:20:33 -07:00
Jeremy Allison
c79ca41baf Fix bug #7288 - SMB job IDs in CUPS job names wrong.
Based on a patch from Michael Karcher <samba@mkarcher.dialup.fu-berlin.de>.

I think this is the correct fix. It causes cups_job_submit to use
print_parse_jobid(), which I've moved into printing/lpq_parse.c (to allow the
link to work).

It turns out the old print_parse_jobid() was *broken*, in that the pjob
filename was set as an absolute path - not relative to the sharename (due to it
not going through the VFS calls).

This meant that the original code doing a strncmp on the first part of the
filename would always fail - it starts with a "/", not the relative pathname of
PRINT_SPOOL_PREFIX ("smbprn.").

This fix could fix some other mysterious printing bugs - probably the ones
Guenther noticed where job control fails on non-cups backends.

Guenther PLEASE CHECK !

Jeremy.
2010-03-25 17:36:47 -07:00
Jeremy Allison
59545276f2 Try and fix bug #7233 - print fails with jobs >4GB from Win7 clients.
Remove an arbitrarty 4G B limit that *doesn't need to be there* !
Jeremy.
2010-03-10 17:46:09 -08:00
Volker Lendecke
89c785c47a s3: Fix a long-standing problem with recycled PIDs
When a samba server process dies hard, it has no chance to clean up its entries
in locking.tdb, brlock.tdb, connections.tdb and sessionid.tdb.

For locking.tdb and brlock.tdb Samba is robust by checking every time we read
an entry from the database if the corresponding process still exists. If it
does not exist anymore, the entry is deleted. This is not 100% failsafe though:
On systems with a limited PID space there is a non-zero chance that between the
smbd's death and the fresh access, the PID is recycled by another long-running
process. This renders all files that had been locked by the killed smbd
potentially unusable until the new process also dies.

This patch is supposed to fix the problem the following way: Every process ID
in every database is augmented by a random 64-bit number that is stored in a
serverid.tdb. Whenever we need to check if a process still exists we know its
PID and the 64-bit number. We look up the PID in serverid.tdb and compare the
64-bit number. If it's the same, the process still is a valid smbd holding the
lock. If it is different, a new smbd has taken over.

I believe this is safe against an smbd that has died hard and the PID has been
taken over by a non-samba process. This process would not have registered
itself with a fresh 64-bit number in serverid.tdb, so the old one still exists
in serverid.tdb. We protect against this case by the parent smbd taking care of
deregistering PIDs from serverid.tdb and the fact that serverid.tdb is
CLEAR_IF_FIRST.

CLEAR_IF_FIRST does not work in a cluster, so the automatic cleanup does not
work when all smbds are restarted. For this, "net serverid wipe" has to be run
before smbd starts up. As a convenience, "net serverid wipedbs" also cleans up
sessionid.tdb and connections.tdb.

While there, this also cleans up overloading connections.tdb with all the
process entries just for messaging_send_all().

Volker
2010-03-10 16:07:10 +01:00
Andrew Tridgell
7cff685c7e s3: convert registry and printing code to TYPESAFE_QSORT() 2010-02-14 18:44:21 +11:00
Volker Lendecke
b1a0c68ff2 s3: "print_job_end" only looks at the size 2009-11-29 11:22:03 +01:00
Volker Lendecke
44ce5603dd s3: Pass the "fake dir create times" parameter to sys_*stat
Step 0 to restore it as a per-share paramter
2009-11-29 11:22:01 +01:00
Aravind Srinivasan
5a4d618109 s3: forward MSG_DEBUG from smbd parent to all children
Before 3.3, an smbcontrol debug message sent to the target "smbd" would
actually be sent to all running processes including nmbd and winbindd.
This behavior was changed in 3.3 so that the "smbd" target would only
send a message to the process found in smbd.pid, while the "all" target
would send a message to all processes.

The ability to set the debug level of all processes within a single
daemon, without specifying each pid is quite useful.  This was implemented
in winbindd in 065760ed.  This patch does the same thing for smbd.

Upon receiving a MSG_DEBUG the parent smbd will rebroadcast it to all of
its children.

The printing process has been added to the list of smbd child processes,
and we now always track the number of smbd children regardless of the
"max smbd processes" setting.
2009-06-22 19:09:37 -07:00
Marc VanHeyningen
a4887e250b s3: Allow child processes to exit gracefully if we are out of fds
When we run out of file descriptors for some reason, every new
connection forks a child that immediately panics causing smbd to
coredump.  This seems unnecessarily harsh; with this code change we
now catch that error and merely log a message about it and exit
without the core dump.

Signed-off-by: Tim Prouty <tprouty@samba.org>
2009-05-27 13:16:17 -07:00
Volker Lendecke
49ca690b4b Introduce "struct stat_ex" as a replacement for SMB_STRUCT_STAT
This patch introduces

struct stat_ex {
        dev_t           st_ex_dev;
        ino_t           st_ex_ino;
        mode_t          st_ex_mode;
        nlink_t         st_ex_nlink;
        uid_t           st_ex_uid;
        gid_t           st_ex_gid;
        dev_t           st_ex_rdev;
        off_t           st_ex_size;
        struct timespec st_ex_atime;
        struct timespec st_ex_mtime;
        struct timespec st_ex_ctime;
        struct timespec st_ex_btime; /* birthtime */
        blksize_t       st_ex_blksize;
        blkcnt_t        st_ex_blocks;
};
typedef struct stat_ex SMB_STRUCT_STAT;

It is really large because due to the friendly libc headers playing macro
tricks with fields like st_ino, so I renamed them to st_ex_xxx.

Why this change? To support birthtime, we already have quite a few #ifdef's at
places where it does not really belong. With a stat struct that we control, we
can consolidate the nanosecond timestamps and the birthtime deep in the VFS
stat calls.

At this moment it is triggered by a request to support the birthtime field for
GPFS. GPFS does not extend the system level struct stat, but instead has a
separate call that gets us the additional information beyond posix. Without
being able to do that within the VFS stat calls, that support would have to be
scattered around the main smbd code.

It will very likely break all the onefs modules, but I think the changes will
be reasonably easy to do.
2009-05-26 17:48:23 +02:00
Jeremy Allison
14c1e9fae2 Hopefully fix the buildfarm. Add some debug level 10 messages
I used to track down the vlp problem, change the vlp test printer
not to use a static path of /tmp/vlp.tdb for the virtual print
database (as this will eventually fill up). Cause it to use
a virtual print database inside the cachepath.
Jeremy.
2009-05-11 17:29:48 -07:00
Günther Deschner
9966541f89 s3-printing: simplify print_queue helper functions and return WERROR.
Guenther
2009-05-06 10:19:04 +02:00
Jelmer Vernooij
4c32978d97 Remove smb_mkstemp() - libreplace will now provide a secure mkstemp() if
the system one is broken.
2009-04-20 23:58:26 +02:00
Stefan Metzmacher
b659daf81f s3:printing: use tevent_loop_wait() instead of manual looping
metze
2009-03-18 07:00:39 +01:00
Stefan Metzmacher
339ea0503d s3:printing: use a fd event to monitor the pipe to the parent
metze
2009-03-18 07:00:39 +01:00
Günther Deschner
4b57f6dd34 s3-spoolss: make jobname a const char * in print_job_start().
Guenther
2009-03-12 14:47:31 +01:00
Volker Lendecke
4a35c974e9 Only copy sharename up from rap_to_pjobid
Why?? :-)

Another one of the little micro-optimizations that I just came across: If you
allocate a variable in a sub-block like the "fstring sharename" in
write_file(), gcc even with -O3 will allocate this variable unconditionally on
the stack at the beginning of the routine. So with eliminating this fstring we
cut 256 bytes of stack in a very hot code path writing to a file. It might make
us a bit more cache-friendly.

This would probably not be worth a second look if it involved larger code
changes, but this one was just too simple to let it pass :-)
2009-03-01 12:27:55 +01:00
Michael Adam
c5e062ed74 s3: fix the build JOB_STATUS_BLOCKED -> JOB_STATUS_BLOCKED_DEVQ
Günther, please check...

Michael
2009-02-26 14:35:27 +01:00
todd stecher
03421944b2 S3: Stop creating SMBD cores when failing to create a pipe.
This was uncovered when the MAX FD limit was hit, causing an instant core
and invoking error reporting. This fix causes SMBD to exit, but without
building a core.
2009-02-18 18:08:33 -08:00
Günther Deschner
46bb22fe5e s3-spoolss: remove more whitespace.
Guenther
2009-02-10 23:59:12 +01:00
Stefan Metzmacher
ac61f650ae s3:smbd: use signal events for SIGTERM, SIGHUP and SIGCHLD
metze
2009-01-27 15:28:07 +01:00