rusty/samba.git
11 years agopatch smb2-server-no-pool-stealing.patch talloc-stack-wip
Rusty Russell [Fri, 29 Jun 2012 07:31:11 +0000 (17:01 +0930)]
patch smb2-server-no-pool-stealing.patch

11 years agolibcli/auth/spnego_parse.c: don't allocate blob from pool.
Rusty Russell [Fri, 29 Jun 2012 07:31:11 +0000 (17:01 +0930)]
libcli/auth/spnego_parse.c: don't allocate blob from pool.

spnego_parse() allocates off the stackframe, but the result gets
stolen onto the request by gensec_spnego_update_out() at
auth/gensec/spnego.c:1260:

talloc_steal(out_mem_ctx, _out->data);

pointer we're stealing:
  0x941e4a0 (DATA_BLOB: ../libcli/auth/spnego_parse.c:341) (in pool 0x9420858 ../source3/smbd/process.c:3590)
  0x941dfa8 (struct spnego_state) (in pool 0x9420858 ../source3/smbd/process.c:3590)
  0x941de70 (struct gensec_security) (in pool 0x9420858 ../source3/smbd/process.c:3590)
  0x9420858 (../source3/smbd/process.c:3590) (POOL)
  0x93f76e8 (TALLOC_CTX *)
  0x93e3058 (null_context)

context we're stealing onto:
  0x93ff860 (struct smb_request)
  0x9420430 (struct smbd_server_connection)
  0x93fc5e0 (struct smbXsrv_connection)
  0x93e6678 (struct tevent_context)
  0x93e3058 (null_context)

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
11 years agosource3/locking/brlock.c: don't steal from talloc_tos()
Rusty Russell [Fri, 29 Jun 2012 07:31:11 +0000 (17:01 +0930)]
source3/locking/brlock.c: don't steal from talloc_tos()

brl_get_locks_readonly() allocates of talloc_tos(), then steals onto
fsp.  That prevents us from freeing up talloc_tos(), and it's completely
gratuitous.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
11 years agosource3/lib/username: don't allocate talloc_tos() for memcache
Rusty Russell [Fri, 29 Jun 2012 07:31:03 +0000 (17:01 +0930)]
source3/lib/username: don't allocate talloc_tos() for memcache

source3/lib/memcache.c:340:
p = talloc_move(cache, ptr);

We can't use mem_ctx, either, because in some paths that's also a
stackframe.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
11 years agodbwrap: don't steal off talloc_stackframe().
Rusty Russell [Fri, 29 Jun 2012 06:39:02 +0000 (16:09 +0930)]
dbwrap: don't steal off talloc_stackframe().

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
11 years agomsg_channel: don't allocate state->channel off stackframe
Rusty Russell [Fri, 29 Jun 2012 06:39:02 +0000 (16:09 +0930)]
msg_channel: don't allocate state->channel off stackframe

We steal this later.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
11 years agosource3/librpc/rpc/dcerpc_ep.c: don't steal off stackframe.
Rusty Russell [Fri, 29 Jun 2012 06:39:01 +0000 (16:09 +0930)]
source3/librpc/rpc/dcerpc_ep.c: don't steal off stackframe.

There's only one allocation anyway, so just allocate it and clean up
if we fail.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
11 years agosmbd: can't use talloc_tos() for request, data.
Rusty Russell [Fri, 29 Jun 2012 06:38:44 +0000 (16:08 +0930)]
smbd: can't use talloc_tos() for request, data.

We talloc_steal the request onto a NULL-parented conn in api_dcerpc_cmd:

tevent_req_set_callback(subreq, api_dcerpc_cmd_write_done,
talloc_move(conn, &req));

This means we're leaking a whole frame until that callback is called.
And since we can't allocate the request on talloc_tos(), we can't
allocate the input buffer there either:

req->inbuf  = (uint8_t *)talloc_move(req, &inbuf);

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
11 years agoauth: don't allocate session_info from pool.
Rusty Russell [Fri, 29 Jun 2012 05:46:41 +0000 (15:16 +0930)]
auth: don't allocate session_info from pool.

source3/smbd/password.c: (register_existing_vuid)
/* Use this to keep tabs on all our info from the authentication */
vuser->session_info = talloc_move(vuser, &session_info);

This is flawed, since session_info is inside the talloc pool allocated
at source3/smbd/process.c:3529.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
11 years agotalloc: panic if we log in developer mode.
Rusty Russell [Fri, 29 Jun 2012 05:46:41 +0000 (15:16 +0930)]
talloc: panic if we log in developer mode.

Otherwise we could be logging all kinds of problems, and the autobuilder
and make test will still be happy.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
11 years ago(throwaway) Extra debug stuff for finding what's stolen.
Rusty Russell [Fri, 29 Jun 2012 05:46:40 +0000 (15:16 +0930)]
(throwaway) Extra debug stuff for finding what's stolen.

