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

434 Commits

Author SHA1 Message Date
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
Stefan Metzmacher
7a07fcdc1e s3:printing: handle tevent_context events in the sys_select() call
metze
2009-01-22 12:37:32 +01:00
Michael Adam
166ffc0d0d s3: put printing/ under cache_dir, not lock_dir
Michael
2009-01-16 01:02:24 +01:00
Bo Yang
022e2f8199 clean event context after child is forked.
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2009-01-05 15:07:31 +01:00
SATOH Fumiyasu
f62e0d6c96 Fix bug #5688 LPQ process is orphaned if socket address parameter is invalid 2008-12-09 14:26:22 -08:00
Volker Lendecke
1db7076b8e Fix nonempty blank lines 2008-12-07 21:30:35 +01:00
Jelmer Vernooij
4746f79d50 Use {u,}int64_t instead of SMB_BIG_{U,}INT. 2008-10-14 01:59:36 +02:00
Jim McDonough
6e6d4c1f5b Allow %u parameters for print job username - use advanced sub
Based on 3.0 and 3.2 patch from Bo Yang <boyang@novell.com>
Bo, please verify this version works for you.
(This used to be commit 9e6760cfea)
2008-07-16 12:37:48 -04:00
Volker Lendecke
a3c0be6325 Change print_access_check to take auth_serversupplied_info instead of current_user
Reason: This is the main user of p->current_user which I would like to remove
(This used to be commit fd43059b3d)
2008-06-26 13:13:23 +02:00
Volker Lendecke
bec1dfab27 Remove "userdom_struct user" from "struct user_struct"
(This used to be commit 420de03523)
2008-05-05 18:28:59 +02:00
Volker Lendecke
0c4093a234 Fix CLEAR_IF_FIRST handling of messages.tdb
We now open messages.tdb even before we do the become_daemon. become_daemon()
involves a fork and an immediate exit of the parent, thus the
parent_is_longlived argument must be set to false in this case. The parent is
not really long lived :-)
(This used to be commit 4f4781c6d1)
2008-04-23 22:18:26 +02:00
Stefan Metzmacher
c5615c6113 printing: call reinit_after_fork() in the backgroundqueue process
metze
(This used to be commit 9adb675a86)
2008-04-18 15:00:19 +02:00
Karolin Seeger
a8124367b4 Fix typos.
Karolin
(This used to be commit 6cee347035)
2008-04-09 16:14:04 +02:00
Michael Adam
da27c77046 use tdb_wipe_all() instead of tdb_wipe() - it is faster...
Michael
(This used to be commit 3d2fdcd50f)
2008-03-26 10:50:35 +01:00
Michael Adam
aaa5971315 util_tdb: add a wrapper tdb_wipe() for traverse with tdb_traverse_delete_fn().
Replace all callers of traverse with this tdb_traverse_delete_fn() and
don't export tdb_traverse_delete_fn() anymore.

Michael
(This used to be commit d4be4e30cd)
2008-03-25 15:55:34 +01:00
Karolin Seeger
2a6a2288c5 Fix some typos.
Karolin
(This used to be commit 2bec0a1fb7)
2008-02-08 10:05:32 +01:00
Volker Lendecke
d826fcf6df Remove a global
(This used to be commit 515f6a8cff)
2007-12-28 17:16:35 +01:00
Volker Lendecke
d60fac2a5a Tiny simplifications
locking.c:open_read_only was unused

