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

1150 Commits

Author SHA1 Message Date
Simo Sorce
849cc65654 s3-smbd: Migrated to new spoolss functions for printing.
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
Andreas Schneider
7c629bda2f s3-printing: Remove unused printer registry key functions.
Signed-off-by: Jim McDonough <jmcd@samba.org>
2010-07-27 10:27:13 -04:00
Andreas Schneider
ae405eed4f s3-printing: Removed unused security descriptor functions.
Signed-off-by: Jim McDonough <jmcd@samba.org>
2010-07-27 10:27:12 -04:00
Andreas Schneider
e2d3c0efa9 s3-printing: Removed unused nt_forms.
Signed-off-by: Jim McDonough <jmcd@samba.org>
2010-07-27 10:27:12 -04:00
Andreas Schneider
c918cfdede s3-printing: Removed unsuded c_setprinter functions.
Signed-off-by: Jim McDonough <jmcd@samba.org>
2010-07-27 10:27:12 -04:00
Andreas Schneider
d8ab3e52dc s3-printing: Removed unused free_a_printer function.
Signed-off-by: Jim McDonough <jmcd@samba.org>
2010-07-27 10:27:12 -04:00
Andreas Schneider
5c1f283747 s3-printing: Removed unused mod_a_printer functions.
Signed-off-by: Jim McDonough <jmcd@samba.org>
2010-07-27 10:27:12 -04:00
Andreas Schneider
4e45d5f824 s3-printing: Removed unused get_a_printer functions.
Signed-off-by: Jim McDonough <jmcd@samba.org>
2010-07-27 10:27:12 -04:00
Simo Sorce
38d6274864 s3-smbd: Added code to print via spoolss. 2010-07-27 10:27:12 -04:00
Simo Sorce
a1fe2ed68a s3-spoolss: Use winreg_delete_printer_key to delete printers.
Signed-off-by: Jim McDonough <jmcd@samba.org>
2010-07-27 10:27:10 -04:00
Simo Sorce
fdf669d377 s3-spoolss: Get rid of get_server_name.
This function was useless the structure is public and used everywhere.

Signed-off-by: Jim McDonough <jmcd@samba.org>
2010-07-27 10:27:10 -04:00
Simo Sorce
44bc6714b0 s3-printing: Converted printer publishing functions.
Use spoolss_PrintInfo2 and winreg calls.

Signed-off-by: Jim McDonough <jmcd@samba.org>
2010-07-27 10:27:10 -04:00
Simo Sorce
d17d73f4be s3-printing: Convert print_driver_in_use.
Use spoolss_PrintInfo2 and winreg calls.

Signed-off-by: Jim McDonough <jmcd@samba.org>
2010-07-27 10:27:10 -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
52b8f1f471 s3-spoolss: Migrated driver functions to winreg.
Signed-off-by: Jim McDonough <jmcd@samba.org>
2010-07-27 10:27:09 -04:00
Andreas Schneider
e517588a20 s3-spoolss: Set c_setprinter always to 0.
This value is only used for the well known printers list which Samba
doesn't implement.

Signed-off-by: Jim McDonough <jmcd@samba.org>
2010-07-27 10:27:09 -04:00
Andreas Schneider
e2c9ad93cb s3-spoolss: Migrated spoolss_AddPrinter and spoolss_SetPrinter.
Signed-off-by: Jim McDonough <jmcd@samba.org>
2010-07-27 10:27:08 -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
Günther Deschner
e4ba8fb3b9 s3-printing: Fix Bug #7541, %D in "printer admin" causing smbd crash.
Guenther
2010-07-01 14:13:16 +02:00
Günther Deschner
14f2525f9e s3-printing: add BUILTIN\Print Operators as FULL CONTROL to default sd.
Guenther
2010-06-16 12:15:24 +02:00
Andreas Schneider
47ae4a518c s3-spoolss: Provide a memory context for clean_up_driver_struct().
If we use a stack variable to setup spoolss_AddDriverInfoCtr this would
segfault with a talloc bad magic value.
2010-06-16 12:03:46 +02:00
Volker Lendecke
3f7e2222f4 s3: Remove the pointless PRINTERNAME macro 2010-06-13 12:40:27 +02:00
Volker Lendecke
1b13755698 s3: Remove the pointless SERVICE 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
Günther Deschner
f9f8007361 s3-build: only use ndr_security.h where needed.
Guenther
2010-05-31 11:32:37 +02: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
Michael Adam
0fe1ff99a1 s3:registry: move reg_objects.h to registry/ and use it only where needed
Every place outside of registry/ where this is used, should probably
be changed to use pure reg_api.c code.
2010-05-25 10:35:31 +02:00
Michael Adam
b5d0fdd96c s3:nt_printing: use regval_ctr_init(). 2010-05-25 10:35:30 +02:00
Michael Adam
9ccf66379a s3:registry: adapt callers of regval_ctr_addvalue to uint8 * instead of char * 2010-05-25 10:35:25 +02:00
Andrew Bartlett
cba7f8b827 s3:dom_sid Global replace of DOM_SID with struct dom_sid
This matches the structure that new code is being written to,
and removes one more of the old-style named structures, and
the need to know that is is just an alias for struct dom_sid.