11 years agotalloc: allow stealing onto a child of the old pool.
Rusty Russell [Fri, 29 Jun 2012 05:46:40 +0000 (15:16 +0930)]
talloc: allow stealing onto a child of the old pool.

This might have to be ifdef DEVELOPER, since it's an expensive check.

11 years agotalloc: warn if we steal outside a pool.
Rusty Russell [Fri, 29 Jun 2012 05:46:40 +0000 (15:16 +0930)]
talloc: warn if we steal outside a pool.

This is almost certainly a bug, so warn about it.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
11 years agotalloc: keep reference to pool even if we overflow it.
Rusty Russell [Fri, 29 Jun 2012 05:46:40 +0000 (15:16 +0930)]
talloc: keep reference to pool even if we overflow it.

If you talloc off a pool, and it doesn't fit, we fallback to a non-pool
talloc.  Unfortunately, all children of that allocation are also unaware
of the pool, even if they would fit.

Instead, save the pool pointer even if we overflow: that way we can
correctly allocate children if they fit.  It also permits better
debugging in the next patch.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
11 years agoloadparm: make the source3/ lp_ functions take an explicit TALLOC_CTX *.
Rusty Russell [Fri, 29 Jun 2012 05:46:40 +0000 (15:16 +0930)]
loadparm: make the source3/ lp_ functions take an explicit TALLOC_CTX *.

They use talloc_tos() internally: hoist that up to the callers, some
of whom don't want to us talloc_tos().

A simple patch, but hits a lot of files.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
11 years agopatch talloc_stack-looser-checking.patch
Rusty Russell [Fri, 29 Jun 2012 05:46:40 +0000 (15:16 +0930)]
patch talloc_stack-looser-checking.patch

11 years agosource3/utils/net_conf.c: fix stackframe leak
Rusty Russell [Fri, 29 Jun 2012 05:46:40 +0000 (15:16 +0930)]
source3/utils/net_conf.c: fix stackframe leak

net_conf_wrap_function() doesn't free its stackframe.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
11 years agosource3/winbindd/winbindd_pam.c: fix stackframe leak
Rusty Russell [Fri, 29 Jun 2012 05:46:40 +0000 (15:16 +0930)]
source3/winbindd/winbindd_pam.c: fix stackframe leak

check_info3_in_group() doesn't always free its stackframe.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
11 years agosource3/lib/smbconf/testsuite.c: fix stackframe leak
Rusty Russell [Fri, 29 Jun 2012 05:46:39 +0000 (15:16 +0930)]
source3/lib/smbconf/testsuite.c: fix stackframe leak

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
11 years agosource3/registry/reg_backend_db.c: fix stackframe leak
Rusty Russell [Fri, 29 Jun 2012 05:46:39 +0000 (15:16 +0930)]
source3/registry/reg_backend_db.c: fix stackframe leak

regdb_store_values_internal() doesn't always free its stackframe.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
11 years agosource3/winbindd/idmap_tdb_common.c: fix stackframe leak
Rusty Russell [Fri, 29 Jun 2012 05:46:39 +0000 (15:16 +0930)]
source3/winbindd/idmap_tdb_common.c: fix stackframe leak

idmap_tdb_common_sid_to_unixid() doesn't always free its stackframe.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
11 years agosource3/rpc_server/svcctl/srv_svcctl_reg.c: fix stackframe leak
Rusty Russell [Fri, 29 Jun 2012 05:46:39 +0000 (15:16 +0930)]
source3/rpc_server/svcctl/srv_svcctl_reg.c: fix stackframe leak

svcctl_init_winreg() doesn't free its stackframe.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
11 years agosource3/modules/vfs_xattr_tdb.c: fix stackframe leak
Rusty Russell [Fri, 29 Jun 2012 05:46:39 +0000 (15:16 +0930)]
source3/modules/vfs_xattr_tdb.c: fix stackframe leak

xattr_tdb_getxattr() doesn't free its stackframe.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
11 years agolib/util/modules.c: fix stackframe leak.
Rusty Russell [Fri, 29 Jun 2012 05:46:39 +0000 (15:16 +0930)]
lib/util/modules.c: fix stackframe leak.

do_smb_load_module() doesn't free its stackframe on success.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
11 years agosource3/winbindd/winbindd_util.c: fix stackframe leak
Rusty Russell [Fri, 29 Jun 2012 05:46:39 +0000 (15:16 +0930)]
source3/winbindd/winbindd_util.c: fix stackframe leak

winbindd_can_contact_domain() doesn't always free its stackframe.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
11 years agont_printing_tdb_migrate(): fix stackframe leak.
Rusty Russell [Fri, 29 Jun 2012 05:46:39 +0000 (15:16 +0930)]
nt_printing_tdb_migrate(): fix stackframe leak.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
11 years agosource3/client/client.c: fix stackframe leak.
Rusty Russell [Fri, 29 Jun 2012 05:46:39 +0000 (15:16 +0930)]
source3/client/client.c: fix stackframe leak.

