summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2008-02-18 11:59:02 +0100
committerJelmer Vernooij <jelmer@samba.org>2008-02-18 11:59:02 +0100
commit4e750552b789054f094c3dc42f091cebdc4f715e (patch)
tree6231d9969f39482b5b9e74e7ee519a96cc989653 /source4
parent85ac8dc17ad8cd01bb773383fd30261b9f357292 (diff)
parente8cf95773df914e8d71dcc1ce713fe0cc723d946 (diff)
downloadsamba-4e750552b789054f094c3dc42f091cebdc4f715e.tar.gz
samba-4e750552b789054f094c3dc42f091cebdc4f715e.tar.bz2
samba-4e750552b789054f094c3dc42f091cebdc4f715e.zip
Merge branch 'v4-0-trivial' into v4-0-gmake3
Conflicts: source/build/smb_build/main.pl source/build/smb_build/makefile.pm (This used to be commit d31987461984aebf8c6f2513e83c92757c0f83c7)
Diffstat (limited to 'source4')
-rw-r--r--source4/build/smb_build/input.pm21
-rw-r--r--source4/build/smb_build/main.pl2
-rw-r--r--source4/build/smb_build/makefile.pm19
-rw-r--r--source4/build/smb_build/output.pm12
-rw-r--r--source4/libcli/raw/rawreadwrite.c3
-rw-r--r--source4/libcli/smb2/request.c47
-rw-r--r--source4/rules.mk3
-rw-r--r--source4/smb_server/smb2/fileio.c5
-rw-r--r--source4/smb_server/smb2/find.c5
-rw-r--r--source4/smb_server/smb2/tcon.c5
-rw-r--r--source4/torture/smb2/getinfo.c10
-rw-r--r--source4/torture/smb2/util.c3
12 files changed, 104 insertions, 31 deletions
diff --git a/source4/build/smb_build/input.pm b/source4/build/smb_build/input.pm
index 35fc1962b2..9c7ffc850e 100644
--- a/source4/build/smb_build/input.pm
+++ b/source4/build/smb_build/input.pm
@@ -66,8 +66,6 @@ sub check_subsystem($$$)
unless (defined($subsys->{INIT_FUNCTION_TYPE})) { $subsys->{INIT_FUNCTION_TYPE} = "NTSTATUS (*) (void)"; }
unless (defined($subsys->{INIT_FUNCTION_SENTINEL})) { $subsys->{INIT_FUNCTION_SENTINEL} = "NULL"; }
-
- add_libreplace($subsys);
}
sub check_module($$$)
@@ -76,8 +74,6 @@ sub check_module($$$)
die("Module $mod->{NAME} does not have a SUBSYSTEM set") if not defined($mod->{SUBSYSTEM});
- my $use_default = 0;
-
if (not exists($INPUT->{$mod->{SUBSYSTEM}}{INIT_FUNCTIONS})) {
$INPUT->{$mod->{SUBSYSTEM}}{INIT_FUNCTIONS} = [];
}
@@ -113,11 +109,11 @@ sub check_module($$$)
$sane_subsystem =~ s/^lib//;
$mod->{INSTALLDIR} = "MODULESDIR/$sane_subsystem";
push (@{$mod->{PUBLIC_DEPENDENCIES}}, $mod->{SUBSYSTEM});
+ add_libreplace($mod);
}
if (grep(/INTEGRATED/, @{$mod->{OUTPUT_TYPE}})) {
push (@{$INPUT->{$mod->{SUBSYSTEM}}{INIT_FUNCTIONS}}, $mod->{INIT_FUNCTION}) if defined($mod->{INIT_FUNCTION});
}
- add_libreplace($mod);
}
sub check_library($$$)
@@ -126,9 +122,7 @@ sub check_library($$$)
return if ($lib->{ENABLE} ne "YES");
- unless (defined($lib->{OUTPUT_TYPE})) {
- $lib->{OUTPUT_TYPE} = $default_ot;
- }
+ unless (defined($lib->{OUTPUT_TYPE})) { $lib->{OUTPUT_TYPE} = $default_ot; }
if (defined($lib->{VERSION}) and not defined($lib->{SO_VERSION})) {
print "$lib->{NAME}: Please specify SO_VERSION when specifying VERSION\n";
@@ -141,12 +135,8 @@ sub check_library($$$)
}
unless (defined($lib->{INIT_FUNCTION_TYPE})) { $lib->{INIT_FUNCTION_TYPE} = "NTSTATUS (*) (void)"; }
-
unless (defined($lib->{INIT_FUNCTION_SENTINEL})) { $lib->{INIT_FUNCTION_SENTINEL} = "NULL"; }
-
- unless(defined($lib->{INSTALLDIR})) {
- $lib->{INSTALLDIR} = "LIBDIR";
- }
+ unless (defined($lib->{INSTALLDIR})) { $lib->{INSTALLDIR} = "LIBDIR"; }
add_libreplace($lib);
}
@@ -233,6 +223,7 @@ sub calc_unique_deps($$$$$$$$)
if (defined ($dep->{OUTPUT_TYPE}) &&
($withlibs or
(@{$dep->{OUTPUT_TYPE}}[0] eq "INTEGRATED") or
+ (@{$dep->{OUTPUT_TYPE}}[0] eq "MERGED_OBJ") or
(@{$dep->{OUTPUT_TYPE}}[0] eq "STATIC_LIBRARY"))) {
push (@$busy, $dep->{NAME});
calc_unique_deps($dep->{NAME}, $INPUT, $dep->{PUBLIC_DEPENDENCIES}, $udeps, $withlibs, $forward, $pubonly, $busy);
@@ -279,9 +270,7 @@ sub check($$$$$)
}
}
- foreach my $k (keys %$INPUT) {
- my $part = $INPUT->{$k};
-
+ foreach my $part (values %$INPUT) {
$part->{LINK_FLAGS} = [];
if ($part->{TYPE} eq "SUBSYSTEM") {
diff --git a/source4/build/smb_build/main.pl b/source4/build/smb_build/main.pl
index c7a92b7ce1..0717cd9b0b 100644
--- a/source4/build/smb_build/main.pl
+++ b/source4/build/smb_build/main.pl
@@ -19,6 +19,7 @@ my $INPUT = {};
my $mkfile = smb_build::config_mk::run_config_mk($INPUT, $config::config{srcdir}, $config::config{builddir}, "main.mk");
my $subsys_output_type;
+#$subsys_output_type = ["MERGED_OBJ"];
$subsys_output_type = ["STATIC_LIBRARY"];
my $library_output_type;
@@ -53,6 +54,7 @@ foreach my $key (values %$OUTPUT) {
next unless defined $key->{OUTPUT_TYPE};
$mkenv->StaticLibraryPrimitives($key) if grep(/STATIC_LIBRARY/, @{$key->{OUTPUT_TYPE}});
+ $mkenv->MergedObj($key) if grep(/MERGED_OBJ/, @{$key->{OUTPUT_TYPE}});
if (defined($key->{PC_FILE})) {
$mkenv->output("PC_FILES += $key->{BASEDIR}/$key->{PC_FILE}\n");
}
diff --git a/source4/build/smb_build/makefile.pm b/source4/build/smb_build/makefile.pm
index ecbf554fc7..072e3c0c4b 100644
--- a/source4/build/smb_build/makefile.pm
+++ b/source4/build/smb_build/makefile.pm
@@ -222,6 +222,25 @@ __EOD__
$self->output("endif\n");
}
+sub MergedObj($$)
+{
+ my ($self, $ctx) = @_;
+
+ $self->output("$ctx->{NAME}_OUTPUT = $ctx->{OUTPUT}\n");
+ $self->_prepare_list($ctx, "OBJ_LIST");
+ $self->_prepare_list($ctx, "FULL_OBJ_LIST");
+ push(@{$self->{all_objs}}, "\$($ctx->{NAME}_FULL_OBJ_LIST)");
+ $self->output(<< "__EOD__"
+#
+$ctx->{TARGET_MERGED_OBJ}: \$($ctx->{NAME}_FULL_OBJ_LIST)
+ \@echo Partially linking \$@
+ \@mkdir -p bin/mergedobj
+ \$(PARTLINK) -o \$@ \$($ctx->{NAME}_FULL_OBJ_LIST)
+
+__EOD__
+);
+}
+
sub StaticLibraryPrimitives($$)
{
my ($self,$ctx) = @_;
diff --git a/source4/build/smb_build/output.pm b/source4/build/smb_build/output.pm
index 4350370fbf..0ddb9e4efb 100644
--- a/source4/build/smb_build/output.pm
+++ b/source4/build/smb_build/output.pm
@@ -89,6 +89,17 @@ sub generate_shared_library($)
$lib->{OUTPUT_SHARED_LIBRARY} = $lib->{TARGET_SHARED_LIBRARY};
}
+sub generate_merged_obj($)
+{
+ my $lib = shift;
+
+ my $link_name = $lib->{NAME};
+ $link_name =~ s/^LIB//;
+
+ $lib->{MERGED_OBJNAME} = lc($link_name).".o";
+ $lib->{TARGET_MERGED_OBJ} = $lib->{OUTPUT_MERGED_OBJ} = "bin/mergedobj/$lib->{MERGED_OBJNAME}";
+}
+
sub generate_static_library($)
{
my $lib = shift;
@@ -153,6 +164,7 @@ sub create_output($$)
generate_binary($part) if grep(/BINARY/, @{$part->{OUTPUT_TYPE}});
generate_shared_library($part) if grep(/SHARED_LIBRARY/, @{$part->{OUTPUT_TYPE}});
generate_static_library($part) if grep(/STATIC_LIBRARY/, @{$part->{OUTPUT_TYPE}});
+ generate_merged_obj($part) if grep(/MERGED_OBJ/, @{$part->{OUTPUT_TYPE}});
$part->{OUTPUT} = $part->{"OUTPUT_" . @{$part->{OUTPUT_TYPE}}[0]};
$part->{TARGET} = $part->{"TARGET_" . @{$part->{OUTPUT_TYPE}}[0]};
}
diff --git a/source4/libcli/raw/rawreadwrite.c b/source4/libcli/raw/rawreadwrite.c
index 2005e36e04..9e4edaf99c 100644
--- a/source4/libcli/raw/rawreadwrite.c
+++ b/source4/libcli/raw/rawreadwrite.c
@@ -171,6 +171,9 @@ NTSTATUS smb_raw_read_recv(struct smbcli_request *req, union smb_read *parms)
parms->readx.out.nread <=
req->in.buffer + req->in.size) {
req->in.data_size += (SVAL(req->in.vwv, VWV(7)) << 16);
+
+ /* update the bufinfo with the new size */
+ smb_setup_bufinfo(req);
}
}
diff --git a/source4/libcli/smb2/request.c b/source4/libcli/smb2/request.c
index 7a0311f886..2471fcaa4d 100644
--- a/source4/libcli/smb2/request.c
+++ b/source4/libcli/smb2/request.c
@@ -206,6 +206,10 @@ bool smb2_request_is_ok(struct smb2_request *req)
*/
bool smb2_oob(struct smb2_request_buffer *buf, const uint8_t *ptr, size_t size)
{
+ if (size == 0) {
+ /* zero bytes is never out of range */
+ return false;
+ }
/* be careful with wraparound! */
if (ptr < buf->body ||
ptr >= buf->body + buf->body_size ||
@@ -270,7 +274,7 @@ NTSTATUS smb2_pull_o16s16_blob(struct smb2_request_buffer *buf, TALLOC_CTX *mem_
}
ofs = SVAL(ptr, 0);
size = SVAL(ptr, 2);
- if (ofs == 0 || size == 0) {
+ if (ofs == 0) {
*blob = data_blob(NULL, 0);
return NT_STATUS_OK;
}
@@ -310,7 +314,10 @@ NTSTATUS smb2_push_o16s16_blob(struct smb2_request_buffer *buf,
return NT_STATUS_BUFFER_TOO_SMALL;
}
- if (blob.length == 0) {
+ if (blob.data == NULL) {
+ if (blob.length != 0) {
+ return NT_STATUS_INTERNAL_ERROR;
+ }
SSVAL(ptr, 0, 0);
SSVAL(ptr, 2, 0);
return NT_STATUS_OK;
@@ -363,7 +370,10 @@ NTSTATUS smb2_push_o16s32_blob(struct smb2_request_buffer *buf,
return NT_STATUS_BUFFER_TOO_SMALL;
}
- if (blob.length == 0) {
+ if (blob.data == NULL) {
+ if (blob.length != 0) {
+ return NT_STATUS_INTERNAL_ERROR;
+ }
SSVAL(ptr, 0, 0);
SIVAL(ptr, 2, 0);
return NT_STATUS_OK;
@@ -416,7 +426,10 @@ NTSTATUS smb2_push_o32s32_blob(struct smb2_request_buffer *buf,
return NT_STATUS_BUFFER_TOO_SMALL;
}
- if (blob.length == 0) {
+ if (blob.data == NULL) {
+ if (blob.length != 0) {
+ return NT_STATUS_INTERNAL_ERROR;
+ }
SIVAL(ptr, 0, 0);
SIVAL(ptr, 4, 0);
return NT_STATUS_OK;
@@ -469,7 +482,10 @@ NTSTATUS smb2_push_s32o32_blob(struct smb2_request_buffer *buf,
return NT_STATUS_BUFFER_TOO_SMALL;
}
- if (blob.length == 0) {
+ if (blob.data == NULL) {
+ if (blob.length != 0) {
+ return NT_STATUS_INTERNAL_ERROR;
+ }
SIVAL(ptr, 0, 0);
SIVAL(ptr, 4, 0);
return NT_STATUS_OK;
@@ -512,7 +528,7 @@ NTSTATUS smb2_pull_o16s32_blob(struct smb2_request_buffer *buf, TALLOC_CTX *mem_
}
ofs = SVAL(ptr, 0);
size = IVAL(ptr, 2);
- if (ofs == 0 || size == 0) {
+ if (ofs == 0) {
*blob = data_blob(NULL, 0);
return NT_STATUS_OK;
}
@@ -536,7 +552,7 @@ NTSTATUS smb2_pull_o32s32_blob(struct smb2_request_buffer *buf, TALLOC_CTX *mem_
}
ofs = IVAL(ptr, 0);
size = IVAL(ptr, 4);
- if (ofs == 0 || size == 0) {
+ if (ofs == 0) {
*blob = data_blob(NULL, 0);
return NT_STATUS_OK;
}
@@ -563,7 +579,7 @@ NTSTATUS smb2_pull_o16As32_blob(struct smb2_request_buffer *buf, TALLOC_CTX *mem
}
ofs = SVAL(ptr, 0);
size = IVAL(ptr, 4);
- if (ofs == 0 || size == 0) {
+ if (ofs == 0) {
*blob = data_blob(NULL, 0);
return NT_STATUS_OK;
}
@@ -587,7 +603,7 @@ NTSTATUS smb2_pull_s32o32_blob(struct smb2_request_buffer *buf, TALLOC_CTX *mem_
}
size = IVAL(ptr, 0);
ofs = IVAL(ptr, 4);
- if (ofs == 0 || size == 0) {
+ if (ofs == 0) {
*blob = data_blob(NULL, 0);
return NT_STATUS_OK;
}
@@ -614,6 +630,11 @@ NTSTATUS smb2_pull_o16s16_string(struct smb2_request_buffer *buf, TALLOC_CTX *me
status = smb2_pull_o16s16_blob(buf, mem_ctx, ptr, &blob);
NT_STATUS_NOT_OK_RETURN(status);
+ if (blob.data == NULL) {
+ *str = NULL;
+ return NT_STATUS_OK;
+ }
+
if (blob.length == 0) {
char *s;
s = talloc_strdup(mem_ctx, "");
@@ -643,10 +664,16 @@ NTSTATUS smb2_push_o16s16_string(struct smb2_request_buffer *buf,
NTSTATUS status;
ssize_t size;
- if (strcmp("", str) == 0) {
+ if (str == NULL) {
return smb2_push_o16s16_blob(buf, ofs, data_blob(NULL, 0));
}
+ if (*str == 0) {
+ blob.data = str;
+ blob.length = 0;
+ return smb2_push_o16s16_blob(buf, ofs, blob);
+ }
+
size = convert_string_talloc(buf->buffer, lp_iconv_convenience(global_loadparm), CH_UNIX, CH_UTF16,
str, strlen(str), (void **)&blob.data);
if (size == -1) {
diff --git a/source4/rules.mk b/source4/rules.mk
index 857e946d34..506d4c0431 100644
--- a/source4/rules.mk
+++ b/source4/rules.mk
@@ -37,6 +37,9 @@ PCHCOMPILE = @$(CC) -Ilib/replace \
$(CFLAGS) `$(PERL) $(srcdir)/script/cflags.pl $@` \
$(PICFLAG) $(CPPFLAGS) -c $(FIRST_PREREQ) -o $@
+# Partial linking
+PARTLINK = @$(PROG_LD) -r
+
include/config.h:
@echo "include/config.h not present"
@echo "You need to rerun ./autogen.sh and ./configure"
diff --git a/source4/smb_server/smb2/fileio.c b/source4/smb_server/smb2/fileio.c
index 567243ba94..0e3df56b42 100644
--- a/source4/smb_server/smb2/fileio.c
+++ b/source4/smb_server/smb2/fileio.c
@@ -80,6 +80,11 @@ void smb2srv_create_recv(struct smb2srv_request *req)
/* TODO: parse the blob */
ZERO_STRUCT(io->smb2.in.eas);
+ /* the VFS backend does not yet handle NULL filenames */
+ if (io->smb2.in.fname == NULL) {
+ io->smb2.in.fname = "";
+ }
+
SMB2SRV_CALL_NTVFS_BACKEND(ntvfs_open(req->ntvfs, io));
}
diff --git a/source4/smb_server/smb2/find.c b/source4/smb_server/smb2/find.c
index c594adf7a0..6018f1958f 100644
--- a/source4/smb_server/smb2/find.c
+++ b/source4/smb_server/smb2/find.c
@@ -161,6 +161,11 @@ void smb2srv_find_recv(struct smb2srv_request *req)
SMB2SRV_CHECK(smb2_pull_o16s16_string(&req->in, info, req->in.body+0x18, &info->in.pattern));
info->in.max_response_size = IVAL(req->in.body, 0x1C);
+ /* the VFS backend does not yet handle NULL patterns */
+ if (info->in.pattern == NULL) {
+ info->in.pattern = "";
+ }
+
SMB2SRV_CHECK_FILE_HANDLE(info->in.file.ntvfs);
SMB2SRV_CALL_NTVFS_BACKEND(smb2srv_find_backend(state));
}
diff --git a/source4/smb_server/smb2/tcon.c b/source4/smb_server/smb2/tcon.c
index 50094b806d..7f7d558b16 100644
--- a/source4/smb_server/smb2/tcon.c
+++ b/source4/smb_server/smb2/tcon.c
@@ -394,6 +394,11 @@ void smb2srv_tcon_recv(struct smb2srv_request *req)
io->smb2.in.reserved = SVAL(req->in.body, 0x02);
SMB2SRV_CHECK(smb2_pull_o16s16_string(&req->in, io, req->in.body+0x04, &io->smb2.in.path));
+ /* the VFS backend does not yet handle NULL paths */
+ if (io->smb2.in.path == NULL) {
+ io->smb2.in.path = "";
+ }
+
req->status = smb2srv_tcon_backend(req, io);
if (req->control_flags & SMB2SRV_REQ_CTRL_FLAG_NOT_REPLY) {
diff --git a/source4/torture/smb2/getinfo.c b/source4/torture/smb2/getinfo.c
index f561b62d47..c47a26277c 100644
--- a/source4/torture/smb2/getinfo.c
+++ b/source4/torture/smb2/getinfo.c
@@ -51,7 +51,9 @@ static struct {
{ LEVEL(RAW_FILEINFO_COMPRESSION_INFORMATION) },
{ LEVEL(RAW_FILEINFO_NETWORK_OPEN_INFORMATION) },
{ LEVEL(RAW_FILEINFO_ATTRIBUTE_TAG_INFORMATION) },
- { LEVEL(RAW_FILEINFO_SMB2_ALL_EAS) },
+/*
+disabled until we know how the alignment now works
+{ LEVEL(RAW_FILEINFO_SMB2_ALL_EAS) }, */
{ LEVEL(RAW_FILEINFO_SMB2_ALL_INFORMATION) },
{ LEVEL(RAW_FILEINFO_SEC_DESC) }
};
@@ -85,13 +87,13 @@ static bool torture_smb2_fileinfo(struct torture_context *tctx, struct smb2_tree
status = torture_smb2_testfile(tree, FNAME, &hfile);
if (!NT_STATUS_IS_OK(status)) {
- printf("Unable to create test file '%s' - %s\n", FNAME, nt_errstr(status));
+ printf(__location__ " Unable to create test file '%s' - %s\n", FNAME, nt_errstr(status));
goto failed;
}
status = torture_smb2_testdir(tree, DNAME, &hdir);
if (!NT_STATUS_IS_OK(status)) {
- printf("Unable to create test directory '%s' - %s\n", DNAME, nt_errstr(status));
+ printf(__location__ " Unable to create test directory '%s' - %s\n", DNAME, nt_errstr(status));
goto failed;
}
@@ -150,7 +152,7 @@ static bool torture_smb2_fsinfo(struct smb2_tree *tree)
printf("Testing fsinfo levels\n");
status = smb2_util_roothandle(tree, &handle);
if (!NT_STATUS_IS_OK(status)) {
- printf("Unable to create test directory '%s' - %s\n", DNAME, nt_errstr(status));
+ printf(__location__ " Unable to create root handle - %s\n", nt_errstr(status));
return false;
}
diff --git a/source4/torture/smb2/util.c b/source4/torture/smb2/util.c
index 219c2140d3..f85b1c42ff 100644
--- a/source4/torture/smb2/util.c
+++ b/source4/torture/smb2/util.c
@@ -123,6 +123,7 @@ static NTSTATUS smb2_create_complex(struct smb2_tree *tree, const char *fname,
io.in.create_disposition = NTCREATEX_DISP_CREATE;
}
+ /* it seems vista is now fussier about alignment? */
if (strchr(fname, ':') == NULL) {
/* setup some EAs */
io.in.eas.num_eas = 2;
@@ -428,7 +429,7 @@ NTSTATUS smb2_util_roothandle(struct smb2_tree *tree, struct smb2_handle *handle
io.in.create_disposition = NTCREATEX_DISP_OPEN;
io.in.share_access = NTCREATEX_SHARE_ACCESS_READ|NTCREATEX_SHARE_ACCESS_DELETE;
io.in.create_options = NTCREATEX_OPTIONS_ASYNC_ALERT;
- io.in.fname = "";
+ io.in.fname = NULL;
status = smb2_create(tree, tree, &io);
NT_STATUS_NOT_OK_RETURN(status);