Andrew Bartlett

Signed-off-by: Günther Deschner <gd@samba.org>
2010-05-21 10:39:59 +02:00
Andreas Schneider
0953087f82 s3-spoolss: Added EN ISO 216, A0 and A1 to builtin forms.
Signed-off-by: Andreas Schneider <asn@samba.org>
Signed-off-by: Günther Deschner <gd@samba.org>
2010-05-18 16:37:16 +02:00
Simo Sorce
d6a73ad85b s3-spoolss: Removed the Phantom DeviceMode.
This was a hack that required a special client from HP.
The client code has never been released and was discontinued,
so this code was just dead weight.

Signed-off-by: Günther Deschner <gd@samba.org>
2010-05-18 15:52:28 +02:00
Andreas Schneider
7d363b8922 s3-spoolss: Create a spoolss_map_to_os2_driver function.
Signed-off-by: Günther Deschner <gd@samba.org>
2010-05-18 15:17:23 +02:00
Andreas Schneider
a3b81a908c s3-spoolss: Use better names for set_last_from_to.
Use set_driver_mapping() and get_win_driver(), get_os2_driver().

Signed-off-by: Günther Deschner <gd@samba.org>
2010-05-18 15:16:55 +02:00
Günther Deschner
d4474ba470 s3-secdesc: use SD_REVISION from security.idl.
Guenther
2010-05-18 12:52:18 +02:00
Günther Deschner
7f6bb48bdf s3-secdesc: remove "typedef struct security_descriptor SEC_DESC".
Guenther
2010-05-18 12:30:12 +02:00
Günther Deschner
8951c8301a s3-secdesc: remove "typedef struct security_acl SEC_ACL".
Guenther
2010-05-18 12:30:12 +02:00
Günther Deschner
a8b01d1f3b s3-secdesc: remove "typedef struct security_ace SEC_ACE".
Guenther
2010-05-18 12:30:11 +02:00
Günther Deschner
8bc9c343c4 s3-secdesc: remove "typedef struct sec_desc_buf SEC_DESC_BUF".
Guenther
2010-05-18 12:30:11 +02:00
Jelmer Vernooij
b8268cf7b0 s3: Remove use of iconv_convenience. 2010-05-18 11:45:31 +02:00
Günther Deschner
fe31b67d5e s3-registry: only include registry headers when really needed.
Guenther
2010-05-18 01:15:38 +02:00
Günther Deschner
3b529d50be s3-rpc_misc: clean out include/rpc_misc.h.
Well known rids don't really belong into an rpc header, just use the ones
defined in security.idl.

Guenther
2010-05-18 00:44:26 +02:00
Günther Deschner
a052aa87be s3-printing: explicitly include "printing/pcap.h" as there is /usr/include/pcap.h.
Thanks metze for pointing this out. Simo, please check.