don't export the silly boolean flag locking_init(bool read_only)
(This used to be commit 2f3c865707)
2007-12-10 12:22:01 +01:00
Volker Lendecke
a1ceee904c remove a static
(This used to be commit 0006b14d38)
2007-12-10 12:22:01 +01:00
Jeremy Allison
bcf033b38e Change tdb_unpack "P" to return a malloc'ed string rather
than expect a pstring space to put data into.
Fix the (few) callers.
Jeremy.
(This used to be commit 7722a7d2c6)
2007-12-03 14:54:06 -08:00
Jeremy Allison
cdad0409c4 Remove pstrcpy I missed.
Jeremy.
(This used to be commit f570175615)
2007-11-20 19:05:30 -08:00
Jeremy Allison
4c6b01b0ef Remove more pstring. Unify talloc_sub functions to make
them a better match for replacing string_sub. Remove
more unused code.
Jeremy.
(This used to be commit ae7885711f)
2007-11-19 18:56:22 -08:00
Jeremy Allison
30191d1a57 RIP BOOL. Convert BOOL -> bool. I found a few interesting
bugs in various places whilst doing this (places that assumed
BOOL == int). I also need to fix the Samba4 pidl generation
(next checkin).
Jeremy.
(This used to be commit f35a266b3c)
2007-10-18 17:40:25 -07:00
Jeremy Allison
470ebf8a35 r25399: Excise uint - > uint32 (where appropriate) or unsigned int.
Jeremy.
(This used to be commit b4ee924000)
2007-10-10 12:31:02 -05:00
Andrew Tridgell
5e54558c6d r23784: use the GPLv3 boilerplate as recommended by the FSF and the license text
(This used to be commit b0132e94fc)
2007-10-10 12:28:22 -05:00
Jeremy Allison
d824b98f80 r23779: Change from v2 or later to v3 or later.
Jeremy.
(This used to be commit 407e6e695b)
2007-10-10 12:28:20 -05:00
Volker Lendecke
14e25f10d6 r23168: Move the lp_max_connections() into service.c.
(This used to be commit 4afe37d431)
2007-10-10 12:22:51 -05:00
Volker Lendecke
f3c477c631 r23167: Remove an unused parameter
(This used to be commit 3452a870d5)
2007-10-10 12:22:51 -05:00
Volker Lendecke
ac3f08ddbe r23055: Rewrite messages.c to use auto-generated marshalling in the tdb. I'm
doing this because for the clustering the marshalling is needed in more
than one place, so I wanted a decent routine to marshall a message_rec
struct which was not there before.

Tridge, this seems about the same speed as it used to be before, the
librpc/ndr overhead in my tests was under the noise.

Volker
(This used to be commit eaefd00563)
2007-10-10 12:22:17 -05:00
Volker Lendecke
e95942ed84 r22954: More messaging_register
(This used to be commit 9b8df24107)
2007-10-10 12:22:11 -05:00
Volker Lendecke
fb99bbe675 r22895: Convert some more calls from message_send_buf to messaging_send_buf
(This used to be commit c8b9827340)
2007-10-10 12:22:05 -05:00
Volker Lendecke
fad7dd8a60 r22868: Replace some message_send_pid calls with messaging_send_pid calls. More
tomorrow.
(This used to be commit 74fa57ca5d)
2007-10-10 12:22:04 -05:00
Volker Lendecke
7192160599 r22747: Fix some C++ warnings
(This used to be commit a66a04e9f1)
2007-10-10 12:21:54 -05:00
Volker Lendecke
e6383f4762 r22736: Start to merge the low-hanging fruit from the now 7000-line cluster patch.
This changes "struct process_id" to "struct server_id", keeping both is
just too much hassle. No functional change (I hope ;-))

Volker
(This used to be commit 0ad4b1226c)
2007-10-10 12:21:52 -05:00
Stefan Metzmacher
bc2b6436d0 r22009: change TDB_DATA from char * to unsigned char *
and fix all compiler warnings in the users

metze
(This used to be commit 3a28443079)
2007-10-10 12:19:00 -05:00
Stefan Metzmacher
2d118cef3f r21988: make use of string_tdb_data()
to avoid creating the TDB_DATA struct from strings "by hand"

