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

1865 Commits

Author SHA1 Message Date
Tim Prouty
9d7c4ad748 s3: Add smb_filename utility functions and fix a bug in copy_smb_filename 2009-06-12 16:14:44 -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
bddd7ad3dc s3: Add utility function for copying an smb_filename struct 2009-06-10 13:13:27 -07:00
Jeremy Allison
dc5c7b7f98 Make ctemp async. Fix the test to pass against W2K3.
Jeremy.
2009-06-10 11:58:00 -07:00
Volker Lendecke
a51e6ce43c Pass a talloc_ctx to pdb_enum_aliasmem 2009-06-08 21:14:10 +02:00
Jeremy Allison
64a1f17aff Make cli_ftruncate async. Also add a simple test.
Jeremy.
2009-06-05 16:06:05 -07:00
Stefan Metzmacher
a02265cdc4 s3:smbd: make make_connection_snum() non static
metze
2009-06-03 17:54:38 +02:00
Stefan Metzmacher
c862018008 s3:smbd: move tcon specific globals to struct smbd_server_connection
metze
2009-06-03 17:54:38 +02:00
Stefan Metzmacher
75d03970b7 s3:smbd: move more session specific globals to struct smbd_server_connection
metze
2009-06-03 17:54:37 +02:00
Stefan Metzmacher
e16e7146b3 s3:smbd: move negprot related globals to struct smbd_server_connection
metze
2009-06-03 17:54:37 +02:00
Jeremy Allison
684d3dddd6 Make cli_nt_delete_on_close() async.
Jeremy.
2009-05-29 14:58:34 -07:00
Michael Adam
e31d4ee936 s3:add prototype of map_nt_error_from_wbcErr() to proto.h
Michael
2009-05-29 23:28:39 +02:00
Simo Sorce
f48e39540c Consolidate create/delete account paths in pdbedit
Use common paths like for smbpasswd, so that all utilities
behave the same way. As for smbpasswd this changes the behavior
of pdbedit to create/delete unix users is the add/delete user
scripts are provided, or ldapsam:editposix is configured.

Signed-off-by: Günther Deschner <gd@samba.org>
2009-05-29 18:03:56 +02:00
Günther Deschner
bff54b90c3 util: move add_gid_to_array_unique to toplevel and add add_uid_to_array_unique.
Guenther
2009-05-29 13:49:58 +02:00
Jeremy Allison
9df85a9374 Make cli_posix_chown()/cli_posix_chmod() async.
Jeremy.
2009-05-28 16:15:09 -07:00
Jeremy Allison
656e86d5fa Make cli_posix_stat() async.
Jeremy.
2009-05-28 13:32:00 -07:00
Jeremy Allison
d74e42e0ec Make getfacl async.
Jeremy.
2009-05-28 13:05:50 -07:00
Volker Lendecke
0dbecbbee5 Make sid_binstring & friends take a talloc context 2009-05-28 11:33:21 +02:00
Jeremy Allison
bccc7ee2c6 Add cli_posix_readlink() and a torture test for it.
Jeremy.
2009-05-27 21:51:15 -07:00
Jeremy Allison
f55c7614bd Add aync POSIX hardlink and symlink and torture test for them.
Missing call cli_readlink() is next.
Jeremy.
2009-05-27 17:28:23 -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
000da55dd9 Make cli_posix_open() and cli_posix_mkdir() async.
Jeremy.
2009-05-20 18:31:36 -07: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
Aravind Srinivasan
1718e803dc s3: Always allocate memory in dptr_ReadDirName
This is a follow up to 69d61453df to
adjust the API to allow the lower layers allocate memory.  Now the
memory can explicitly be freed rather than relying on talloc_tos().