Guenther
2010-05-14 14:41:50 +02:00
Simo Sorce
348b4b9bab Make pcap headers private
Signed-off-by: Günther Deschner <gd@samba.org>
2010-05-14 14:15:08 +02:00
Simo Sorce
f36396f90f Move standard printcap parsing to print_standard.c
Signed-off-by: Günther Deschner <gd@samba.org>
2010-05-14 14:14:55 +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
Andreas Schneider
66f7699511 s3-spoolss: Added a generic spoolss_create_default_secdesc function.
Signed-off-by: Günther Deschner <gd@samba.org>
2010-05-05 18:16:23 +02:00
Andreas Schneider
b2ea8fbcce s3-spoolss: Added a function to create a default spoolss_DeviceMode.
Signed-off-by: Günther Deschner <gd@samba.org>
2010-05-05 18:08:56 +02:00
Andreas Schneider
6683b0d4b6 s3-lib: Create a sec_desc_merge and sec_desc_merge_buf function.
Signed-off-by: Günther Deschner <gd@samba.org>
2010-05-04 19:37:39 +02:00
Simo Sorce
dffeb12f3d smbd: move printfile_offset() within write_file() 2010-04-30 11:52:39 -07: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
Simo Sorce
168b86c384 s3-smbd: group print relate data in own structure 2010-04-23 14:26:33 -07:00
Simo Sorce
8f56cdfaee s3-spoolss: Move info_ctr conversion to a public helper.
Signed-off-by: Günther Deschner <gd@samba.org>
2010-04-23 16:23:49 +02:00
Andreas Schneider
d65485b3c5 s3-spoolss: Use const values for notify functions.
Signed-off-by: Günther Deschner <gd@samba.org>
2010-04-23 16:06:51 +02:00
Günther Deschner
413ffe9adb s3-spoolss: fix some crash bugs and missing error codes in AddDriver paths.
Found by torture test.

Guenther
2010-04-23 02:34:43 +02:00
Günther Deschner
63b111bd32 s3: add iconv_convenience handle to pull/push sz helpers.
Guenther
2010-04-09 18:33:45 +02:00
Günther Deschner
d9138f4ccf s3-spoolss: Fix an issue in _spoolss_DeleteForm.
Found by torture test.

Guenther
2010-04-07 23:53:19 +02:00
Jeremy Allison
32c8feab5d Fix for bug #7233 - print fails with jobs >4GB from Win7 clients.
Contains for by Sebastian Kloska <oncaphillis@snafu.de>. Submitter
confirms this fixes the problem.

Jeremy.
2010-03-30 15:27:26 -07:00
Günther Deschner
3da91b786e s3-printing: avoid mixing cups backend code with nt_printing code in cups_pull_comment_location.
Guenther
2010-03-26 14:36:46 +01: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
Michael Karcher
845c2281c7 Fix bug #7269 - Job management commands don't work for CUPS queues.
Samba needs to retrieve pjob->sysjob from the CUPS response (as
is done in the iprint backend).
2010-03-24 17:33:21 -07:00
Jeremy Allison
0d6d068bc4 s3-printing: Fix "printer admin" functionality.
Fix bug #7255 ("printer admin" parameter does not work as expected).
2010-03-18 11:24:06 +01: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
Jeremy Allison
c61c9c3a4c Fix for bug #7189 - Open txt files with notepad on samba shares creates problem.
Ensure we don't use any of the create_options for Samba private
use. Add a new parameter to the VFS_CREATE call (private_flags)
which is only used internally. Renumber NTCREATEX_OPTIONS_PRIVATE_DENY_DOS
and NTCREATEX_OPTIONS_PRIVATE_DENY_FCB to match the S4 code).
Rev. the VFS interface to version 28.

Jeremy.
2010-03-05 15:13:37 -08:00
Andreas Schneider
d9f31fea6a s3-print: Remove obsolete signal type cast. 2010-02-23 12:23:42 +01:00
Andrew Tridgell
7cff685c7e s3: convert registry and printing code to TYPESAFE_QSORT() 2010-02-14 18:44:21 +11:00
Jeremy Allison
9252df53d9 Use sec_initial_uid() in the places where being root doesn't matter,
and 0 in the places where it does.

