diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2008-10-20 11:07:38 +0200 |
---|---|---|
committer | Jelmer Vernooij <jelmer@samba.org> | 2008-10-20 11:07:38 +0200 |
commit | 70eba79edb3cba9432508ff3c439200e980f9468 (patch) | |
tree | 7c1bee4412410a52799d243cc71e5ae456a31cc1 | |
parent | 86576f0f1627bf799e422d16baac5a7057de0316 (diff) | |
parent | 221ea78e2e1688f2e79703784b3d1d1a68057604 (diff) | |
download | samba-70eba79edb3cba9432508ff3c439200e980f9468.tar.gz samba-70eba79edb3cba9432508ff3c439200e980f9468.tar.bz2 samba-70eba79edb3cba9432508ff3c439200e980f9468.zip |
Merge branch 'master' of ssh://git.samba.org/data/git/samba into selftest
-rw-r--r-- | lib/replace/crypt.c (renamed from source3/lib/ufc.c) | 2 | ||||
-rw-r--r-- | lib/replace/crypt.m4 | 7 | ||||
-rw-r--r-- | lib/replace/libreplace.m4 | 1 | ||||
-rw-r--r-- | lib/replace/replace.h | 9 | ||||
-rw-r--r-- | lib/replace/samba.m4 | 2 | ||||
-rw-r--r-- | lib/zlib/infback.c | 26 | ||||
-rw-r--r-- | lib/zlib/inffast.c | 10 | ||||
-rw-r--r-- | lib/zlib/inflate.c | 44 | ||||
-rw-r--r-- | lib/zlib/inflate.h | 4 | ||||
-rw-r--r-- | librpc/ndr/ndr_compression.c | 8 | ||||
-rw-r--r-- | selftest/output/plain.pm | 2 | ||||
-rwxr-xr-x | selftest/selftest.pl | 44 | ||||
-rw-r--r-- | source3/Makefile.in | 4 | ||||
-rw-r--r-- | source3/configure.in | 8 | ||||
-rw-r--r-- | source3/include/proto.h | 4 | ||||
-rw-r--r-- | source3/printing/tests/README.vlp (renamed from testsuite/printing/README.vlp) | 20 | ||||
-rw-r--r-- | source3/printing/tests/vlp.c (renamed from testsuite/printing/vlp.c) | 0 | ||||
-rw-r--r-- | source3/smbd/process.c | 53 | ||||
-rw-r--r-- | source3/smbd/reply.c | 182 | ||||
-rw-r--r-- | source4/scripting/python/samba/provision.py | 19 | ||||
-rwxr-xr-x | source4/selftest/tests.sh | 29 | ||||
-rw-r--r-- | source4/setup/provision.zone | 4 | ||||
-rw-r--r-- | testsuite/printing/Makefile.vlp | 14 |
23 files changed, 263 insertions, 233 deletions
diff --git a/source3/lib/ufc.c b/lib/replace/crypt.c index 89329808c9..22341ce511 100644 --- a/source3/lib/ufc.c +++ b/lib/replace/crypt.c @@ -16,7 +16,7 @@ */ -#include "includes.h" +#include "replace.h" #ifndef HAVE_CRYPT diff --git a/lib/replace/crypt.m4 b/lib/replace/crypt.m4 new file mode 100644 index 0000000000..047766d470 --- /dev/null +++ b/lib/replace/crypt.m4 @@ -0,0 +1,7 @@ +############################################### +# test for where we get crypt() from +AC_CHECK_HEADERS(crypt.h) +AC_SEARCH_LIBS_EXT(crypt, [crypt], + [test "$ac_cv_search_crypt" = "none required" || CRYPT_LIBS="-lcrypt" + AC_DEFINE(HAVE_CRYPT,1,[Whether the system has the crypt() function])], + [ LIBREPLACEOBJ="${LIBREPLACEOBJ} crypt.o" ]) diff --git a/lib/replace/libreplace.m4 b/lib/replace/libreplace.m4 index e563acfd79..05e73fb569 100644 --- a/lib/replace/libreplace.m4 +++ b/lib/replace/libreplace.m4 @@ -276,6 +276,7 @@ m4_include(strptime.m4) m4_include(win32.m4) m4_include(timegm.m4) m4_include(repdir.m4) +m4_include(crypt.m4) AC_CHECK_FUNCS([syslog printf memset memcpy],,[AC_MSG_ERROR([Required function not found])]) diff --git a/lib/replace/replace.h b/lib/replace/replace.h index 4ac77e7270..af1208a8fc 100644 --- a/lib/replace/replace.h +++ b/lib/replace/replace.h @@ -628,4 +628,13 @@ typedef int bool; #define MAX_DNS_NAME_LENGTH 256 /* Actually 255 but +1 for terminating null. */ #endif +#ifndef HAVE_CRYPT +char *ufc_crypt(const char *key, const char *salt); +#define crypt ufc_crypt +#else +#ifdef HAVE_CRYPT_H +#include <crypt.h> +#endif +#endif + #endif /* _LIBREPLACE_REPLACE_H */ diff --git a/lib/replace/samba.m4 b/lib/replace/samba.m4 index 07c4d38887..ccb6f2e20d 100644 --- a/lib/replace/samba.m4 +++ b/lib/replace/samba.m4 @@ -1,7 +1,7 @@ AC_LIBREPLACE_BROKEN_CHECKS AC_LIBREPLACE_NETWORK_CHECKS -SMB_EXT_LIB(LIBREPLACE_EXT, [${LIBDL}]) +SMB_EXT_LIB(LIBREPLACE_EXT, [${LIBDL} ${CRYPT_LIBS}]) SMB_ENABLE(LIBREPLACE_EXT) SMB_EXT_LIB(LIBREPLACE_NETWORK, [${LIBREPLACE_NETWORK_LIBS}]) diff --git a/lib/zlib/infback.c b/lib/zlib/infback.c index 5680937f34..284d523a6d 100644 --- a/lib/zlib/infback.c +++ b/lib/zlib/infback.c @@ -309,7 +309,7 @@ void FAR *out_desc; break; case 3: strm->msg = "invalid block type"; - state->mode = BAD; + state->mode = BAD_DATA; } DROPBITS(2); break; @@ -320,7 +320,7 @@ void FAR *out_desc; NEEDBITS(32); if ((hold & 0xffff) != ((hold >> 16) ^ 0xffff)) { strm->msg = "invalid stored block lengths"; - state->mode = BAD; + state->mode = BAD_DATA; break; } state->length = (unsigned)hold & 0xffff; @@ -358,7 +358,7 @@ void FAR *out_desc; #ifndef PKZIP_BUG_WORKAROUND if (state->nlen > 286 || state->ndist > 30) { strm->msg = "too many length or distance symbols"; - state->mode = BAD; + state->mode = BAD_DATA; break; } #endif @@ -380,7 +380,7 @@ void FAR *out_desc; &(state->lenbits), state->work); if (ret) { strm->msg = "invalid code lengths set"; - state->mode = BAD; + state->mode = BAD_DATA; break; } Tracev((stderr, "inflate: code lengths ok\n")); @@ -404,7 +404,7 @@ void FAR *out_desc; DROPBITS(this.bits); if (state->have == 0) { strm->msg = "invalid bit length repeat"; - state->mode = BAD; + state->mode = BAD_DATA; break; } len = (unsigned)(state->lens[state->have - 1]); @@ -427,7 +427,7 @@ void FAR *out_desc; } if (state->have + copy > state->nlen + state->ndist) { strm->msg = "invalid bit length repeat"; - state->mode = BAD; + state->mode = BAD_DATA; break; } while (copy--) @@ -436,7 +436,7 @@ void FAR *out_desc; } /* handle error breaks in while */ - if (state->mode == BAD) break; + if (state->mode == BAD_DATA) break; /* build code tables */ state->next = state->codes; @@ -446,7 +446,7 @@ void FAR *out_desc; &(state->lenbits), state->work); if (ret) { strm->msg = "invalid literal/lengths set"; - state->mode = BAD; + state->mode = BAD_DATA; break; } state->distcode = (code const FAR *)(state->next); @@ -455,7 +455,7 @@ void FAR *out_desc; &(state->next), &(state->distbits), state->work); if (ret) { strm->msg = "invalid distances set"; - state->mode = BAD; + state->mode = BAD_DATA; break; } Tracev((stderr, "inflate: codes ok\n")); @@ -513,7 +513,7 @@ void FAR *out_desc; /* invalid code */ if (this.op & 64) { strm->msg = "invalid literal/length code"; - state->mode = BAD; + state->mode = BAD_DATA; break; } @@ -545,7 +545,7 @@ void FAR *out_desc; DROPBITS(this.bits); if (this.op & 64) { strm->msg = "invalid distance code"; - state->mode = BAD; + state->mode = BAD_DATA; break; } state->offset = (unsigned)this.val; @@ -560,7 +560,7 @@ void FAR *out_desc; if (state->offset > state->wsize - (state->whave < state->wsize ? left : 0)) { strm->msg = "invalid distance too far back"; - state->mode = BAD; + state->mode = BAD_DATA; break; } Tracevv((stderr, "inflate: distance %u\n", state->offset)); @@ -595,7 +595,7 @@ void FAR *out_desc; } goto inf_leave; - case BAD: + case BAD_DATA: ret = Z_DATA_ERROR; goto inf_leave; diff --git a/lib/zlib/inffast.c b/lib/zlib/inffast.c index bfc727694a..687dfa054b 100644 --- a/lib/zlib/inffast.c +++ b/lib/zlib/inffast.c @@ -49,7 +49,7 @@ LEN -- ran out of enough output space or enough available input TYPE -- reached end of block code, inflate() to interpret next block - BAD -- error in block data + BAD_DATA -- error in block data Notes: @@ -176,7 +176,7 @@ unsigned start; /* inflate()'s starting value for strm->avail_out */ #ifdef INFLATE_STRICT if (dist > dmax) { strm->msg = (char *)"invalid distance too far back"; - state->mode = BAD; + state->mode = BAD_DATA; break; } #endif @@ -188,7 +188,7 @@ unsigned start; /* inflate()'s starting value for strm->avail_out */ op = dist - op; /* distance back in window */ if (op > whave) { strm->msg = "invalid distance too far back"; - state->mode = BAD; + state->mode = BAD_DATA; break; } from = window - OFF; @@ -264,7 +264,7 @@ unsigned start; /* inflate()'s starting value for strm->avail_out */ } else { strm->msg = "invalid distance code"; - state->mode = BAD; + state->mode = BAD_DATA; break; } } @@ -279,7 +279,7 @@ unsigned start; /* inflate()'s starting value for strm->avail_out */ } else { strm->msg = "invalid literal/length code"; - state->mode = BAD; + state->mode = BAD_DATA; break; } } while (in < last && out < end); diff --git a/lib/zlib/inflate.c b/lib/zlib/inflate.c index ccbfac804d..bcaca0d773 100644 --- a/lib/zlib/inflate.c +++ b/lib/zlib/inflate.c @@ -609,19 +609,19 @@ int flush; #endif ((BITS(8) << 8) + (hold >> 8)) % 31) { strm->msg = "incorrect header check"; - state->mode = BAD; + state->mode = BAD_DATA; break; } if (BITS(4) != Z_DEFLATED) { strm->msg = "unknown compression method"; - state->mode = BAD; + state->mode = BAD_DATA; break; } DROPBITS(4); len = BITS(4) + 8; if (len > state->wbits) { strm->msg = "invalid window size"; - state->mode = BAD; + state->mode = BAD_DATA; break; } state->dmax = 1U << len; @@ -636,12 +636,12 @@ int flush; state->flags = (int)(hold); if ((state->flags & 0xff) != Z_DEFLATED) { strm->msg = "unknown compression method"; - state->mode = BAD; + state->mode = BAD_DATA; break; } if (state->flags & 0xe000) { strm->msg = "unknown header flags set"; - state->mode = BAD; + state->mode = BAD_DATA; break; } if (state->head != Z_NULL) @@ -745,7 +745,7 @@ int flush; NEEDBITS(16); if (hold != (state->check & 0xffff)) { strm->msg = "header crc mismatch"; - state->mode = BAD; + state->mode = BAD_DATA; break; } INITBITS(); @@ -800,7 +800,7 @@ int flush; break; case 3: strm->msg = "invalid block type"; - state->mode = BAD; + state->mode = BAD_DATA; } DROPBITS(2); break; @@ -809,7 +809,7 @@ int flush; NEEDBITS(32); if ((hold & 0xffff) != ((hold >> 16) ^ 0xffff)) { strm->msg = "invalid stored block lengths"; - state->mode = BAD; + state->mode = BAD_DATA; break; } state->length = (unsigned)hold & 0xffff; @@ -845,7 +845,7 @@ int flush; #ifndef PKZIP_BUG_WORKAROUND if (state->nlen > 286 || state->ndist > 30) { strm->msg = "too many length or distance symbols"; - state->mode = BAD; + state->mode = BAD_DATA; break; } #endif @@ -867,7 +867,7 @@ int flush; &(state->lenbits), state->work); if (ret) { strm->msg = "invalid code lengths set"; - state->mode = BAD; + state->mode = BAD_DATA; break; } Tracev((stderr, "inflate: code lengths ok\n")); @@ -891,7 +891,7 @@ int flush; DROPBITS(this.bits); if (state->have == 0) { strm->msg = "invalid bit length repeat"; - state->mode = BAD; + state->mode = BAD_DATA; break; } len = state->lens[state->have - 1]; @@ -914,7 +914,7 @@ int flush; } if (state->have + copy > state->nlen + state->ndist) { strm->msg = "invalid bit length repeat"; - state->mode = BAD; + state->mode = BAD_DATA; break; } while (copy--) @@ -923,7 +923,7 @@ int flush; } /* handle error breaks in while */ - if (state->mode == BAD) break; + if (state->mode == BAD_DATA) break; /* build code tables */ state->next = state->codes; @@ -933,7 +933,7 @@ int flush; &(state->lenbits), state->work); if (ret) { strm->msg = "invalid literal/lengths set"; - state->mode = BAD; + state->mode = BAD_DATA; break; } state->distcode = (code const FAR *)(state->next); @@ -942,7 +942,7 @@ int flush; &(state->next), &(state->distbits), state->work); if (ret) { strm->msg = "invalid distances set"; - state->mode = BAD; + state->mode = BAD_DATA; break; } Tracev((stderr, "inflate: codes ok\n")); @@ -985,7 +985,7 @@ int flush; } if (this.op & 64) { strm->msg = "invalid literal/length code"; - state->mode = BAD; + state->mode = BAD_DATA; break; } state->extra = (unsigned)(this.op) & 15; @@ -1017,7 +1017,7 @@ int flush; DROPBITS(this.bits); if (this.op & 64) { strm->msg = "invalid distance code"; - state->mode = BAD; + state->mode = BAD_DATA; break; } state->offset = (unsigned)this.val; @@ -1032,13 +1032,13 @@ int flush; #ifdef INFLATE_STRICT if (state->offset > state->dmax) { strm->msg = "invalid distance too far back"; - state->mode = BAD; + state->mode = BAD_DATA; break; } #endif if (state->offset > state->whave + out - left) { strm->msg = "invalid distance too far back"; - state->mode = BAD; + state->mode = BAD_DATA; break; } Tracevv((stderr, "inflate: distance %u\n", state->offset)); @@ -1090,7 +1090,7 @@ int flush; #endif REVERSE(hold)) != state->check) { strm->msg = "incorrect data check"; - state->mode = BAD; + state->mode = BAD_DATA; break; } INITBITS(); @@ -1103,7 +1103,7 @@ int flush; NEEDBITS(32); if (hold != (state->total & 0xffffffffUL)) { strm->msg = "incorrect length check"; - state->mode = BAD; + state->mode = BAD_DATA; break; } INITBITS(); @@ -1114,7 +1114,7 @@ int flush; case DONE: ret = Z_STREAM_END; goto inf_leave; - case BAD: + case BAD_DATA: ret = Z_DATA_ERROR; goto inf_leave; case MEM: diff --git a/lib/zlib/inflate.h b/lib/zlib/inflate.h index 07bd3e78a7..25b6538bc2 100644 --- a/lib/zlib/inflate.h +++ b/lib/zlib/inflate.h @@ -45,7 +45,7 @@ typedef enum { CHECK, /* i: waiting for 32-bit check value */ LENGTH, /* i: waiting for 32-bit length (gzip) */ DONE, /* finished check, done -- remain here until reset */ - BAD, /* got a data error -- remain here until reset */ + BAD_DATA, /* got a data error -- remain here until reset */ MEM, /* got an inflate() memory error -- remain here until reset */ SYNC /* looking for synchronization bytes to restart inflate() */ } inflate_mode; @@ -53,7 +53,7 @@ typedef enum { /* State transitions between above modes - - (most modes can go to the BAD or MEM mode -- not shown for clarity) + (most modes can go to the BAD_DATA or MEM mode -- not shown for clarity) Process header: HEAD -> (gzip) or (zlib) diff --git a/librpc/ndr/ndr_compression.c b/librpc/ndr/ndr_compression.c index afd397e2a2..c73c3bb6fa 100644 --- a/librpc/ndr/ndr_compression.c +++ b/librpc/ndr/ndr_compression.c @@ -260,7 +260,9 @@ static enum ndr_err_code ndr_push_compression_mszip_chunk(struct ndr_push *ndrpu ndrpush->offset = tmp_offset; DEBUG(9,("MSZIP comp plain_chunk_size: %08X (%u) comp_chunk_size: %08X (%u)\n", - plain_chunk.length, plain_chunk.length, comp_chunk_size, comp_chunk_size)); + (unsigned int)plain_chunk.length, + (unsigned int)plain_chunk.length, + comp_chunk_size, comp_chunk_size)); ndrpush->offset += comp_chunk_size; return NDR_ERR_SUCCESS; @@ -307,7 +309,7 @@ static enum ndr_err_code ndr_pull_compression_xpress_chunk(struct ndr_pull *ndrp if (ret < 0) { return ndr_pull_error(ndrpull, NDR_ERR_COMPRESSION, "XPRESS lzxpress_decompress() returned %d\n", - ret); + (int)ret); } plain_chunk.length = ret; @@ -361,7 +363,7 @@ static enum ndr_err_code ndr_push_compression_xpress_chunk(struct ndr_push *ndrp if (ret < 0) { return ndr_pull_error(ndrpull, NDR_ERR_COMPRESSION, "XPRESS lzxpress_compress() returned %d\n", - ret); + (int)ret); } comp_chunk.length = ret; diff --git a/selftest/output/plain.pm b/selftest/output/plain.pm index 4e1e290534..82a73ab932 100644 --- a/selftest/output/plain.pm +++ b/selftest/output/plain.pm @@ -188,7 +188,7 @@ sub summary($) } close(SUMMARY); - print "\nA summary with detailed informations can be found in:\n $self->{summaryfile}\n"; + print "\nA summary with detailed information can be found in:\n $self->{summaryfile}\n"; if ($#{$self->{suitesfailed}} == -1) { my $ok = $self->{statistics}->{TESTS_EXPECTED_OK} + diff --git a/selftest/selftest.pl b/selftest/selftest.pl index 1477d10d46..60eabe41d6 100755 --- a/selftest/selftest.pl +++ b/selftest/selftest.pl @@ -283,12 +283,12 @@ sub ShowHelp() print "Samba test runner Copyright (C) Jelmer Vernooij <jelmer\@samba.org> -Usage: $Script [OPTIONS] PREFIX +Usage: $Script [OPTIONS] TESTNAME-REGEX Generic options: --help this help page --target=samba[34]|win|kvm Samba version to target - --testlist=FILE file to read available tests from + --testlist=FILE file to read available tests from Paths: --prefix=DIR prefix to run tests in [st] @@ -296,14 +296,14 @@ Paths: --builddir=DIR output directory [.] Target Specific: - --socket-wrapper-pcap save traffic to pcap directories + --socket-wrapper-pcap save traffic to pcap directories --socket-wrapper-keep-pcap keep all pcap files, not just those for tests that failed --socket-wrapper enable socket wrapper --expected-failures=FILE specify list of tests that is guaranteed to fail Samba4 Specific: - --ldap=openldap|fedora-ds back samba onto specified ldap server + --ldap=openldap|fedora-ds back samba onto specified ldap server Samba3 Specific: --bindir=PATH path to binaries @@ -533,6 +533,7 @@ my $interfaces = join(',', ("127.0.0.6/8", "127.0.0.11/8")); my $conffile = "$prefix_abs/client/client.conf"; +$ENV{SMB_CONF_PATH} = $conffile; sub write_clientconf($$) { @@ -588,24 +589,9 @@ sub write_clientconf($$) close(CF); } -my @torture_options = (); -push (@torture_options, "--configfile=$conffile"); -# ensure any one smbtorture call doesn't run too long -push (@torture_options, "--maximum-runtime=$torture_maxtime"); -push (@torture_options, "--target=$opt_target"); -push (@torture_options, "--basedir=$prefix_abs"); -push (@torture_options, "--option=torture:progress=no") unless ($opt_verbose); -push (@torture_options, "--format=subunit"); -push (@torture_options, "--option=torture:quick=yes") if ($opt_quick); - -$ENV{TORTURE_OPTIONS} = join(' ', @torture_options); -print "OPTIONS $ENV{TORTURE_OPTIONS}\n"; - my @todo = (); my $testsdir = "$srcdir/selftest"; -$ENV{SMB_CONF_PATH} = "$conffile"; -$ENV{CONFIGURATION} = "--configfile=$conffile"; my %required_envs = (); @@ -640,6 +626,26 @@ if ($#testlists == -1) { die("No testlists specified"); } +$ENV{SELFTEST_PREFIX} = "$prefix_abs"; +if ($opt_socket_wrapper) { + $ENV{SELFTEST_INTERFACES} = $interfaces; +} else { + $ENV{SELFTEST_INTERFACES} = ""; +} +if ($opt_verbose) { + $ENV{SELFTEST_VERBOSE} = "1"; +} else { + $ENV{SELFTEST_VERBOSE} = ""; +} +if ($opt_quick) { + $ENV{SELFTEST_QUICK} = "1"; +} else { + $ENV{SELFTEST_QUICK} = ""; +} +$ENV{SELFTEST_TARGET} = $opt_target; +$ENV{SELFTEST_MAXTIME} = $torture_maxtime; +$ENV{SELFTEST_CONFFILE} = $conffile; + my @available = (); foreach my $fn (@testlists) { foreach (read_testlist($fn)) { diff --git a/source3/Makefile.in b/source3/Makefile.in index 831db95b34..e806e3f062 100644 --- a/source3/Makefile.in +++ b/source3/Makefile.in @@ -336,7 +336,7 @@ LIB_OBJ = $(LIBSAMBAUTIL_OBJ) $(UTIL_OBJ) $(CRYPTO_OBJ) \ $(VERSION_OBJ) lib/charcnv.o lib/debug.o lib/fault.o \ lib/interface.o lib/pidfile.o \ lib/system.o lib/sendfile.o lib/recvfile.o lib/time.o \ - lib/ufc.o lib/genrand.o lib/username.o \ + lib/genrand.o lib/username.o \ lib/util_pw.o lib/access.o lib/smbrun.o \ lib/bitmap.o lib/dprintf.o $(UTIL_REG_OBJ) \ lib/wins_srv.o \ @@ -1125,7 +1125,7 @@ NTLM_AUTH_OBJ = ${NTLM_AUTH_OBJ1} $(LIBSAMBA_OBJ) $(POPT_LIB_OBJ) \ $(LIBNDR_GEN_OBJ0) $(LIBNDR_GEN_OBJ1) -VLP_OBJ1 = ../testsuite/printing/vlp.o $(RPC_CLIENT_OBJ1) $(RPC_PARSE_OBJ2) $(RPC_CLIENT_OBJ) ../librpc/rpc/binding.o +VLP_OBJ1 = printing/tests/vlp.o $(RPC_CLIENT_OBJ1) $(RPC_PARSE_OBJ2) $(RPC_CLIENT_OBJ) ../librpc/rpc/binding.o VLP_OBJ = $(VLP_OBJ1) $(PARAM_OBJ) $(LIBSMB_OBJ) \ $(LIB_NONSMBD_OBJ) $(KRBCLIENT_OBJ) $(LIBMSRPC_GEN_OBJ) \ diff --git a/source3/configure.in b/source3/configure.in index 9388ebabc0..a97d535c77 100644 --- a/source3/configure.in +++ b/source3/configure.in @@ -657,6 +657,8 @@ AC_SUBST(LIBREPLACE_OBJS) # add -ldl to the global LIBS LIBS="${LIBS} ${LIBDL} ${LIBREPLACE_NETWORK_LIBS}" +AUTH_LIBS="${AUTH_LIBS} ${CRYPT_LIBS}" + AC_CHECK_HEADERS(aio.h sys/fcntl.h sys/select.h fcntl.h sys/time.h sys/unistd.h rpc/nettype.h) AC_CHECK_HEADERS(unistd.h utime.h grp.h sys/id.h memory.h alloca.h) @@ -4318,12 +4320,6 @@ AC_ARG_WITH(pam_smbpass, ) -############################################### -# test for where we get crypt() from -AC_SEARCH_LIBS(crypt, [crypt], - [test "$ac_cv_search_crypt" = "none required" || AUTH_LIBS="-lcrypt $AUTH_LIBS" - AC_DEFINE(HAVE_CRYPT,1,[Whether the system has the crypt() function])]) - ## ## moved after the check for -lcrypt in order to ## ensure that the necessary libraries are included diff --git a/source3/include/proto.h b/source3/include/proto.h index 156e66d4dc..18bbd11ab9 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -1184,10 +1184,6 @@ const char *time_to_asc(const time_t t); const char *display_time(NTTIME nttime); bool nt_time_is_set(const NTTIME *nt); -/* The following definitions come from lib/ufc.c */ - -char *ufc_crypt(const char *key,const char *salt); - /* The following definitions come from lib/username.c */ char *get_user_home_dir(TALLOC_CTX *mem_ctx, const char *user); diff --git a/testsuite/printing/README.vlp b/source3/printing/tests/README.vlp index 48d2c8c0a2..fc0b91ad69 100644 --- a/testsuite/printing/README.vlp +++ b/source3/printing/tests/README.vlp @@ -6,22 +6,7 @@ virtual full-function printer. Setup -1) Configure and build Samba. - For this to work, you need to add: - -DDEVELOPER - to your CFLAGS, and add: - --srcdir=<wherever your source is> - when running configure. Generally - ./configure --srcdir=`pwd` <other configure options> - should work. - -2) Build and install vlp. - # cd testsuite/printing - # make -f Makefile.vlp vlp - # su - # cp vlp /usr/local/samba/bin - -3) Set up Samba to use vlp. +Set up Samba to use vlp. In your smb.conf file under [global], add the following option: printing = vlp and then add any number of print shares, without needing to make them @@ -31,5 +16,4 @@ Setup printable = yes is all you need for the most basic virtual printer. - - + diff --git a/testsuite/printing/vlp.c b/source3/printing/tests/vlp.c index 15459889e9..15459889e9 100644 --- a/testsuite/printing/vlp.c +++ b/source3/printing/tests/vlp.c diff --git a/source3/smbd/process.c b/source3/smbd/process.c index ceffd6f46c..a8b93d8e1c 100644 --- a/source3/smbd/process.c +++ b/source3/smbd/process.c @@ -105,7 +105,11 @@ static bool valid_smb_header(const uint8_t *inbuf) if (is_encrypted_packet(inbuf)) { return true; } - return (strncmp(smb_base(inbuf),"\377SMB",4) == 0); + /* + * This used to be (strncmp(smb_base(inbuf),"\377SMB",4) == 0) + * but it just looks weird to call strncmp for this one. + */ + return (IVAL(smb_base(inbuf), 0) == 0x424D53FF); } /* Socket functions for smbd packet processing. */ @@ -974,7 +978,7 @@ force write permissions on print services. */ static const struct smb_message_struct { const char *name; - void (*fn_new)(struct smb_request *req); + void (*fn)(struct smb_request *req); int flags; } smb_messages[256] = { @@ -1350,7 +1354,7 @@ static connection_struct *switch_message(uint8 type, struct smb_request *req, in exit_server_cleanly("Non-SMB packet"); } - if (smb_messages[type].fn_new == NULL) { + if (smb_messages[type].fn == NULL) { DEBUG(0,("Unknown message type %d!\n",type)); smb_dump("Unknown", 1, (char *)req->inbuf, size); reply_unknown_new(req, type); @@ -1472,7 +1476,7 @@ static connection_struct *switch_message(uint8 type, struct smb_request *req, in return conn; } - smb_messages[type].fn_new(req); + smb_messages[type].fn(req); return req->conn; } @@ -1534,25 +1538,6 @@ static void process_smb(char *inbuf, size_t nread, size_t unread_bytes, bool enc DO_PROFILE_INC(smb_count); - if (trans_num == 0) { - char addr[INET6_ADDRSTRLEN]; - - /* on the first packet, check the global hosts allow/ hosts - deny parameters before doing any parsing of the packet - passed to us by the client. This prevents attacks on our - parsing code from hosts not in the hosts allow list */ - - if (!check_access(smbd_server_fd(), lp_hostsallow(-1), - lp_hostsdeny(-1))) { - /* send a negative session response "not listening on calling name" */ - static unsigned char buf[5] = {0x83, 0, 0, 1, 0x81}; - DEBUG( 1, ( "Connection denied from %s\n", - client_addr(get_client_fd(),addr,sizeof(addr)) ) ); - (void)srv_send_smb(smbd_server_fd(),(char *)buf,false); - exit_server_cleanly("connection denied"); - } - } - DEBUG( 6, ( "got message type 0x%x of len 0x%x\n", msg_type, smb_len(inbuf) ) ); DEBUG( 3, ( "Transaction %d of length %d (%u toread)\n", trans_num, @@ -1893,6 +1878,28 @@ void smbd_process(void) unsigned int num_smbs = 0; size_t unread_bytes = 0; + char addr[INET6_ADDRSTRLEN]; + + /* + * Before the first packet, check the global hosts allow/ hosts deny + * parameters before doing any parsing of packets passed to us by the + * client. This prevents attacks on our parsing code from hosts not in + * the hosts allow list. + */ + + if (!check_access(smbd_server_fd(), lp_hostsallow(-1), + lp_hostsdeny(-1))) { + /* + * send a negative session response "not listening on calling + * name" + */ + unsigned char buf[5] = {0x83, 0, 0, 1, 0x81}; + DEBUG( 1, ("Connection denied from %s\n", + client_addr(get_client_fd(),addr,sizeof(addr)) ) ); + (void)srv_send_smb(smbd_server_fd(),(char *)buf,false); + exit_server_cleanly("connection denied"); + } + max_recv = MIN(lp_maxxmit(),BUFFER_SIZE); while (True) { diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c index b7763cb1cf..25480c6e3b 100644 --- a/source3/smbd/reply.c +++ b/source3/smbd/reply.c @@ -424,22 +424,22 @@ void reply_special(char *inbuf) * header. */ char outbuf[smb_size]; - + static bool already_got_session = False; *name1 = *name2 = 0; - + memset(outbuf, '\0', sizeof(outbuf)); smb_setlen(outbuf,0); - + switch (msg_type) { case 0x81: /* session request */ - + if (already_got_session) { exit_server_cleanly("multiple session request not permitted"); } - + SCVAL(outbuf,0,0x82); SCVAL(outbuf,3,0); if (name_len(inbuf+4) > 50 || @@ -478,24 +478,24 @@ void reply_special(char *inbuf) already_got_session = True; break; - + case 0x89: /* session keepalive request (some old clients produce this?) */ SCVAL(outbuf,0,SMBkeepalive); SCVAL(outbuf,3,0); break; - + case 0x82: /* positive session response */ case 0x83: /* negative session response */ case 0x84: /* retarget session response */ DEBUG(0,("Unexpected session response\n")); break; - + case SMBkeepalive: /* session keepalive */ default: return; } - + DEBUG(5,("init msg_type=0x%x msg_flags=0x%x\n", msg_type, msg_flags)); @@ -1062,7 +1062,7 @@ void reply_getatr(struct smb_request *req) SSVAL(req->outbuf, smb_flg2, SVAL(req->outbuf, smb_flg2) | FLAGS2_IS_LONG_NAME); } - + DEBUG(3,("reply_getatr: name=%s mode=%d size=%u\n", fname, mode, (unsigned int)size ) ); END_PROFILE(SMBgetatr); @@ -1169,9 +1169,9 @@ void reply_setatr(struct smb_request *req) } reply_outbuf(req, 0, 0); - + DEBUG( 3, ( "setatr name=%s mode=%d\n", fname, mode ) ); - + END_PROFILE(SMBsetatr); return; } @@ -1193,7 +1193,7 @@ void reply_dskattr(struct smb_request *req) } reply_outbuf(req, 5, 0); - + if (Protocol <= PROTOCOL_LANMAN2) { double total_space, free_space; /* we need to scale this to a number that DOS6 can handle. We @@ -1207,7 +1207,7 @@ void reply_dskattr(struct smb_request *req) dsize = (uint64_t)((total_space+63*512) / (64*512)); dfree = (uint64_t)((free_space+63*512) / (64*512)); - + if (dsize > 0xFFFF) dsize = 0xFFFF; if (dfree > 0xFFFF) dfree = 0xFFFF; @@ -1713,7 +1713,7 @@ void reply_open(struct smb_request *req) SCVAL(req->outbuf,smb_flg, CVAL(req->outbuf,smb_flg)|CORE_OPLOCK_GRANTED); } - + if(EXCLUSIVE_OPLOCK_TYPE(fsp->oplock_type)) { SCVAL(req->outbuf,smb_flg, CVAL(req->outbuf,smb_flg)|CORE_OPLOCK_GRANTED); @@ -2201,7 +2201,7 @@ void reply_ctemp(struct smb_request *req) SCVAL(req->outbuf, smb_flg, CVAL(req->outbuf,smb_flg)|CORE_OPLOCK_GRANTED); } - + if (EXCLUSIVE_OPLOCK_TYPE(fsp->oplock_type)) { SCVAL(req->outbuf, smb_flg, CVAL(req->outbuf,smb_flg)|CORE_OPLOCK_GRANTED); @@ -2914,14 +2914,14 @@ void reply_readbraw(struct smb_request *req) if (nread < mincount) nread = 0; #endif - + DEBUG( 3, ( "reply_readbraw: fnum=%d start=%.0f max=%lu " "min=%lu nread=%lu\n", fsp->fnum, (double)startpos, (unsigned long)maxcount, (unsigned long)mincount, (unsigned long)nread ) ); - + send_file_readbraw(conn, fsp, startpos, nread, mincount); DEBUG(5,("reply_readbraw finished\n")); @@ -2978,7 +2978,7 @@ void reply_lockread(struct smb_request *req) reply_outbuf(req, 5, numtoread + 3); data = smb_buf(req->outbuf) + 3; - + /* * NB. Discovered by Menny Hamburger at Mainsoft. This is a core+ * protocol request that predates the read/write lock concept. @@ -2986,7 +2986,7 @@ void reply_lockread(struct smb_request *req) * for a write lock. JRA. * Note that the requested lock size is unaffected by max_recv. */ - + br_lck = do_lock(smbd_messaging_context(), fsp, req->smbpid, @@ -3022,7 +3022,7 @@ Returning short read of maximum allowed for compatibility with Windows 2000.\n", END_PROFILE(SMBlockread); return; } - + srv_set_message((char *)req->outbuf, 5, nread+3, False); SSVAL(req->outbuf,smb_vwv0,nread); @@ -3030,7 +3030,7 @@ Returning short read of maximum allowed for compatibility with Windows 2000.\n", p = smb_buf(req->outbuf); SCVAL(p,0,0); /* pad byte. */ SSVAL(p,1,nread); - + DEBUG(3,("lockread fnum=%d num=%d nread=%d\n", fsp->fnum, (int)numtoread, (int)nread)); @@ -3094,7 +3094,7 @@ Returning short read of maximum allowed for compatibility with Windows 2000.\n", reply_outbuf(req, 5, numtoread+3); data = smb_buf(req->outbuf) + 3; - + if (is_locked(fsp, (uint32)req->smbpid, (uint64_t)numtoread, (uint64_t)startpos, READ_LOCK)) { reply_doserror(req, ERRDOS,ERRlock); @@ -3117,7 +3117,7 @@ Returning short read of maximum allowed for compatibility with Windows 2000.\n", SSVAL(req->outbuf,smb_vwv5,nread+3); SCVAL(smb_buf(req->outbuf),0,1); SSVAL(smb_buf(req->outbuf),1,nread); - + DEBUG( 3, ( "read fnum=%d num=%d nread=%d\n", fsp->fnum, (int)numtoread, (int)nread ) ); @@ -3659,7 +3659,7 @@ void reply_writeunlock(struct smb_request *req) END_PROFILE(SMBwriteunlock); return; } - + fsp = file_fsp(req, SVAL(req->inbuf,smb_vwv0)); if (!check_fsp(conn, req, fsp)) { @@ -3676,7 +3676,7 @@ void reply_writeunlock(struct smb_request *req) numtowrite = SVAL(req->inbuf,smb_vwv1); startpos = IVAL_TO_SMB_OFF_T(req->inbuf,smb_vwv2); data = smb_buf(req->inbuf) + 3; - + if (numtowrite && is_locked(fsp, (uint32)req->smbpid, (uint64_t)numtowrite, (uint64_t)startpos, WRITE_LOCK)) { @@ -3693,7 +3693,7 @@ void reply_writeunlock(struct smb_request *req) } else { nwritten = write_file(req,fsp,data,startpos,numtowrite); } - + status = sync_file(conn, fsp, False /* write through */); if (!NT_STATUS_IS_OK(status)) { DEBUG(5,("reply_writeunlock: sync_file for %s returned %s\n", @@ -3725,12 +3725,12 @@ void reply_writeunlock(struct smb_request *req) } reply_outbuf(req, 1, 0); - + SSVAL(req->outbuf,smb_vwv0,nwritten); - + DEBUG(3,("writeunlock fnum=%d num=%d wrote=%d\n", fsp->fnum, (int)numtowrite, (int)nwritten)); - + END_PROFILE(SMBwriteunlock); return; } @@ -3783,7 +3783,7 @@ void reply_write(struct smb_request *req) numtowrite = SVAL(req->inbuf,smb_vwv1); startpos = IVAL_TO_SMB_OFF_T(req->inbuf,smb_vwv2); data = smb_buf(req->inbuf) + 3; - + if (is_locked(fsp, (uint32)req->smbpid, (uint64_t)numtowrite, (uint64_t)startpos, WRITE_LOCK)) { reply_doserror(req, ERRDOS, ERRlock); @@ -3834,14 +3834,14 @@ void reply_write(struct smb_request *req) } reply_outbuf(req, 1, 0); - + SSVAL(req->outbuf,smb_vwv0,nwritten); if (nwritten < (ssize_t)numtowrite) { SCVAL(req->outbuf,smb_rcls,ERRHRD); SSVAL(req->outbuf,smb_err,ERRdiskfull); } - + DEBUG(3,("write fnum=%d num=%d wrote=%d\n", fsp->fnum, (int)numtowrite, (int)nwritten)); END_PROFILE(SMBwrite); @@ -4062,7 +4062,7 @@ void reply_write_and_X(struct smb_request *req) END_PROFILE(SMBwriteX); return; } - + nwritten = write_file(req,fsp,data,startpos,numtowrite); } @@ -4178,7 +4178,7 @@ void reply_lseek(struct smb_request *req) reply_outbuf(req, 2, 0); SIVAL(req->outbuf,smb_vwv0,res); - + DEBUG(3,("lseek fnum=%d ofs=%.0f newpos = %.0f mode=%d\n", fsp->fnum, (double)startpos, (double)res, mode)); @@ -4209,7 +4209,7 @@ void reply_flush(struct smb_request *req) if ((fnum != 0xFFFF) && !check_fsp(conn, req, fsp)) { return; } - + if (!fsp) { file_sync_all(conn); } else { @@ -4222,7 +4222,7 @@ void reply_flush(struct smb_request *req) return; } } - + reply_outbuf(req, 0, 0); DEBUG(3,("flush\n")); @@ -4293,7 +4293,7 @@ void reply_close(struct smb_request *req) DEBUG(3,("close fd=%d fnum=%d (numopen=%d)\n", fsp->fh->fd, fsp->fnum, conn->num_files_open)); - + /* * Take care of any time sent in the close. */ @@ -4306,7 +4306,7 @@ void reply_close(struct smb_request *req) * was detected on close - normally this is due to * a disk full error. If not then it was probably an I/O error. */ - + status = close_file(req, fsp, NORMAL_CLOSE); } @@ -4361,7 +4361,7 @@ void reply_writeclose(struct smb_request *req) mtime = convert_time_t_to_timespec(srv_make_unix_date3( req->inbuf+smb_vwv4)); data = smb_buf(req->inbuf) + 1; - + if (numtowrite && is_locked(fsp, (uint32)req->smbpid, (uint64_t)numtowrite, (uint64_t)startpos, WRITE_LOCK)) { @@ -4369,7 +4369,7 @@ void reply_writeclose(struct smb_request *req) END_PROFILE(SMBwriteclose); return; } - + nwritten = write_file(req,fsp,data,startpos,numtowrite); set_close_write_time(fsp, mtime); @@ -4388,13 +4388,13 @@ void reply_writeclose(struct smb_request *req) DEBUG(3,("writeclose fnum=%d num=%d wrote=%d (numopen=%d)\n", fsp->fnum, (int)numtowrite, (int)nwritten, conn->num_files_open)); - + if(((nwritten == 0) && (numtowrite != 0))||(nwritten < 0)) { reply_doserror(req, ERRHRD, ERRdiskfull); END_PROFILE(SMBwriteclose); return; } - + if(!NT_STATUS_IS_OK(close_status)) { reply_nterror(req, close_status); END_PROFILE(SMBwriteclose); @@ -4402,7 +4402,7 @@ void reply_writeclose(struct smb_request *req) } reply_outbuf(req, 1, 0); - + SSVAL(req->outbuf,smb_vwv0,nwritten); END_PROFILE(SMBwriteclose); return; @@ -4496,10 +4496,10 @@ void reply_unlock(struct smb_request *req) END_PROFILE(SMBunlock); return; } - + count = (uint64_t)IVAL(req->inbuf,smb_vwv1); offset = (uint64_t)IVAL(req->inbuf,smb_vwv3); - + status = do_unlock(smbd_messaging_context(), fsp, req->smbpid, @@ -4620,7 +4620,7 @@ void reply_printopen(struct smb_request *req) connection_struct *conn = req->conn; files_struct *fsp; NTSTATUS status; - + START_PROFILE(SMBsplopen); if (req->wct < 2) { @@ -4646,7 +4646,7 @@ void reply_printopen(struct smb_request *req) reply_outbuf(req, 1, 0); SSVAL(req->outbuf,smb_vwv0,fsp->fnum); - + DEBUG(3,("openprint fd=%d fnum=%d\n", fsp->fh->fd, fsp->fnum)); @@ -4684,10 +4684,10 @@ void reply_printclose(struct smb_request *req) END_PROFILE(SMBsplclose); return; } - + DEBUG(3,("printclose fd=%d fnum=%d\n", fsp->fh->fd,fsp->fnum)); - + status = close_file(req, fsp, NORMAL_CLOSE); if(!NT_STATUS_IS_OK(status)) { @@ -4738,7 +4738,7 @@ void reply_printqueue(struct smb_request *req) SSVAL(req->outbuf,smb_vwv1,0); SCVAL(smb_buf(req->outbuf),0,1); SSVAL(smb_buf(req->outbuf),1,0); - + DEBUG(3,("printqueue start_index=%d max_count=%d\n", start_index, max_count)); @@ -4754,7 +4754,7 @@ void reply_printqueue(struct smb_request *req) num_to_get = 0; else num_to_get = MIN(num_to_get,count-first); - + for (i=first;i<first+num_to_get;i++) { char blob[28]; @@ -4787,10 +4787,10 @@ void reply_printqueue(struct smb_request *req) } SAFE_FREE(queue); - + DEBUG(3,("%d entries returned in queue\n",count)); } - + END_PROFILE(SMBsplretq); return; } @@ -4813,7 +4813,7 @@ void reply_printwrite(struct smb_request *req) END_PROFILE(SMBsplwr); return; } - + fsp = file_fsp(req, SVAL(req->inbuf,smb_vwv0)); if (!check_fsp(conn, req, fsp)) { @@ -5211,7 +5211,7 @@ static bool resolve_wildcards(TALLOC_CTX *ctx, char *ext1 = NULL; char *ext2 = NULL; char *p,*p2, *pname1, *pname2; - + name2_copy = talloc_strdup(ctx, name2); if (!name2_copy) { return False; @@ -5223,7 +5223,7 @@ static bool resolve_wildcards(TALLOC_CTX *ctx, if (!pname1 || !pname2) { return False; } - + /* Truncate the copy of name2 at the last '/' */ *pname2 = '\0'; @@ -6540,26 +6540,26 @@ static uint32 map_lock_offset(uint32 high, uint32 low) unsigned int i; uint32 mask = 0; uint32 highcopy = high; - + /* * Try and find out how many significant bits there are in high. */ - + for(i = 0; highcopy; i++) highcopy >>= 1; - + /* * We use 31 bits not 32 here as POSIX * lock offsets may not be negative. */ - + mask = (~0) << (31 - i); - + if(low & mask) return 0; /* Fail. */ - + high <<= (31 - i); - + return (high|low); } #endif /* !defined(HAVE_LONGLONG) */ @@ -6589,7 +6589,7 @@ uint64_t get_lock_offset( char *data, int data_offset, bool large_file_format, b * negotiated. For boxes without large unsigned ints mangle the * lock offset by mapping the top 32 bits onto the lower 32. */ - + if(IVAL(data,SMB_LARGE_LKOFF_OFFSET_HIGH(data_offset)) != 0) { uint32 low = IVAL(data,SMB_LARGE_LKOFF_OFFSET_LOW(data_offset)); uint32 high = IVAL(data,SMB_LARGE_LKOFF_OFFSET_HIGH(data_offset)); @@ -6641,7 +6641,7 @@ void reply_lockingX(struct smb_request *req) END_PROFILE(SMBlockingX); return; } - + fsp = file_fsp(req, SVAL(req->inbuf,smb_vwv2)); locktype = CVAL(req->inbuf,smb_vwv3); oplocklevel = CVAL(req->inbuf,smb_vwv3+1); @@ -6654,7 +6654,7 @@ void reply_lockingX(struct smb_request *req) END_PROFILE(SMBlockingX); return; } - + data = smb_buf(req->inbuf); if (locktype & LOCKING_ANDX_CHANGE_LOCKTYPE) { @@ -6665,7 +6665,7 @@ void reply_lockingX(struct smb_request *req) END_PROFILE(SMBlockingX); return; } - + /* Check if this is an oplock break on a file we have granted an oplock on. */ @@ -6682,7 +6682,7 @@ void reply_lockingX(struct smb_request *req) * Make sure we have granted an exclusive or batch oplock on * this file. */ - + if (fsp->oplock_type == 0) { /* The Samba4 nbench simulator doesn't understand @@ -6714,7 +6714,7 @@ void reply_lockingX(struct smb_request *req) } else { result = downgrade_oplock(fsp); } - + if (!result) { DEBUG(0, ("reply_lockingX: error in removing " "oplock on file %s\n", fsp->fsp_name)); @@ -6743,7 +6743,7 @@ void reply_lockingX(struct smb_request *req) * We do this check *after* we have checked this is not a oplock break * response message. JRA. */ - + release_level_2_oplocks_on_change(fsp); if (smb_buflen(req->inbuf) < @@ -6752,14 +6752,14 @@ void reply_lockingX(struct smb_request *req) END_PROFILE(SMBlockingX); return; } - + /* Data now points at the beginning of the list of smb_unlkrng structs */ for(i = 0; i < (int)num_ulocks; i++) { lock_pid = get_lock_pid( data, i, large_file_format); count = get_lock_count( data, i, large_file_format); offset = get_lock_offset( data, i, large_file_format, &err); - + /* * There is no error code marked "stupid client bug".... :-). */ @@ -6772,7 +6772,7 @@ void reply_lockingX(struct smb_request *req) DEBUG(10,("reply_lockingX: unlock start=%.0f, len=%.0f for " "pid %u, file %s\n", (double)offset, (double)count, (unsigned int)lock_pid, fsp->fsp_name )); - + status = do_unlock(smbd_messaging_context(), fsp, lock_pid, @@ -6792,20 +6792,20 @@ void reply_lockingX(struct smb_request *req) if (!lp_blocking_locks(SNUM(conn))) { lock_timeout = 0; } - + /* Now do any requested locks */ data += ((large_file_format ? 20 : 10)*num_ulocks); - + /* Data now points at the beginning of the list of smb_lkrng structs */ - + for(i = 0; i < (int)num_locks; i++) { enum brl_type lock_type = ((locktype & LOCKING_ANDX_SHARED_LOCK) ? READ_LOCK:WRITE_LOCK); lock_pid = get_lock_pid( data, i, large_file_format); count = get_lock_count( data, i, large_file_format); offset = get_lock_offset( data, i, large_file_format, &err); - + /* * There is no error code marked "stupid client bug".... :-). */ @@ -6814,12 +6814,12 @@ void reply_lockingX(struct smb_request *req) reply_doserror(req, ERRDOS, ERRnoaccess); return; } - + DEBUG(10,("reply_lockingX: lock start=%.0f, len=%.0f for pid " "%u, file %s timeout = %d\n", (double)offset, (double)count, (unsigned int)lock_pid, fsp->fsp_name, (int)lock_timeout )); - + if (locktype & LOCKING_ANDX_CANCEL_LOCK) { if (lp_blocking_locks(SNUM(conn))) { @@ -6918,7 +6918,7 @@ void reply_lockingX(struct smb_request *req) return; } } - + /* If any of the above locks failed, then we must unlock all of the previous locks (X/Open spec). */ @@ -6935,7 +6935,7 @@ void reply_lockingX(struct smb_request *req) count = get_lock_count( data, i, large_file_format); offset = get_lock_offset( data, i, large_file_format, &err); - + /* * There is no error code marked "stupid client * bug".... :-). @@ -6945,7 +6945,7 @@ void reply_lockingX(struct smb_request *req) reply_doserror(req, ERRDOS, ERRnoaccess); return; } - + do_unlock(smbd_messaging_context(), fsp, lock_pid, @@ -6959,10 +6959,10 @@ void reply_lockingX(struct smb_request *req) } reply_outbuf(req, 2, 0); - + DEBUG(3, ("lockingX fnum=%d type=%d num_locks=%d num_ulocks=%d\n", fsp->fnum, (unsigned int)locktype, num_locks, num_ulocks)); - + END_PROFILE(SMBlockingX); chain_reply(req); } @@ -7036,7 +7036,7 @@ void reply_setattrE(struct smb_request *req) srv_make_unix_date2(req->inbuf+smb_vwv3)); /* atime. */ ts[1] = convert_time_t_to_timespec( srv_make_unix_date2(req->inbuf+smb_vwv5)); /* mtime. */ - + reply_outbuf(req, 0, 0); /* @@ -7068,7 +7068,7 @@ void reply_setattrE(struct smb_request *req) END_PROFILE(SMBsetattrE); return; } - + DEBUG( 3, ( "reply_setattrE fnum=%d actime=%u modtime=%u\n", fsp->fnum, (unsigned int)ts[0].tv_sec, @@ -7143,9 +7143,9 @@ void reply_getattrE(struct smb_request *req) END_PROFILE(SMBgetattrE); return; } - + mode = dos_mode(conn,fsp->fsp_name,&sbuf); - + /* * Convert the times into dos times. Set create * date to be last modify date as UNIX doesn't save @@ -7170,9 +7170,9 @@ void reply_getattrE(struct smb_request *req) SIVAL(req->outbuf, smb_vwv8, allocation_size); } SSVAL(req->outbuf,smb_vwv10, mode); - + DEBUG( 3, ( "reply_getattrE fnum=%d\n", fsp->fnum)); - + END_PROFILE(SMBgetattrE); return; } diff --git a/source4/scripting/python/samba/provision.py b/source4/scripting/python/samba/provision.py index 4764d0cafa..823d5e6ff6 100644 --- a/source4/scripting/python/samba/provision.py +++ b/source4/scripting/python/samba/provision.py @@ -959,13 +959,16 @@ def provision(setup_dir, message, session_info, paths = provision_paths_from_lp(lp, names.dnsdomain) if hostip is None: - hostip = socket.getaddrinfo(names.hostname, None, socket.AF_INET, socket.AI_CANONNAME, socket.IPPROTO_IP)[0][-1][0] + try: + hostip = socket.getaddrinfo(names.hostname, None, socket.AF_INET, socket.AI_CANONNAME, socket.IPPROTO_IP)[0][-1][0] + except socket.gaierror, (socket.EAI_NODATA, msg): + hostip = None if hostip6 is None: try: hostip6 = socket.getaddrinfo(names.hostname, None, socket.AF_INET6, socket.AI_CANONNAME, socket.IPPROTO_IP)[0][-1][0] - except socket.gaierror: - pass + except socket.gaierror, (socket.EAI_NODATA, msg): + hostip6 = None if serverrole is None: serverrole = lp.get("server role") @@ -1426,12 +1429,20 @@ def create_zone_file(path, setup_path, dnsdomain, domaindn, hostip6_base_line = "" hostip6_host_line = "" + if hostip is not None: + hostip_base_line = " IN A " + hostip + hostip_host_line = hostname + " IN A " + hostip + else: + hostip_base_line = "" + hostip_host_line = "" + setup_file(setup_path("provision.zone"), path, { "DNSPASS_B64": b64encode(dnspass), "HOSTNAME": hostname, "DNSDOMAIN": dnsdomain, "REALM": realm, - "HOSTIP": hostip, + "HOSTIP_BASE_LINE": hostip_base_line, + "HOSTIP_HOST_LINE": hostip_host_line, "DOMAINGUID": domainguid, "DATESTRING": time.strftime("%Y%m%d%H"), "DEFAULTSITE": DEFAULTSITE, diff --git a/source4/selftest/tests.sh b/source4/selftest/tests.sh index fa799f51ff..42bc8141c6 100755 --- a/source4/selftest/tests.sh +++ b/source4/selftest/tests.sh @@ -4,11 +4,11 @@ # The output of this script is parsed by selftest.pl, which then decides # which of the tests to actually run. It will, for example, skip all tests -# listed in samba4-skip or only run a subset during "make quicktest". +# listed in selftest/skip or only run a subset during "make quicktest". # The idea is that this script outputs all of the tests of Samba 4, not # just those that are known to pass, and list those that should be skipped -# or are known to file in samba4-skip/samba4-knownfail. This makes it +# or are known to fail in selftest/skip or selftest/knownfail. This makes it # very easy to see what functionality is still missing in Samba 4 and makes # it possible to run the testsuite against other servers, such as Samba 3 or # Windows that have a different set of features. @@ -58,8 +58,33 @@ bin/smbtorture -V samba4srcdir=. samba4bindir=$samba4srcdir/bin + +prefix_abs="$SELFTEST_PREFIX/s4client" + +mkdir "$prefix_abs" +conffile="$SELFTEST_CONFFILE" + +TORTURE_OPTIONS="" +TORTURE_OPTIONS="$TORTURE_OPTIONS --configfile=$conffile" +TORTURE_OPTIONS="$TORTURE_OPTIONS --maximum-runtime=$SELFTEST_MAXTIME" +TORTURE_OPTIONS="$TORTURE_OPTIONS --target=$SELFTEST_TARGET" +TORTURE_OPTIONS="$TORTURE_OPTIONS --basedir=$prefix_abs" +if [ -n "$SELFTEST_VERBOSE" ]; then + TORTURE_OPTIONS="$TORTURE_OPTIONS --option=torture:progress=no" +fi +TORTURE_OPTIONS="$TORTURE_OPTIONS --format=subunit" +if [ -n "$SELFTEST_QUICK" ]; then + TORTURE_OPTIONS="$TORTURE_OPTIONS --option=torture:quick=yes" +fi smb4torture="$samba4bindir/smbtorture $TORTURE_OPTIONS" +echo "OPTIONS $TORTURE_OPTIONS" + +SMB_CONF_PATH="$conffile" +export SMB_CONF_PATH +CONFIGURATION="--configfile=$conffile" +export CONFIGURATION + # Simple tests for LDAP and CLDAP for options in "" "--option=socket:testnonblock=true" "-U\$USERNAME%\$PASSWORD --option=socket:testnonblock=true" "-U\$USERNAME%\$PASSWORD"; do diff --git a/source4/setup/provision.zone b/source4/setup/provision.zone index 17ae3bb47a..e7d600df87 100644 --- a/source4/setup/provision.zone +++ b/source4/setup/provision.zone @@ -10,10 +10,10 @@ $TTL 1W 1W ) ; minimum IN NS ${HOSTNAME} ${HOSTIP6_BASE_LINE} - IN A ${HOSTIP} +${HOSTIP_BASE_LINE} ; ${HOSTIP6_HOST_LINE} -${HOSTNAME} IN A ${HOSTIP} +${HOSTIP_HOST_LINE} gc._msdcs IN CNAME ${HOSTNAME} ${HOSTGUID}._msdcs IN CNAME ${HOSTNAME} ; diff --git a/testsuite/printing/Makefile.vlp b/testsuite/printing/Makefile.vlp deleted file mode 100644 index 142082ebfe..0000000000 --- a/testsuite/printing/Makefile.vlp +++ /dev/null @@ -1,14 +0,0 @@ -# -# Makefile for vlp utility -# - -vlp_default: vlp - -include ../../source/Makefile - -VLP_OBJ1 = $(LIB_OBJ) $(PARAM_OBJ) $(UBIQX_OBJ) - -VLP_OBJS = $(VLP_OBJ1:%=$(srcdir)/%) - -vlp: $(VLP_OBJS) vlp.o - $(CC) -o $@ vlp.o $(VLP_OBJS) $(LIBS) |