[SCM] Samba Shared Repository - branch master updated
Jeremy Allison
jra at samba.org
Thu Apr 21 19:17:02 MDT 2011
The branch, master has been updated
via e919e76 Cosmetic. Fix bad indentation.
via 644046f Fix compiler warning in debug message.
via 20baa11 Remove duplicate code - move to parent_dirname() as a common function.
from 5290927 s3-vfs: another attempt to fix the Tru64 build.
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit e919e767fb846fc91160cf44cbc838a9b4f2a832
Author: Jeremy Allison <jra at samba.org>
Date: Thu Apr 21 17:25:13 2011 -0700
Cosmetic. Fix bad indentation.
Autobuild-User: Jeremy Allison <jra at samba.org>
Autobuild-Date: Fri Apr 22 03:16:43 CEST 2011 on sn-devel-104
commit 644046f064d73ff97f95a7dfbc5fca199f0dd973
Author: Jeremy Allison <jra at samba.org>
Date: Thu Apr 21 17:22:44 2011 -0700
Fix compiler warning in debug message.
commit 20baa11f33c5282c609258e21a07c7255df7ae30
Author: Jeremy Allison <jra at samba.org>
Date: Thu Apr 21 16:50:49 2011 -0700
Remove duplicate code - move to parent_dirname() as a common function.
-----------------------------------------------------------------------
Summary of changes:
source3/printing/print_cups.c | 4 +-
source3/smbd/vfs.c | 75 +++++++++++++++++-----------------------
2 files changed, 34 insertions(+), 45 deletions(-)
Changeset truncated at 500 lines:
diff --git a/source3/printing/print_cups.c b/source3/printing/print_cups.c
index e3b08b7..da42cb6 100644
--- a/source3/printing/print_cups.c
+++ b/source3/printing/print_cups.c
@@ -127,7 +127,7 @@ static bool send_pcap_blob(DATA_BLOB *pcap_blob, int fd)
return false;
}
- DEBUG(10, ("successfully sent blob of len %ld\n", (int64_t)ret));
+ DEBUG(10, ("successfully sent blob of len %d\n", (int)ret));
return true;
}
@@ -152,7 +152,7 @@ static bool recv_pcap_blob(TALLOC_CTX *mem_ctx, int fd, DATA_BLOB *pcap_blob)
return false;
}
- DEBUG(10, ("successfully recvd blob of len %ld\n", (int64_t)ret));
+ DEBUG(10, ("successfully recvd blob of len %d\n", (int)ret));
return true;
}
diff --git a/source3/smbd/vfs.c b/source3/smbd/vfs.c
index 414e00c..3b482e7 100644
--- a/source3/smbd/vfs.c
+++ b/source3/smbd/vfs.c
@@ -899,7 +899,6 @@ char *vfs_GetWd(TALLOC_CTX *ctx, connection_struct *conn)
NTSTATUS check_reduced_name(connection_struct *conn, const char *fname)
{
char *resolved_name = NULL;
- char *p = NULL;
DEBUG(3,("check_reduced_name [%s] [%s]\n", fname, conn->connectpath));
@@ -915,28 +914,20 @@ NTSTATUS check_reduced_name(connection_struct *conn, const char *fname)
case ENOENT:
{
TALLOC_CTX *ctx = talloc_tos();
- char *tmp_fname = NULL;
- char *last_component = NULL;
- /* Last component didn't exist. Remove it and try and canonicalise the directory. */
-
- tmp_fname = talloc_strdup(ctx, fname);
- if (!tmp_fname) {
+ char *dir_name = NULL;
+ const char *last_component = NULL;
+ char *new_name = NULL;
+
+ /* Last component didn't exist.
+ Remove it and try and canonicalise
+ the directory name. */
+ if (!parent_dirname(ctx, fname,
+ &dir_name,
+ &last_component)) {
return NT_STATUS_NO_MEMORY;
}
- p = strrchr_m(tmp_fname, '/');
- if (p) {
- *p++ = '\0';
- last_component = p;
- } else {
- last_component = tmp_fname;
- tmp_fname = talloc_strdup(ctx,
- ".");
- if (!tmp_fname) {
- return NT_STATUS_NO_MEMORY;
- }
- }
- resolved_name = SMB_VFS_REALPATH(conn,tmp_fname);
+ resolved_name = SMB_VFS_REALPATH(conn,dir_name);
if (!resolved_name) {
NTSTATUS status = map_nt_error_from_unix(errno);
@@ -951,18 +942,16 @@ NTSTATUS check_reduced_name(connection_struct *conn, const char *fname)
nt_errstr(status)));
return status;
}
- tmp_fname = talloc_asprintf(ctx,
+ new_name = talloc_asprintf(ctx,
"%s/%s",
resolved_name,
last_component);
- if (!tmp_fname) {
+ if (!new_name) {
return NT_STATUS_NO_MEMORY;
}
SAFE_FREE(resolved_name);
- resolved_name = SMB_STRDUP(tmp_fname);
+ resolved_name = SMB_STRDUP(new_name);
if (!resolved_name) {
- DEBUG(0, ("check_reduced_name: malloc "
- "fail for %s\n", tmp_fname));
return NT_STATUS_NO_MEMORY;
}
break;
@@ -986,26 +975,26 @@ NTSTATUS check_reduced_name(connection_struct *conn, const char *fname)
/* Check for widelinks allowed. */
if (!lp_widelinks(SNUM(conn))) {
- const char *conn_rootdir;
-
- conn_rootdir = SMB_VFS_CONNECTPATH(conn, fname);
- if (conn_rootdir == NULL) {
- DEBUG(2, ("check_reduced_name: Could not get "
- "conn_rootdir\n"));
- SAFE_FREE(resolved_name);
- return NT_STATUS_ACCESS_DENIED;
- }
+ const char *conn_rootdir;
+
+ conn_rootdir = SMB_VFS_CONNECTPATH(conn, fname);
+ if (conn_rootdir == NULL) {
+ DEBUG(2, ("check_reduced_name: Could not get "
+ "conn_rootdir\n"));
+ SAFE_FREE(resolved_name);
+ return NT_STATUS_ACCESS_DENIED;
+ }
- if (strncmp(conn_rootdir, resolved_name,
+ if (strncmp(conn_rootdir, resolved_name,
strlen(conn_rootdir)) != 0) {
- DEBUG(2, ("check_reduced_name: Bad access "
- "attempt: %s is a symlink outside the "
- "share path\n", fname));
- DEBUGADD(2, ("conn_rootdir =%s\n", conn_rootdir));
- DEBUGADD(2, ("resolved_name=%s\n", resolved_name));
- SAFE_FREE(resolved_name);
- return NT_STATUS_ACCESS_DENIED;
- }
+ DEBUG(2, ("check_reduced_name: Bad access "
+ "attempt: %s is a symlink outside the "
+ "share path\n", fname));
+ DEBUGADD(2, ("conn_rootdir =%s\n", conn_rootdir));
+ DEBUGADD(2, ("resolved_name=%s\n", resolved_name));
+ SAFE_FREE(resolved_name);
+ return NT_STATUS_ACCESS_DENIED;
+ }
}
/* Check if we are allowing users to follow symlinks */
--
Samba Shared Repository
More information about the samba-cvs
mailing list