Jeremy
2010-02-12 23:18:53 -08:00
Volker Lendecke
3ea64e0ad8 s3: Replace most calls to sid_append_rid() by sid_compose() 2010-01-10 20:56:16 +01:00
Günther Deschner
35c50dcce3 s3-spoolss: use driver level info8 everywhere in spoolss server internally.
Guenther
2009-12-08 11:05:21 +01:00
Günther Deschner
a367b2b5df s3-spoolss: a default printer should have at least a "PrintDriverData" key.
Guenther
2009-12-07 14:41:44 +01: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
Jeremy Allison
c5b234c9cd Fix warnings with talloc_asprintf.
Jeremy.
2009-11-25 14:47:36 -08:00
Günther Deschner
513d6da404 s3-printing: remove duplicate code while cleaning up driver structs.
Guenther
2009-11-23 12:57:46 +01:00
Günther Deschner
ec56895bde s3-printing: use spoolss types and structs while getting and deleting drivers.
Guenther
2009-11-23 12:19:11 +01:00
Günther Deschner
68cc1166d9 s3-printing: use spoolss types and structs while adding drivers.
Guenther
2009-11-23 12:19:04 +01:00
Jeremy Allison
a770caed0f Remove "store create time" code, cause create time to be stored
in the "user.DOSATTRIB" EA. From the docs:
In Samba 3.5.0 and above the "user.DOSATTRIB" extended attribute has been extended to store
the create time for a file as well as the DOS attributes. This is done in a backwards compatible
way so files created by Samba 3.5.0 and above can still have the DOS attribute read from this
extended attribute by earlier versions of Samba, but they will not be able to read the create
time stored there. Storing the create time separately from the normal filesystem meta-data
allows Samba to faithfully reproduce NTFS semantics on top of a POSIX filesystem.
Passes make test but will need more testing.
Jeremy.
2009-11-17 14:55:02 -08:00
Günther Deschner
ad836c4d48 s3-registry: use pull_reg_sz() where appropriate.
(and move away from rpcstr_pull and rpcstr_pull_talloc).

Guenther
2009-10-01 11:40:30 +02:00
Günther Deschner
bbf394f36d s3-printing: use regval_ctr_addvalue_multi_sz.
Guenther
2009-09-30 16:23:40 +02:00
Günther Deschner
1b0f3b7e3a s3-registry: use regval_ctr_addvalue_sz().
Greatly simplifies and cleanes up the code.

Guenther
2009-09-30 00:30:12 +02:00
Günther Deschner
2c11b73391 s3-registry: use push_reg_sz().
Guenther
2009-09-30 00:29:49 +02:00
Günther Deschner
8e5beb738c s3-spoolss: remove device mode defines from nt_printing.h.
Guenther
2009-08-10 11:32:26 +02:00
Stefan Metzmacher
70afd419a6 s3:smbd: conn_free_internal() can be static now
metze
2009-08-07 14:18:15 +02:00
Tim Prouty
f49f3fcb01 s3: Convert a few callers of unix_convert() over to filename_convert()
This patch also changes the unix convert flags to make sure the
correct semantics are preservered for allowing/disallowing wildcards
in the last component of the path.
2009-07-24 18:51:41 -07:00
Tim Prouty
c9b8a01714 s3: Finish plumbing the fsp->fsp_name smb_fname conversion through the modules. 2009-07-20 17:26:57 -07:00
Günther Deschner
2579afc897 s3-vlp: drastically shrink size and dependencies of the virtual line printer.
This gets vlp from 13M down to 214K on my box.

Guenther
2009-06-26 09:34:02 +02:00
Günther Deschner
05459cf833 s3-printing: eliminate another non sec_initial_uid using security check.
Guenther
2009-06-24 00:36:48 +02: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
Jeremy Allison
271d09f599 Fix coverity #740. Resource leak in error paths. We should
always return queue here as the caller will free.
Jeremy.
2009-06-19 17:20:00 -07:00
Volker Lendecke
0c3580c5de Do a correct TALLOC_FREE in an error case 2009-06-15 07:48:50 +02:00
Tim Prouty
04afa4b6b5 s3: Plumb smb_filename through SMB_VFS_CREATE_FILE 2009-06-12 16:14:50 -07:00
Tim Prouty
a9ec21cf21 s3: Prepare the first set of SMB_VFS_CREATE_FILE callers to take an smb_filename struct
Some of the callers required minimal changes, while others
(copy_internals) required significant changes.  The task is simplified
a little bit because we are able to do operations and checks on the
base_name when a stream isn't used.

This patch should cause no functional changes.

Volker, Jeremy: Please check
2009-06-10 13:13:27 -07:00
Tim Prouty
ab779f5c34 s3: Remove extraneous calls to unix_convert
Not only are these unnecessary in spirit because unlink_internals
calls unix_convert, but in practice the return value is simply being
ignored right now.
2009-06-10 13:13:26 -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
Tim Prouty
c1a21d085d s3: Change unix_convert (and its callers) to use struct smb_filename
This is the first of a series of patches that change path based
operations to operate on a struct smb_filename instead of a char *.
This same concept already exists in source4.