do_message_op() doesn't free its stackframe in various paths.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
11 years agosmbpasswd: always free frame.
Rusty Russell [Fri, 29 Jun 2012 05:46:39 +0000 (15:16 +0930)]
smbpasswd: always free frame.

The fascist test in --check-talloc-stack complains.  We're about to exit,
so it doesn't really matter, but might as well unify the paths.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
11 years agotalloc_stack: add --check-talloc-stack
Rusty Russell [Fri, 29 Jun 2012 05:46:39 +0000 (15:16 +0930)]
talloc_stack: add --check-talloc-stack

This allows us (with sufficient compiler support) to enforce usage
restrictions on talloc_stackframe().  It's slow, so requires explicit
action to turn it on.

1) panic if we don't free a stackframe in the same function they created it.
2) panic if we call talloc_tos() with no stackframe.

This would be much more efficient if I could add the -finstrument-functions only
to compilation units which depend on talloc_stack, but I couldn't figure out
how to do that.  So I add it everywhere, and suppress it manually inside
talloc_stack.c.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
11 years agoBefore:
Rusty Russell [Fri, 29 Jun 2012 05:46:39 +0000 (15:16 +0930)]
Before:
Stacksize for 566162 stacks: 144-3971728 (avg 95614): 1.74526e+07 succeeded 922716 failed: 94.9785%

After:
Stacksize for 565503 stacks: 144-324624 (avg 12725.5): 1.36168e+07 succeeded 1.38407e+06 failed: 90.7734%

11 years agotalloc_stack: use talloc_pool_stats() to autosize.
Rusty Russell [Fri, 29 Jun 2012 05:46:27 +0000 (15:16 +0930)]
talloc_stack: use talloc_pool_stats() to autosize.

The talloc_stackframe_pool() provides us a static structure where we can
store persistent information about this stackframe.

On destruction, we gather the stats.  When we create the pool, we
enlarge it if it's less than 95% successful in servicing allocations
from the pool, and shrink it if it was 100% successful.  The heuristic
is fairly simple, but seems stable here.

To see our overall success and failures, try this:
$ grep 'success rate' st/s3dc/smbd_test.log  | awk 'BEGIN { MIN=1000000 } { gsub(/%/,"",$8); SUCCPERC=int($8); NUMALLOCS=int($10); SUCC += SUCCPERC * NUMALLOCS / 100; FAIL += NUMALLOCS - (SUCCPERC * NUMALLOCS / 100); gsub(/,/,"",$4); STSIZE=int($4); SIZE += STSIZE; if (STSIZE > MAX) { MAX=STSIZE; } if (STSIZE < MIN) { MIN=STSIZE; } NUM++; } END { print "Stacksize for " NUM " stacks: " MIN "-" MAX " (avg " SIZE/NUM "): " SUCC " succeeded " FAIL " failed: " SUCC*100/(SUCC + FAIL) "%" }'

Two partial runs of make test:

On my 32-bit machine:
$ Stacksize for 430256 stacks: 64-2240192 (avg 67822.6): 1.2023e+07 succeeded 690528 failed: 94.5686%

On sn-devel (64-bit machine):
$ Stacksize for 430256 stacks: 144-5591568 (avg 137879): 1.58109e+07 succeeded 682280 failed: 95.8633%

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
11 years agotalloc_stack: always include the location when creating a talloc_stackframe().
Rusty Russell [Fri, 29 Jun 2012 05:16:14 +0000 (14:46 +0930)]
talloc_stack: always include the location when creating a talloc_stackframe().

Much better for debugging.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
11 years agotalloc: keep stats for pools, add talloc_pool_stats().
Rusty Russell [Fri, 29 Jun 2012 05:15:14 +0000 (14:45 +0930)]
talloc: keep stats for pools, add talloc_pool_stats().

This allows us to determine how much (if any) overflow has happened to
a pool.  We compress the stats into two u16s, so it doesn't add 16
bytes on 32-bit platforms.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
11 years agotalloc_stack: handle more than one talloc_stackframe_pool()
Rusty Russell [Fri, 29 Jun 2012 05:14:14 +0000 (14:44 +0930)]
talloc_stack: handle more than one talloc_stackframe_pool()

The only reason we make one stackframe parent of the next is so we use
our parent's pool.  That doesn't make sense if we're a new pool, and
wouldn't work anyway.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
11 years agotalloc: don't allow a talloc_pool inside a talloc_pool.
Rusty Russell [Fri, 29 Jun 2012 04:24:44 +0000 (13:54 +0930)]
talloc: don't allow a talloc_pool inside a talloc_pool.