metze
(This used to be commit 2f52df7103)
2007-10-10 12:18:57 -05:00
Volker Lendecke
8dbeb4dbeb r21446: Karolins "printjob username"
(This used to be commit 19ee677925)
2007-10-10 12:18:04 -05:00
Volker Lendecke
caf8c6a76b r21064: The core of this patch is
void message_register(int msg_type,
                      void (*fn)(int msg_type, struct process_id pid,
-                                void *buf, size_t len))
+                                void *buf, size_t len,
+                                void *private_data),
+                     void *private_data)
 {
        struct dispatch_fns *dfn;

So this adds a (so far unused) private pointer that is passed from
message_register to the message handler. A prerequisite to implement a tiny
samba4-API compatible wrapper around our messaging system. That itself is
necessary for the Samba4 notify system.

Yes, I know, I could import the whole Samba4 messaging system, but I want to
do it step by step and I think getting notify in is more important in this
step.

Volker
(This used to be commit c8ae60ed65)
2007-10-10 12:17:32 -05:00
Herb Lewis
791f48f167 r20124: clean up nested extern declaration warnings
(This used to be commit ac3eb7813e)
2007-10-10 12:16:26 -05:00
Volker Lendecke
08e308fe2c r17590: Some C++ Warnings
(This used to be commit b7ec240880)
2007-10-10 11:38:41 -05:00
Jeremy Allison
a093a76dc1 r17293: After the results from the cluster tests in Germany,
fix the messaging code to call the efficient calls :

save_re_uid()
set_effective_uid(0);

messaging_op

restore_re_uid();

instead of using heavyweight become_root()/unbecome_root()
pairs around all messaging code. Fixup the messaging
code to ensure sec_init() is called (only once) so that non-root
processes still work when sending messages.

This is a lighter weight solution to become_root()/unbecome_root()
(which swaps all the supplemental groups) and should be more
efficient. I will migrate all server code over to using this
(a similar technique should be used in the passdb backend
where needed).

Jeremy.
(This used to be commit 4ace291278)
2007-10-10 11:38:24 -05:00
Jeremy Allison
fbdcf2663b 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.
(This used to be commit 9dafb7f48c)
2007-10-10 11:19:14 -05:00
Jeremy Allison
e5f766aac8 r16648: Fix bug #3889 reported by jason@ncac.gwu.edu.
Jeremy.
(This used to be commit 2eefe9b6f5)
2007-10-10 11:19:06 -05:00
Jeremy Allison
57ba729fac r16626: Fix bug #3878. Reported by jason@ncac.gwu.edu.
Jeremy.
(This used to be commit 4c3019eb99)
2007-10-10 11:19:04 -05:00
Jeremy Allison
fc77e332e3 r16599: Make it clear to Klocwork we're not dereferencing. Issue #2026.
Jeremy.
(This used to be commit 9402bf0d4c)
2007-10-10 11:19:02 -05:00
Jeremy Allison
2e8b3ca0cb r16216: Add debug messages to make it possible to try and
debug why a job pause or resume command is not being
done.
Jeremy.
(This used to be commit e6aacb1426)
2007-10-10 11:17:26 -05:00
Volker Lendecke
e17302200c r15101: Little step towards getting Samba4 tdb into 3: tdb_lock_bystring does not
have the timeout argument in Samba4. Add a new routine
tdb_lock_bystring_with_timeout.

Volker
(This used to be commit b9c6e3f556)
2007-10-10 11:16:23 -05:00
Jeremy Allison
cc8ba23e8d r15025: Fix exit_server_cleanly call.
Jeremy.
(This used to be commit a64976b944)
2007-10-10 11:15:57 -05:00
James Peach
4fa5559800 r14898: This change is an attempt to improve the quality of the information that
is produced when a process exits abnormally.

First, we coalesce the core dumping code so that we greatly improve our
odds of being able to produce a core file, even in the case of a memory
fault. I've removed duplicates of dump_core() and split it in two to
reduce the amount of work needed to actually do the dump.

Second, we refactor the exit_server code path to always log an explanation
and a stack trace. My goal is to always produce enough log information
for us to be able to explain any server exit, though there is a risk
that this could produce too much log information on a flaky network.

Finally, smbcontrol has gained a smbd fault injection operation to test
the changes above. This is only enabled for developer builds.
(This used to be commit 56bc02d644)
2007-10-10 11:15:53 -05:00
Jeremy Allison
894358a8f3 r13915: Fixed a very interesting class of realloc() bugs found by Coverity.
realloc can return NULL in one of two cases - (1) the realloc failed,
(2) realloc succeeded but the new size requested was zero, in which
case this is identical to a free() call.

The error paths dealing with these two cases should be different,
but mostly weren't. Secondly the standard idiom for dealing with
realloc when you know the new size is non-zero is the following :

 tmp = realloc(p, size);
 if (!tmp) {
    SAFE_FREE(p);
    return error;
 } else {
    p = tmp;
 }

However, there were *many* *many* places in Samba where we were
using the old (broken) idiom of :

 p = realloc(p, size)
 if (!p) {
    return error;
 }

which will leak the memory pointed to by p on realloc fail.

This commit (hopefully) fixes all these cases by moving to
a standard idiom of :

 p = SMB_REALLOC(p, size)
 if (!p) {
    return error;
 }

Where if the realloc returns null due to the realloc failing
or size == 0 we *guarentee* that the storage pointed to by p
has been freed. This allows me to remove a lot of code that
was dealing with the standard (more verbose) method that required
a tmp pointer. This is almost always what you want. When a
realloc fails you never usually want the old memory, you
want to free it and get into your error processing asap.

For the 11 remaining cases where we really do need to keep the
old pointer I have invented the new macro SMB_REALLOC_KEEP_OLD_ON_ERROR,
which can be used as follows :

 tmp = SMB_REALLOC_KEEP_OLD_ON_ERROR(p, size);
 if (!tmp) {
    SAFE_FREE(p);
    return error;
 } else {
    p = tmp;
 }

SMB_REALLOC_KEEP_OLD_ON_ERROR guarentees never to free the
pointer p, even on size == 0 or realloc fail. All this is
done by a hidden extra argument to Realloc(), BOOL free_old_on_error
which is set appropriately by the SMB_REALLOC and SMB_REALLOC_KEEP_OLD_ON_ERROR
macros (and their array counterparts).

It remains to be seen what this will do to our Coverity bug count :-).