My goals for this series of patches are to eventually:

1) Solve the stream vs. posix filename that contains a colon ambiguity
   that currently exists.
2) Make unix_convert the only function that parses the stream name.
3) Clean up the unix_convert API.
4) Change all path based vfs operation to take a struct smb_filename.
5) Make is_ntfs_stream_name() a constant operation that can simply
   check the state of struct smb_filename rather than re-parse the
   filename.
6) Eliminate the need for split_ntfs_stream_name() to exist.

My strategy is to start from the inside at unix_convert() and work my
way out through the vfs layer, call by call.  This first patch does
just that, by changing unix_convert and all of its callers to operate
on struct smb_filename.  Since this is such a large change, I plan on
pushing the patches in phases, where each phase keeps full
compatibility and passes make test.

The API of unix_convert has been simplified from:

NTSTATUS unix_convert(TALLOC_CTX *ctx,
		      connection_struct *conn,
		      const char *orig_path,
		      bool allow_wcard_last_component,
		      char **pp_conv_path,
		      char **pp_saved_last_component,
		      SMB_STRUCT_STAT *pst)
to:

NTSTATUS unix_convert(TALLOC_CTX *ctx,
		      connection_struct *conn,
		      const char *orig_path,
		      struct smb_filename *smb_fname,
		      uint32_t ucf_flags)

Currently the smb_filename struct looks like:

struct smb_filename {
       char *base_name;
       char *stream_name;
       char *original_lcomp;
       SMB_STRUCT_STAT st;
};

One key point here is the decision to break up the base_name and
stream_name.  I have introduced a helper function called
get_full_smb_filename() that takes an smb_filename struct and
allocates the full_name.  I changed the callers of unix_convert() to
subsequently call get_full_smb_filename() for the time being, but I
plan to eventually eliminate get_full_smb_filename().
2009-05-20 17:40:15 -07:00
Günther Deschner
652251701d s3-printing: no need to define struct table_node 4 times.
Guenther
2009-05-13 15:27:06 +02:00
Günther Deschner
7403dd39d6 s3-spoolss: move SPL_ARCH_X defines to IDL.
Guenther
2009-05-13 01:56:40 +02:00
Günther Deschner
94665adb48 s3-printing: Fix vlp testprinter application.
Jeremy, we cannot just access cache_path() here without calling lp_load and
friends as well as parsing configfile from the commandline in order to make
"make test/selftest" find the correct conffile with path, etc.

I just changed it to pass the target tdbfilename as an argument, ok ?

Guenther
2009-05-12 11:41:14 +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
Günther Deschner
baf7850689 s3-printing: rework move_driver_file_to_download_area() a bit for clarity.
Guenther
2009-04-30 17:33:07 +02:00
Günther Deschner
233bfb25c9 s3-printing: use move_driver_file_to_download_area() to avoid code duplication.
Guenther
2009-04-30 11:22:23 +02:00
Günther Deschner
a2a155bee5 s3-printing: add move_driver_file_to_download_area().
Guenther
2009-04-30 11:22:23 +02:00
Michael Adam
a94bd62d28 s3:nt_printing: fix a comment typo
Michael
2009-04-27 18:17:27 +02:00
Michael Adam
8185d31fb0 s3:registry: replace typedef REGISTRY_VALUE by struct regval_blob
Michael
2009-04-27 11:21:03 +02:00
Michael Adam
221151a2a2 s3:registry: replace typedef REGVAL_CTR by struct regval_ctr.
This paves the way for hiding the typedef and the implementation
from the surface.

Michael
2009-04-27 11:21:02 +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
Günther Deschner
62480385c1 s3-printing: use ARRAY_SIZE() macro in forms functions.
Guenther
2009-04-20 01:06:01 +02:00
Günther Deschner
d9aaf3759a s3-printing: use sec_initial_uid() instead "0" in print_access_check().
Another babystep in order to make us pass RPC-SPOOLSS.

Guenther
2009-04-20 00:59:36 +02:00
Günther Deschner
e3ceb0c653 s3-spoolss: remove unused dup_nt_devicemode().
Guenther
2009-04-14 12:13:17 +02:00
Günther Deschner
d71dec9259 s3-libads: avoid NULL talloc context with ads_get_dn().
Guenther
2009-04-07 01:17:30 +02:00
Andrew Bartlett
2050187673 s3:libads Make ads_get_dn() take a talloc context
Also remove ads_memfree(), which was only ever a wrapper around
SAFE_FREE, used only to free the DN from ads_get_ds().