We explicitly call free() on a pool which falls to zero, assuming it's
not inside another pool (we crash).  Check on creation and explicitly
document this case.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
11 years agotalloc: use a struct for pool headers.
Rusty Russell [Fri, 29 Jun 2012 04:23:44 +0000 (13:53 +0930)]
talloc: use a struct for pool headers.

This neatens the code a bit (we should do a similar thing for all the
TALLOC_CHUNK macros).

Two subtler changes:
(1) As a result of the struct, we actually pack object_count into the
    talloc header on 32-bit platforms (since the header is 40 bytes, but
    needs to be 16-byte aligned).
(2) I avoid VALGRIND_MAKE_MEM_UNDEFINED on memmove when we resize the
    only entry in a pool; that's done later anyway.

With -O2 on my 11.04 Ubuntu 32-bit x86 laptop, the talloc_pool speed as
measured by testsuite.c actually increases 10%.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
11 years agoccan: we're subsystems, not a library.
Rusty Russell [Fri, 29 Jun 2012 02:39:06 +0000 (12:09 +0930)]
ccan: we're subsystems, not a library.

Don't expose a libccan.so; it would produce clashes if someone else
does the same thing.  Unfortunately, if we just change it from a
SAMBA_LIBRARY to a SAMBA_SUBSYSTEM, it doesn't create a static library
as we'd like, but links all the object files in.  This means we get
many duplicates (eg. everyone gets a copy of tally, even though only
ntdb wants it).

So, the solution is twofold:
1) Make the ccan modules separate.
2) Make the ccan modules SAMBA_SUBSYSTEMs not SAMBA_LIBRARYs so we don't
   build shared libraries which we can't share.
3) Make the places which uses ccan explicit.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Autobuild-User(master): Rusty Russell <rusty@rustcorp.com.au>
Autobuild-Date(master): Fri Jun 29 06:22:44 CEST 2012 on sn-devel-104

11 years agoMove back to using per-thread credentials on Linux. Fixes the glibc native AIO lost...
Jeremy Allison [Thu, 28 Jun 2012 20:41:19 +0000 (13:41 -0700)]
Move back to using per-thread credentials on Linux. Fixes the glibc native AIO lost wakeup problem.

See this post:

https://lists.samba.org/archive/samba-technical/2012-June/085101.html

for details.

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Fri Jun 29 03:57:45 CEST 2012 on sn-devel-104

11 years agoReplace all uses of setXX[ug]id() and setgroups with samba_setXX[ug]id() calls.
Jeremy Allison [Thu, 28 Jun 2012 18:59:51 +0000 (11:59 -0700)]
Replace all uses of setXX[ug]id() and setgroups with samba_setXX[ug]id() calls.

Will allow thread-specific credentials to be added by modifying
the central definitions. Deliberately left the setXX[ug]id()
call in popt as this is not used in Samba.

11 years agoAdd missing setresgid() wrapper.
Jeremy Allison [Tue, 26 Jun 2012 01:08:36 +0000 (18:08 -0700)]
Add missing setresgid() wrapper.

11 years agodocs-xml: document "server max protocol" "SMB2" selects PROTOCOL_SMB2_10
Stefan Metzmacher [Sun, 3 Jun 2012 21:09:33 +0000 (23:09 +0200)]
docs-xml: document "server max protocol" "SMB2" selects PROTOCOL_SMB2_10

metze

Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Fri Jun 29 02:07:17 CEST 2012 on sn-devel-104

11 years agos3:param: change "server max protocol" to "SMB2" (SMB2_10)
Stefan Metzmacher [Sun, 3 Jun 2012 21:04:44 +0000 (23:04 +0200)]
s3:param: change "server max protocol" to "SMB2" (SMB2_10)

metze

11 years agolib/param: let "SMB2" select PROTOCOL_SMB2_10
Stefan Metzmacher [Sun, 3 Jun 2012 21:02:56 +0000 (23:02 +0200)]
lib/param: let "SMB2" select PROTOCOL_SMB2_10

metze

11 years agos3:smb2_server: make the logic in smbd_smb2_request_verify_creditcharge() simpler
Stefan Metzmacher [Mon, 25 Jun 2012 21:35:46 +0000 (23:35 +0200)]
s3:smb2_server: make the logic in smbd_smb2_request_verify_creditcharge() simpler

We just need a max_charge variable to make the algorithm independent
of multi_credit support.

metze

11 years agos3:smb2_server: simplify smbd_smb2_request_verify_creditcharge() a bit.
Stefan Metzmacher [Mon, 25 Jun 2012 19:14:43 +0000 (21:14 +0200)]
s3:smb2_server: simplify smbd_smb2_request_verify_creditcharge() a bit.

A credit charge of 0 is really not a special case, it just means the same
as 1.

metze

11 years agos3:smb2_negprot: support SMB2_CAP_LARGE_MTU on everything but port 139
Stefan Metzmacher [Mon, 25 Jun 2012 19:40:00 +0000 (21:40 +0200)]
s3:smb2_negprot: support SMB2_CAP_LARGE_MTU on everything but port 139