Jeremy.
(This used to be commit 1d710d06a2)
2007-10-10 11:10:59 -05:00
Günther Deschner
cab298856a r13622: Allow to rename machine accounts in a Samba Domain. This still uses the
"rename user script" to do the rename of the posix machine account (this
might be changed later). Fixes #2331.

Guenther
(This used to be commit b2eac2e6eb)
2007-10-10 11:10:19 -05:00
Jeremy Allison
d14af63e6a r13293: Rather a big patch I'm afraid, but this should fix bug #3347
by saving the UNIX token used to set a delete on close flag,
and using it when doing the delete. libsmbsharemodes.so still
needs updating to cope with this change.
Samba4 torture tests to follow.
Jeremy.
(This used to be commit 23f16cbc2e)
2007-10-10 11:06:21 -05:00
Gerald Carter
54abd2aa66 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)
(This used to be commit 939c3cb5d7)
2007-10-10 11:04:48 -05:00
Gerald Carter
2919634467 r10555: a few compile warnings from jason Mader
(This used to be commit 88998fa0b9)
2007-10-10 11:04:47 -05:00
Jeremy Allison
c762908074 r10371: Adding iPrint printing backend written by Joel J. Smith @ Novell.
Jeremy.
(This used to be commit 155dc2d52a)
2007-10-10 11:03:41 -05:00
Jeremy Allison
4ae6b9765f r9244: Fix bugs found by Coverity.
Jeremy.
(This used to be commit bf80edeea7)
2007-10-10 11:00:28 -05:00
Günther Deschner
0b98400cc0 r8686: Revert %LOGONSERVER%-substitution. The substition is done on the client,
not on the server.

We now preserve this windows variable (important for vampired setups)
and correctly substitute only the "%L"s in strings like:

        "%LOGONSERVER% %L %lOgOnSeRvEr% %L".

