[SCM] Samba Shared Repository - branch v3-2-stable updated -
release-3-2-0pre2-576-g134de6a
Karolin Seeger
kseeger at samba.org
Sat Apr 12 05:47:58 GMT 2008
The branch, v3-2-stable has been updated
via 134de6a97dfb51f2260087f24457cb931f340650 (commit)
via d1fdcc91eebfc1992b0990031ee4994be07e7983 (commit)
via 9673fab81d48e52f25ae111914788f041cfb2600 (commit)
via 0cd786a5c59b92d052215ecdfc497f417c0d1318 (commit)
via 262249fdc1ed5467b5c225910dce8fb68404aa99 (commit)
via d86a910b155d01f62a51aeb0c5187420b0374bad (commit)
via be101d3ec52b2dad89ea4c0e7a75debcfa9ef016 (commit)
via faac0a01c0b9fa5afa2493531c984e1377fa0799 (commit)
via 821a282108cdb67ae626ac83f06134d1be3d7def (commit)
via 0c6c2f28062a75871050880a8e047341080be6f4 (commit)
via 63288fffa65678614683ffc2d531004e14ba8de6 (commit)
via 8d61d3dba9e75ea62f4b675f508a71ffb9378e61 (commit)
via 703d047a69f22697d4f80e6bcf32209b3db1bd16 (commit)
via 3e23e369a6f6a14da5542df0aca72433fc7c9ff9 (commit)
via 41d4b00591303bdc189e17140b18014fee4c0774 (commit)
via 3ad0f027e4bec8ffef33d71fff7a7f2e1362164d (commit)
via 75978720bfd2f0f52251fc433f6f6c9798895d7f (commit)
via 896d94683e0f15c6bbd8e964f3ae0f3452eb1372 (commit)
via e50b3909e0fa3e04c206915f4f7bbc98a46c1f21 (commit)
via 65194e60b3cf5963587ae2eebd0440ee38740a98 (commit)
via aaf8f85595eb8b0b7d32490776b457cda6679465 (commit)
via 2c5ef79b5b39c83a09c9925341e54cf7c9c880b3 (commit)
via 3ffe394caa63202436f40f100443584cdeeaa327 (commit)
via 042f9d57578ee2975d506d575ca6d72ee9c20a28 (commit)
via 816f8d68a3d7d0e19d78804df7dc2d79ab4e8656 (commit)
via 89e850e1e9e86a29b17fc29c29f09acb1e6e4cfe (commit)
via e62331daba221e69676b6deb74374d21c4ef494a (commit)
via 60156e4b68901ca5cb16ac11013802337da1a71f (commit)
via d02e98760c488d3fb702107549fd24f002e71b32 (commit)
via 25fcc805558cafa949f899c8c809bcab7e6e391a (commit)
via 55b6fc1f75ead24258f38d0c8c2088a1899c154b (commit)
via 08906a082e526182ed87883a18c9f45de19d6ed2 (commit)
via 06c3879c15de99bf6fff7478daad4b26be1ee6a8 (commit)
via c259d057d70d3b839990c8cc1e75041cdcd27a23 (commit)
from bba96a49a73cad8790afd079c863db206427ff7f (commit)
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-2-stable
- Log -----------------------------------------------------------------
commit 134de6a97dfb51f2260087f24457cb931f340650
Author: Stefan Metzmacher <metze at samba.org>
Date: Fri Apr 11 15:16:51 2008 +0200
net: 'net' doesn't need wb_common.o anymore.
metze
(cherry picked from commit 05f7f77135ab997b92b2454871f21543ecbde0ed)
commit d1fdcc91eebfc1992b0990031ee4994be07e7983
Author: Stefan Metzmacher <metze at samba.org>
Date: Fri Apr 11 12:01:02 2008 +0200
nsswitch: remove unused nsswitch/wb_client.c
metze
(cherry picked from commit 2b236c7ace15b4408c31ed918b449d5a22e1769f)
commit 9673fab81d48e52f25ae111914788f041cfb2600
Author: Stefan Metzmacher <metze at samba.org>
Date: Fri Apr 11 12:00:29 2008 +0200
net_idmap: use wbcSet[U|G]idMapping() and wbcSet[U|G]idHwm() functions
metze
(cherry picked from commit dc9a3f8db0af03b4e8223068857092fcaff404f2)
commit 0cd786a5c59b92d052215ecdfc497f417c0d1318
Author: Stefan Metzmacher <metze at samba.org>
Date: Fri Apr 11 09:28:20 2008 +0200
libwbclient: add wbcSet[U|G]idMapping() and wbcSet[U|G]idHwm() functions
metze
(cherry picked from commit 364e146805bb74b46da4d3c187e9a684d4b99a01)
commit 262249fdc1ed5467b5c225910dce8fb68404aa99
Author: Volker Lendecke <vl at samba.org>
Date: Sun Apr 6 12:26:15 2008 +0200
Fix a C++ warning
(cherry picked from commit c274fe7d21badb42ca8d4d1115ae6bffdb19485f)
commit d86a910b155d01f62a51aeb0c5187420b0374bad
Author: Volker Lendecke <vl at samba.org>
Date: Sun Apr 6 12:26:01 2008 +0200
Remove external refs to winbindd_fd
(cherry picked from commit 18bf2b2028e64403a79b7cc06d3185a3e526d97d)
commit be101d3ec52b2dad89ea4c0e7a75debcfa9ef016
Author: Volker Lendecke <vl at samba.org>
Date: Mon Apr 7 12:19:25 2008 +0200
Fix an uninitialized variable
(cherry picked from commit 8b2d9ee8c54ed84f83fdecf04e656dd66b622abb)
commit faac0a01c0b9fa5afa2493531c984e1377fa0799
Author: Stefan Metzmacher <metze at samba.org>
Date: Sun Apr 6 11:58:58 2008 +0200
wbinfo: make use of wbcGetGroups()
metze
(cherry picked from commit c78f4dc043523842cf42f1a3fd4e8f3855518efa)
commit 821a282108cdb67ae626ac83f06134d1be3d7def
Author: Stefan Metzmacher <metze at samba.org>
Date: Wed Apr 2 06:10:04 2008 +0200
wbinfo: use wbcLookupNames()
metze
(cherry picked from commit 9d0e5a13215d4904084e81fde6098c70ee4d4636)
commit 0c6c2f28062a75871050880a8e047341080be6f4
Author: Stefan Metzmacher <metze at samba.org>
Date: Wed Apr 2 06:03:48 2008 +0200
wbinfo: use wbcLookupRids()
metze
(cherry picked from commit 046b26b763b16362dd662a77b2434641bf583bc2)
commit 63288fffa65678614683ffc2d531004e14ba8de6
Author: Stefan Metzmacher <metze at samba.org>
Date: Wed Apr 2 05:26:36 2008 +0200
wbinfo: use wbcLookupSid()
metze
(cherry picked from commit b917be4986bd55aeffae03b08cf476ea6302fa26)
commit 8d61d3dba9e75ea62f4b675f508a71ffb9378e61
Author: Stefan Metzmacher <metze at samba.org>
Date: Wed Apr 2 06:02:45 2008 +0200
wbinfo: catch NULL domain string as in other places
metze
(cherry picked from commit ff4611832a0b498b83590279a7153e606a4720f5)
commit 703d047a69f22697d4f80e6bcf32209b3db1bd16
Author: Stefan Metzmacher <metze at samba.org>
Date: Fri Mar 28 16:55:53 2008 +0100
wbinfo: use wbcInterfaceDetails()
metze
(cherry picked from commit ff87260f1268d190170608b0808c191ef8f3e942)
commit 3e23e369a6f6a14da5542df0aca72433fc7c9ff9
Author: Stefan Metzmacher <metze at samba.org>
Date: Fri Mar 28 19:39:43 2008 +0100
wbinfo: use wbcAllocateGid()
metze
(cherry picked from commit 960c069a2354e0803e2cbf22c26e1a9d0b657b79)
commit 41d4b00591303bdc189e17140b18014fee4c0774
Author: Stefan Metzmacher <metze at samba.org>
Date: Fri Mar 28 19:39:16 2008 +0100
wbinfo: use wbcAllocateUid()
metze
(cherry picked from commit a7d735df292cee7dd6e23c7d2328481d57162904)
commit 3ad0f027e4bec8ffef33d71fff7a7f2e1362164d
Author: Stefan Metzmacher <metze at samba.org>
Date: Fri Mar 28 19:38:24 2008 +0100
wbinfo: use wbcSidToGid()
metze
(cherry picked from commit 43df48bdca1a71fa44b24bb3917869f886555d9c)
commit 75978720bfd2f0f52251fc433f6f6c9798895d7f
Author: Stefan Metzmacher <metze at samba.org>
Date: Fri Mar 28 19:37:50 2008 +0100
wbinfo: use wbcSidToUid()
metze
(cherry picked from commit a25b39cac1716323154dd30acb30180d3273587b)
commit 896d94683e0f15c6bbd8e964f3ae0f3452eb1372
Author: Stefan Metzmacher <metze at samba.org>
Date: Fri Mar 28 19:37:02 2008 +0100
wbinfo: use wbcGitToSid()
metze
(cherry picked from commit 9936d861a1c1163ce6fd079211b50fd9b52bc05d)
commit e50b3909e0fa3e04c206915f4f7bbc98a46c1f21
Author: Stefan Metzmacher <metze at samba.org>
Date: Fri Mar 28 19:34:10 2008 +0100
wbinfo: use wbcUidToSid()
metze
(cherry picked from commit 4766ebf7ac8d33f9cd0f983ecdc54ef44959648b)
commit 65194e60b3cf5963587ae2eebd0440ee38740a98
Author: Stefan Metzmacher <metze at samba.org>
Date: Fri Mar 28 19:01:54 2008 +0100
wbinfo: use wbcPing()
metze
(cherry picked from commit 9a2f0b21925e630fa9b268cedbc19cf814686b42)
commit aaf8f85595eb8b0b7d32490776b457cda6679465
Author: Stefan Metzmacher <metze at samba.org>
Date: Mon Mar 24 21:05:30 2008 +0100
wbinfo: use wbcDomainInfo()
metze
(cherry picked from commit 7714f9232110b2ee50e6ba8371f0bc23b83717a6)
commit 2c5ef79b5b39c83a09c9925341e54cf7c9c880b3
Author: Stefan Metzmacher <metze at samba.org>
Date: Mon Mar 24 20:44:34 2008 +0100
wbinfo: use wbcGetgrnam()
metze
(cherry picked from commit 8945dce4a18874bdf1a57f1ff8116a66a6f699a0)
commit 3ffe394caa63202436f40f100443584cdeeaa327
Author: Stefan Metzmacher <metze at samba.org>
Date: Mon Mar 24 20:32:14 2008 +0100
wbinfo: use wbcListUsers() and wbcListGroups()
metze
(cherry picked from commit 5a0ae1ad0c36e5ef97008a2c6bc2a921ca6538bd)
commit 042f9d57578ee2975d506d575ca6d72ee9c20a28
Author: Stefan Metzmacher <metze at samba.org>
Date: Sun Mar 23 22:41:45 2008 +0100
wbinfo: use wbcLookupUserSids()
metze
(cherry picked from commit ff16b66631bc93909c0e7adf9e6bb1cf1d641ffd)
commit 816f8d68a3d7d0e19d78804df7dc2d79ab4e8656
Author: Günther Deschner <gd at samba.org>
Date: Tue Apr 8 21:41:16 2008 +0200
Fix the build of reply_setattrE().
How ever could this compile ?
Guenther
(cherry picked from commit 02f5f35e5ed3b061cfd020d0b13014c72fced5f4)
commit 89e850e1e9e86a29b17fc29c29f09acb1e6e4cfe
Author: Stefan Metzmacher <metze at samba.org>
Date: Tue Apr 8 18:50:49 2008 +0200
selftest: run the BASE-DELAYWRITE test 4 times faster in make test
metze
(cherry picked from commit 83b6da7c52a6f5285a9765d22d13a53fe9dc80e5)
commit e62331daba221e69676b6deb74374d21c4ef494a
Author: Stefan Metzmacher <metze at samba.org>
Date: Mon Apr 7 09:27:22 2008 +0200
smbd: make it possible to change the write time delay for testing
metze
(cherry picked from commit df8c100c2b53575a0d425a2daf52e2d59904746a)
commit 60156e4b68901ca5cb16ac11013802337da1a71f
Author: Stefan Metzmacher <metze at samba.org>
Date: Mon Apr 7 09:21:19 2008 +0200
smbd: make it possible to disable get_file_infos() on searches
metze
(cherry picked from commit 404a865a34c3a7c67131b3f99e92c11b2abe3e39)
commit d02e98760c488d3fb702107549fd24f002e71b32
Author: Stefan Metzmacher <metze at samba.org>
Date: Tue Apr 1 11:40:23 2008 +0200
locking: combine get_delete_on_close_flag() and get_write_time() into get_file_infos()
This means we need to fetch the record only once.
metze
(cherry picked from commit 4130b873291d39e363184fe4e38dc1f24ebe5056)
commit 25fcc805558cafa949f899c8c809bcab7e6e391a
Author: Stefan Metzmacher <metze at samba.org>
Date: Wed Mar 12 18:26:43 2008 +0100
selftest: samba3 passes BASE-DELAYWRITE
metze
(cherry picked from commit 5df34634317633820993c9ef924d694a8fe1c4fe)
commit 55b6fc1f75ead24258f38d0c8c2088a1899c154b
Author: Stefan Metzmacher <metze at samba.org>
Date: Wed Mar 12 15:39:38 2008 +0100
smbd: implement the strange write time update logic
We now never call file_ntimes() directly, every update
is done via smb_set_file_time().
This let samba3 pass the BASE-DELAYWRITE test.
The write time is only updated 2 seconds after the
first write() on any open handle to the current time
(not the time of the first write).
Each handle which had write requests updates the write
time to the current time on close().
If the write time is set explicit via setfileinfo or setpathinfo
the write time is visible directly and a following close
on the same handle doesn't update the write time.
metze
(cherry picked from commit 2eab212ea2e1bfd8fa716c2c89b2c042f7ba12ea)
commit 08906a082e526182ed87883a18c9f45de19d6ed2
Author: Stefan Metzmacher <metze at samba.org>
Date: Wed Mar 12 15:32:47 2008 +0100
locking: store the write time in the locking.tdb
This is needed to implement the strange write time update
logic later. We need to store 2 time timestamps to
distinguish between the time the file system had before
the first client opened the file and a forced timestamp update.
metze
(cherry picked from commit 6aaa2ce0eeb46f6735ec984a2e7aadde7a7f456d)
commit 06c3879c15de99bf6fff7478daad4b26be1ee6a8
Author: Jeremy Allison <jra at samba.org>
Date: Tue Mar 11 13:59:04 2008 -0700
Metze pointed out this we don't need FILE_ATTRIBUTE_READ here.
Jeremy.
(cherry picked from commit 923aa9f330cb370221af6b66cf0f237a9bd06f8e)
commit c259d057d70d3b839990c8cc1e75041cdcd27a23
Author: Stefan Metzmacher <metze at sernet.de>
Date: Mon Mar 17 14:08:57 2008 +0100
socket_wrapper: make pcap code more portable
Now the pcap support works on x86_64.
metze
(cherry picked from commit 61a87bed61ef661d98131239976be95c6a8b4d96)
(cherry picked from commit c22204aa85d4bb33534b6974dcfed9aad0c28cc4)
-----------------------------------------------------------------------
Summary of changes:
source/Makefile.in | 4 +-
source/include/local.h | 3 +
source/include/smb.h | 14 +-
source/lib/socket_wrapper/socket_wrapper.c | 79 ++--
source/locking/locking.c | 111 +++++-
source/nsswitch/libwbclient/wbc_idmap.c | 149 ++++++++
source/nsswitch/libwbclient/wbclient.h | 8 +
source/nsswitch/wb_client.c | 96 -----
source/nsswitch/wbinfo.c | 553 +++++++++++++++-------------
source/nsswitch/winbind_nss_linux.c | 4 +-
source/script/tests/selftest.sh | 1 +
source/script/tests/test_posix_s3.sh | 3 +-
source/smbd/close.c | 84 ++++-
source/smbd/dir.c | 14 +-
source/smbd/dosmode.c | 42 ++-
source/smbd/fileio.c | 66 +++--
source/smbd/filename.c | 18 +-
source/smbd/files.c | 29 +--
source/smbd/nttrans.c | 2 +-
source/smbd/open.c | 15 +-
source/smbd/oplock.c | 9 +-
source/smbd/reply.c | 75 +++--
source/smbd/trans2.c | 102 +++---
source/utils/net_idmap.c | 46 ++-
source/utils/ntlm_auth.c | 2 -
25 files changed, 932 insertions(+), 597 deletions(-)
delete mode 100644 source/nsswitch/wb_client.c
Changeset truncated at 500 lines:
diff --git a/source/Makefile.in b/source/Makefile.in
index b85319d..0e81ee4 100644
--- a/source/Makefile.in
+++ b/source/Makefile.in
@@ -851,7 +851,7 @@ NET_OBJ1 = utils/net.o utils/net_ads.o utils/net_help.o \
$(PASSWD_UTIL_OBJ) utils/net_dns.o utils/net_ads_gpo.o \
utils/net_conf.o \
utils/net_registry.o \
- auth/token_util.o utils/net_dom.o nsswitch/wb_client.o
+ auth/token_util.o utils/net_dom.o
# these are not processed by make proto
NET_OBJ2 = utils/net_registry_util.o
@@ -868,7 +868,7 @@ NET_OBJ = $(NET_OBJ1) \
$(LDB_OBJ) $(LIBGPO_OBJ) @BUILD_INIPARSER@ $(DISPLAY_SEC_OBJ) \
$(REG_SMBCONF_OBJ) @LIBNETAPI_STATIC@ $(LIBNET_OBJ) \
$(LIBSMBCONF_OBJ) \
- $(WBCOMMON_OBJ) @LIBWBCLIENT_STATIC@ \
+ @LIBWBCLIENT_STATIC@ \
$(PRIVILEGES_BASIC_OBJ)
CUPS_OBJ = client/smbspool.o $(PARAM_OBJ) $(LIBSMB_OBJ) \
diff --git a/source/include/local.h b/source/include/local.h
index 6d32f4f..c125ded 100644
--- a/source/include/local.h
+++ b/source/include/local.h
@@ -233,6 +233,9 @@
/* Number of microseconds to wait before a sharing violation. */
#define SHARING_VIOLATION_USEC_WAIT 950000
+/* Number of microseconds to wait before a updating the write time (2 secs). */
+#define WRITE_TIME_UPDATE_USEC_DELAY 2000000
+
#define MAX_LDAP_REPLICATION_SLEEP_TIME 5000 /* In milliseconds. */
/* tdb hash size for the open database. */
diff --git a/source/include/smb.h b/source/include/smb.h
index bf9ca6b..70e980a 100644
--- a/source/include/smb.h
+++ b/source/include/smb.h
@@ -485,9 +485,13 @@ typedef struct files_struct {
struct timeval open_time;
uint32 access_mask; /* NTCreateX access bits (FILE_READ_DATA etc.) */
uint32 share_access; /* NTCreateX share constants (FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE). */
- bool pending_modtime_owner;
- struct timespec pending_modtime;
- struct timespec last_write_time;
+
+ bool update_write_time_triggered;
+ struct timed_event *update_write_time_event;
+ bool update_write_time_on_close;
+ struct timespec close_write_time;
+ bool write_time_forced;
+
int oplock_type;
int sent_oplock_break;
struct timed_event *oplock_timeout;
@@ -811,6 +815,8 @@ struct share_mode_lock {
struct share_mode_entry *share_modes;
UNIX_USER_TOKEN *delete_token;
bool delete_on_close;
+ struct timespec old_write_time;
+ struct timespec changed_write_time;
bool fresh;
bool modified;
struct db_record *record;
@@ -826,6 +832,8 @@ struct locking_data {
struct {
int num_share_mode_entries;
bool delete_on_close;
+ struct timespec old_write_time;
+ struct timespec changed_write_time;
uint32 delete_token_size; /* Only valid if either of
the two previous fields
are True. */
diff --git a/source/lib/socket_wrapper/socket_wrapper.c b/source/lib/socket_wrapper/socket_wrapper.c
index 5b8052e..c0a7c16 100644
--- a/source/lib/socket_wrapper/socket_wrapper.c
+++ b/source/lib/socket_wrapper/socket_wrapper.c
@@ -71,6 +71,7 @@
#include <unistd.h>
#include <string.h>
#include <stdio.h>
+#include <stdint.h>
#define _PUBLIC_
@@ -499,67 +500,67 @@ enum swrap_packet_type {
};
struct swrap_file_hdr {
- unsigned long magic;
- unsigned short version_major;
- unsigned short version_minor;
- long timezone;
- unsigned long sigfigs;
- unsigned long frame_max_len;
+ uint32_t magic;
+ uint16_t version_major;
+ uint16_t version_minor;
+ int32_t timezone;
+ uint32_t sigfigs;
+ uint32_t frame_max_len;
#define SWRAP_FRAME_LENGTH_MAX 0xFFFF
- unsigned long link_type;
+ uint32_t link_type;
};
#define SWRAP_FILE_HDR_SIZE 24
struct swrap_packet {
struct {
- unsigned long seconds;
- unsigned long micro_seconds;
- unsigned long recorded_length;
- unsigned long full_length;
+ uint32_t seconds;
+ uint32_t micro_seconds;
+ uint32_t recorded_length;
+ uint32_t full_length;
} frame;
#define SWRAP_PACKET__FRAME_SIZE 16
struct {
struct {
- unsigned char ver_hdrlen;
- unsigned char tos;
- unsigned short packet_length;
- unsigned short identification;
- unsigned char flags;
- unsigned char fragment;
- unsigned char ttl;
- unsigned char protocol;
- unsigned short hdr_checksum;
- unsigned long src_addr;
- unsigned long dest_addr;
+ uint8_t ver_hdrlen;
+ uint8_t tos;
+ uint16_t packet_length;
+ uint16_t identification;
+ uint8_t flags;
+ uint8_t fragment;
+ uint8_t ttl;
+ uint8_t protocol;
+ uint16_t hdr_checksum;
+ uint32_t src_addr;
+ uint32_t dest_addr;
} hdr;
#define SWRAP_PACKET__IP_HDR_SIZE 20
union {
struct {
- unsigned short source_port;
- unsigned short dest_port;
- unsigned long seq_num;
- unsigned long ack_num;
- unsigned char hdr_length;
- unsigned char control;
- unsigned short window;
- unsigned short checksum;
- unsigned short urg;
+ uint16_t source_port;
+ uint16_t dest_port;
+ uint32_t seq_num;
+ uint32_t ack_num;
+ uint8_t hdr_length;
+ uint8_t control;
+ uint16_t window;
+ uint16_t checksum;
+ uint16_t urg;
} tcp;
#define SWRAP_PACKET__IP_P_TCP_SIZE 20
struct {
- unsigned short source_port;
- unsigned short dest_port;
- unsigned short length;
- unsigned short checksum;
+ uint16_t source_port;
+ uint16_t dest_port;
+ uint16_t length;
+ uint16_t checksum;
} udp;
#define SWRAP_PACKET__IP_P_UDP_SIZE 8
struct {
- unsigned char type;
- unsigned char code;
- unsigned short checksum;
- unsigned long unused;
+ uint8_t type;
+ uint8_t code;
+ uint16_t checksum;
+ uint32_t unused;
} icmp;
#define SWRAP_PACKET__IP_P_ICMP_SIZE 8
} p;
diff --git a/source/locking/locking.c b/source/locking/locking.c
index 782e10f..5faebef 100644
--- a/source/locking/locking.c
+++ b/source/locking/locking.c
@@ -503,12 +503,20 @@ static bool parse_share_modes(TDB_DATA dbuf, struct share_mode_lock *lck)
data = (struct locking_data *)dbuf.dptr;
lck->delete_on_close = data->u.s.delete_on_close;
+ lck->old_write_time = data->u.s.old_write_time;
+ lck->changed_write_time = data->u.s.changed_write_time;
lck->num_share_modes = data->u.s.num_share_mode_entries;
- DEBUG(10, ("parse_share_modes: delete_on_close: %d, "
- "num_share_modes: %d\n",
- lck->delete_on_close,
- lck->num_share_modes));
+ DEBUG(10, ("parse_share_modes: delete_on_close: %d, owrt: %s, "
+ "cwrt: %s, tok: %u, num_share_modes: %d\n",
+ lck->delete_on_close,
+ timestring(debug_ctx(),
+ convert_timespec_to_time_t(lck->old_write_time)),
+ timestring(debug_ctx(),
+ convert_timespec_to_time_t(
+ lck->changed_write_time)),
+ (unsigned int)data->u.s.delete_token_size,
+ lck->num_share_modes));
if ((lck->num_share_modes < 0) || (lck->num_share_modes > 1000000)) {
DEBUG(0, ("invalid number of share modes: %d\n",
@@ -659,11 +667,20 @@ static TDB_DATA unparse_share_modes(struct share_mode_lock *lck)
ZERO_STRUCTP(data);
data->u.s.num_share_mode_entries = lck->num_share_modes;
data->u.s.delete_on_close = lck->delete_on_close;
+ data->u.s.old_write_time = lck->old_write_time;
+ data->u.s.changed_write_time = lck->changed_write_time;
data->u.s.delete_token_size = delete_token_size;
- DEBUG(10, ("unparse_share_modes: del: %d, tok = %u, num: %d\n",
- data->u.s.delete_on_close,
- (unsigned int)data->u.s.delete_token_size,
- data->u.s.num_share_mode_entries));
+
+ DEBUG(10,("unparse_share_modes: del: %d, owrt: %s cwrt: %s, tok: %u, "
+ "num: %d\n", data->u.s.delete_on_close,
+ timestring(debug_ctx(),
+ convert_timespec_to_time_t(lck->old_write_time)),
+ timestring(debug_ctx(),
+ convert_timespec_to_time_t(
+ lck->changed_write_time)),
+ (unsigned int)data->u.s.delete_token_size,
+ data->u.s.num_share_mode_entries));
+
memcpy(result.dptr + sizeof(*data), lck->share_modes,
sizeof(struct share_mode_entry)*lck->num_share_modes);
offset = sizeof(*data) +
@@ -739,7 +756,8 @@ static bool fill_share_mode_lock(struct share_mode_lock *lck,
struct file_id id,
const char *servicepath,
const char *fname,
- TDB_DATA share_mode_data)
+ TDB_DATA share_mode_data,
+ const struct timespec *old_write_time)
{
/* Ensure we set every field here as the destructor must be
valid even if parse_share_modes fails. */
@@ -751,13 +769,16 @@ static bool fill_share_mode_lock(struct share_mode_lock *lck,
lck->share_modes = NULL;
lck->delete_token = NULL;
lck->delete_on_close = False;
+ ZERO_STRUCT(lck->old_write_time);
+ ZERO_STRUCT(lck->changed_write_time);
lck->fresh = False;
lck->modified = False;
lck->fresh = (share_mode_data.dptr == NULL);
if (lck->fresh) {
- if (fname == NULL || servicepath == NULL) {
+ if (fname == NULL || servicepath == NULL
+ || old_write_time == NULL) {
return False;
}
lck->filename = talloc_strdup(lck, fname);
@@ -766,6 +787,7 @@ static bool fill_share_mode_lock(struct share_mode_lock *lck,
DEBUG(0, ("talloc failed\n"));
return False;
}
+ lck->old_write_time = *old_write_time;
} else {
if (!parse_share_modes(share_mode_data, lck)) {
DEBUG(0, ("Could not parse share modes\n"));
@@ -779,7 +801,8 @@ static bool fill_share_mode_lock(struct share_mode_lock *lck,
struct share_mode_lock *get_share_mode_lock(TALLOC_CTX *mem_ctx,
const struct file_id id,
const char *servicepath,
- const char *fname)
+ const char *fname,
+ const struct timespec *old_write_time)
{
struct share_mode_lock *lck;
struct file_id tmp;
@@ -797,7 +820,7 @@ struct share_mode_lock *get_share_mode_lock(TALLOC_CTX *mem_ctx,
}
if (!fill_share_mode_lock(lck, id, servicepath, fname,
- lck->record->value)) {
+ lck->record->value, old_write_time)) {
DEBUG(3, ("fill_share_mode_lock failed\n"));
TALLOC_FREE(lck);
return NULL;
@@ -829,7 +852,7 @@ struct share_mode_lock *fetch_share_mode_unlocked(TALLOC_CTX *mem_ctx,
return NULL;
}
- if (!fill_share_mode_lock(lck, id, servicepath, fname, data)) {
+ if (!fill_share_mode_lock(lck, id, servicepath, fname, data, NULL)) {
DEBUG(3, ("fill_share_mode_lock failed\n"));
TALLOC_FREE(lck);
return NULL;
@@ -917,17 +940,40 @@ bool rename_share_filename(struct messaging_context *msg_ctx,
return True;
}
-bool get_delete_on_close_flag(struct file_id id)
+void get_file_infos(struct file_id id,
+ bool *delete_on_close,
+ struct timespec *write_time)
{
- bool result;
struct share_mode_lock *lck;
-
+
+ if (delete_on_close) {
+ *delete_on_close = false;
+ }
+
+ if (write_time) {
+ ZERO_STRUCTP(write_time);
+ }
+
if (!(lck = fetch_share_mode_unlocked(talloc_tos(), id, NULL, NULL))) {
- return False;
+ return;
+ }
+
+ if (delete_on_close) {
+ *delete_on_close = lck->delete_on_close;
+ }
+
+ if (write_time) {
+ struct timespec wt;
+
+ wt = lck->changed_write_time;
+ if (null_timespec(wt)) {
+ wt = lck->old_write_time;
+ }
+
+ *write_time = wt;
}
- result = lck->delete_on_close;
+
TALLOC_FREE(lck);
- return result;
}
bool is_valid_share_mode_entry(const struct share_mode_entry *e)
@@ -1321,7 +1367,8 @@ bool set_delete_on_close(files_struct *fsp, bool delete_on_close, UNIX_USER_TOKE
return True;
}
- lck = get_share_mode_lock(talloc_tos(), fsp->file_id, NULL, NULL);
+ lck = get_share_mode_lock(talloc_tos(), fsp->file_id, NULL, NULL,
+ NULL);
if (lck == NULL) {
return False;
}
@@ -1361,6 +1408,30 @@ bool set_allow_initial_delete_on_close(struct share_mode_lock *lck, files_struct
return True;
}
+bool set_write_time(struct file_id fileid, struct timespec write_time,
+ bool overwrite)
+{
+ struct share_mode_lock *lck;
+
+ DEBUG(5,("set_write_time: %s overwrite=%d id=%s\n",
+ timestring(debug_ctx(),
+ convert_timespec_to_time_t(write_time)),
+ overwrite, file_id_string_tos(&fileid)));
+
+ lck = get_share_mode_lock(NULL, fileid, NULL, NULL, NULL);
+ if (lck == NULL) {
+ return False;
+ }
+
+ if (overwrite || null_timespec(lck->changed_write_time)) {
+ lck->modified = True;
+ lck->changed_write_time = write_time;
+ }
+
+ TALLOC_FREE(lck);
+ return True;
+}
+
struct forall_state {
void (*fn)(const struct share_mode_entry *entry,
const char *sharepath,
diff --git a/source/nsswitch/libwbclient/wbc_idmap.c b/source/nsswitch/libwbclient/wbc_idmap.c
index 17f6fb8..e32d66c 100644
--- a/source/nsswitch/libwbclient/wbc_idmap.c
+++ b/source/nsswitch/libwbclient/wbc_idmap.c
@@ -272,3 +272,152 @@ wbcErr wbcAllocateGid(gid_t *pgid)
return wbc_status;
}
+/* we can't include smb.h here... */
+#define _ID_TYPE_UID 1
+#define _ID_TYPE_GID 2
+
+/** @brief Set an user id mapping
+ *
+ * @param uid Uid of the desired mapping.
+ * @param *sid Pointer to the sid of the diresired mapping.
+ *
+ * @return #wbcErr
+ **/
+wbcErr wbcSetUidMapping(uid_t uid, const struct wbcDomainSid *sid)
+{
+ struct winbindd_request request;
+ struct winbindd_response response;
+ wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE;
+ char *sid_string = NULL;
+
+ if (!sid) {
+ return WBC_ERR_INVALID_PARAM;
+ }
+
+ /* Initialise request */
+
+ ZERO_STRUCT(request);
+ ZERO_STRUCT(response);
+
+ /* Make request */
+
+ request.data.dual_idmapset.id = uid;
+ request.data.dual_idmapset.type = _ID_TYPE_UID;
+
+ wbc_status = wbcSidToString(sid, &sid_string);
+ BAIL_ON_WBC_ERROR(wbc_status);
+
+ strncpy(request.data.dual_idmapset.sid, sid_string,
+ sizeof(request.data.dual_idmapset.sid)-1);
+ wbcFreeMemory(sid_string);
+
+ wbc_status = wbcRequestResponse(WINBINDD_SET_MAPPING,
+ &request, &response);
+ BAIL_ON_WBC_ERROR(wbc_status);
+
+ done:
+ return wbc_status;
+}
+
+/** @brief Set a group id mapping
+ *
+ * @param gid Gid of the desired mapping.
+ * @param *sid Pointer to the sid of the diresired mapping.
+ *
+ * @return #wbcErr
+ **/
+wbcErr wbcSetGidMapping(gid_t gid, const struct wbcDomainSid *sid)
+{
+ struct winbindd_request request;
+ struct winbindd_response response;
+ wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE;
+ char *sid_string = NULL;
+
+ if (!sid) {
+ return WBC_ERR_INVALID_PARAM;
+ }
+
+ /* Initialise request */
+
+ ZERO_STRUCT(request);
+ ZERO_STRUCT(response);
+
+ /* Make request */
+
+ request.data.dual_idmapset.id = gid;
+ request.data.dual_idmapset.type = _ID_TYPE_GID;
+
+ wbc_status = wbcSidToString(sid, &sid_string);
+ BAIL_ON_WBC_ERROR(wbc_status);
+
+ strncpy(request.data.dual_idmapset.sid, sid_string,
+ sizeof(request.data.dual_idmapset.sid)-1);
+ wbcFreeMemory(sid_string);
+
+ wbc_status = wbcRequestResponse(WINBINDD_SET_MAPPING,
+ &request, &response);
+ BAIL_ON_WBC_ERROR(wbc_status);
+
+ done:
+ return wbc_status;
+}
+
+/** @brief Set the highwater mark for allocated uids.
+ *
--
Samba Shared Repository
More information about the samba-cvs
mailing list