In future we'll have other transports like RDMA.
This makes NBT (tcp port 139) special instead of port 445.

metze

11 years agos3:smb2_server: grant extra credits for multi-credit requests
Stefan Metzmacher [Mon, 25 Jun 2012 19:45:54 +0000 (21:45 +0200)]
s3:smb2_server: grant extra credits for multi-credit requests

metze

11 years agos3:smb2_server: implement credit granting similar to windows
Stefan Metzmacher [Wed, 27 Jun 2012 13:33:43 +0000 (15:33 +0200)]
s3:smb2_server: implement credit granting similar to windows

This makes it much easier to compare traces.

metze

11 years agos3:smb2_server: make sure sequence numbers don't wrap at UINT64_MAX
Stefan Metzmacher [Wed, 27 Jun 2012 13:33:43 +0000 (15:33 +0200)]
s3:smb2_server: make sure sequence numbers don't wrap at UINT64_MAX

metze

11 years agos3:smb2_server: make sure we don't grant more credits than we allow
Stefan Metzmacher [Wed, 27 Jun 2012 13:33:43 +0000 (15:33 +0200)]
s3:smb2_server: make sure we don't grant more credits than we allow

If the client hasn't consumed the lowest seqnum, but the distance
between lowest and highest seqnum has reached max credits.

In that case we should stop granting credits.

metze

11 years agos3:smb2_server: check the credit_charge against the already granted credits
Stefan Metzmacher [Tue, 26 Jun 2012 12:28:07 +0000 (14:28 +0200)]
s3:smb2_server: check the credit_charge against the already granted credits

metze

11 years agos3:smb2_server: split out a smb2_validate_sequence_number() function
Stefan Metzmacher [Mon, 25 Jun 2012 21:17:55 +0000 (23:17 +0200)]
s3:smb2_server: split out a smb2_validate_sequence_number() function

metze

11 years agos3:smb2_server: clear sequence window if we got the lowest sequence id
Stefan Metzmacher [Tue, 26 Jun 2012 06:08:37 +0000 (08:08 +0200)]
s3:smb2_server: clear sequence window if we got the lowest sequence id

Otherwise we'll never consume sequence id '0'.

metze

11 years agos3:smb2_server: fix calculation of the next bitmap_offset
Stefan Metzmacher [Mon, 25 Jun 2012 21:39:37 +0000 (23:39 +0200)]
s3:smb2_server: fix calculation of the next bitmap_offset

metze

11 years agos3:smb2_server: remove unused and confusing DEFAULT_SMB2_MAX_CREDIT_BITMAP_FACTOR
Stefan Metzmacher [Mon, 25 Jun 2012 21:38:32 +0000 (23:38 +0200)]
s3:smb2_server: remove unused and confusing DEFAULT_SMB2_MAX_CREDIT_BITMAP_FACTOR

metze

11 years agos3:smb2_server: call smbd_smb2_request_validate() also in smbd_smb2_first_negprot()
Stefan Metzmacher [Mon, 25 Jun 2012 21:14:24 +0000 (23:14 +0200)]
s3:smb2_server: call smbd_smb2_request_validate() also in smbd_smb2_first_negprot()

We need to consume message_id 0, for SMB1 negprot starts.

metze

11 years agos3:smb2_server: start the connection with one credit granted to the client
Stefan Metzmacher [Tue, 26 Jun 2012 12:23:12 +0000 (14:23 +0200)]
s3:smb2_server: start the connection with one credit granted to the client

metze

11 years agos3: fine tune and clean up statvfs tests
Björn Jacke [Thu, 28 Jun 2012 19:17:28 +0000 (21:17 +0200)]
s3: fine tune and clean up statvfs tests

This should also fix the build on Tru64. Tru64 has a POSIX compliant statvfs()
function while most *BSD systems ignore POSIX.

Autobuild-User(master): Björn Jacke <bj@sernet.de>
Autobuild-Date(master): Thu Jun 28 23:07:23 CEST 2012 on sn-devel-104

11 years agodocs-xml: fix typos and format in smb.conf server max protocol man
Björn Baumbach [Wed, 27 Jun 2012 11:06:50 +0000 (13:06 +0200)]
docs-xml: fix typos and format in smb.conf server max protocol man

11 years agopackaging(RHEL-CTDB): fix build dependencies
Björn Baumbach [Thu, 3 May 2012 12:11:42 +0000 (14:11 +0200)]
packaging(RHEL-CTDB): fix build dependencies

Building manual pages needs rsync for copying built mans.
source3/script/installmo.sh calls msgfmt, thats part of gettext.

11 years agoselftest: run pdbtest against s3dc as well
Andrew Bartlett [Thu, 28 Jun 2012 11:21:23 +0000 (21:21 +1000)]
selftest: run pdbtest against s3dc as well