This actually makes libgpo more consistant, as it mixed a talloc and a
malloc based string on the same element.

Andrew Bartlett

Signed-off-by: Günther Deschner <gd@samba.org>
2009-04-06 15:54:41 +02:00
Andrew Bartlett
89278b1819 s3:printing Convert nt_printer_publish_ads() to use talloc better
In particular, this removes one more user of pull_utf8_allocate()

Andrew Bartlett

Signed-off-by: Günther Deschner <gd@samba.org>
2009-04-06 14:56:29 +02:00
Björn Jacke
4b184eaea1 s3/cups: add encryption support 2009-03-30 11:11:19 +02:00
Günther Deschner
5a388115a9 s3-spoolss: apply some const in spoolss server.
Guenther
2009-03-20 17:20:32 +01:00
Günther Deschner
31106cdace s3-spoolss: use printer and job notify enums provided by idl.
Guenther
2009-03-18 16:47:01 +01:00
Günther Deschner
b0747651b9 s3-printing: use marshall/unmarshall_sec_desc_buf in sec_desc_upg_fn().
Guenther
2009-03-18 13:06:24 +01: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
47c024fd75 s3-spoolss: rename temporary convert_devicemode_new function.
Guenther
2009-03-17 18:39:17 +01:00
Günther Deschner
04fd767c0b s3-spoolss: remove obsolete get_a_builtin_ntform.
Guenther
2009-03-17 10:37:53 +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
Günther Deschner
670a22852c s3-spoolss: use DSPRINT flags instead of SPOOLS_DS flags.
Guenther
2009-02-27 13:33:15 +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
Jeremy Allison
15f108f091 Fix some NetBSD warnings.
Jeremy.
2009-02-25 09:59:53 -08:00
Günther Deschner
e1749a1f78 s3-spoolss: use marshall/unmarshall_sec_desc_buf in nt_printing_setsec/getsec.
Guenther
2009-02-24 12:41:21 +01:00
Günther Deschner
bcd6e5ec33 s3-spoolss: fix notify_printer_status_byname.
This took me almost a week to find, so here a little longer explanation:

When a windows client registers printer *status* change notifies using
spoolss_RemoteFindFirstChangeNotify, it registers them to a print server handle,
not a printer handle. We were then correctly monitoring the printer status
changes but were sending out the spoolss_RouterReplyPrinterEx via the back-channel
connection with job_id set to 0 (which we only may do for monitored printer
change status notifies on printer handlers, not print server handles). Windows
was then showing a new empty dummy printer icon in the explorer as it cannot
route the notify event to the approriate local handle. It also discarded the
content of the notify event message of course. With this, printer change notify for
pausing, resuming and purging printers nicely works again here.

Jerry, Tim and all other printing gurus, please check.

