[SCM] Samba Shared Repository - branch master updated -
d99aeed50f1221561d8d935777216d372a2a4a71
Volker Lendecke
vlendec at samba.org
Wed Dec 31 18:34:17 GMT 2008
The branch, master has been updated
via d99aeed50f1221561d8d935777216d372a2a4a71 (commit)
via 608910d40bbba37e3424ce1f7e06582190be13f2 (commit)
via 8ae4155f82269cbb7944faf5a0e2c968481fc03e (commit)
via 1ce9525be28c3758fa41981573b50fa841e93804 (commit)
via 98f830cdfc8258fb36fc856bef80d25ddedf5c31 (commit)
via e0fd61f0cbfb0a25c8e9603375c2eb98936c8345 (commit)
via 9e1cabdd43bb608c6aa707f0e42d99e204e86603 (commit)
via 972295f80a96e3928be426edf607cbdd3990a2d9 (commit)
via 9b79181f1508b8a126a48511232205abe456e923 (commit)
via 70002c1667ee9ea4fc716f9b8134c8dcd22ec409 (commit)
via 4a9a569600cbcddffcfbeca97587de516259e939 (commit)
via 5f0b633c725238602dbd5ce8ae4aac8f7bbe6e8d (commit)
via 8a507b1e7fa179c16c2dd6ddc2bdd345d00545f4 (commit)
via add3d572d05951f6f5ac89044d449c4dbdc03308 (commit)
from 641772b605520ed3914ee36d5a953c247c1082c7 (commit)
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit d99aeed50f1221561d8d935777216d372a2a4a71
Author: Volker Lendecke <vl at samba.org>
Date: Thu Dec 25 14:37:33 2008 +0100
Replace a static variable and alarm() calls by using sys_select()
Günther, please check!
commit 608910d40bbba37e3424ce1f7e06582190be13f2
Author: Volker Lendecke <vl at samba.org>
Date: Thu Dec 25 14:29:39 2008 +0100
Fix some nonempty blank lines
commit 8ae4155f82269cbb7944faf5a0e2c968481fc03e
Author: Volker Lendecke <vl at samba.org>
Date: Thu Dec 25 14:26:17 2008 +0100
Make a CONST_DISCARD unnecessary by applying some const
Derrell, please check!
commit 1ce9525be28c3758fa41981573b50fa841e93804
Author: Volker Lendecke <vl at samba.org>
Date: Sat Dec 20 10:42:02 2008 +0100
Replace "goto again" by "return NT_STATUS_RETRY" in receive_message_or_smb
This gives lower-level routines the chance to indicate a retry condition
commit 98f830cdfc8258fb36fc856bef80d25ddedf5c31
Author: Volker Lendecke <vl at samba.org>
Date: Thu Dec 25 13:44:11 2008 +0100
Disable the use of splice(2)
On a debian lenny installation with a kernel that calls itself 2.6.28, I could
repeatably block smbd using splice. According to the output of netstat, the
recvq of the TCP connection was full and at the same time according to strace
smbd was stuck in a splice syscall trying to read from that TCP connection. We
can not protect ourselves from this condition, as nobody will ever notify us
that something is broken. So sadly we can't use splice yet at all. Maybe in
2.6.29...
commit e0fd61f0cbfb0a25c8e9603375c2eb98936c8345
Author: Volker Lendecke <vl at samba.org>
Date: Tue Dec 23 22:45:03 2008 +0100
Try to fix recvfile using splice on Linux
According to the splice(2) manpage, one of the file descriptors *must* be a
pipe. With this patch I could successfully run splice(2) on a debian lenny
installation.
Jeremy, please check!
commit 9e1cabdd43bb608c6aa707f0e42d99e204e86603
Author: Volker Lendecke <vl at samba.org>
Date: Wed Dec 24 13:52:20 2008 +0100
Fix a "nested extern" warning
commit 972295f80a96e3928be426edf607cbdd3990a2d9
Author: Volker Lendecke <vl at samba.org>
Date: Wed Dec 24 13:51:47 2008 +0100
Rename parent_dirname_talloc() to parent_dirname()
commit 9b79181f1508b8a126a48511232205abe456e923
Author: Volker Lendecke <vl at samba.org>
Date: Wed Dec 24 13:47:41 2008 +0100
Remove unused function parent_dirname
commit 70002c1667ee9ea4fc716f9b8134c8dcd22ec409
Author: Volker Lendecke <vl at samba.org>
Date: Wed Dec 24 13:46:22 2008 +0100
Use parent_dirname_talloc instead of parent_dirname in smb_unix_mknod
commit 4a9a569600cbcddffcfbeca97587de516259e939
Author: Volker Lendecke <vl at samba.org>
Date: Wed Dec 24 13:44:44 2008 +0100
Use parent_dirname_talloc instead of parent_dirname in copy_internals
commit 5f0b633c725238602dbd5ce8ae4aac8f7bbe6e8d
Author: Volker Lendecke <vl at samba.org>
Date: Wed Dec 24 13:41:42 2008 +0100
Use parent_dirname_talloc instead of parent_dirname in vfswrap_mkdir
commit 8a507b1e7fa179c16c2dd6ddc2bdd345d00545f4
Author: Volker Lendecke <vl at samba.org>
Date: Wed Dec 24 13:18:35 2008 +0100
Make use of TALLOC_MEMDUP in parent_dirname_talloc()
commit add3d572d05951f6f5ac89044d449c4dbdc03308
Author: Volker Lendecke <vl at samba.org>
Date: Wed Dec 24 13:05:25 2008 +0100
Remove unused function get_numlist()
-----------------------------------------------------------------------
Summary of changes:
source3/include/proto.h | 6 +--
source3/lib/recvfile.c | 59 ++++++++++++++++++++------------
source3/lib/util.c | 71 ++-------------------------------------
source3/libads/cldap.c | 51 ++++++++++++++--------------
source3/libsmb/libsmb_xattr.c | 5 +--
source3/modules/onefs_open.c | 6 +--
source3/modules/vfs_acl_tdb.c | 5 +--
source3/modules/vfs_acl_xattr.c | 5 +--
source3/modules/vfs_default.c | 7 +++-
source3/smbd/file_access.c | 5 +--
source3/smbd/nttrans.c | 8 +++-
source3/smbd/open.c | 8 ++---
source3/smbd/posix_acls.c | 5 +--
source3/smbd/process.c | 24 +++++++------
source3/smbd/reply.c | 4 +-
source3/smbd/trans2.c | 9 +++--
16 files changed, 112 insertions(+), 166 deletions(-)
Changeset truncated at 500 lines:
diff --git a/source3/include/proto.h b/source3/include/proto.h
index b187a66..be34bb0 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -1165,7 +1165,6 @@ struct user_auth_info *get_cmdline_auth_info_copy(TALLOC_CTX *mem_ctx,
bool set_cmdline_auth_info_machine_account_creds(struct user_auth_info *auth_info);
bool add_gid_to_array_unique(TALLOC_CTX *mem_ctx, gid_t gid,
gid_t **gids, size_t *num_gids);
-const char *get_numlist(const char *p, uint32 **num, int *count);
bool file_exist_stat(const char *fname,SMB_STRUCT_STAT *sbuf);
bool socket_exist(const char *fname);
bool directory_exist_stat(char *dname,SMB_STRUCT_STAT *st);
@@ -1231,9 +1230,8 @@ char *modules_path(const char *name);
char *data_path(const char *name);
char *state_path(const char *name);
const char *shlib_ext(void);
-char *parent_dirname(const char *path);
-bool parent_dirname_talloc(TALLOC_CTX *mem_ctx, const char *dir,
- char **parent, const char **name);
+bool parent_dirname(TALLOC_CTX *mem_ctx, const char *dir, char **parent,
+ const char **name);
bool ms_has_wild(const char *s);
bool ms_has_wild_w(const smb_ucs2_t *s);
bool mask_match(const char *string, const char *pattern, bool is_case_sensitive);
diff --git a/source3/lib/recvfile.c b/source3/lib/recvfile.c
index 513742c..c9710a7 100644
--- a/source3/lib/recvfile.c
+++ b/source3/lib/recvfile.c
@@ -145,7 +145,8 @@ ssize_t sys_recvfile(int fromfd,
SMB_OFF_T offset,
size_t count)
{
- static bool try_splice_call = true;
+ static int pipefd[2] = { -1, -1 };
+ static bool try_splice_call = false;
size_t total_written = 0;
DEBUG(10,("sys_recvfile: from = %d, to = %d, "
@@ -171,31 +172,45 @@ ssize_t sys_recvfile(int fromfd,
count);
}
- while (total_written < count) {
- ssize_t ret = splice(fromfd,
- NULL,
- tofd,
- &offset,
- count,
- 0);
- if (ret == -1) {
- if (errno != EINTR) {
- if (total_written == 0 &&
- (errno == EBADF || errno == EINVAL)) {
- try_splice_call = false;
- return default_sys_recvfile(fromfd,
- tofd,
- offset,
- count);
- }
- break;
+ if ((pipefd[0] == -1) && (pipe(pipefd) == -1)) {
+ try_splice_call = false;
+ return default_sys_recvfile(fromfd, tofd, offset, count);
+ }
+
+ while (count > 0) {
+ int nread, to_write;
+
+ nread = splice(fromfd, NULL, pipefd[1], NULL, count, 0);
+ if (nread == -1) {
+ if (errno == EINTR) {
+ continue;
+ }
+ if (total_written == 0 &&
+ (errno == EBADF || errno == EINVAL)) {
+ try_splice_call = false;
+ return default_sys_recvfile(fromfd, tofd,
+ offset, count);
}
- continue;
+ break;
}
- total_written += ret;
- count -= ret;
+
+ to_write = nread;
+ while (to_write > 0) {
+ int thistime;
+ thistime = splice(pipefd[0], NULL, tofd, &offset,
+ to_write, 0);
+ if (thistime == -1) {
+ goto done;
+ }
+ offset += thistime;
+ to_write -= thistime;
+ }
+
+ total_written += nread;
+ count -= nread;
}
+ done:
if (total_written < count) {
int saved_errno = errno;
if (drain_socket(fromfd, count-total_written) !=
diff --git a/source3/lib/util.c b/source3/lib/util.c
index dd23d54..d00a764 100644
--- a/source3/lib/util.c
+++ b/source3/lib/util.c
@@ -491,57 +491,6 @@ bool add_gid_to_array_unique(TALLOC_CTX *mem_ctx, gid_t gid,
return True;
}
-/****************************************************************************
- Like atoi but gets the value up to the separator character.
-****************************************************************************/
-
-static const char *Atoic(const char *p, int *n, const char *c)
-{
- if (!isdigit((int)*p)) {
- DEBUG(5, ("Atoic: malformed number\n"));
- return NULL;
- }
-
- (*n) = atoi(p);
-
- while ((*p) && isdigit((int)*p))
- p++;
-
- if (strchr_m(c, *p) == NULL) {
- DEBUG(5, ("Atoic: no separator characters (%s) not found\n", c));
- return NULL;
- }
-
- return p;
-}
-
-/*************************************************************************
- Reads a list of numbers.
- *************************************************************************/
-
-const char *get_numlist(const char *p, uint32 **num, int *count)
-{
- int val;
-
- if (num == NULL || count == NULL)
- return NULL;
-
- (*count) = 0;
- (*num ) = NULL;
-
- while ((p = Atoic(p, &val, ":,")) != NULL && (*p) != ':') {
- *num = SMB_REALLOC_ARRAY((*num), uint32, (*count)+1);
- if (!(*num)) {
- return NULL;
- }
- (*num)[(*count)] = val;
- (*count)++;
- p++;
- }
-
- return p;
-}
-
/*******************************************************************
Check if a file exists - call vfs_file_exist for samba files.
********************************************************************/
@@ -2383,23 +2332,10 @@ const char *shlib_ext(void)
/*******************************************************************
Given a filename - get its directory name
- NB: Returned in static storage. Caveats:
- o If caller wishes to preserve, they should copy.
********************************************************************/
-char *parent_dirname(const char *path)
-{
- char *parent;
-
- if (!parent_dirname_talloc(talloc_tos(), path, &parent, NULL)) {
- return NULL;
- }
-
- return parent;
-}
-
-bool parent_dirname_talloc(TALLOC_CTX *mem_ctx, const char *dir,
- char **parent, const char **name)
+bool parent_dirname(TALLOC_CTX *mem_ctx, const char *dir, char **parent,
+ const char **name)
{
char *p;
ptrdiff_t len;
@@ -2418,10 +2354,9 @@ bool parent_dirname_talloc(TALLOC_CTX *mem_ctx, const char *dir,
len = p-dir;
- if (!(*parent = TALLOC_ARRAY(mem_ctx, char, len+1))) {
+ if (!(*parent = (char *)TALLOC_MEMDUP(mem_ctx, dir, len+1))) {
return False;
}
- memcpy(*parent, dir, len);
(*parent)[len] = '\0';
if (name) {
diff --git a/source3/libads/cldap.c b/source3/libads/cldap.c
index 8f9a8ff..d66e35c 100644
--- a/source3/libads/cldap.c
+++ b/source3/libads/cldap.c
@@ -9,12 +9,12 @@
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
-
+
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
-
+
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
@@ -106,17 +106,6 @@ static int send_cldap_netlogon(TALLOC_CTX *mem_ctx, int sock, const char *domain
return 0;
}
-static SIG_ATOMIC_T gotalarm;
-
-/***************************************************************
- Signal function to tell us we timed out.
-****************************************************************/
-
-static void gotalarm_sig(void)
-{
- gotalarm = 1;
-}
-
/*
receive a cldap netlogon reply
*/
@@ -132,11 +121,12 @@ static int recv_cldap_netlogon(TALLOC_CTX *mem_ctx,
DATA_BLOB os2 = data_blob_null;
DATA_BLOB os3 = data_blob_null;
int i1;
- /* half the time of a regular ldap timeout, not less than 3 seconds. */
- unsigned int al_secs = MAX(3,lp_ldap_timeout()/2);
struct netlogon_samlogon_response *r = NULL;
NTSTATUS status;
+ fd_set r_fds;
+ struct timeval timeout;
+
blob = data_blob(NULL, 8192);
if (blob.data == NULL) {
DEBUG(1, ("data_blob failed\n"));
@@ -144,18 +134,29 @@ static int recv_cldap_netlogon(TALLOC_CTX *mem_ctx,
return -1;
}
- /* Setup timeout */
- gotalarm = 0;
- CatchSignal(SIGALRM, SIGNAL_CAST gotalarm_sig);
- alarm(al_secs);
- /* End setup timeout. */
-
- ret = read(sock, blob.data, blob.length);
+ FD_ZERO(&r_fds);
+ FD_SET(sock, &r_fds);
- /* Teardown timeout. */
- CatchSignal(SIGALRM, SIGNAL_CAST SIG_IGN);
- alarm(0);
+ /*
+ * half the time of a regular ldap timeout, not less than 3 seconds.
+ */
+ timeout.tv_sec = MAX(3,lp_ldap_timeout()/2);
+ timeout.tv_usec = 0;
+ ret = sys_select(sock+1, &r_fds, NULL, NULL, &timeout);
+ if (ret == -1) {
+ DEBUG(10, ("select failed: %s\n", strerror(errno)));
+ data_blob_free(&blob);
+ return -1;
+ }
+
+ if (ret == 0) {
+ DEBUG(1,("no reply received to cldap netlogon\n"));
+ data_blob_free(&blob);
+ return -1;
+ }
+
+ ret = read(sock, blob.data, blob.length);
if (ret <= 0) {
DEBUG(1,("no reply received to cldap netlogon\n"));
data_blob_free(&blob);
diff --git a/source3/libsmb/libsmb_xattr.c b/source3/libsmb/libsmb_xattr.c
index 4983018..d71a318 100644
--- a/source3/libsmb/libsmb_xattr.c
+++ b/source3/libsmb/libsmb_xattr.c
@@ -424,7 +424,7 @@ sec_desc_parse(TALLOC_CTX *ctx,
struct cli_state *ipc_cli,
POLICY_HND *pol,
bool numeric,
- char *str)
+ const char *str)
{
const char *p = str;
char *tok;
@@ -1531,8 +1531,7 @@ cacl_set(TALLOC_CTX *ctx,
the_acl = p + 1;
}
- sd = sec_desc_parse(ctx, ipc_cli, pol, numeric,
- CONST_DISCARD(char *, the_acl));
+ sd = sec_desc_parse(ctx, ipc_cli, pol, numeric, the_acl);
if (!sd) {
errno = EINVAL;
diff --git a/source3/modules/onefs_open.c b/source3/modules/onefs_open.c
index d0310d0..a4a317d 100644
--- a/source3/modules/onefs_open.c
+++ b/source3/modules/onefs_open.c
@@ -462,8 +462,7 @@ NTSTATUS onefs_open_file_ntcreate(connection_struct *conn,
return print_fsp_open(req, conn, fname, req->vuid, fsp);
}
- if (!parent_dirname_talloc(talloc_tos(), fname, &parent_dir,
- &newname)) {
+ if (!parent_dirname(talloc_tos(), fname, &parent_dir, &newname)) {
return NT_STATUS_NO_MEMORY;
}
@@ -1339,8 +1338,7 @@ static NTSTATUS onefs_open_directory(connection_struct *conn,
}
/* Get parent dirname */
- if (!parent_dirname_talloc(talloc_tos(), fname, &parent_dir,
- &dirname)) {
+ if (!parent_dirname(talloc_tos(), fname, &parent_dir, &dirname)) {
return NT_STATUS_NO_MEMORY;
}
diff --git a/source3/modules/vfs_acl_tdb.c b/source3/modules/vfs_acl_tdb.c
index 9cb887a..3d140e3 100644
--- a/source3/modules/vfs_acl_tdb.c
+++ b/source3/modules/vfs_acl_tdb.c
@@ -433,10 +433,7 @@ static NTSTATUS inherit_new_acl(vfs_handle_struct *handle,
size_t size;
char *parent_name;
- if (!parent_dirname_talloc(ctx,
- fname,
- &parent_name,
- NULL)) {
+ if (!parent_dirname(ctx, fname, &parent_name, NULL)) {
return NT_STATUS_NO_MEMORY;
}
diff --git a/source3/modules/vfs_acl_xattr.c b/source3/modules/vfs_acl_xattr.c
index 3c8f241..7c78b50 100644
--- a/source3/modules/vfs_acl_xattr.c
+++ b/source3/modules/vfs_acl_xattr.c
@@ -328,10 +328,7 @@ static NTSTATUS inherit_new_acl(vfs_handle_struct *handle,
size_t size;
char *parent_name;
- if (!parent_dirname_talloc(ctx,
- fname,
- &parent_name,
- NULL)) {
+ if (!parent_dirname(ctx, fname, &parent_name, NULL)) {
return NT_STATUS_NO_MEMORY;
}
diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c
index cfd3b1e..61e1deb 100644
--- a/source3/modules/vfs_default.c
+++ b/source3/modules/vfs_default.c
@@ -150,12 +150,17 @@ static int vfswrap_mkdir(vfs_handle_struct *handle, const char *path, mode_t mo
{
int result;
bool has_dacl = False;
+ char *parent = NULL;
START_PROFILE(syscall_mkdir);
- if (lp_inherit_acls(SNUM(handle->conn)) && (has_dacl = directory_has_default_acl(handle->conn, parent_dirname(path))))
+ if (lp_inherit_acls(SNUM(handle->conn))
+ && parent_dirname(talloc_tos(), path, &parent, NULL)
+ && (has_dacl = directory_has_default_acl(handle->conn, parent)))
mode = 0777;
+ TALLOC_FREE(parent);
+
result = mkdir(path, mode);
if (result == 0 && !has_dacl) {
diff --git a/source3/smbd/file_access.c b/source3/smbd/file_access.c
index c535bc7..d44e63a 100644
--- a/source3/smbd/file_access.c
+++ b/source3/smbd/file_access.c
@@ -66,10 +66,7 @@ bool can_delete_file_in_directory(connection_struct *conn, const char *fname)
}
/* Get the parent directory permission mask and owners. */
- if (!parent_dirname_talloc(ctx,
- fname,
- &dname,
- NULL)) {
+ if (!parent_dirname(ctx, fname, &dname, NULL)) {
return False;
}
if(SMB_VFS_STAT(conn, dname, &sbuf) != 0) {
diff --git a/source3/smbd/nttrans.c b/source3/smbd/nttrans.c
index 24a14a8..9bfc566 100644
--- a/source3/smbd/nttrans.c
+++ b/source3/smbd/nttrans.c
@@ -1127,6 +1127,7 @@ static NTSTATUS copy_internals(TALLOC_CTX *ctx,
int info;
SMB_OFF_T ret=-1;
NTSTATUS status = NT_STATUS_OK;
+ char *parent;
ZERO_STRUCT(sbuf1);
ZERO_STRUCT(sbuf2);
@@ -1255,8 +1256,11 @@ static NTSTATUS copy_internals(TALLOC_CTX *ctx,
/* Grrr. We have to do this as open_file_ntcreate adds aARCH when it
creates the file. This isn't the correct thing to do in the copy
case. JRA */
- file_set_dosmode(conn, newname, fattr, &sbuf2,
- parent_dirname(newname),false);
+ if (!parent_dirname(talloc_tos(), newname, &parent, NULL)) {
+ return NT_STATUS_NO_MEMORY;
+ }
+ file_set_dosmode(conn, newname, fattr, &sbuf2, parent, false);
+ TALLOC_FREE(parent);
if (ret < (SMB_OFF_T)sbuf1.st_size) {
return NT_STATUS_DISK_FULL;
diff --git a/source3/smbd/open.c b/source3/smbd/open.c
index 8fe20f9..05b131e 100644
--- a/source3/smbd/open.c
+++ b/source3/smbd/open.c
@@ -23,6 +23,7 @@
extern const struct generic_mapping file_generic_mapping;
extern bool global_client_failed_oplock_break;
+extern uint32 global_client_caps;
struct deferred_open_record {
bool delayed_for_oplocks;
@@ -796,7 +797,6 @@ static bool delay_for_oplocks(struct share_mode_lock *lck,
int pass_number,
int oplock_request)
{
- extern uint32 global_client_caps;
int i;
struct share_mode_entry *exclusive = NULL;
bool valid_entry = false;
@@ -1363,8 +1363,7 @@ static NTSTATUS open_file_ntcreate(connection_struct *conn,
return print_fsp_open(req, conn, fname, req->vuid, fsp, psbuf);
}
- if (!parent_dirname_talloc(talloc_tos(), fname, &parent_dir,
- &newname)) {
+ if (!parent_dirname(talloc_tos(), fname, &parent_dir, &newname)) {
return NT_STATUS_NO_MEMORY;
}
@@ -2190,8 +2189,7 @@ static NTSTATUS mkdir_internal(connection_struct *conn,
return status;
}
- if (!parent_dirname_talloc(talloc_tos(), name, &parent_dir,
- &dirname)) {
+ if (!parent_dirname(talloc_tos(), name, &parent_dir, &dirname)) {
return NT_STATUS_NO_MEMORY;
}
diff --git a/source3/smbd/posix_acls.c b/source3/smbd/posix_acls.c
index b184279..8fe7a9a 100644
--- a/source3/smbd/posix_acls.c
+++ b/source3/smbd/posix_acls.c
@@ -3241,10 +3241,7 @@ NTSTATUS append_parent_acl(files_struct *fsp,
return NT_STATUS_NO_MEMORY;
}
- if (!parent_dirname_talloc(mem_ctx,
- fsp->fsp_name,
- &parent_name,
- NULL)) {
+ if (!parent_dirname(mem_ctx, fsp->fsp_name, &parent_name, NULL)) {
return NT_STATUS_NO_MEMORY;
}
diff --git a/source3/smbd/process.c b/source3/smbd/process.c
index e4d15d8..8466e84 100644
--- a/source3/smbd/process.c
--
Samba Shared Repository
More information about the samba-cvs
mailing list