This validates the password expiry, account disable in the s3 auth code
and the save/restore of values in tdbsam.

It also provides the first test of some net sam set subcommands.

Andrew Bartlett

Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Thu Jun 28 20:39:38 CEST 2012 on sn-devel-104

11 years agoselftest: use a loop rather than declare tests for both dc and s3dc
Andrew Bartlett [Thu, 28 Jun 2012 10:42:31 +0000 (20:42 +1000)]
selftest: use a loop rather than declare tests for both dc and s3dc

11 years agolibrpc/ndr: Initilaise the remainder of struct dom_sid after a pull
Andrew Bartlett [Tue, 26 Jun 2012 10:07:32 +0000 (20:07 +1000)]
librpc/ndr: Initilaise the remainder of struct dom_sid after a pull

This copes with the fact that r->sub_auths is a fixed-size array, not
an allocated pointer, and so will still have some bytes no filled in
if the sid did not have a MAX_SUB_AUTHS sub-authorities.

Andrew Bartlett

11 years agos4-torture: fix typo in samlogon test.
Günther Deschner [Thu, 28 Jun 2012 12:57:17 +0000 (14:57 +0200)]
s4-torture: fix typo in samlogon test.

Guenther

Autobuild-User(master): Günther Deschner <gd@samba.org>
Autobuild-Date(master): Thu Jun 28 18:43:46 CEST 2012 on sn-devel-104

11 years agos4-torture: use torture context for printing debug output.
Günther Deschner [Thu, 28 Jun 2012 11:59:50 +0000 (13:59 +0200)]
s4-torture: use torture context for printing debug output.

Guenther

11 years agos3: Fix compilation of pthreadpool_sync.c on platforms without pthread.h
Volker Lendecke [Thu, 28 Jun 2012 09:19:31 +0000 (11:19 +0200)]
s3: Fix compilation of pthreadpool_sync.c on platforms without pthread.h

Signed-off-by: Bjoern Jacke <bj@sernet.de>
Autobuild-User(master): Björn Jacke <bj@sernet.de>
Autobuild-Date(master): Thu Jun 28 16:43:13 CEST 2012 on sn-devel-104

11 years agos3:smbd: change nt_open_pipe() to uint16_t pnum/fnum
Stefan Metzmacher [Thu, 28 Jun 2012 10:22:07 +0000 (12:22 +0200)]
s3:smbd: change nt_open_pipe() to uint16_t pnum/fnum

This is SMB1 code...

metze

Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Thu Jun 28 14:47:45 CEST 2012 on sn-devel-104

11 years agos3:smb2_create: add usefull DEBUG() message
Stefan Metzmacher [Thu, 28 Jun 2012 08:02:01 +0000 (10:02 +0200)]
s3:smb2_create: add usefull DEBUG() message

All calls which take an file handle have the same,
so we should also log it, when we create a handle.

metze

Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Thu Jun 28 12:41:49 CEST 2012 on sn-devel-104

11 years agos3:smbd/files: fsp->fnum is uint64_t not int!
Stefan Metzmacher [Thu, 28 Jun 2012 08:00:37 +0000 (10:00 +0200)]
s3:smbd/files: fsp->fnum is uint64_t not int!

metze

11 years agos3:brlock: s/int/uint64_t for fnum
Stefan Metzmacher [Thu, 28 Jun 2012 07:54:41 +0000 (09:54 +0200)]
s3:brlock: s/int/uint64_t for fnum

fsp->fnum and lock->fnum are uint64_t already and we should not truncate the value here.

Currently this doesn't matter as we only use 16-bit.

But as 'int' is int32_t and we later compare fnum with lock->fnum == fnum,
the cast from int32_t to uint64_t goes via int64_t instead of uint32_t.

This means even if fsp->fnum just uses 32-bit of the uint64_t
we'll get the wrong result, as the implicit cast from a negative int32_t
value to uint64_t adds 0xFFFFFFFF00000000.

metze

11 years agos3:brlock: add some const to print_lock_struct()
Stefan Metzmacher [Thu, 28 Jun 2012 07:54:14 +0000 (09:54 +0200)]
s3:brlock: add some const to print_lock_struct()

metze

11 years agos3:wscript: use LOCKING subsystem for smbtorture3
Stefan Metzmacher [Wed, 27 Jun 2012 22:51:45 +0000 (00:51 +0200)]
s3:wscript: use LOCKING subsystem for smbtorture3

metze

11 years agosource4/smbd/pidfile: don't panic if pid file is corrupt.
Rusty Russell [Thu, 28 Jun 2012 01:34:25 +0000 (11:04 +0930)]
source4/smbd/pidfile: don't panic if pid file is corrupt.

In particular, on a virtual machine after a forced reboot, it
contained "Ille" instead of a valid PID.  Given it was the right
length, I'm assuming it was filesystem corruption.

process_exists_by_pid() then panics, when given a pid < 1.