Signed-off-by: Tim Prouty <tprouty@samba.org>
2009-05-18 21:50:07 -07:00
Jeremy Allison
459dc8f39c Change access_check_samr_object -> access_check_object.
Make map_max_allowed_access global. Change lsa_get_generic_sd
to add Everyone:LSA_POLICY_READ|LSA_POLICY_EXECUTE, not just
LSA_POLICY_EXECUTE.
Jeremy.
2009-05-18 15:44:03 -07:00
Volker Lendecke
22085c59cb Add "file_walk_table" to do stuff with all open files 2009-05-18 10:42:22 +02:00
Simo Sorce
4112bb2428 Move smb_create_user() in samsync
It is not used anywhere else, so make it also static and remove
it from proto.h
2009-05-16 15:30:48 -04:00
Günther Deschner
dccecdf338 s3-privileges: add privilege_delete_account().
Guenther
2009-05-16 01:27:51 +02:00
Stefan Metzmacher
b9f3a78169 s3:libsmb: move read_smb_send/recv() static in async_smb.c
metze
2009-05-13 18:27:50 +02:00
Michael Adam
a04bac7135 s3:proto.h: remove old param/params.c prototype
Michael
2009-05-12 08:41:00 +02:00
Günther Deschner
f05d888d7a s3-samr: let set_user_info_16 and 20 follow the same pattern as all other levels.
Guenther
2009-05-08 00:41:40 +02:00
Günther Deschner
f93f713898 s3-samr: support some more info levels in samr_SetUserInfo calls.
Guenther
2009-05-08 00:41:40 +02:00
Volker Lendecke
d52b0a25ad Make cli_tcon_andx chainable 2009-05-07 16:37:54 +02:00
Volker Lendecke
b35967edba Make cli_session_setup_guest chainable 2009-05-07 16:37:54 +02:00
Jeremy Allison
606edf0f35 Make cli_setatr async.
Jeremy.
2009-05-06 16:13:42 -07:00
Jeremy Allison
512879a69b Make cli_setattrE async.
Jeremy.
2009-05-06 15:07:05 -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
Jeremy Allison
4cbd0c77e4 Make cli_getatr() async.
Jeremy.
2009-05-05 20:59:22 -07:00
Jeremy Allison
e091fdc565 Make cli_getattrE async.
Jeremy.
2009-05-05 16:28:44 -07:00
Volker Lendecke
5b7b47f015 Add getaddrinfo_send/recv 2009-05-01 12:30:59 +02:00
Volker Lendecke
8cf75770cf Add fncall_send/recv 2009-05-01 12:30:59 +02:00
Jeremy Allison
f3af298e5b Cause cli_close to return an NTSTATUS.
Jeremy.
2009-04-30 16:57:42 -07:00
Jeremy Allison
8cf78ff553 Get medieval on our ass about SMB1 file descriptors being 16 bits, not an int.
Convert all uses of cli_open(), cli_nt_createXXX to NTSTATUS versions.
This is smaller than it looks, it just fixes a lot of old code.
Next up, ensure all cli_XX functions return NTSTATUS.
Jeremy.
2009-04-30 15:26:43 -07:00
Jeremy Allison
370e7209db Make cli_unlink async.
Jeremy.
2009-04-29 18:26:02 -07:00
Jeremy Allison
edd25980b0 More async calls in libsmb/clifile.c
Jeremy.
2009-04-29 10:48:16 -07:00
Michael Adam
077bcc1125 s3:smbd/service: switch load_registry_service/shares to use loadparm routines
instead of reading the registry directly with tdb and activating the
configure options by hand.

This eliminates the need for repeating checks done in loadparm.
For instance it disables registry shares without path in the server
as is the case with text based shares.

