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

556 Commits

Author SHA1 Message Date
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
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
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
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
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
Günther Deschner
05459cf833 s3-printing: eliminate another non sec_initial_uid using security check.
Guenther
2009-06-24 00:36:48 +02: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
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
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
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
Günther Deschner
5a388115a9 s3-spoolss: apply some const in spoolss server.
Guenther
2009-03-20 17:20:32 +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
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
670a22852c s3-spoolss: use DSPRINT flags instead of SPOOLS_DS flags.
Guenther
2009-02-27 13:33:15 +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
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
Michael Adam
166ffc0d0d s3: put printing/ under cache_dir, not lock_dir
Michael
2009-01-16 01:02:24 +01:00
Jelmer Vernooij
08259c1c52 Add iconv_convenience argument to size functions. 2009-01-01 04:45:33 +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
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
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
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
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
Jelmer Vernooij
1b99d8fbb5 Use common util_file code. 2008-10-12 17:34:43 +02:00
Jeremy Allison
e5692d4cbe Remove SEC_ACCESS. It's a uint32_t.
Jeremy.
2008-10-09 09:49:03 -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
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
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
320fadd8fc Remove the reference to current_user_info from share_access.c
This required to pass around the domain a bit
(This used to be commit 17b0db20d2)
2008-05-25 11:43:57 +02:00
Tim Prouty
fb37f15600 Cleanup size_t return values in callers of convert_string_allocate
This patch is the second iteration of an inside-out conversion to cleanup
functions in charcnv.c returning size_t == -1 to indicate failure.
(This used to be commit 6b189dabc5)
2008-05-20 22:40:13 +02:00
Jeremy Allison
fbc780b604 Try and fix bug #5095, "Manage Documents privilege is not functional".
Should map the created sd to printer jobs, not printer.
Jerry please test and I'll add to 3.2 if it passes. Thanks,
Jeremy.
(This used to be commit 0a1fe8d601)
2008-05-05 16:24:52 -07:00
Jeremy Allison
501562f15c Fix from Martin Zielinski <mz@seh.de>. Don't delete files when
they're in use by other drivers.
Jeremy.
(This used to be commit 205c352cae)
2008-04-24 15:02:23 -07:00
Jeremy Allison
40d16fa275 Fix bug #5372. With a large CUPS installation with a remote server, contacting
the server when searching for a name for the location and comment fields can
take so much time the client times out. When searching for a name we don't
use these fields anyway, so add a function get_a_printer_search() which
doesn't contact the CUPS server.
Jeremy.
(This used to be commit 92d9f20852)
2008-04-04 11:14:09 -07:00
Volker Lendecke
c5356479c1 Some simplifications
(This used to be commit b59b436997)
2008-03-17 21:10:16 +01:00
Marc VanHeyningen
e06aa46b9f Coverity fixes
(This used to be commit 3fc85d2259)
2008-03-17 20:52:25 +01:00
Volker Lendecke
594a164548 Fix a crash bug in nt_printer_publish_ads
Reported by Martin Zielinski <mz@seh.de>
(This used to be commit 4db26c803d)
2008-01-16 11:39:20 +01:00
Jeremy Allison
23aab9dab7 Fix CID 498. Ensure we don't prs_mem_free an uninitialized
prs_struct.
Jeremy.
(This used to be commit 7b9d9fba23)
2008-01-11 23:24:13 -08:00
Michael Adam
87a684f7fc Remove redundant parameter fd from SMB_VFS_FSTAT().
Michael
(This used to be commit 0b86c420be)
2008-01-07 15:59:01 +01:00
Michael Adam
6f657c873e Remove redundant parameter fd from SMB_VFS_LSEEK().
Michael
(This used to be commit df929796f2)
2008-01-07 15:59:01 +01:00
Jeremy Allison
9254bb4ef1 Refactor the crypto code after a very helpful conversation
with Volker. Mostly making sure we have data on the incoming
packet type, not stored in the smb header.
Jeremy.
(This used to be commit c4e5a50504)
2008-01-04 12:56:23 -08:00
Volker Lendecke
7cbdb48475 Remove tiny code duplication
ndr_size_security_descriptor does the same as sec_desc_size
(This used to be commit bc3bd7a8e7)
2007-12-29 23:13:26 +01:00
Jeremy Allison
7326612cfd Two more static fstrings gone.
Jeremy.
(This used to be commit 4056bb8645)
2007-12-18 18:16:40 -08:00
Volker Lendecke
900288a2b8 Replace sid_string_static by sid_string_dbg in DEBUGs
(This used to be commit bb35e794ec)
2007-12-15 22:09:36 +01:00
Jeremy Allison
b9342eaaa6 Remove unused wpstring and macros. Stop using pstrcpy in smbd/*.c
Jeremy.
(This used to be commit e72bce5b62)
2007-12-03 15:19:22 -08: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
Volker Lendecke
1011b32678 Remove some statics
(This used to be commit 1fab16ffb8)
2007-11-27 14:18:47 +01:00
Jeremy Allison
01acd4bb38 Remove pstring from printing/*.c except for the
tdb_unpack requirement (I'll be making that an
allocating interface later).
Jeremy.
(This used to be commit d2ee75326a)
2007-11-21 13:56:36 -08:00
Jeremy Allison
68be9a8200 More pstring removal. This one was tricky. I had to add
one horror (pstring_clean_name()) which will have to
remain until I've removed all pstrings from the client code.
Jeremy.
(This used to be commit 1ea3ac8014)
2007-11-15 14:19:52 -08:00
Jeremy Allison
214bb0f119 Fix case where we have no dns domain name. Return a talloc of "".
Jeremy.
(This used to be commit ab8934844a)
2007-11-08 17:58:55 -08:00
Jeremy Allison
d40e47db4b Remove more fstring/pstring bad useage. Go talloc !
Jeremy.
(This used to be commit 2a0173743d)
2007-11-08 17:25:45 -08:00
Gerald (Jerry) Carter
88ee61625a Patch 2 of 3 from Debian Samba packagers:
The point is doing the following associations:

- non discardable state data (all TDB files that may need to be backed
  up) go to statedir
- shared data (codepage stuff) go to codepagedir

The patch *does not change* the default location for these
directories. So, there is no behaviour change when applying it.

The main change is for samba developers who have to think when dealing
with files that previously pertained to libdir whether they:
- go in statedir
- go in codepagedir
- stay in libdir
(This used to be commit d6cdbfd875)
2007-11-01 15:53:44 -04: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
Volker Lendecke
0ebab65706 r25534: Apply some const
Why? It moves these structs from the data into the text segment, so they
will never been copy-on-write copied. Not much, but as in German you say
"Kleinvieh macht auch Mist...."
(This used to be commit 0141e64ad4)
2007-10-10 12:31:12 -05:00
Michael Adam
c97fe37ea3 r25294: Tidy up callers of unistr2_to_ascii() to pass sizeof(target_area) to
the maxeln parameter instead of sizeof(target_area) - 1 (or even
sizeof(fstring) - 1 in some places.

I hope these were really all there were.

Michael
(This used to be commit 9a28be220d)
2007-10-10 12:30:58 -05:00
Jeremy Allison
eacd314057 r25138: More pstring elimination. Add a TALLOC_CTX parameter
to unix_convert().
Jeremy.
(This used to be commit 39c211a702)
2007-10-10 12:30:44 -05:00
Jeremy Allison
12f61e09d9 r25117: The mega-patch Jerry was waiting for. Remove all pstrings from
the main server code paths. We should now be able to cope with
paths up to PATH_MAX length now.
Final job will be to add the TALLOC_CTX * parameter to
unix_convert to make it explicit (for Volker).
Jeremy.
(This used to be commit 7f0db75fb0)
2007-10-10 12:30:41 -05:00
Jeremy Allison
132ee3990a r25009: Large patch discussed with Volker. Move unix_convert to a talloc-based
interface. More development will come on top of this. Remove the
"mangled map" parameter.
Jeremy.
(This used to be commit dee8beba7a)
2007-10-10 12:30:32 -05:00
Stefan Metzmacher
809c9d4d31 r23888: move elements belonging to the current ldap connection to a
substructure.

metze
(This used to be commit 00909194a6)
2007-10-10 12:28:38 -05:00
Andrew Tridgell
153cfb9c83 r23801: The FSF has moved around a lot. This fixes their Mass Ave address.
(This used to be commit 87c91e4362)
2007-10-10 12:28:27 -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
0bc56a2e5f r23724: Reduce access to the global inbuf a tiny bit. Add a struct smb_request
that contains some of the fields from the SMB header, removing the need
to access inbuf directly. This right now is used only in the open file
code & friends, and creating that header is only done when needed. This
needs more work, but it is a start.

Jeremy, I'm only checking this into 3_0, please review before I merge it
to _26.

Volker
(This used to be commit ca988f4e79)
2007-10-10 12:23:48 -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
b4a7b7a888 r22844: Introduce const DATA_BLOB data_blob_null = { NULL, 0, NULL }; and
replace all data_blob(NULL, 0) calls.
(This used to be commit 3d3d61687e)
2007-10-10 12:22:01 -05:00
Günther Deschner
3e8283cf7c r22524: Fix memleak.
Guenther
(This used to be commit e55c52f654)
2007-10-10 12:19:42 -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
110980d771 r21989: make use of tdb_*_bystring() and string_term_tdb_data()
to avoid creating the TDB_DATA struct from strings "by hand"

metze
(This used to be commit 1897da9efc)
2007-10-10 12:18:57 -05:00
Stefan Metzmacher
a806037b87 r21987: split tdb_prs_*() functions in version which take a keystr and a TDB_DATA key
metze
(This used to be commit 724c6fa337)
2007-10-10 12:18:56 -05:00
Gerald Carter
1899c834f0 r21875: BUG 3275: Patch from Andy Polyakov <appro@fy.chalmers.se>
Relax check for i386 header checks in the PE header of printer
driver files.  Thus allowing uploading of x64 print drivers
from 64bit Windows clients.
(This used to be commit 328807ec7b)
2007-10-10 12:18:42 -05:00
Gerald Carter
2d30923864 r21862: add the cups comment and location lookup to get_a_printer_2_default() as well
(This used to be commit 5b47c4e5c2)
2007-10-10 12:18:39 -05:00
Gerald Carter
b2bc94eeee r21861: Pull the comment and location from CUPS if we don't have one
when fetching a printer from ntprinters.tdb.

Slightly modified from original version submitted on
samba-technical ml by Andy Polyakov <appro@fy.chalmers.se>
(This used to be commit e859e1fdcd)
2007-10-10 12:18:39 -05:00
Jeremy Allison
10ab7a3a78 r21672: The cannonical file access pattern should look like this :
srvstr_get_path(inbuf, name, smb_buf(inbuf) + 1, sizeof(name), 0, STR_TERMINATE, &status);
	if (!NT_STATUS_IS_OK(status)) {
		return ERROR_NT(status);
	}

	RESOLVE_DFSPATH(name, conn, inbuf, outbuf);

	status = unix_convert(conn, name, False, NULL, &sbuf);
	if (!NT_STATUS_IS_OK(status)) {
		return ERROR_NT(status);
	}

	status = check_name(conn, name);
	if (!NT_STATUS_IS_OK(status)) {
		return ERROR_NT(status);
	}

Make sure that every access pattern (including the
wildcard generated paths from unlink, rename, and copy)
do the same. Tidy things up a bit....

Jeremy.
(This used to be commit b8327b21dd)
2007-10-10 12:18:23 -05:00
Simo Sorce
e9e6af5951 r21606: Implement escaping function for ldap RDN values
Fix escaping of DN components and filters around the code
Add some notes to commandline help messages about how to pass DNs

revert jra's "concistency" commit to nsswitch/winbindd_ads.c, as it was
incorrect.
The 2 functions use DNs in different ways.

- lookup_usergroups_member() uses the DN in a search filter,
and must use the filter escaping function to escape it
Escaping filters that include escaped DNs ("\," becomes "\5c,") is the
correct way to do it (tested against W2k3).

- lookup_usergroups_memberof() instead uses the DN ultimately as a base dn.
Both functions do NOT need any DN escaping function as DNs can't be reliably
escaped when in a string form, intead each single RDN value must be escaped
separately.

DNs coming from other ldap calls (like ads_get_dn()), do not need escaping as
they come already escaped on the wire and passed as is by the ldap libraries

DN filtering has been tested.
For example now it is possible to do something like:
'net ads add user joe#5' as now the '#' character is correctly escaped when
building the DN, previously such a call failed with Invalid DN Syntax.

Simo.
(This used to be commit 5b4838f62a)
2007-10-10 12:18:16 -05:00
Gerald Carter
56b40269c8 r21258: Fix for connecting printers from Vista by storing
the printer GUID as a REG_SZ as Vista seems to
whine about unknown REG_BINARY values.

Thanks to Martin Zielinski <mz@seh.de> for his excellent
analysis on this.
(This used to be commit fa5490b71b)
2007-10-10 12:17:52 -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
Volker Lendecke
0cfc6a8e11 r20796: Fix the same problem Jeremy has fixed (improper handling of deferred opens)
for delete_driver_files. Proper fix pending... :-)

Jeremy, please check.

Volker
(This used to be commit 21b8f15dd5)
2007-10-10 12:17:09 -05:00
Jeremy Allison
db0ad252a0 r20718: Sync up the filename path parsing changes from SAMBA_3_0_24.
The only difference between the two trees now w.r.t file
serving are the changes to smbd/open.c in this branch I need
to review.
Jeremy.
(This used to be commit f4474edf6a)
2007-10-10 12:17:04 -05:00
Volker Lendecke
1307337aaf r20544: Change copy_file() to return NTSTATUS. This is in preparation of turning
close_file() to NTSTATUS as well.

I'm not sure I got all the error codes right, but as I've never come across a
smb_copy() call in all my Samba work, I'm leaving it at that. If I'm
absolutely bored, I will write a thorough torture test.

As far as I can see, Samba4 even does not have a libcli implementation for
it...  :-)

Volker
(This used to be commit 5ebdf02ba1)
2007-10-10 12:16:56 -05:00
Volker Lendecke
d0c6f9b728 r20339: Make mkdir_internal static to open.c
(This used to be commit 6dd0886b49)
2007-10-10 12:16:42 -05:00
Jelmer Vernooij
4db7642caa r18745: Use the Samba4 data structures for security descriptors and security descriptor
buffers.

Make security access masks simply a uint32 rather than a structure
with a uint32 in it.
(This used to be commit b41c52b9db)
2007-10-10 12:00:54 -05:00
Jelmer Vernooij
4e7d11449a r18654: Rename "struct uuid" => "struct GUID" for consistency.
(This used to be commit 5de76767e8)
2007-10-10 11:52:19 -05:00
Volker Lendecke
ee0e397d6f r18019: Fix a C++ warnings: Don't use void * in libads/ for LDAPMessage anymore.
Compiled it on systems with and without LDAP, I hope it does not break the
build farm too badly. If it does, I'll fix it tomorrow.

Volker
(This used to be commit b2ff9680eb)
2007-10-10 11:39:49 -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
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
Gerald Carter
be25a49a94 r16701: Fix segv when adding a printer caused by not initializing the
realm name in ads_init() in nt_printer_publish().
(This used to be commit a25e75e78d)
2007-10-10 11:19:09 -05:00
Jeremy Allison
d1014c1cdf r16582: Fix Klocwork #1997 and all generic class of problems
where we don't correctly check the return from memdup.
Jeremy.
(This used to be commit ce14daf51c)
2007-10-10 11:19:01 -05:00
Jeremy Allison
f014291edd r16424: Fix possible null deref and a memory leak found by
examining Klockwork #1519. get_printer_subkeys()
could return zero without initializing it's return
pointer arg. Fixed this. Added free of subkey pointer
return in registry/reg_printing.c (interesting that
neithe Coverity or Klocwork found this one).
Jeremy.
(This used to be commit 4fbeae1a3a)
2007-10-10 11:18:52 -05:00
Jeremy Allison
1b64f06048 r16367: Missed one, Klocwork #915.
Jeremy.
(This used to be commit b581fee982)
2007-10-10 11:18:49 -05:00
Jeremy Allison
d5b6dedfdd r16365: Fix Klocwork #895, #898, #899, #915, #932, #938 and a
few other problems Klocwork missed.
Jeremy.
(This used to be commit fe05769a1a)
2007-10-10 11:18:49 -05:00
Volker Lendecke
5895967601 r15569: Fix Coverity bug # 287. Jerry, can you check if WERR_NOMEM is a correct error
code here?

Thanks,

Volker
(This used to be commit 5787bd0ee9)
2007-10-10 11:17:01 -05:00
Gerald Carter
2c029a8b96 r15543: New implementation of 'net ads join' to be more like Windows XP.
The motivating factor is to not require more privileges for
the user account than Windows does when joining a domain.

The points of interest are

* net_ads_join() uses same rpc mechanisms as net_rpc_join()
* Enable CLDAP queries for filling in the majority of the
  ADS_STRUCT->config information
* Remove ldap_initialized() from sam/idmap_ad.c and
  libads/ldap.c
* Remove some unnecessary fields from ADS_STRUCT
* Manually set the dNSHostName and servicePrincipalName attribute
  using the machine account after the join

Thanks to Guenther and Simo for the review.

Still to do:

* Fix the userAccountControl for DES only systems
* Set the userPrincipalName in order to support things like
  'kinit -k' (although we might be able to just use the sAMAccountName
  instead)
* Re-add support for pre-creating the machine account in
  a specific OU
(This used to be commit 4c4ea7b20f)
2007-10-10 11:16:57 -05:00
Gerald Carter
d4a51cc500 r15309: normalize printing keys when deleting
(This used to be commit 037f9f831e)
2007-10-10 11:16:34 -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
Günther Deschner
a17d276fa0 r14506: Remove remaining references to a KCM credential cache type.
Guenther
(This used to be commit aae8f8ae7a)
2007-10-10 11:15:35 -05:00
Jeremy Allison
419871306c r14489: Guard against coverity reversion. #181 is a false positive
but make the intent clearer.
Jeremy.
(This used to be commit 2703df7a8f)
2007-10-10 11:15:34 -05:00
Jeremy Allison
3b58c82a52 r14273: Fix coverity bug #202. Memory leak on error path.
Jeremy.
(This used to be commit d2be8163f2)
2007-10-10 11:15:22 -05:00
Jeremy Allison
c00e664e25 r14221: Fix coverity #76. My previous change wasn't quite enough :-).
Jeremy.
(This used to be commit 21b70035f3)
2007-10-10 11:15:17 -05:00
Jeremy Allison
f2006f8ce1 r14184: Coverity fix #56. Ensure we can't deref null.
Jeremy.
(This used to be commit c76092a066)
2007-10-10 11:15:15 -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
Gerald Carter
b2ae6e08da r13547: add earlier checks to deny deleting a printer driver. The previous
code relied upon file permissions alone.  Now we check that
the user is a printer administrator and that the share has not been
marked read only for that user.
(This used to be commit 117d9fd9e1)
2007-10-10 11:10:12 -05:00
Gerald Carter
0af1500fc0 r13316: Let the carnage begin....
Sync with trunk as off r13315
(This used to be commit 17e63ac4ed)
2007-10-10 11:06:23 -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
dbac670166 r12889: BUG 3380: fix crash when changing printer drivers caused by accessing a previously freed pointer
(This used to be commit bcce3b69f8)
2007-10-10 11:06:06 -05:00
Jeremy Allison
6baec64a73 r11420: Fix issue pointed out by Dina Fine <dina@exanet.com>. We can
only tell at parse time from the wire if an incoming name
has wildcards or not. If it's a mangled name and we demangle
the demangled name may contain wildcard characters. Ensure
these are ignored.
Jeremy.
(This used to be commit 4cd8e2a96b)
2007-10-10 11:05:15 -05:00
Gerald Carter
a1faaa9e67 r10554: * BUG 3057: assume x64 drivers are v3 drivers
* BUG 3087: allow smbspool to establisha geust connection
  using a username with no password
(This used to be commit 39369c8041)
2007-10-10 11:04:47 -05:00
Günther Deschner
b4857a4c2a r10154: Fix crash bug on security descriptor upgrade (as seen on x86_64).
Guenther
(This used to be commit daa61ef75b)
2007-10-10 11:03:35 -05:00