Reported-by: lostogre on #samba-technical
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Autobuild-User(master): Rusty Russell <rusty@rustcorp.com.au>
Autobuild-Date(master): Thu Jun 28 05:19:24 CEST 2012 on sn-devel-104

11 years agoreplace: define INT64_MAX when not defined
Björn Jacke [Wed, 27 Jun 2012 17:23:15 +0000 (19:23 +0200)]
replace: define INT64_MAX when not defined

Tru64 doesn't have any stdint.h

Autobuild-User(master): Björn Jacke <bj@sernet.de>
Autobuild-Date(master): Thu Jun 28 00:45:58 CEST 2012 on sn-devel-104

11 years agos3-param: Rename loadparm_s3_context -> loadparm_s3_helpers
Andrew Bartlett [Wed, 27 Jun 2012 13:24:39 +0000 (23:24 +1000)]
s3-param: Rename loadparm_s3_context -> loadparm_s3_helpers

This helps clarify the role of this structure and wrapper function.

The purpose here is to provide helper functions to the lib/param
loadparm_context that point back at the s3 lp_ functions.  This allows
a struct loadparm_context to be passed to any point in the code, and
always refer to the correct loadparm system.  If this has not been
set, the variables loaded in the lib/param code will be returned.

As requested by Michael Adam.

Andrew Bartlett

Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Wed Jun 27 17:11:16 CEST 2012 on sn-devel-104

11 years agos3-pdb_samba4: Remove dupliate profilePath handling
Andrew Bartlett [Wed, 27 Jun 2012 09:23:05 +0000 (19:23 +1000)]
s3-pdb_samba4: Remove dupliate profilePath handling

Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Wed Jun 27 13:16:26 CEST 2012 on sn-devel-104

11 years agos4-selftest: expand passdb testing
Andrew Bartlett [Tue, 26 Jun 2012 10:59:25 +0000 (20:59 +1000)]
s4-selftest: expand passdb testing

This tests pdb_samba4 in the first instance

11 years agos3-pdbtest: Initialise more elements for testing
Andrew Bartlett [Wed, 27 Jun 2012 04:36:31 +0000 (14:36 +1000)]
s3-pdbtest: Initialise more elements for testing

If these were left as defaults, they cause issues when the backend (pdb_samba4)
returns the internal defaults from the directory, not the defaults from samu_new()

Andrew Bartlett

11 years agos3-pdb_samba4: Add support for lastLogon and lastLogoff
Andrew Bartlett [Wed, 27 Jun 2012 04:34:47 +0000 (14:34 +1000)]
s3-pdb_samba4: Add support for lastLogon and lastLogoff

11 years agos3-pdb_samba4: Fix time handling, use nt_time_to_unix()
Andrew Bartlett [Wed, 27 Jun 2012 04:56:04 +0000 (14:56 +1000)]
s3-pdb_samba4: Fix time handling, use nt_time_to_unix()

This matches 478d74fe1447c4588b14ef7040c8c13339d54026 which I failed to
merge from pdb_ads.

Andrew Bartlett

11 years agolib/ldb: Print trace messages for modify correctly
Andrew Bartlett [Wed, 27 Jun 2012 04:33:42 +0000 (14:33 +1000)]
lib/ldb: Print trace messages for modify correctly

11 years agos4-selftest: Test login with a password expired user
Andrew Bartlett [Wed, 27 Jun 2012 02:47:59 +0000 (12:47 +1000)]
s4-selftest: Test login with a password expired user

This uses rkpty to test changing an expired password.

Andrew Bartlett

11 years agos4-dsdb when setting DSDB_CONTROL_PASSWORD_BYPASS_LAST_SET_OID make it non-critical
Andrew Bartlett [Wed, 27 Jun 2012 02:45:37 +0000 (12:45 +1000)]
s4-dsdb when setting DSDB_CONTROL_PASSWORD_BYPASS_LAST_SET_OID make it non-critical

11 years agos4-dsdb: Remove hooks for non-directory password handling
Andrew Bartlett [Wed, 27 Jun 2012 02:42:31 +0000 (12:42 +1000)]
s4-dsdb: Remove hooks for non-directory password handling

This was an interesting hack, and the local_password module still exists, but
until it has a use case and a test case, remove the bypass of password_hash.

Andrew Bartlett

11 years agoselftest: allow NSS_WRAPPER_* vars to be exported to the environment
Andrew Bartlett [Wed, 27 Jun 2012 02:40:59 +0000 (12:40 +1000)]
selftest: allow NSS_WRAPPER_* vars to be exported to the environment

11 years agoselftest: Add extra users to nss_wrapper
Andrew Bartlett [Wed, 27 Jun 2012 07:51:55 +0000 (17:51 +1000)]
selftest: Add extra users to nss_wrapper

These will be used for a test using pdbtest and to run the client
test environment under nss_wrapper.

Andrew Bartlett