Guenther
2009-02-24 01:08:03 +01:00
Jeremy Allison
669f2a02e2 Fix printf warnings found on systems where time_t <> long int.
Jeremy.
2009-02-19 13:36:20 -08: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
Volker Lendecke
ad07bb8dbd Fix Coverity ID 740 (RESOURCE_LEAK) 2009-02-13 21:55:10 +01:00
Günther Deschner
46bb22fe5e s3-spoolss: remove more whitespace.
Guenther
2009-02-10 23:59:12 +01:00
Günther Deschner
dfa559145c s3-spoolss: remove whitespace in printing code.
Guenther
2009-02-09 12:42:42 +01:00
Günther Deschner
894d05bc41 s3-spoolss: restore delete_a_form().
Guenther
2009-02-09 10:42:46 +01:00
Günther Deschner
9ef58a9196 s3-spoolss: use pidl for _spoolss_SetForm.
Guenther
2009-02-09 10:42:33 +01:00
Günther Deschner
3a1f9411e5 s3-spoolss: use pidl for spoolss_AddForm.
Guenther
2009-02-09 10:42:12 +01:00
Günther Deschner
b56c5bf510 s3-spoolss: rework some form functions and add form_by_string functions.
Guenther
2009-02-07 01:52:28 +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
c5e242b1a3 s3:printing: make some functions static and use tevent functions
metze
2009-01-22 12:37:33 +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
Jeremy Allison
1f8b6238dd Attempt to fix crash seen with new CUPS async printcap loading code.
Jeremy.
2009-01-05 13:47:34 -08:00
Jelmer Vernooij
37e6849d45 Merge branch 'master' of ssh://git.samba.org/data/git/samba 2009-01-05 18:01:04 +01:00
Stefan Metzmacher
c34d5f445a s3:events: change event_add_timed() prototype to match samba4
metze
2009-01-05 15:07:35 +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
Jelmer Vernooij
08259c1c52 Add iconv_convenience argument to size functions. 2009-01-01 04:45:33 +01:00
Volker Lendecke
ce2ff557bd Fix an ancient uninitialized variable read
The callers of open_file_ntcreate expect *psbuf to be filled correctly
2008-12-31 10:51:44 +01:00
Volker Lendecke
fee2664dad Fix a memory leak in cups_pull_comment_location
We allocated "request" with ippNew, so we also should ippDelete it.
2008-12-30 15:59:25 +01:00
Volker Lendecke
b3abd484db Fix a spinning smbd when printing
Without this, we end up adding more than one timed event. In the event handler
print_notify_event_send_messages() only one event will be deleted, all others
will fire indefinitely.
2008-12-30 14:14:06 +01:00
Jeremy Allison
d0eeb9aa8d Fix more asprintf warnings and some error path errors.
Jeremy.
2008-12-23 12:11:12 -08:00
Jeremy Allison
b143938b8a Fix more asprintf errors and error code paths.
Jeremy.
2008-12-23 11:27:19 -08: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
Tim Prouty
5844012285 s3: Change SMB_VFS_CREATE_FILE to take a create_file_flags argument
This replaces the is_dos_path bool with a more future-proof argument.
The next step is to plumb INTERNAL_OPEN_ONLY through this flag instead
of overridding the oplock_request.
2008-12-03 17:51:44 -08:00
Tim Prouty
08ce060475 s3: Modify direct callers of open_file_ntcreate and open_directory to call SMB_VFS_CREATE_FILE 2008-12-03 17:51:16 -08:00
Volker Lendecke
c25f5c778a Convert delete_driver_files to use create_conn_struct
Jerry, please check!
2008-11-24 11:39:03 +01:00
Volker Lendecke
cb4f8573ba Convert get_correct_cversion to use create_conn_struct
Jerry, please check!
2008-11-24 11:39:03 +01:00
Volker Lendecke
783ab0480b Convert move_driver_to_download_area to use create_conn_struct
This removes a use of struct current_user and the vuid

The become_user() here is unnecessary, within the spoolss handling code we have
switched to the authenticated pipe user anyway.

Jerry, please check!
2008-11-24 11:39:03 +01:00
Jeremy Allison
97fb05c2c0 First part of fix for bug #5903 - vfs_streams_xattr breaks contents of the file.
Restructures parts of open code so that fsp must be allocated before calling
open_file_ntcreate(_internal). Also fix up file ref-counting inside files.c.
Jeremy.
2008-11-21 12:14:53 -08:00
Volker Lendecke
c6973e69b7 Remove an unused variable 2008-11-02 09:40:30 +01:00
Jelmer Vernooij
ddcab787c4 Rename dos_errstr() to win_errstr() for consistency with Samba 4. 2008-11-01 17:19:26 +01:00
Jeremy Allison
8344e94574 Unify se_access_check with the S4 code. Will make
calculation of SEC_FLAG_MAXIMUM_ALLOWED much easier
for files.
Jeremy.
2008-10-31 10:51:45 -07:00
Jeremy Allison
7c53ffea28 Allow a new file to inherit the Windows ACL from its parent.
Now to do the same for directories.
Jeremy.
2008-10-29 13:27:14 -07:00
Kai Blin
c88cbbfdf3 vlp: Move closer to the code tested. 2008-10-19 15:03:22 +02:00
Jelmer Vernooij
f0c4829e82 Remove silly safe_free() function which is a wrapper around SAFE_FREE().
Since it's a function it just sets the local pointer to NULL and basically
is an equivalent to free().