Michael
2009-04-29 02:20:19 +02:00
Michael Adam
fb3b657612 s3:loadparm: refactor process_registry_service out or process_registry_globals
Michael
2009-04-29 02:20:19 +02:00
Jeremy Allison
bd6447dcf2 Convert cli_rename to async.
Jeremy.
2009-04-28 16:43:16 -07:00
Jeremy Allison
06e404f574 Convert cli_posix_unlink() and cli_posix_rmdir()
to async. First trans calls I've done.
Jeremy.
2009-04-28 13:18:51 -07:00
Michael Adam
e935d8616b s3:registry: replace typedef REGISTRY_OPS by struct registry_ops
Michael
2009-04-27 11:21:04 +02:00
Michael Adam
cec8428747 s3:registry: replace typedef REGISTRY_KEY by struct registry_key_handle
Michael
2009-04-27 11:21:04 +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
Jeremy Allison
bd5c2c7dc8 find/replace. Change uintX types to uintX_t types to tidy up the code.
Jeremy.
2009-04-24 07:06:48 -07:00
Volker Lendecke
652dc40f0d Add missing prototypes 2009-04-23 16:46:01 +02:00
Jeremy Allison
455f2a4c65 Make dskattr async.
Jeremy.
2009-04-22 08:04:53 -07:00
Jeremy Allison
502f47c7c0 Make cli_chkpath async.
Jeremy
2009-04-22 06:46:42 -07:00
Jelmer Vernooij
f4195183a4 s3: Use common security_descriptor_equal(). 2009-04-21 18:17:40 +02:00
Jeremy Allison
5ccf58ff59 Make rmdir async.
Jeremy.
2009-04-21 06:52:54 -07:00
Jeremy Allison
dfc79de607 Make cli_mkdir async. Change it to return NTSTATUS.
Jeremy.
2009-04-21 05:52:34 -07:00
Wilco Baan Hofman
248554370a Make gpo_ldap.c compatible with samba 4. Add ads_get_ldap_server_name() function to samba 3. Move prototypes to root libgpo where appropriate.
gpo_ldap.c now compiles for both samba 3 and 4.

Signed-off-by: Günther Deschner <gd@samba.org>
2009-04-20 23:16:16 +02:00
Andrew Bartlett
6c9caed481 Merge commit 'origin/master' into libcli-auth-merge-without-netlogond 2009-04-20 16:53:02 +02:00
Andrew Bartlett
53765c81f7 Remove use of talloc_reference in cli_rpc_pipe_open_schannel_with_key() 2009-04-20 16:50:49 +02:00
Volker Lendecke
35e6a0e618 Add "uint32_t access_granted" to policy handles
All policy handles have a mask of allowed operations attached that were
calculated at creation time, so they should carry this mask. This is the basis
for consolidating all our policy handle access checks.

If you want to do your own more complicated access checks further down, just
pass "0" to policy_handle_find.
2009-04-19 09:27:15 +02:00
Volker Lendecke
9b3f2e69f7 Make "struct policy" private to srv_lsa_hnd.c 2009-04-19 09:27:14 +02:00
Volker Lendecke
c9bc1728f9 Add type-safe policy_handle_create/find 2009-04-18 13:58:48 +02:00
Volker Lendecke
fd558b37f6 Add some const 2009-04-18 13:58:48 +02:00
Volker Lendecke
32a36e4703 Add notify_onelevel.tdb
This optimizes non-recursive notifys. For non-recursive notifies we can use a
per-directory file-id indexed notify record. This matters for the Windows
Explorer and IIS cases which do not use recursive notifies. In these cases, we
do not have to shuffle around the whole notify record on every change.

For the cluster case, this improves correctness of the notifies, ctdb only
distributes the tdb seqnum once a second, so we can lose notifies.
2009-04-16 15:07:06 +02:00
Andrew Bartlett
4678d1c6f4 Merge branch 'master' of ssh://git.samba.org/data/git/samba into libcli-auth-merge-without-netlogond 2009-04-15 14:36:13 +10:00
Günther Deschner
e3ceb0c653 s3-spoolss: remove unused dup_nt_devicemode().
Guenther
2009-04-14 12:13:17 +02:00
Andrew Bartlett
baf7274fed Make Samba3 use the new common libcli/auth code
This is particuarly in the netlogon client (but not server at this
stage)
2009-04-14 16:23:44 +10:00
Andrew Bartlett
f28f113d8e Rework Samba3 to use new libcli/auth code (partial)
This commit is mostly to cope with the removal of SamOemHash (replaced
by arcfour_crypt()) and other collisions (such as changed function
arguments compared to Samba3).

We still provide creds_hash3 until Samba3 uses the credentials code in
netlogon server

Andrew Bartlett
2009-04-14 16:23:35 +10:00
Andrew Bartlett
786447dea0 s3:charcnv remove now unused malloc() based conversion functions 2009-04-14 12:54:13 +10:00
Andrew Bartlett
3b3e21bd9b Convert Samba3 to use the common lib/util/charset API
This removes calls to push_*_allocate() and pull_*_allocate(), as well
as convert_string_allocate, as they are not in the common API