Guenther
(This used to be commit dccf777f42)
2007-10-10 11:00:15 -05:00
Gerald Carter
eb1123e500 r8506: BUG 2853: don't strip out characters like '$' from printer names
when substituting for the lpq command.
(This used to be commit 2f5de718a9)
2007-10-10 11:00:07 -05:00
Gerald Carter
18dc1009e6 r7829: fix unitialized printer status field that was breaking migration of print queues
(This used to be commit ada1d326ae)
2007-10-10 10:57:58 -05:00
Jeremy Allison
fe0ce8dd8e r6890: Refactor printing interface to take offset into job. Fixes bug
where large print jobs can have out-of-order offsets. Bug found
by Arcady Chernyak <Arcady.Chernyak@efi.com>
Jeremy.
(This used to be commit 482f7e0e37)
2007-10-10 10:56:56 -05:00
Gerald Carter
fd237d9903 r6490: BUG 1998: patch from Olaf Imig <Olaf.Imig@bifab.de>; fix byte ordering bug when storing 16-bit RAP print job ids
(This used to be commit 2c66a4098a)
2007-10-10 10:56:42 -05:00
Gerald Carter
a49c567d4a r5993: compiler warning fix
(This used to be commit 4e8b868e6e)
2007-10-10 10:56:14 -05:00
Gerald Carter
9b38ced168 r5950: more compiler warning's from Jason Mader
(This used to be commit 27c6e85ad5)
2007-10-10 10:56:10 -05:00
Gerald Carter
cacc3e1888 r5807: fix segfault after compiler warning clean up (and cleanup another warning)
(This used to be commit 2dae527e21)
2007-10-10 10:56:02 -05:00
Volker Lendecke
5918d8a311 r5770: Get rid of some compiler warnings
(This used to be commit 96a0f7d60c)
2007-10-10 10:56:00 -05:00
Gerald Carter
ad4fe018c2 r5691: wrapping the pause/resume/purge printer commands in
{become,unbecome}_root() blocks.  We've already done
a print_access_check() to ensure the user is admin.
The means that non-root users can pause and manage printers.
I really don't see how this worked before without setuid
binaries on the server.

Also update print_queue_update() interface to allow an smbd
to update the print queue cache locally rather than going through
the bg lpq daemon.  This is needed for things like pjob_delete()
to ensure the cache is current for the specific client.
(This used to be commit f75369ec86)
2007-10-10 10:55:55 -05:00
Jeremy Allison
57e3af57fd r4662: Fix from "Jerome Borsboom" <j.borsboom@erasmusmc.nl> to fix
missing release reference for printer tdb.
Jeremy.
(This used to be commit 5942bb7737)
2007-10-10 10:53:50 -05:00
Gerald Carter
d097ea4905 r4539: patch from Rob -- adding real printcap name cache function to speed up printcap reloads
(This used to be commit 1cad525093)
2007-10-10 10:53:46 -05:00
Gerald Carter
bc7142ce23 r4094: BUG 2107: fix memory bloating caused by large numbers of print_queue_updates() requests sent via messages.tdb
(This used to be commit 56b1110c71)
2007-10-10 10:53:34 -05:00
Jeremy Allison
acf9d61421 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.
(This used to be commit 620f2e608f)
2007-10-10 10:53:32 -05:00
Gerald Carter
90bd2b4fd0 r4028: * prevent the background LPQ daemon from updating
the print queue cache just because multiple smbd
  processes sent a message that it was out of date.

* add some extra debug messages while trying to track down
  down jobs being left in the queue after printing has
  completed.
(This used to be commit a64505d52f)
2007-10-10 10:53:28 -05:00
Jeremy Allison
79f7373b33 r3867: Fix from david.hu@hp.com - make a copy of an incoming message
rather than indirecting into it as a struct (may not be on an
even byte boundary). Bug #2052.
Jeremy.
(This used to be commit 8a91a69961)
2007-10-10 10:53:22 -05:00
Gerald Carter
293136c04b r3067: patch based on volker's initial work in trunk that fixes the queu update problem when using the background daemon
(This used to be commit de7af09e72)
2007-10-10 10:53:00 -05:00
Gerald Carter
5a8effaaae r2569: Patch from Rob Foehl <rwf@loonybin.net>:
- fix typo in libads/ldap_printer.c:39, ads_find_printer_on_server()
  (originally libads-typo.patch)
- fix leak in printing/nt_printing.c, is_printer_published()
  (originally is_printer_published-leak.patch)
