[SCM] Samba Shared Repository - branch master updated

2010-06-04 Thread Günther Deschner
The branch, master has been updated
   via  bb4693d... s4-smbtorture: completely rework RPC-SPOOLSS-PRINTER.
   via  789125f... s4-smbtorture: rework order of test in 
RPC-SPOOLSS-PRINTSERVER a bit.
  from  e8576ef... ѕ3:Makefile: use PIC instead of PIE flags for shared 
libs

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -
commit bb4693d15e18d7ee775d45cf7519b2352d9d5d7a
Author: Günther Deschner 
Date:   Thu Jun 3 21:39:51 2010 +0200

s4-smbtorture: completely rework RPC-SPOOLSS-PRINTER.

This is now a child testsuite to RPC-SPOOLSS. You can call simple tests via
RPC-SPOOLSS-{addprinter,addprinterex}-testname.

Guenther

commit 789125f9a4fedaf31968893e77a19316a47186fe
Author: Günther Deschner 
Date:   Thu Jun 3 20:48:49 2010 +0200

s4-smbtorture: rework order of test in RPC-SPOOLSS-PRINTSERVER a bit.

Guenther

---

Summary of changes:
 source4/torture/rpc/rpc.c |1 -
 source4/torture/rpc/spoolss.c |  848 +
 2 files changed, 522 insertions(+), 327 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source4/torture/rpc/rpc.c b/source4/torture/rpc/rpc.c