To allow transition to a common charcnv in future, provide Samba4-like
strupper functions in source3/lib/charcnv.c

(the actual implementation remains distinct, but the API is now shared)

Andrew Bartlett
2009-04-14 12:53:56 +10:00
Andrew Bartlett
4786a493f7 Solve some of the conflict between Samba3 and Samba4 push_string
This renames push_string in Samba3 into push_string_base and
push_string_check for the two different use cases.

This should allow push_string to be imported from Samba4, using it's
calling conventions.
2009-04-14 12:11:00 +10:00
Volker Lendecke
dcda3ab8ca Reactivate get_socket_port 2009-04-12 14:51:15 +02:00
Volker Lendecke
cf7d26933b Convert cli_push to tevent_req
Metze, please check!

Thanks,

Volker
2009-04-08 23:11:59 +02:00
Volker Lendecke
9c89aee5f3 Convert cli_pull to tevent_req 2009-04-08 23:11:59 +02:00
Volker Lendecke
a3f24d91c5 Convert rpc_transport_smbd_init to tevent_req 2009-04-08 22:17:04 +02:00
Volker Lendecke
8a2112c942 Convert rpc_cli_smbd_conn_init to tevent_req 2009-04-08 22:17:04 +02:00
Volker Lendecke
f3d33cd81d Convert rpc_transport_np_init to tevent_req 2009-04-08 22:17:03 +02:00
Günther Deschner
47bda3f3c7 s3-eventlog: split out evlog_convert_tdb_to_evt().
Guenther
2009-04-08 19:45:58 +02:00
Günther Deschner
98d703a6b7 s3-eventlog: move rpc_server/srv_eventlog_lib.c out of rpc_server.
Guenther
2009-04-08 19:45:57 +02:00
Andrew Bartlett
0c22d55134 s3:charcnv Remove unused unistrcpy() and unistrlen()
Signed-off-by: Günther Deschner <gd@samba.org>
2009-04-07 20:51:56 +02:00
Andrew Bartlett
3277b19800 s3:rpc_parse remove unused prs_unistr2()
Signed-off-by: Günther Deschner <gd@samba.org>
2009-04-07 20:51:55 +02:00
Andrew Bartlett
80163b5ac5 s3:charcnv Remove unused unistr2 functions
Natrually, the hard work to make these unsued was done by GD, not me :-)

Andrew Bartlett

Signed-off-by: Günther Deschner <gd@samba.org>
2009-04-07 20:51:55 +02:00
Andrew Bartlett
5fff538820 s3:charcnv Remove unused ucs2_to_unistr2()
Signed-off-by: Günther Deschner <gd@samba.org>
2009-04-07 20:51:55 +02:00
Tim Prouty
651fa0964a s3 oplocks: Refactor level II oplock contention 2009-04-06 13:53:45 -07:00
Volker Lendecke
0c353b5711 Make cli_oplock_ack async 2009-04-06 21:32:08 +02:00
Volker Lendecke
025eb40fbc Convert cli_open to tevent_req 2009-04-06 21:32:07 +02:00
Volker Lendecke
31910810cf Convert cli_close to tevent_req 2009-04-06 21:32:07 +02:00
Volker Lendecke
097db28c5d Convert cli_write_andx to tevent_req 2009-04-06 21:32:07 +02:00
Volker Lendecke
c23ccff13a Convert cli_read_andx to tevent_req 2009-04-06 21:32:07 +02:00
Volker Lendecke
ca7cd350a6 Convert cli_ntcreate to tevent_req 2009-04-06 21:32:07 +02:00
Volker Lendecke
807328ce6d Convert cli_tcon_andx to tevent_req 2009-04-06 21:32:07 +02:00
Volker Lendecke
03becb5066 Convert cli_negprot to tevent_req 2009-04-06 21:32:06 +02:00
Volker Lendecke
95c792b6af Convert cli_session_setup_guest to tevent_req 2009-04-06 21:32:06 +02:00
Volker Lendecke
7ef78bd7b5 Convert cli_trans to tevent_req 2009-04-06 21:32:06 +02:00
Volker Lendecke
dec928e884 Convert cli_echo to tevent_req 2009-04-06 21:32:06 +02:00