It also claims it's being used for callbacks but isn't used that way
anywhere.
2008-10-19 13:06:14 +02:00
Jelmer Vernooij
a62c510d8b Use GUID_from_string. 2008-10-14 02:33:41 +02:00
Jelmer Vernooij
1f3e4f39c5 Use GUID_string rather than smb_uuid_string(). 2008-10-14 02:26:18 +02:00
Jelmer Vernooij
4746f79d50 Use {u,}int64_t instead of SMB_BIG_{U,}INT. 2008-10-14 01:59:36 +02:00
Volker Lendecke
c530009401 Pass struct smb_request to file_free
on the way to get rid of chain_fsp
2008-10-13 19:32:38 +02:00
Volker Lendecke
c3fedcddd5 Pass struct smb_request to file_new
Goal is to remove the chain_fsp global variable
2008-10-13 19:32:38 +02:00
Jelmer Vernooij
1b99d8fbb5 Use common util_file code. 2008-10-12 17:34:43 +02:00
Volker Lendecke
d661ac196e Fix the build 2008-10-12 10:38:55 +02:00
Jelmer Vernooij
cb78d4593b Cope with changed signature of http_timestring(). 2008-10-11 23:57:44 +02:00
Jeremy Allison
47f7ef8f39 Initialize near creation of resource. Makes code clearer.
Jeremy.
2008-10-10 16:48:18 -07:00
Jeremy Allison
1d151b3161 Ensure we do reinit_after_fork().
Jeremy.
2008-10-10 16:43:13 -07:00
Jeremy Allison
4cbb3b23a4 Allow data flow to be debugged and only log on error. All seems ok now.
Jeremy.
2008-10-10 16:29:14 -07:00
Jeremy Allison
430cc44390 Async is trickier than it looks :-). Don't use a stack variable for a private data ptr.
Jeremy.
2008-10-10 15:55:49 -07:00
Jeremy Allison
eada8f8abe If you have a large number of cups printers, then scanning for print info can cause a client to timeout
(it takes longer than 30 seconds to enumerate them). Make scanning for printers async with a callback
from the main loop. This fixes a bug that was irritating *me* :-).
Jeremy.
2008-10-10 11:55:14 -07:00
Jeremy Allison
e5692d4cbe Remove SEC_ACCESS. It's a uint32_t.
Jeremy.
2008-10-09 09:49:03 -07:00
Jeremy Allison
f6c883b4b0 Simply our main loop processing. A lot :-). Correctly use events for all the previous "special" cases.
A step on the way to adding signals to the events and being able to merge the S3 event system with
the S4 one.
Jeremy.
2008-10-03 14:18:35 -07:00
Jeremy Allison
e0dbac6873 Don't reject a successful alloc :-(.
Jeremy.
2008-10-02 12:21:11 -07:00
Jeremy Allison
3bfb53caa8 Fix bug #5080. Access to cups-printers via samba broken with cups 1.3.4, Unsupported character set.
Cups 1.3.4 expects utf8 to be used in all messages to/from the server. We may be using a
different character set so we need to use talloc utf8 push/pull functions in all communication.
Needs more testing. Don't release until I've done a thorough test. I also have a version for 3.2.x.
Jeremy.
2008-10-01 16:40:41 -07:00
Jeremy Allison
ea85ceefa9 Whitespace cleanup.
Jeremy.
2008-10-01 15:01:05 -07:00
Jeremy Allison
c383e8d760 Ensure we null out fsp after a close in all paths.
Jeremy.
2008-09-29 10:57:22 -07:00
Jelmer Vernooij
55e201b0a1 Avoid freeing fsp twice when opening new_file fails. (Debian #431696)
If opening new_file fails, fsp would still be set to the files_struct of
old_file.
2008-09-29 19:09:53 +02:00
Karolin Seeger
9cf1a68977 printing: Rename new parameter "cups timeout" to "cups connection timeout".
Karolin
2008-09-24 11:09:04 -07:00
Karolin Seeger
765e5d2282 printing: Add new parameter "cups timeout".
The default timeout for connections to CUPS servers is set
to 5 minutes in the CUPS libraries. The smbd hangs on startup
until the timeout is reached if the CUPS server is unreachable.
This parameter makes the timeout configurable. The default value
is set to 30 seconds.

Karolin
2008-09-23 16:57:58 -07: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
44e9a2bb9a remove unused extern current_user from nt_printing.c
(This used to be commit b34283adef)
2008-06-26 13:13:23 +02:00
Volker Lendecke
c885ae01eb Remove current_user reference from printfsp.c
(This used to be commit 510f45d01a)
2008-06-26 13:13:23 +02: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