index 63ebe6c..746698e 100644
--- a/source4/torture/rpc/rpc.c
+++ b/source4/torture/rpc/rpc.c
@@ -444,7 +444,6 @@ NTSTATUS torture_rpc_init(void)
torture_suite_add_suite(suite, torture_rpc_spoolss(suite));
torture_suite_add_suite(suite, torture_rpc_spoolss_notify(suite));
torture_suite_add_suite(suite, torture_rpc_spoolss_win(suite));
-   torture_suite_add_suite(suite, torture_rpc_spoolss_printer(suite));
torture_suite_add_suite(suite, torture_rpc_spoolss_driver(suite));
torture_suite_add_simple_test(suite, "SAMR", torture_rpc_samr);
torture_suite_add_simple_test(suite, "SAMR-USERS", 
torture_rpc_samr_users);
diff --git a/source4/torture/rpc/spoolss.c b/source4/torture/rpc/spoolss.c
index 6d04690..7154b83 100644
--- a/source4/torture/rpc/spoolss.c
+++ b/source4/torture/rpc/spoolss.c
@@ -96,6 +96,7 @@ struct torture_driver_context {
 };
 
 struct torture_printer_context {
+   struct dcerpc_pipe *spoolss_pipe;
struct spoolss_SetPrinterInfo2 info2;
struct torture_driver_context driver;
bool ex;
@@ -103,6 +104,7 @@ struct torture_printer_context {
bool added_driver;
bool have_driver;
struct spoolss_DeviceMode *devmode;
+   struct policy_handle handle;
 };
 
 static bool upload_printer_driver(struct torture_context *tctx,
@@ -1383,6 +1385,8 @@ static bool test_PrinterInfo(struct torture_context *tctx,
bool ret = true;
int i;
 
+   torture_skip(tctx, "Printer Info test is currently broken, skipping");
+
uint32_t status_list[] = {
/* these do not stick
PRINTER_STATUS_PAUSED,
@@ -5623,10 +5627,12 @@ static bool call_OpenPrinterEx(struct torture_context 
*tctx,
 }
 
 static bool test_printer_rename(struct torture_context *tctx,
-   struct dcerpc_pipe *p,
-   struct policy_handle *handle,
-   const char *name)
+   void *private_data)
 {
+   struct torture_printer_context *t =
+   (struct torture_printer_context 
*)talloc_get_type_abort(private_data, struct torture_printer_context);
+   struct dcerpc_pipe *p = t->spoolss_pipe;
+
bool ret = true;
union spoolss_PrinterInfo info;
union spoolss_SetPrinterInfo sinfo;
@@ -5646,7 +5652,7 @@ static bool test_printer_rename(struct torture_context 
*tctx,
torture_comment(tctx, "Testing Printer rename operations\n");
 
torture_assert(tctx,
-   test_GetPrinter_level(tctx, b, handle, 2, &info),
+   test_GetPrinter_level(tctx, b, &t->handle, 2, &info),
"failed to call GetPrinter level 2");
 
printer_name_orig = talloc_strdup(tctx, info.info2.printername);
@@ -5666,11 +5672,11 @@ static bool test_printer_rename(struct torture_context 
*tctx,
info_ctr.info = sinfo;
 
torture_assert(tctx,
-   test_SetPrinter(tctx, b, handle, &info_ctr, &devmode_ctr, 
&secdesc_ctr, 0),
+   test_SetPrinter(tctx, b, &t->handle, &info_ctr, &devmode_ctr, 
&secdesc_ctr, 0),
"failed to call SetPrinter level 2");
 
torture_assert(tctx,
-   test_GetPrinter_level(tctx, b, handle, 2, &info),
+   test_GetPrinter_level(tctx, b, &t->handle, 2, &info),
"failed to call GetPrinter level 2");
 
printer_name = talloc_strdup(tctx, info.info2.printername);
@@ -5765,7 +5771,7 @@ static bool test_OpenPrinterEx(struct torture_context 
*tctx,
ret = false;
}
 
-   if (!test_printer_keys(tctx, b, &handle)) 

[SCM] Samba Shared Repository - branch master updated

2010-06-04 Thread Günther Deschner
The branch, master has been updated
   via  09daf63... s3-selftest: do not call main RPC-SPOOLSS testsuite.
  from  bb4693d... s4-smbtorture: completely rework RPC-SPOOLSS-PRINTER.

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -
commit 09daf63c9332d0314dee6c7a46b95aacb470940b
Author: Günther Deschner 
Date:   Fri Jun 4 14:31:08 2010 +0200

s3-selftest: do not call main RPC-SPOOLSS testsuite.

The tests formerly available in there can now be accessed via
RPC-SPOOLSS-PRINTSERVER.

Guenther

---

Summary of changes:
 source3/script/tests/test_posix_s3.sh |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/script/tests/test_posix_s3.sh 
b/source3/script/tests/test_posix_s3.sh
index c1ca4d1..3864b6b 100755
--- a/source3/script/tests/test_posix_s3.sh
+++ b/source3/script/tests/test_posix_s3.sh
@@ -42,7 +42,7 @@ rpc="$rpc RPC-SAMBA3-SPOOLSS RPC-SAMBA3-WKSSVC 
RPC-SAMBA3-WINREG"
 rpc="$rpc RPC-SAMBA3-GETALIASMEMBERSHIP-0"
 rpc="$rpc RPC-SAMBA3-NETLOGON RPC-SAMBA3-SESSIONKEY RPC-SAMBA3-GETUSERNAME"
 rpc="$rpc RPC-SVCCTL RPC-NTSVCS RPC-WINREG RPC-EVENTLOG"
-rpc="$rpc RPC-SPOOLSS RPC-SPOOLSS-WIN RPC-SPOOLSS-NOTIFY RPC-SPOOLSS-PRINTER"
+rpc="$rpc RPC-SPOOLSS-PRINTSERVER RPC-SPOOLSS-WIN RPC-SPOOLSS-NOTIFY 
RPC-SPOOLSS-PRINTER"
 rpc="$rpc RPC-SPOOLSS-DRIVER"
 rpc="$rpc RPC-LSA-GETUSER RPC-LSA-LOOKUPSIDS RPC-LSA-LOOKUPNAMES"
 rpc="$rpc RPC-LSA-PRIVILEGES "


-- 
Samba Shared Repository


[SCM] Samba Shared Repository - branch master updated

2010-06-04 Thread Simo Sorce
The branch, master has been updated
   via  15f64af... s3-rpc: Create a file with all functions for a internal 
named pipe.
   via  3344adc... s3-rpc: Seperate rpc_srv_register for plain connection.
   via  9097bdd... s3-auth: Moved smbd user functions to a generic place.
   via  fad86dd... s3-smbd: Remove unneeded dependency of map_username to 
globals.c.
  from  09daf63... s3-selftest: do not call main RPC-SPOOLSS testsuite.

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -
commit 15f64af8e3d5aa889a9c9fb852a3357237ba9972
Author: Andreas Schneider 
Date:   Thu Jun 3 22:04:08 2010 +0200

s3-rpc: Create a file with all functions for a internal named pipe.

This makes it possible to use the samr rpc server in winbind without
linking in smbd.

Reviewed-by: Simo Sorce 

commit 3344adc3404df47f02f6eb3096cb623ae94850b8
Author: Andreas Schneider 
Date:   Thu Jun 3 22:01:46 2010 +0200

s3-rpc: Seperate rpc_srv_register for plain connection.

This will make it possible to create plain rpc named pipe connnections.

Reviewed-by: Simo Sorce 

commit 9097b03f81579699e0d0ce725a7453a3a158
Author: Andreas Schneider 
Date:   Wed Jun 2 19:39:18 2010 +0200

s3-auth: Moved smbd user functions to a generic place.

Reviewed-by: Simo Sorce 

commit fad86ddf5531c8f5862b697e99c24a7bd526d73e
Author: Andreas Schneider 
Date:   Mon May 31 18:33:38 2010 +0200

s3-smbd: Remove unneeded dependency of map_username to globals.c.

Reviewed-by: Simo Sorce 

---

Summary of changes:
 source3/Makefile.in|   10 +-
 source3/auth/user_util.c   |  406 
 source3/include/proto.h|4 +
 source3/rpc_server/rpc_ncacn_np_internal.c |  242 +
 source3/rpc_server/srv_pipe.c  |  157 +++-
 source3/rpc_server/srv_pipe_hnd.c  |  203 --
 source3/rpc_server/srv_pipe_internal.h |   42 +++
 source3/rpc_server/srv_pipe_register.c |  200 ++
 source3/smbd/globals.c |3 -
 source3/smbd/globals.h |3 -
 source3/smbd/map_username.c|  271 ---
 source3/smbd/password.c|  133 -
 source3/wscript_build  |9 +-
 13 files changed, 939 insertions(+), 744 deletions(-)
 create mode 100644 source3/auth/user_util.c
 create mode 100644 source3/rpc_server/rpc_ncacn_np_internal.c
 create mode 100644 source3/rpc_server/srv_pipe_internal.h
 create mode 100644 source3/rpc_server/srv_pipe_register.c
 delete mode 100644 source3/smbd/map_username.c


Changeset truncated at 500 lines:

diff --git a/source3/Makefile.in b/source3/Makefile.in
index 82407e5..d9e4ec5 100644
--- a/source3/Makefile.in
+++ b/source3/Makefile.in
@@ -653,8 +653,11 @@ RPC_EVENTLOG_OBJ = rpc_server/srv_eventlog_nt.o \
 
 NPA_TSTREAM_OBJ = ../libcli/named_pipe_auth/npa_tstream.o
 
-RPC_PIPE_OBJ = rpc_server/srv_pipe_hnd.o \
-   rpc_server/srv_pipe.o rpc_server/srv_lsa_hnd.o
+RPC_NCACN_NP_INTERNAL = rpc_server/srv_pipe_register.o 
rpc_server/rpc_ncacn_np_internal.o \
+   rpc_server/srv_lsa_hnd.o
+
+RPC_PIPE_OBJ = rpc_server/srv_pipe.o rpc_server/srv_pipe_hnd.o \
+  $(RPC_NCACN_NP_INTERNAL)
 
 RPC_ECHO_OBJ = rpc_server/srv_echo_nt.o librpc/gen_ndr/srv_echo.o
 
@@ -772,6 +775,7 @@ AUTH_OBJ = auth/auth.o @AUTH_STATIC@ auth/auth_util.o 
auth/token_util.o \
   auth/server_info.o \
   auth/server_info_sam.o \
   auth/user_info.o \
+  auth/user_util.o \
   auth/auth_compat.o auth/auth_ntlmssp.o \
   $(PLAINTEXT_AUTH_OBJ) $(SLCACHE_OBJ) $(DCUTIL_OBJ)
 
@@ -783,7 +787,7 @@ BUILDOPT_OBJ = smbd/build_options.o
 
 SMBD_OBJ_SRV = smbd/server_reload.o \
   smbd/files.o smbd/connection.o \
-  smbd/utmp.o smbd/session.o smbd/map_username.o \
+  smbd/utmp.o smbd/session.o \
smbd/dfree.o smbd/dir.o smbd/password.o smbd/conn.o \
   smbd/share_access.o smbd/fileio.o \
smbd/ipc.o smbd/lanman.o smbd/negprot.o \
diff --git a/source3/auth/user_util.c b/source3/auth/user_util.c
new file mode 100644
index 000..3d7123c
--- /dev/null
+++ b/source3/auth/user_util.c
@@ -0,0 +1,406 @@
+/*
+   Unix SMB/CIFS implementation.
+   Username handling
+   Copyright (C) Andrew Tridgell 1992-1998
+   Copyright (C) Jeremy Allison 1997-2001.
+   Copyright (C) Volker Lendecke 2006
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distribute

[SCM] Samba Shared Repository - branch master updated

2010-06-04 Thread Jeremy Allison
The branch, master has been updated
   via  e0acee4... Change smbd_aio_complete_mid() -> 
smbd_aio_complete_aio_ex(). Simplifies the code and eliminates find_aio_ex().
  from  15f64af... s3-rpc: Create a file with all functions for a internal 
named pipe.

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -
commit e0acee4919d1f416c98faa1a0ebc779f3716ab70
Author: Jeremy Allison 
Date:   Fri Jun 4 11:30:46 2010 -0700

Change smbd_aio_complete_mid() -> smbd_aio_complete_aio_ex(). Simplifies
the code and eliminates find_aio_ex().

Jeremy.

---

Summary of changes:
 source3/include/proto.h|2 +-
 source3/include/smb.h  |3 +++
 source3/modules/vfs_aio_fork.c |9 ++---
 source3/smbd/aio.c |   36 
 4 files changed, 10 insertions(+), 40 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/include/proto.h b/source3/include/proto.h
index 884ce3f..41ab440 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -5321,7 +5321,7 @@ NTSTATUS schedule_aio_write_and_X(connection_struct *conn,
  size_t numtowrite);
 int wait_for_aio_completion(files_struct *fsp);
 void cancel_aio_by_fsp(files_struct *fsp);
-void smbd_aio_complete_mid(uint64_t mid);
+void smbd_aio_complete_aio_ex(struct aio_extra *aio_ex);
 
 /* The following definitions come from smbd/blocking.c  */
 
diff --git a/source3/include/smb.h b/source3/include/smb.h
index d20a04e..877588a 100644
--- a/source3/include/smb.h
+++ b/source3/include/smb.h
@@ -1963,4 +1963,7 @@ struct deferred_open_record;
 #define CSC_POLICY_PROGRAMS 2
 #define CSC_POLICY_DISABLE 3
 
+/* Used inside aio code. */
+struct aio_extra;
+
 #endif /* _SMB_H */
diff --git a/source3/modules/vfs_aio_fork.c b/source3/modules/vfs_aio_fork.c
index 8fd8936..38a1c21 100644
--- a/source3/modules/vfs_aio_fork.c
+++ b/source3/modules/vfs_aio_fork.c
@@ -382,8 +382,8 @@ static void handle_aio_completion(struct event_context 
*event_ctx,
  struct fd_event *event, uint16 flags,
  void *p)
 {
+   struct aio_extra *aio_ex = NULL;
struct aio_child *child = (struct aio_child *)p;
-   uint64_t mid;
 
DEBUG(10, ("handle_aio_completion called with flags=%d\n", flags));
 
@@ -411,12 +411,7 @@ static void handle_aio_completion(struct event_context 
*event_ctx,
   child->retval.size);
}
 
-   /* FIXME - this won't work for SMB2. */
-   mid = (uint64_t)child->aiocb->aio_sigevent.sigev_value.sival_int;
-
-   DEBUG(10, ("mid %d finished\n", (int)mid));
-
-   smbd_aio_complete_mid(mid);
+   smbd_aio_complete_aio_ex(aio_ex);
 }
 
 static int aio_child_destructor(struct aio_child *child)
diff --git a/source3/smbd/aio.c b/source3/smbd/aio.c
index 8cc26f1..c7a70b3 100644
--- a/source3/smbd/aio.c
+++ b/source3/smbd/aio.c
@@ -62,7 +62,7 @@ static void smbd_aio_signal_handler(struct tevent_context 
*ev_ctx,
struct aio_extra *aio_ex = (struct aio_extra *)
info->si_value.sival_ptr;
 
-   smbd_aio_complete_mid(aio_ex->req->mid);
+   smbd_aio_complete_aio_ex(aio_ex);
 }
 
 
@@ -123,26 +123,6 @@ static struct aio_extra *create_aio_extra(files_struct 
*fsp, size_t buflen)
 }
 
 /
- Given the mid find the extended aio struct containing it.
-*/
-
-static struct aio_extra *find_aio_ex(uint64_t mid)
-{
-   struct aio_extra *p;
-
-   for( p = aio_list_head; p; p = p->next) {
-   if (mid == p->req->mid) {
-   return p;
-   }
-   }
-   return NULL;
-}
-
-/
- We can have these many aio buffers in flight.
-*/
-
-/
  Set up an aio request from a SMBreadX call.
 */
 
@@ -577,23 +557,15 @@ static bool handle_aio_completed(struct aio_extra 
*aio_ex, int *perr)
  Handle any aio completion inline.
 */
 
-void smbd_aio_complete_mid(uint64_t mid)
+void smbd_aio_complete_aio_ex(struct aio_extra *aio_ex)
 {
files_struct *fsp = NULL;
-   struct aio_extra *aio_ex = find_aio_ex(mid);
int ret = 0;
 
outstanding_aio_calls--;
 
DEBUG(10,("smbd_aio_complete_mid: mid[%llu]\n",
-   (unsigned long long)mid));
-
-   if (!aio_ex) {
-   DE

[SCM] Samba Shared Repository - branch master updated

2010-06-04 Thread Jeremy Allison
The branch, master has been updated
   via  b12409a... wait_for_aio_completion() should return 0 on non-aio 
compiled case.
   via  be5133f... Rename req -> smbreq.
  from  e0acee4... Change smbd_aio_complete_mid() -> 
smbd_aio_complete_aio_ex(). Simplifies the code and eliminates find_aio_ex().

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -
commit b12409a480410116b88f8c6a4522a79056ccbaff
Author: Jeremy Allison 
Date:   Fri Jun 4 11:41:57 2010 -0700

wait_for_aio_completion() should return 0 on non-aio compiled case.

commit be5133f1e07599862ae732056161be6c124a0664
Author: Jeremy Allison 
Date:   Fri Jun 4 11:41:38 2010 -0700

Rename req -> smbreq.

---

Summary of changes:
 source3/smbd/aio.c |   54 ++--
 1 files changed, 27 insertions(+), 27 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/smbd/aio.c b/source3/smbd/aio.c
index c7a70b3..ab88b12 100644
--- a/source3/smbd/aio.c
+++ b/source3/smbd/aio.c
@@ -43,7 +43,7 @@ struct aio_extra {
struct aio_extra *next, *prev;
SMB_STRUCT_AIOCB acb;
files_struct *fsp;
-   struct smb_request *req;
+   struct smb_request *smbreq;
DATA_BLOB outbuf;
struct lock_struct lock;
int (*handle_completion)(struct aio_extra *ex, int errcode);
@@ -127,7 +127,7 @@ static struct aio_extra *create_aio_extra(files_struct 
*fsp, size_t buflen)
 */
 
 NTSTATUS schedule_aio_read_and_X(connection_struct *conn,
-struct smb_request *req,
+struct smb_request *smbreq,
 files_struct *fsp, SMB_OFF_T startpos,
 size_t smb_maxcnt)
 {
@@ -158,7 +158,7 @@ NTSTATUS schedule_aio_read_and_X(connection_struct *conn,
 
/* Only do this on non-chained and non-chaining reads not using the
 * write cache. */
-if (req_is_in_chain(req) || (lp_write_cache_size(SNUM(conn)) != 0)) {
+if (req_is_in_chain(smbreq) || (lp_write_cache_size(SNUM(conn)) != 0)) 
{
return NT_STATUS_RETRY;
}
 
@@ -180,11 +180,11 @@ NTSTATUS schedule_aio_read_and_X(connection_struct *conn,
}
aio_ex->handle_completion = handle_aio_read_complete;
 
-   construct_reply_common_req(req, (char *)aio_ex->outbuf.data);
+   construct_reply_common_req(smbreq, (char *)aio_ex->outbuf.data);
srv_set_message((char *)aio_ex->outbuf.data, 12, 0, True);
SCVAL(aio_ex->outbuf.data,smb_vwv0,0xFF); /* Never a chained reply. */
 
-   init_strict_lock_struct(fsp, (uint64_t)req->smbpid,
+   init_strict_lock_struct(fsp, (uint64_t)smbreq->smbpid,
(uint64_t)startpos, (uint64_t)smb_maxcnt, READ_LOCK,
&aio_ex->lock);
 
@@ -216,12 +216,12 @@ NTSTATUS schedule_aio_read_and_X(connection_struct *conn,
}
 
outstanding_aio_calls++;
-   aio_ex->req = talloc_move(aio_ex, &req);
+   aio_ex->smbreq = talloc_move(aio_ex, &smbreq);
 
DEBUG(10,("schedule_aio_read_and_X: scheduled aio_read for file %s, "
  "offset %.0f, len = %u (mid = %u)\n",
  fsp_str_dbg(fsp), (double)startpos, (unsigned int)smb_maxcnt,
- (unsigned int)aio_ex->req->mid ));
+ (unsigned int)aio_ex->smbreq->mid ));
 
return NT_STATUS_OK;
 }
@@ -231,7 +231,7 @@ NTSTATUS schedule_aio_read_and_X(connection_struct *conn,
 */
 
 NTSTATUS schedule_aio_write_and_X(connection_struct *conn,
- struct smb_request *req,
+ struct smb_request *smbreq,
  files_struct *fsp, char *data,
  SMB_OFF_T startpos,
  size_t numtowrite)
@@ -239,7 +239,7 @@ NTSTATUS schedule_aio_write_and_X(connection_struct *conn,
struct aio_extra *aio_ex;
SMB_STRUCT_AIOCB *a;
size_t bufsize;
-   bool write_through = BITSETW(req->vwv+7,0);
+   bool write_through = BITSETW(smbreq->vwv+7,0);
size_t min_aio_write_size = lp_aio_write_size(SNUM(conn));
int ret;
 
@@ -264,7 +264,7 @@ NTSTATUS schedule_aio_write_and_X(connection_struct *conn,
 
/* Only do this on non-chained and non-chaining reads not using the
 * write cache. */
-if (req_is_in_chain(req) || (lp_write_cache_size(SNUM(conn)) != 0)) {
+if (req_is_in_chain(smbreq) || (lp_write_cache_size(SNUM(conn)) != 0)) 
{
return NT_STATUS_RETRY;
}
 
@@ -277,7 +277,7 @@ NTSTATUS schedule_aio_write_and_X(connection_struct *conn,
  "(mid = %u)\n",

[SCM] Samba Shared Repository - branch master updated

2010-06-04 Thread Jeremy Allison
The branch, master has been updated
   via  fb79a8d... Oops. Forgot to re-initialize the aio_ex pointer from 
sival_ptr.
  from  b12409a... wait_for_aio_completion() should return 0 on non-aio 
compiled case.

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -
commit fb79a8d7f0f4b7686983d8c9025c1ebd0445e84f
Author: Jeremy Allison 
Date:   Fri Jun 4 13:49:38 2010 -0700

Oops. Forgot to re-initialize the aio_ex pointer from sival_ptr.

---

Summary of changes:
 source3/modules/vfs_aio_fork.c |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/modules/vfs_aio_fork.c b/source3/modules/vfs_aio_fork.c
index 38a1c21..b026254 100644
--- a/source3/modules/vfs_aio_fork.c
+++ b/source3/modules/vfs_aio_fork.c
@@ -411,6 +411,7 @@ static void handle_aio_completion(struct event_context 
*event_ctx,
   child->retval.size);
}
 
+   aio_ex = (struct aio_extra 
*)child->aiocb->aio_sigevent.sigev_value.sival_ptr;
smbd_aio_complete_aio_ex(aio_ex);
 }
 


-- 
Samba Shared Repository


[SCM] Samba Shared Repository - branch master updated

2010-06-04 Thread Günther Deschner
The branch, master has been updated
   via  e89502e... s4-smbtorture: add RPC-SPOOLSS-ACCESS.
   via  29c0c10... s4-smbtorture: share test_ClosePrinter between 
RPC-SPOOLSS and RPC-SPOOLSS-WIN.
   via  b3ebebd... s3-rpcclient: allow to add access_mask in 
cmd_spoolss_open_printer_ex().
   via  8b3059d... s4-smbtorture: check error codes in RAP-SAM testsuite.
  from  fb79a8d... Oops. Forgot to re-initialize the aio_ex pointer from 
sival_ptr.

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -
commit e89502e0f5a79c960cbecf50f49af3aa4bba8e35
Author: Günther Deschner 
Date:   Fri Jun 4 19:03:11 2010 +0200

s4-smbtorture: add RPC-SPOOLSS-ACCESS.

This test creates

- a user
- a user with BUILTIN\Administrators membership
- a user with BUILTIN\Print Operators membership
- a user with SePrintOperatorPrivilege (if available)
- a user with full access in security descriptor

and checks what access rights are granted in spoolss_OpenPrinterEx.

Guenther

commit 29c0c103afed7238698cc83ff3ab017fc1510dcd
Author: Günther Deschner 
Date:   Fri Jun 4 19:02:17 2010 +0200

s4-smbtorture: share test_ClosePrinter between RPC-SPOOLSS and 
RPC-SPOOLSS-WIN.

Guenther

commit b3ebebd3b18e4d9ebfc50012e02f7011f8d067be
Author: Günther Deschner 
Date:   Fri Jun 4 16:55:07 2010 +0200

s3-rpcclient: allow to add access_mask in cmd_spoolss_open_printer_ex().

Guenther

commit 8b3059de977eeeae69ebff7d33119bd6b565b637
Author: Günther Deschner 
Date:   Fri Jun 4 19:05:24 2010 +0200

s4-smbtorture: check error codes in RAP-SAM testsuite.

Guenther

---

Summary of changes:
 source3/rpcclient/cmd_spoolss.c  |   12 +-
 source4/torture/config.mk|2 +-
 source4/torture/rap/sam.c|2 +
 source4/torture/rpc/rpc.c|1 +
 source4/torture/rpc/spoolss.c|   10 +-
 source4/torture/rpc/spoolss_access.c |  751 ++
 source4/torture/rpc/spoolss_win.c|   19 -
 source4/torture/wscript_build|2 +-
 8 files changed, 766 insertions(+), 33 deletions(-)
 create mode 100644 source4/torture/rpc/spoolss_access.c


Changeset truncated at 500 lines:

diff --git a/source3/rpcclient/cmd_spoolss.c b/source3/rpcclient/cmd_spoolss.c
index d5a7ce7..39c581c 100644
--- a/source3/rpcclient/cmd_spoolss.c
+++ b/source3/rpcclient/cmd_spoolss.c
@@ -105,20 +105,22 @@ static WERROR cmd_spoolss_open_printer_ex(struct 
rpc_pipe_client *cli,
 {
WERROR  werror;
struct policy_handlehnd;
+   uint32_t access_mask = PRINTER_ALL_ACCESS;
 
-   if (argc != 2) {
-   printf("Usage: %s \n", argv[0]);
+   if (argc < 2) {
+   printf("Usage: %s  [access_mask]\n", argv[0]);
return WERR_OK;
}
 
-   if (!cli)
-return WERR_GENERAL_FAILURE;
+   if (argc >= 3) {
+   sscanf(argv[2], "%x", &access_mask);
+   }
 
/* Open the printer handle */
 
werror = rpccli_spoolss_openprinter_ex(cli, mem_ctx,
   argv[1],
-  PRINTER_ALL_ACCESS,
+  access_mask,
   &hnd);
if (W_ERROR_IS_OK(werror)) {
printf("Printer %s opened successfully\n", argv[1]);
diff --git a/source4/torture/config.mk b/source4/torture/config.mk
index 4d65256..25e9b53 100644
--- a/source4/torture/config.mk
+++ b/source4/torture/config.mk
@@ -124,7 +124,7 @@ PRIVATE_DEPENDENCIES = \
 
 torture_rpc_OBJ_FILES = $(addprefix $(torturesrcdir)/rpc/, \
join.o lsa.o lsa_lookup.o session_key.o echo.o dfs.o drsuapi.o \
-   drsuapi_cracknames.o dssync.o dsgetinfo.o spoolss.o 
spoolss_notify.o spoolss_win.o \
+   drsuapi_cracknames.o dssync.o dsgetinfo.o spoolss.o 
spoolss_notify.o spoolss_win.o spoolss_access.o \
unixinfo.o samr.o samr_accessmask.o wkssvc.o srvsvc.o svcctl.o 
atsvc.o \
eventlog.o epmapper.o winreg.o initshutdown.o oxidresolve.o 
remact.o mgmt.o \
scanner.o autoidl.o countcalls.o testjoin.o schannel.o 
netlogon.o remote_pac.o samlogon.o \
diff --git a/source4/torture/rap/sam.c b/source4/torture/rap/sam.c
index 290ba08..144abaa 100644
--- a/source4/torture/rap/sam.c
+++ b/source4/torture/rap/sam.c
@@ -206,6 +206,8 @@ static bool test_usergetinfo_byname(struct torture_context 
*tctx,
torture_assert_ntstatus_ok(tctx,
smbcli_rap_netusergetinfo(cli->tree, tctx, &r),
"smbcli_rap_netusergetinfo failed");
+   torture_assert_werr_ok(tctx, W_ERROR(r.out.status),
+   "smbcli_rap_netusergeti

[SCM] Samba Shared Repository - branch master updated

2010-06-04 Thread Günther Deschner
The branch, master has been updated
   via  6309f7b... s4-smbtorture: make RPC-SPOOLSS-ACCESS more compatible 
with older samba releases.
   via  3ad2fa6... s4-smbtorture: remove another incarnation of 
test_ClosePrinter.
  from  e89502e... s4-smbtorture: add RPC-SPOOLSS-ACCESS.

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -
commit 6309f7b9505d1de60ef01a7129e2d6022cdc8b9d
Author: Günther Deschner 
Date:   Sat Jun 5 01:26:49 2010 +0200

s4-smbtorture: make RPC-SPOOLSS-ACCESS more compatible with older samba 
releases.

Guenther

commit 3ad2fa672818269f2cbb7a63ff71df4f2cc81a95
Author: Günther Deschner 
Date:   Sat Jun 5 01:25:05 2010 +0200

s4-smbtorture: remove another incarnation of test_ClosePrinter.

This should fix the build; why waf didn't catch that durint make 
bin/smbtorture4 ?

Guenther

---

Summary of changes:
 source4/torture/rpc/spoolss_access.c |   15 +--
 source4/torture/rpc/spoolss_notify.c |   19 ---
 2 files changed, 9 insertions(+), 25 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source4/torture/rpc/spoolss_access.c 
b/source4/torture/rpc/spoolss_access.c
index f86c2e3..812a280 100644
--- a/source4/torture/rpc/spoolss_access.c
+++ b/source4/torture/rpc/spoolss_access.c
@@ -357,7 +357,7 @@ static bool spoolss_access_setup_sd(struct torture_context 
*tctx,
 }
 
 static bool test_EnumPrinters_findone(struct torture_context *tctx,
- struct dcerpc_binding_handle *b,
+ struct dcerpc_pipe *p,
  const char **printername)
 {
struct spoolss_EnumPrinters r;
@@ -365,11 +365,12 @@ static bool test_EnumPrinters_findone(struct 
torture_context *tctx,
union spoolss_PrinterInfo *info;
uint32_t needed;
int i;
+   struct dcerpc_binding_handle *b = p->binding_handle;
 
*printername = NULL;
 
r.in.flags = PRINTER_ENUM_LOCAL;
-   r.in.server = NULL;
+   r.in.server = talloc_asprintf(tctx, "%s", dcerpc_server_name(p));
r.in.level = 1;
r.in.buffer = NULL;
r.in.offered = 0;
@@ -414,9 +415,11 @@ static bool torture_rpc_spoolss_access_setup_common(struct 
torture_context *tctx
const char *printername;
const char *binding = torture_setting_string(tctx, "binding", NULL);
 
-   testuser = torture_create_testuser(tctx, t->user.username,
-  torture_setting_string(tctx, 
"workgroup", NULL),
-  ACB_NORMAL, &testuser_passwd);
+   testuser = torture_create_testuser_max_pwlen(tctx, t->user.username,
+
torture_setting_string(tctx, "workgroup", NULL),
+ACB_NORMAL,
+&testuser_passwd,
+32);
if (!testuser) {
torture_fail(tctx, "Failed to create test user");
}
@@ -464,7 +467,7 @@ static bool torture_rpc_spoolss_access_setup_common(struct 
torture_context *tctx
"Error connecting to server");
 
torture_assert(tctx,
-   test_EnumPrinters_findone(tctx, spoolss_pipe->binding_handle, 
&printername),
+   test_EnumPrinters_findone(tctx, spoolss_pipe, &printername),
"failed to enumerate printers");
 
if (t->user.sd) {
diff --git a/source4/torture/rpc/spoolss_notify.c 
b/source4/torture/rpc/spoolss_notify.c
index 9fa6b63..26faf0a 100644
--- a/source4/torture/rpc/spoolss_notify.c
+++ b/source4/torture/rpc/spoolss_notify.c
@@ -372,25 +372,6 @@ static bool test_RouterRefreshPrinterChangeNotify(struct 
torture_context *tctx,
return true;
 }
 
-static bool test_ClosePrinter(struct torture_context *tctx,
- struct dcerpc_binding_handle *b,
- struct policy_handle *handle)
-{
-   struct spoolss_ClosePrinter r;
-
-   r.in.handle = handle;
-   r.out.handle = handle;
-
-   torture_comment(tctx, "Testing ClosePrinter\n");
-
-   torture_assert_ntstatus_ok(tctx, dcerpc_spoolss_ClosePrinter_r(b, tctx, 
&r),
-   "ClosePrinter failed");
-   torture_assert_werr_ok(tctx, r.out.result,
-   "ClosePrinter failed");
-
-   return true;
-}
-
 static bool test_SetPrinter(struct torture_context *tctx,
struct dcerpc_pipe *p,
struct policy_handle *handle)


-- 
Samba Shared Repository


[SCM] Samba Shared Repository - branch master updated

2010-06-04 Thread Björn Jacke
The branch, master has been updated
   via  79ec886... s3:build: add shared lib flag for HP-UX compiler
   via  a973eb1... s3: fix build on Heimdal based systems like NetBSD5
  from  6309f7b... s4-smbtorture: make RPC-SPOOLSS-ACCESS more compatible 
with older samba releases.

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -
commit 79ec886aa4e8398cd45d9821030a1b87a17950f8
Author: Björn Jacke 
Date:   Sat Jun 5 02:13:21 2010 +0200

s3:build: add shared lib flag for HP-UX compiler

commit a973eb1968c416eb17de71655173fa2af16cb185
Author: Björn Jacke 
Date:   Sat Jun 5 02:12:02 2010 +0200

s3: fix build on Heimdal based systems like NetBSD5

---

Summary of changes:
 source3/configure.in |4 +++-
 source3/libsmb/clikrb5.c |6 +++---
 2 files changed, 6 insertions(+), 4 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/configure.in b/source3/configure.in
index 146dc85..71d416c 100644
--- a/source3/configure.in
+++ b/source3/configure.in
@@ -1674,7 +1674,9 @@ DSO_EXPORTS=""
LDSHFLAGS="-shared"
else
PICFLAG="+z"
-   LDSHFLAGS="-Wl,-B,symbolic,-b"
+   LDSHFLAGS="-b"
+   # "Uses depth-first symbol resolution"
+   LDSHFLAGS="$LDSHFLAGS -Wl,-B,symbolic,-b"
if test "$host_cpu" != "ia64"; then
# "don't store literals in read-only 
memory" (?):
PICFLAG="$PICFLAG +ESnolit"
diff --git a/source3/libsmb/clikrb5.c b/source3/libsmb/clikrb5.c
index 098d633..2e3fdf3 100644
--- a/source3/libsmb/clikrb5.c
+++ b/source3/libsmb/clikrb5.c
@@ -20,6 +20,9 @@
along with this program.  If not, see .
 */
 
+#include "includes.h"
+#include "smb_krb5.h"
+
 #ifndef KRB5_AUTHDATA_WIN2K_PAC
 #define KRB5_AUTHDATA_WIN2K_PAC 128
 #endif
@@ -28,9 +31,6 @@
 #define KRB5_AUTHDATA_IF_RELEVANT 1
 #endif
 
-#include "includes.h"
-#include "smb_krb5.h"
-
 #ifdef HAVE_KRB5
 
 #define GSSAPI_CHECKSUM  0x8003 /* Checksum type value for 
Kerberos */


-- 
Samba Shared Repository


[SCM] Samba Shared Repository - branch master updated

2010-06-04 Thread Jeremy Allison
The branch, master has been updated
   via  62e0a74... Fix a long-standing bug with async io that would only be 
triggered by SMB2.
  from  79ec886... s3:build: add shared lib flag for HP-UX compiler

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -
commit 62e0a744e23ced873241b8fd531276e8f0c870b7
Author: Jeremy Allison 
Date:   Fri Jun 4 21:00:24 2010 -0700

Fix a long-standing bug with async io that would only be triggered by SMB2.

On normal or shutdown close, ensure we wait for any pending IO to
complete before returning. Implement a blocking aio_suspend inside
vfs_aio_fork.c. These changes pass make test when the aio_fork module
is used by default on the test shares.

Jeremy.

---

Summary of changes:
 source3/modules/vfs_aio_fork.c |  124 
 source3/smbd/close.c   |   10 ++--
 2 files changed, 129 insertions(+), 5 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/modules/vfs_aio_fork.c b/source3/modules/vfs_aio_fork.c
index b026254..b43aad2 100644
--- a/source3/modules/vfs_aio_fork.c
+++ b/source3/modules/vfs_aio_fork.c
@@ -2,6 +2,7 @@
  * Simulate the Posix AIO using mmap/fork
  *
  * Copyright (C) Volker Lendecke 2008
+ * Copyright (C) Jeremy Allison 2010
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -343,9 +344,12 @@ static void aio_child_loop(int sockfd, struct mmap_area 
*map)
ret_struct.size = sys_pread(
fd, (void *)map->ptr, cmd_struct.n,
cmd_struct.offset);
+#if 0
+/* This breaks "make test" when run with aio_fork module. */
 #ifdef ENABLE_BUILD_FARM_HACKS
ret_struct.size = MAX(1, ret_struct.size * 0.9);
 #endif
+#endif
}
else {
ret_struct.size = sys_pwrite(
@@ -723,12 +727,132 @@ static int aio_fork_error_fn(struct vfs_handle_struct 
*handle,
return child->retval.ret_errno;
 }
 
+static void aio_fork_suspend_timed_out(struct tevent_context *event_ctx,
+   struct tevent_timer *te,
+   struct timeval now,
+   void *private_data)
+{
+   bool *timed_out = (bool *)private_data;
+   /* Remove this timed event handler. */
+   TALLOC_FREE(te);
+   *timed_out = true;
+}
+
+static int aio_fork_suspend(struct vfs_handle_struct *handle,
+   struct files_struct *fsp,
+   const SMB_STRUCT_AIOCB * const aiocb_array[],
+   int n,
+   const struct timespec *timeout)
+{
+   struct aio_child_list *children = NULL;
+   TALLOC_CTX *frame = talloc_stackframe();
+   struct event_context *ev = NULL;
+   int i;
+   int ret = -1;
+   bool timed_out = false;
+
+   children = init_aio_children(handle);
+   if (children == NULL) {
+   errno = EINVAL;
+   goto out;
+   }
+
+   /* This is a blocking call, and has to use a sub-event loop. */
+   ev = event_context_init(frame);
+   if (ev == NULL) {
+   errno = ENOMEM;
+   goto out;
+   }
+
+   if (timeout) {
+   struct timeval tv;
+   struct tevent_timer *te = tevent_add_timer(ev,
+   frame,
+   
timeval_current_ofs(tv.tv_sec,0),
+   aio_fork_suspend_timed_out,
+   &timed_out);
+   if (!te) {
+   errno = ENOMEM;
+   goto out;
+   }
+   }
+
+   for (i = 0; i < n; i++) {
+   struct aio_child *child = NULL;
+   const SMB_STRUCT_AIOCB *aiocb = aiocb_array[i];
+
+   if (!aiocb) {
+   continue;
+   }
+
+   /*
+* We're going to cheat here. We know that smbd/aio.c
+* only calls this when it's waiting for every single
+* outstanding call to finish on a close, so just wait
+* individually for each IO to complete. We don't care
+* what order they finish - only that they all do. JRA.
+*/
+
+   for (child = children->children; child != NULL; child = 
child->next) {
+   if (child->aiocb == NULL) {
+   continue;
+   }
+   if (child->aiocb->aio_fildes != fsp->fh->fd) {
+   continue;
+

[SCM] CTDB repository - branch master updated - ctdb-1.0.114-139-g8fec60c

2010-06-04 Thread Ronnie Sahlberg
The branch, master has been updated
   via  8fec60cb92d26886d853c918b8bc7931fec46469 (commit)
   via  9ec0b9bb148327a40e439d9c643c9d2ff93ce598 (commit)
   via  ced3bc40f841d353bc86a6ee9dd1868473223f52 (commit)
   via  108e9c2450876a9f8821aa7efd5be971eee5afd3 (commit)
   via  cdc19dc73032470d57f38bf825d8113b3a0c8cd1 (commit)
   via  e285b5d5a9d4fbc4f75dbb237d2fcdbd84f2d605 (commit)
   via  c620cfbad3b5f0d6330ef47f572d4ade08e169e8 (commit)
   via  fecb8a19e97f6e453066461b234acdb0946bbadd (commit)
   via  86259aa39aaf7b2fae7326caa2ea62961092 (commit)
   via  0786152472bc43efae4c896f7c6c07c6e080b9b2 (commit)
  from  87dc18a3a051da04685f14529c53c428d37c2912 (commit)

http://gitweb.samba.org/?p=sahlberg/ctdb.git;a=shortlog;h=master


- Log -
commit 8fec60cb92d26886d853c918b8bc7931fec46469
Author: Ronnie Sahlberg 
Date:   Sat Jun 5 14:38:01 2010 +1000

update "ctdb pnn" to use the new return value for _recv() where
bool false means failure and true means success.

commit 9ec0b9bb148327a40e439d9c643c9d2ff93ce598
Author: Ronnie Sahlberg 
Date:   Sat Jun 5 14:27:46 2010 +1000

Must initialize ctdb->locks or else bad things happen

commit ced3bc40f841d353bc86a6ee9dd1868473223f52
Author: Ronnie Sahlberg 
Date:   Sat Jun 5 14:21:42 2010 +1000

Update the ctdb tool to use the new signature for ctdb_connect()

commit 108e9c2450876a9f8821aa7efd5be971eee5afd3
Author: Rusty Russell 
Date:   Fri Jun 4 20:30:08 2010 +0930

libctdb: documentation

Full documentation for all the functions.

This looks longer than it is, because it sorts them into async and
sync parts, and also renames some formal parameters.

Added TODO to libctdb directory to track our plans.

Signed-off-by: Rusty Russell 

commit cdc19dc73032470d57f38bf825d8113b3a0c8cd1
Author: Rusty Russell 
Date:   Fri Jun 4 20:22:03 2010 +0930

libctdb: use values from ctdb_protocol.h, don't re-declare

We're best off including ctdb_protocol.h to get these, even if we
document the important ones in ctdb.h.

Signed-off-by: Rusty Russell 

commit e285b5d5a9d4fbc4f75dbb237d2fcdbd84f2d605
Author: Rusty Russell 
Date:   Fri Jun 4 20:19:25 2010 +0930

libctdb: use bool in API

Return bool instead of -1/0; that's what the young kids are doing
these days!

Signed-off-by: Rusty Russell 

commit c620cfbad3b5f0d6330ef47f572d4ade08e169e8
Author: Rusty Russell 
Date:   Fri Jun 4 19:41:42 2010 +0930

libctdb: track lock for each ctdb_db, complain if they hold too long.

In particular, this stops them grabbing two (with wrappers so we can
enhance this logic once we support threads), and warns them if they
re-enter ctdb_service() holding a lock (you are not supposed to block!).

Signed-off-by: Rusty Russell 

commit fecb8a19e97f6e453066461b234acdb0946bbadd
Author: Rusty Russell 
Date:   Fri Jun 4 20:27:06 2010 +0930

patch libctdb-use-logging.patch

commit 86259aa39aaf7b2fae7326caa2ea62961092
Author: Rusty Russell 
Date:   Fri Jun 4 20:27:03 2010 +0930

libctdb: add logging infrastructure

This is based on Ronnie's work, merged with mine.  That means
errors are all my fault.

Differences from Ronnie's:
1) use syslog's LOG_ levels directly.
2) typesafe arg to log function, and use it (eg stderr) in helper function.
3) store fn in ctdb context, and expose ctdb_log_level directly thru API.

Signed-off-by: Rusty Russell 

commit 0786152472bc43efae4c896f7c6c07c6e080b9b2
Author: Rusty Russell 
Date:   Fri Jun 4 16:54:08 2010 +0930

libctdb: add ctdb arg to more functions.

This is going to help for logging, since we want it there.

Signed-off-by: Rusty Russell 

---

Summary of changes:
 Makefile.in   |3 +-
 include/ctdb.h|  522 +++--
 libctdb/TODO  |3 +
 libctdb/control.c |   32 ++-
 libctdb/ctdb.c|  252 --
 libctdb/libctdb_private.h |   25 ++-
 libctdb/logging.c |   56 +
 libctdb/messages.c|   42 +++-
 libctdb/sync.c|   56 +++---
 libctdb/tst.c |   39 ++--
 tools/ctdb.c  |7 +-
 11 files changed, 783 insertions(+), 254 deletions(-)
 create mode 100644 libctdb/TODO
 create mode 100644 libctdb/logging.c


Changeset truncated at 500 lines:

diff --git a/Makefile.in b/Makefile.in
index dd7864e..d2e0dea 100755
--- a/Makefile.in
+++ b/Makefile.in
@@ -47,7 +47,8 @@ CTDB_COMMON_OBJ =  common/ctdb_io.o common/ctdb_util.o \
common/ctdb_logging.c
 
 CTDB_LIB_OBJ = libctdb/ctdb.o libctdb/io_elem.o libctdb/local_tdb.o \
-   libctdb/messages.o libctdb/sync.o libctdb/control.o
+   libctdb/messages.o libctdb/sync.o libctdb/control.o \
+

[SCM] CTDB repository - branch master updated - ctdb-1.0.114-141-gf62c7e4

2010-06-04 Thread Ronnie Sahlberg
The branch, master has been updated
   via  f62c7e44dc303f274bbc1dd59fad2167e72a2af0 (commit)
   via  463a266205f145cd9c4c36b9c59d3747eeef0e2e (commit)
  from  8fec60cb92d26886d853c918b8bc7931fec46469 (commit)

http://gitweb.samba.org/?p=sahlberg/ctdb.git;a=shortlog;h=master


- Log -
commit f62c7e44dc303f274bbc1dd59fad2167e72a2af0
Author: Ronnie Sahlberg 
Date:   Sat Jun 5 15:43:01 2010 +1000

In ctdb_writerecord()
Verify that the lock is still held and refuse the write otherwise.

We have to guarantee that we dont write to an unlocked record.

If we write to a record after it has been released, the record may have
already migrated off the node, in which case we get a DMASTER split brain 
for this record. (These application bugs are incredibly hard to track down)

commit 463a266205f145cd9c4c36b9c59d3747eeef0e2e
Author: Ronnie Sahlberg 
Date:   Sat Jun 5 15:38:11 2010 +1000

Split ctdb_release_lock() into a function to release the locvk and another 
function to free the data structures.
This allows us to keep the datastructure valid after the lock has been 
released by the application and we can trap and warn when the application is 
accessing the lock after it has been released. I.e. application bugs.

---

Summary of changes:
 include/ctdb.h |3 +++
 libctdb/ctdb.c |   29 +++--
 libctdb/tst.c  |4 +++-
 3 files changed, 33 insertions(+), 3 deletions(-)


Changeset truncated at 500 lines:

diff --git a/include/ctdb.h b/include/ctdb.h
index e62bb45..0dc5da7 100644
--- a/include/ctdb.h
+++ b/include/ctdb.h
@@ -214,6 +214,9 @@ struct ctdb_db *ctdb_attachdb_recv(struct ctdb_connection 
*ctdb,
  *
  * You MUST NOT block during holding this lock and MUST release it
  * quickly by performing ctdb_release_lock(lock).
+ * Do NOT make any system calls that may block while holding the lock.
+ *
+ * Try to release the lock as quickly as possible.
  */
 struct ctdb_lock;
 
diff --git a/libctdb/ctdb.c b/libctdb/ctdb.c
index 9d79f6e..b7f1c59 100644
--- a/libctdb/ctdb.c
+++ b/libctdb/ctdb.c
@@ -642,10 +642,26 @@ void ctdb_release_lock(struct ctdb_lock *lock)
lock->held = false;
remove_lock(lock->ctdb_db->ctdb, lock);
}
+}
+
+static void ctdb_free_lock(struct ctdb_lock *lock)
+{
+   if (lock->held) {
+   errno = EEXIST;
+   DEBUG(lock->ctdb_db->ctdb, LOG_ERR,
+   "Lock freed before it was released");
+   ctdb_release_lock(lock);
+   }
free(lock->hdr);
free(lock);
 }
 
+static void ctdb_destroy_lock(struct ctdb_lock *lock)
+{
+   ctdb_release_lock(lock);
+   ctdb_free_lock(lock);
+}
+
 /* We keep the lock if local node is the dmaster. */
 static bool try_readrecordlock(struct ctdb_lock *lock, TDB_DATA *data)
 {
@@ -676,7 +692,7 @@ static bool try_readrecordlock(struct ctdb_lock *lock, 
TDB_DATA *data)
 static void destroy_lock(struct ctdb_connection *ctdb,
 struct ctdb_request *req)
 {
-   ctdb_release_lock(req->extra);
+   ctdb_destroy_lock(req->extra);
 }
 
 static void readrecordlock_retry(struct ctdb_connection *ctdb,
@@ -704,6 +720,7 @@ static void readrecordlock_retry(struct ctdb_connection 
*ctdb,
/* Now it's their responsibility to free lock & request! */
req->extra_destructor = NULL;
lock->callback(lock->ctdb_db, lock, data, private);
+   ctdb_free_lock(lock);
return;
}
 
@@ -743,6 +760,7 @@ ctdb_readrecordlock_async(struct ctdb_db *ctdb_db, TDB_DATA 
key,
/* Fast path. */
if (try_readrecordlock(lock, &data)) {
callback(ctdb_db, lock, data, cbdata);
+   ctdb_free_lock(lock);
return true;
}
 
@@ -752,7 +770,7 @@ ctdb_readrecordlock_async(struct ctdb_db *ctdb_db, TDB_DATA 
key,
if (!req) {
DEBUG(ctdb_db->ctdb, LOG_ERR,
  "ctdb_readrecordlock_async: allocation failed");
-   ctdb_release_lock(lock);
+   ctdb_destroy_lock(lock);
return NULL;
}
req->extra = lock;
@@ -776,6 +794,13 @@ ctdb_readrecordlock_async(struct ctdb_db *ctdb_db, 
TDB_DATA key,
 
 int ctdb_writerecord(struct ctdb_lock *lock, TDB_DATA data)
 {
+   if (!lock->held) {
+   errno = EBADF;
+   DEBUG(lock->ctdb_db->ctdb, LOG_ERR,
+ "ctdb_writerecord: Can not write. Lock has been 
released.");
+   return -1;
+   }
+   
if (lock->ctdb_db->persistent) {
errno = EINVAL;
DEBUG(lock->ctdb_db->ctdb, LOG_ERR,
diff --git a/libctdb/tst.c b/libctdb/tst.c
index c8c08cf..391e92c 100644
--- a/libctdb/tst.c
+++ b/libctdb/tst.c
@@ -109,9 +109,11 @@

Build status as of Sat Jun 5 06:00:02 2010

2010-06-04 Thread build
URL: http://build.samba.org/

--- /home/build/master/cache/broken_results.txt.old 2010-06-04 
00:00:06.0 -0600
+++ /home/build/master/cache/broken_results.txt 2010-06-05 00:00:03.0 
-0600
@@ -1,4 +1,4 @@
-Build status as of Fri Jun  4 06:00:05 2010
+Build status as of Sat Jun  5 06:00:02 2010
 
 Build counts:
 Tree Total  Broken Panic 
@@ -16,7 +16,7 @@
 samba_3_master 28 28 0 
 samba_3_next 28 28 6 
 samba_4_0_test 30 30 0 
-samba_4_0_waf 30 29 0 
+samba_4_0_waf 30 29 7 
 talloc   30 12 0 
 tdb  28 17 0