[SCM] Samba Shared Repository - branch v3-3-test updated -
release-3-2-0pre2-3610-g15fc242
Michael Adam
obnox at samba.org
Tue Aug 12 20:04:31 GMT 2008
The branch, v3-3-test has been updated
via 15fc2427f91da697e0e91f7f34b0f0c6e230a9a5 (commit)
via ec5956ab0df1b3f567470b2481b73da9c3c67371 (commit)
via 834684a524a24bb4eb46b4af583d39947dc87d95 (commit)
via 469ba9b87103aa0053c371e481acc5acf0f98ac1 (commit)
from f760dd3f3128c846cdeab16cc52bbb5189427955 (commit)
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-3-test
- Log -----------------------------------------------------------------
commit 15fc2427f91da697e0e91f7f34b0f0c6e230a9a5
Author: Michael Adam <obnox at samba.org>
Date: Tue Aug 12 15:19:17 2008 +0200
Make sure to always set errno on error path in OpenDir (and hence scan_directory).
Michael
commit ec5956ab0df1b3f567470b2481b73da9c3c67371
Author: Michael Adam <obnox at samba.org>
Date: Tue Aug 12 14:59:59 2008 +0200
Fix unix_convert() for "*" after changing map_nt_error_from_unix().
map_nt_error_from_unix() now assumes that it is called in
an error path and returns an error even for a given errno == 0.
The original behaviour of unix_convert() used the mapping
of errno == 0 ==> NT_STATUS_OK to return success through
an error path.
I think this must have been an oversight, and unix_convert() worked
only by coincidence (or because explicitly using the knowledge
of the conceptually wrong working of map_nt_error_from_unix().
This patch puts this straight by not interpreting errno == 0
as an error condition and proceeding in that case.
Jeremy - please check!
Michael
commit 834684a524a24bb4eb46b4af583d39947dc87d95
Author: Andrew Tridgell <tridge at samba.org>
Date: Sun Aug 10 10:43:36 2008 +1000
I found lots of places where we assume error will be set when calling
one of our virtualised functions, such as db_open(), but error is only
set when a system call fails, and it is not uncommon for us to fail a
function internally without ever making a system call. That led to us
passing back success when a function had in fact failed.
I found two places where we relied on map_nt_error_from_unix()
returning success when errno==0, but lots and lots of places where we
relied on the reverse, so I fixed those two places.
map_nt_error_from_unix() will now always return an error, returning
NT_STATUS_UNSUCCESSFUL if errno is 0
(cherry picked from commit 69d40ca4c1af925d4b0e59ddc69ef8c26e6501d1)
commit 469ba9b87103aa0053c371e481acc5acf0f98ac1
Author: Andrew Tridgell <tridge at samba.org>
Date: Mon Aug 11 17:21:11 2008 +1000
ensure we give an error code to any routines above that are looking
for one
-----------------------------------------------------------------------
Summary of changes:
source/lib/dbwrap.c | 3 +++
source/lib/errmap_unix.c | 12 ++++++++++--
source/smbd/dir.c | 1 +
source/smbd/filename.c | 2 +-
source/smbd/reply.c | 4 ++--
5 files changed, 17 insertions(+), 5 deletions(-)
Changeset truncated at 500 lines:
diff --git a/source/lib/dbwrap.c b/source/lib/dbwrap.c
index eec15a8..ff200c3 100644
--- a/source/lib/dbwrap.c
+++ b/source/lib/dbwrap.c
@@ -83,6 +83,9 @@ struct db_context *db_open(TALLOC_CTX *mem_ctx,
if (result == NULL) {
DEBUG(0,("failed to attach to ctdb %s\n",
partname));
+ if (errno == 0) {
+ errno = EIO;
+ }
return NULL;
}
}
diff --git a/source/lib/errmap_unix.c b/source/lib/errmap_unix.c
index 8194cf8..2cd2386 100644
--- a/source/lib/errmap_unix.c
+++ b/source/lib/errmap_unix.c
@@ -107,8 +107,16 @@ NTSTATUS map_nt_error_from_unix(int unix_error)
{
int i = 0;
- if (unix_error == 0)
- return NT_STATUS_OK;
+ if (unix_error == 0) {
+ /* we map this to an error, not success, as this
+ function is only called in an error path. Lots of
+ our virtualised functions may fail without making a
+ unix system call that fails (such as when they are
+ checking for some handle existing), so unix_error
+ may be unset
+ */
+ return NT_STATUS_UNSUCCESSFUL;
+ }
/* Look through list */
while(unix_dos_nt_errmap[i].unix_error != 0) {
diff --git a/source/smbd/dir.c b/source/smbd/dir.c
index 74cd63d..c2735c0 100644
--- a/source/smbd/dir.c
+++ b/source/smbd/dir.c
@@ -1084,6 +1084,7 @@ struct smb_Dir *OpenDir(TALLOC_CTX *mem_ctx, connection_struct *conn,
dirp->dir_path = talloc_strdup(dirp, name);
if (!dirp->dir_path) {
+ errno = ENOMEM;
goto fail;
}
diff --git a/source/smbd/filename.c b/source/smbd/filename.c
index 4323e84..41a0b92 100644
--- a/source/smbd/filename.c
+++ b/source/smbd/filename.c
@@ -477,7 +477,7 @@ NTSTATUS unix_convert(TALLOC_CTX *ctx,
}
/* ENOENT is the only valid error here. */
- if (errno != ENOENT) {
+ if ((errno != 0) && (errno != ENOENT)) {
/*
* ENOTDIR and ELOOP both map to
* NT_STATUS_OBJECT_PATH_NOT_FOUND
diff --git a/source/smbd/reply.c b/source/smbd/reply.c
index 80afd58..d32d998 100644
--- a/source/smbd/reply.c
+++ b/source/smbd/reply.c
@@ -2527,7 +2527,7 @@ NTSTATUS unlink_internals(connection_struct *conn, struct smb_request *req,
TALLOC_FREE(dir_hnd);
}
- if (count == 0 && NT_STATUS_IS_OK(status)) {
+ if (count == 0 && NT_STATUS_IS_OK(status) && errno != 0) {
status = map_nt_error_from_unix(errno);
}
@@ -5910,7 +5910,7 @@ NTSTATUS rename_internals(TALLOC_CTX *ctx,
}
TALLOC_FREE(dir_hnd);
- if (count == 0 && NT_STATUS_IS_OK(status)) {
+ if (count == 0 && NT_STATUS_IS_OK(status) && errno != 0) {
status = map_nt_error_from_unix(errno);
}
--
Samba Shared Repository
More information about the samba-cvs
mailing list