- fix double print_backend_init() calls, now only called from main()
- restructuring in printing/nt_printing.c
  - replaced (un)publish_it() with ads-specific functions
  - moved common code to nt_printer_publish()
  - improved error handling in several places
- added check_published_printers() in printing/nt_printing.c, to verify
  that each published printer is actually in the directory at startup
- changed calling semantics of mod_a_printer, dump_a_printer, and
  update_driver_init to be more consistent with the rest of the api and
  reduce some copying
(This used to be commit 50a5a3dbd0)
2007-10-10 10:52:46 -05:00
Gerald Carter
12172c91da r2191: ensure that we assign our pid to print jobs (and not our parent's pid); ensures that spooling jobs from dead smbds are removed from the tdb
(This used to be commit 9e42d016e1)
2007-10-10 10:52:35 -05:00
Gerald Carter
278f9467f2 r2133: Several fixes:
* BUG 1627: fix for NIS compiles on HPUX 11.00, AIX 4.3 and 5.1
  patch from Olaf Flebbe <o.flebbe@science-computing.de>.
  Will need to watch this one in the build farm.

* Fix bug found by rwf@loonybin.net where the PRINT_ATTRIBUTE_PUBLISHED
  was getting reset by attempts to sanitize the defined attributes
  (PRINTER_ATTRIBUTE_SAMBA)

* Resolve name conflict on DEC OSF-5.1 (inspired by patch from
  Adharsh Praveen <rprav@india.hp.com>)

* Work around parsing error in the print change notify code
  (not that the alignment bug is still there but reording the
   entries in the array works around it).

* remove duplicate declaration of getprintprocdir from rpcclient.
(This used to be commit 7474c6a446)
2007-10-10 10:52:32 -05:00
Gerald Carter
1842fde7d1 r1885: tighten the cache consistency with the ntprinters.tdb entry an the in memory cache associated with open printer handles; also make sure that register_messages_flags() doesn't overwrite the originally registers flags
(This used to be commit 540daf71d8)
2007-10-10 10:52:23 -05:00
Gerald Carter
d90c4a0462 r1384: ensure we remove the tdb entry for a job in the spooling state
(This used to be commit bc8cf6c852)
2007-10-10 10:52:09 -05:00
Volker Lendecke
baf7cf42a6 r1295: To be able to send a message to the background queue updated, we need to be
root. Otherwise the USR1 signal will not be delivered.

Volker
(This used to be commit c66be874d8)
2007-10-10 10:52:04 -05:00
Gerald Carter
087868c499 r1230: (merges from HP PSA) fixing a couple of caching bugs in the printing code. (a) make sure to clear jobs_changed list when deleting a job and, (b) invalidate the printer handle cache when we get a notification that something has changed on that printer
(This used to be commit e3d4fea780)
2007-10-10 10:52:01 -05:00
Gerald Carter
7959cba656 r925: add changes frpm trunk (r841 and r842) -- enable background queue update process and allow printers to have different sharenames from printernames
(This used to be commit 066b9c4276)
2007-10-10 10:51:49 -05:00
Jim McDonough
88adbfa1f7 r560: Fix bugzilla 1279: cannot control individual print jobs using cups
Store the print job using a little-endian key.
(This used to be commit e0491dae98)
2007-10-10 10:51:29 -05:00
Jim McDonough
ba8a59dbf4 r555: Fix big-endian storage of jobids in jobs_changed list. Found during
debugging of 1279
(This used to be commit 7c1cfb16c0)
2007-10-10 10:51:29 -05:00
Gerald Carter
dbb38cc6b5 merging print change notify fix from HP appliance. Also might address some one the issues in BUG 1007
(This used to be commit 17ecea4152)
2004-03-16 17:06:11 +00:00
Gerald Carter
dbe9e8a4cb fix byte ordering problem when storing the updating pid for the lpq cache; was causing an abort in process_exists() on solaris
(This used to be commit 26681cd2a1)
2004-03-15 15:06:33 +00:00
Gerald Carter
cb49c07c98 fix compiler warning
(This used to be commit df19b6066e)
2004-03-05 17:39:38 +00:00