11 years agos3-pdbtest: show mis-matching times
Andrew Bartlett [Tue, 26 Jun 2012 23:04:46 +0000 (09:04 +1000)]
s3-pdbtest: show mis-matching times

11 years agos3:registry: change reg_import.c according to coding guidelines.
Michael Adam [Wed, 27 Jun 2012 06:20:59 +0000 (08:20 +0200)]
s3:registry: change reg_import.c according to coding guidelines.

Autobuild-User(master): Michael Adam <obnox@samba.org>
Autobuild-Date(master): Wed Jun 27 10:07:54 CEST 2012 on sn-devel-104

11 years agos3:registry: use TALLOC_CTX * instead of const void * in reg_import_adapter()
Michael Adam [Wed, 27 Jun 2012 06:20:31 +0000 (08:20 +0200)]
s3:registry: use TALLOC_CTX * instead of const void * in reg_import_adapter()

11 years agos3: add a tool "cclean" to cleanup orphaned entries from connections.tdb
Gregor Beck [Thu, 7 Jun 2012 11:34:35 +0000 (13:34 +0200)]
s3: add a tool "cclean" to cleanup orphaned entries from connections.tdb

Signed-off-by: Michael Adam <obnox@samba.org>
11 years agos3:conn_tdb: add a function connections_fetch_entry_ext() that also takes the cnum
Gregor Beck [Thu, 7 Jun 2012 11:25:17 +0000 (13:25 +0200)]
s3:conn_tdb: add a function connections_fetch_entry_ext() that also takes the cnum

and have connections_fetch_entry() call connections_fetch_entry_ext().

Signed-off-by: Michael Adam <obnox@samba.org>
11 years agos3:lib:dbwrap: fix return value of db_ctdb_traverse[_read] for non-persistent dbs
Gregor Beck [Tue, 12 Jun 2012 08:10:36 +0000 (10:10 +0200)]
s3:lib:dbwrap: fix return value of db_ctdb_traverse[_read] for non-persistent dbs

to return the number of traversed records upon successful traverse.

Signed-off-by: Michael Adam <obnox@samba.org>
11 years agos3-printing: fix broken print_job_get_name() return
David Disseldorp [Tue, 26 Jun 2012 23:23:57 +0000 (01:23 +0200)]
s3-printing: fix broken print_job_get_name() return

Autobuild-User(master): David Disseldorp <ddiss@samba.org>
Autobuild-Date(master): Wed Jun 27 04:04:56 CEST 2012 on sn-devel-104

11 years agos3:test_net_registry_check.sh: grep -E isn't portable, use egrep
Björn Jacke [Tue, 26 Jun 2012 22:25:53 +0000 (00:25 +0200)]
s3:test_net_registry_check.sh: grep -E isn't portable, use egrep

grep -E doesn't work on Solaris /usr/bin/grep e.g.

Autobuild-User(master): Björn Jacke <bj@sernet.de>
Autobuild-Date(master): Wed Jun 27 02:18:07 CEST 2012 on sn-devel-104

11 years agotests: make test_ldb portable, eliminate "local" keyword
Björn Jacke [Tue, 26 Jun 2012 10:23:41 +0000 (12:23 +0200)]
tests: make test_ldb portable, eliminate "local" keyword

this is BASH only, don't use it.

11 years agos3:net registry import: implement dry-run with "--test"
Michael Adam [Tue, 26 Jun 2012 13:35:32 +0000 (15:35 +0200)]
s3:net registry import: implement dry-run with "--test"

Pair-Programmed-With: Gregor Beck <gbeck@sernet.de>

Autobuild-User(master): Michael Adam <obnox@samba.org>
Autobuild-Date(master): Tue Jun 26 21:43:49 CEST 2012 on sn-devel-104

11 years agos3:net registry import: add an assert
Michael Adam [Tue, 26 Jun 2012 13:13:28 +0000 (15:13 +0200)]
s3:net registry import: add an assert

Pair-Programmed-With: Gergor Beck <gbeck@sernet.de>

11 years agos3:net registry import: reduce indentation
Michael Adam [Tue, 26 Jun 2012 13:12:28 +0000 (15:12 +0200)]
s3:net registry import: reduce indentation

Pair-Programmed-With: Gregor Beck <gbeck@sernet.de>

11 years agos3:net registry import: fix the return code when transaction commit fails
Michael Adam [Tue, 26 Jun 2012 13:11:22 +0000 (15:11 +0200)]
s3:net registry import: fix the return code when transaction commit fails

Pair-Programmed-With: Gregor Beck <gbeck@sernet.de>

11 years agos3:net registry import: improve regdb_open/close layering
Michael Adam [Tue, 26 Jun 2012 13:02:41 +0000 (15:02 +0200)]
s3:net registry import: improve regdb_open/close layering

Pair-Programmed-With: Gregor Beck <gbeck@sernet.de>