svn commit: samba r20079 - in branches/SAMBA_4_0/source: libnet librpc/idl torture/rpc

2006-12-08 Thread metze
Author: metze
Date: 2006-12-08 17:34:15 + (Fri, 08 Dec 2006)
New Revision: 20079

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=20079

Log:
the 2nd guid is the source_dsa invocation_id not the objectGUID,
this wasn't noticed because on the 1st dc in the forest both have the
same value

metze
Modified:
   branches/SAMBA_4_0/source/libnet/libnet_become_dc.c
   branches/SAMBA_4_0/source/librpc/idl/drsuapi.idl
   branches/SAMBA_4_0/source/torture/rpc/drsuapi.c
   branches/SAMBA_4_0/source/torture/rpc/dssync.c


Changeset:
Modified: branches/SAMBA_4_0/source/libnet/libnet_become_dc.c
===
--- branches/SAMBA_4_0/source/libnet/libnet_become_dc.c 2006-12-08 03:47:55 UTC 
(rev 20078)
+++ branches/SAMBA_4_0/source/libnet/libnet_become_dc.c 2006-12-08 17:34:15 UTC 
(rev 20079)
@@ -118,6 +118,7 @@
struct drsuapi_DsReplicaObjectIdentifier nc;
struct GUID destination_dsa_guid;
struct GUID source_dsa_guid;
+   struct GUID source_dsa_invocation_id;
struct drsuapi_DsReplicaHighWaterMark highwatermark;
struct drsuapi_DsReplicaCoursorCtrEx *uptodateness_vector;
uint32_t replica_flags;
@@ -1555,7 +1556,7 @@
if (drsuapi_h-remote_info28.supported_extensions  
DRSUAPI_SUPPORTED_EXTENSION_GETCHGREQ_V8) {
r-in.level = 8;
r-in.req.req8.destination_dsa_guid = 
partition-destination_dsa_guid;
-   r-in.req.req8.source_dsa_guid  = 
partition-source_dsa_guid;
+   r-in.req.req8.source_dsa_invocation_id = 
partition-source_dsa_invocation_id;
r-in.req.req8.naming_context   = partition-nc;
r-in.req.req8.highwatermark= 
partition-highwatermark;
r-in.req.req8.uptodateness_vector  = 
partition-uptodateness_vector;
@@ -1571,7 +1572,7 @@
} else {
r-in.level = 5;
r-in.req.req5.destination_dsa_guid = 
partition-destination_dsa_guid;
-   r-in.req.req5.source_dsa_guid  = 
partition-source_dsa_guid;
+   r-in.req.req5.source_dsa_invocation_id = 
partition-source_dsa_invocation_id;
r-in.req.req5.naming_context   = partition-nc;
r-in.req.req5.highwatermark= 
partition-highwatermark;
r-in.req.req5.uptodateness_vector  = 
partition-uptodateness_vector;

Modified: branches/SAMBA_4_0/source/librpc/idl/drsuapi.idl
===
--- branches/SAMBA_4_0/source/librpc/idl/drsuapi.idl2006-12-08 03:47:55 UTC 
(rev 20078)
+++ branches/SAMBA_4_0/source/librpc/idl/drsuapi.idl2006-12-08 17:34:15 UTC 
(rev 20079)
@@ -230,7 +230,7 @@
 
typedef struct {
GUID destination_dsa_guid;
-   GUID source_dsa_guid;
+   GUID source_dsa_invocation_id; /* the 'invocationId' field of 
the CN=NTDS Settings object */
[ref] drsuapi_DsReplicaObjectIdentifier *naming_context;
drsuapi_DsReplicaHighWaterMark highwatermark;
drsuapi_DsReplicaCoursorCtrEx *uptodateness_vector;
@@ -258,7 +258,7 @@
 
typedef struct {
GUID destination_dsa_guid;
-   GUID source_dsa_guid;
+   GUID source_dsa_invocation_id; /* the 'invocationId' field of 
the CN=NTDS Settings object */
[ref] drsuapi_DsReplicaObjectIdentifier *naming_context;
drsuapi_DsReplicaHighWaterMark highwatermark;
drsuapi_DsReplicaCoursorCtrEx *uptodateness_vector;

Modified: branches/SAMBA_4_0/source/torture/rpc/drsuapi.c
===
--- branches/SAMBA_4_0/source/torture/rpc/drsuapi.c 2006-12-08 03:47:55 UTC 
(rev 20078)
+++ branches/SAMBA_4_0/source/torture/rpc/drsuapi.c 2006-12-08 17:34:15 UTC 
(rev 20079)
@@ -553,7 +553,7 @@
nc.dn   = priv-domain_obj_dn?priv-domain_obj_dn:;
 
r.in.req.req5.destination_dsa_guid  = 
GUID_random();
-   r.in.req.req5.source_dsa_guid   = 
null_guid;
+   r.in.req.req5.source_dsa_invocation_id  = 
null_guid;
r.in.req.req5.naming_context= nc;
r.in.req.req5.highwatermark.tmp_highest_usn = 0;
r.in.req.req5.highwatermark.reserved_usn= 0;
@@ -575,7 +575,7 @@
nc.dn   = priv-domain_obj_dn?priv-domain_obj_dn:;
 
r.in.req.req8.destination_dsa_guid  = 
GUID_random();
-   r.in.req.req8.source_dsa_guid   = 
null_guid;
+   

svn commit: samba r20080 - in branches/SAMBA_4_0/source/libcli/util: .

2006-12-08 Thread metze
Author: metze
Date: 2006-12-08 18:01:30 + (Fri, 08 Dec 2006)
New Revision: 20080

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=20080

Log:
add error code that maps to NT_STATUS_INVALID_NETWORD_RESPONSE

metze
Modified:
   branches/SAMBA_4_0/source/libcli/util/doserr.c
   branches/SAMBA_4_0/source/libcli/util/doserr.h


Changeset:
Modified: branches/SAMBA_4_0/source/libcli/util/doserr.c
===
--- branches/SAMBA_4_0/source/libcli/util/doserr.c  2006-12-08 17:34:15 UTC 
(rev 20079)
+++ branches/SAMBA_4_0/source/libcli/util/doserr.c  2006-12-08 18:01:30 UTC 
(rev 20080)
@@ -36,6 +36,7 @@
{ WERR_BADFID, WERR_BADFID },
{ WERR_BADFUNC, WERR_BADFUNC },
{ WERR_BAD_NETPATH, WERR_BAD_NETPATH },
+   { WERR_BAD_NET_RESP,  WERR_BAD_NET_RESP },
{ WERR_UNEXP_NET_ERR, WERR_UNEXP_NET_ERR },
{ WERR_INSUFFICIENT_BUFFER, WERR_INSUFFICIENT_BUFFER },
{ WERR_NO_SUCH_SHARE, WERR_NO_SUCH_SHARE },

Modified: branches/SAMBA_4_0/source/libcli/util/doserr.h
===
--- branches/SAMBA_4_0/source/libcli/util/doserr.h  2006-12-08 17:34:15 UTC 
(rev 20079)
+++ branches/SAMBA_4_0/source/libcli/util/doserr.h  2006-12-08 18:01:30 UTC 
(rev 20080)
@@ -174,6 +174,7 @@
 #define WERR_GENERAL_FAILURE W_ERROR(31)
 #define WERR_NOT_SUPPORTED W_ERROR(50)
 #define WERR_BAD_NETPATH W_ERROR(53)
+#define WERR_BAD_NET_RESP W_ERROR(58)
 #define WERR_UNEXP_NET_ERR W_ERROR(59)
 #define WERR_PRINTQ_FULL W_ERROR(61)
 #define WERR_NO_SPOOL_SPACE W_ERROR(62)



svn commit: samba r20081 - in branches/SAMBA_4_0/source/libnet: .

2006-12-08 Thread metze
Author: metze
Date: 2006-12-08 18:06:38 + (Fri, 08 Dec 2006)
New Revision: 20081

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=20081

Log:
pull the whole schema partition

metze
Modified:
   branches/SAMBA_4_0/source/libnet/libnet_become_dc.c


Changeset:
Modified: branches/SAMBA_4_0/source/libnet/libnet_become_dc.c
===
--- branches/SAMBA_4_0/source/libnet/libnet_become_dc.c 2006-12-08 18:01:30 UTC 
(rev 20080)
+++ branches/SAMBA_4_0/source/libnet/libnet_become_dc.c 2006-12-08 18:06:38 UTC 
(rev 20081)
@@ -122,6 +122,9 @@
struct drsuapi_DsReplicaHighWaterMark highwatermark;
struct drsuapi_DsReplicaCoursorCtrEx *uptodateness_vector;
uint32_t replica_flags;
+
+   struct drsuapi_DsReplicaObjectListItemEx *first_object;
+   struct drsuapi_DsReplicaObjectListItemEx *last_object;
} schema;
 
struct becomeDC_fsmo {
@@ -1583,6 +1586,11 @@
r-in.req.req5.h1   = 0;
}
 
+DEBUG(0,(start NC[%s] tmp_highest_usn[%llu] highest_usn[%llu]\n,
+   partition-nc.dn,
+   partition-highwatermark.tmp_highest_usn,
+   partition-highwatermark.highest_usn));
+
/* 
 * we should try to use the drsuapi_p-pipe here, as w2k3 does
 * but it seems that some extra flags in the DCERPC Bind call
@@ -1614,6 +1622,77 @@
 
becomeDC_drsuapi3_pull_schema_recv);
 }
 
+static WERROR becomeDC_drsuapi_pull_partition_recv(struct 
libnet_BecomeDC_state *s,
+  struct becomeDC_partition 
*partition,
+  struct 
drsuapi_DsGetNCChanges *r)
+{
+   struct drsuapi_DsGetNCChangesCtr1 *ctr1 = NULL;
+   struct drsuapi_DsGetNCChangesCtr6 *ctr6 = NULL;
+   uint32_t out_level = 0;
+   struct GUID *source_dsa_guid;
+   struct GUID *source_dsa_invocation_id;
+   struct drsuapi_DsReplicaHighWaterMark *new_highwatermark;
+   struct drsuapi_DsReplicaObjectListItemEx *first_object;
+   struct drsuapi_DsReplicaObjectListItemEx *cur;
+
+   if (!W_ERROR_IS_OK(r-out.result)) {
+   return r-out.result;
+   }
+
+   if (r-out.level == 1) {
+   out_level = 1;
+   ctr1 = r-out.ctr.ctr1;
+   } else if (r-out.level == 2) {
+   out_level = 1;
+   ctr1 = r-out.ctr.ctr2.ctr.mszip1.ctr1;
+   } else if (r-out.level == 6) {
+   out_level = 6;
+   ctr6 = r-out.ctr.ctr6;
+   } else if (r-out.level == 7 
+  r-out.ctr.ctr7.level == 6 
+  r-out.ctr.ctr7.type == DRSUAPI_COMPRESSION_TYPE_MSZIP) {
+   out_level = 6;
+   ctr6 = r-out.ctr.ctr7.ctr.mszip6.ctr6;
+   } else {
+   return WERR_BAD_NET_RESP;
+   }
+
+   switch (out_level) {
+   case 1:
+   source_dsa_guid = ctr1-source_dsa_guid;
+   source_dsa_invocation_id= 
ctr1-source_dsa_invocation_id;
+   new_highwatermark   = ctr1-new_highwatermark;
+   first_object= ctr1-first_object;
+   break;
+   case 6:
+   source_dsa_guid = ctr6-source_dsa_guid;
+   source_dsa_invocation_id= 
ctr6-source_dsa_invocation_id;
+   new_highwatermark   = ctr6-new_highwatermark;
+   first_object= ctr6-first_object;
+   break;
+   }
+
+   partition-highwatermark= *new_highwatermark;
+   partition-source_dsa_guid  = *source_dsa_guid;
+   partition-source_dsa_invocation_id = *source_dsa_invocation_id;
+
+   if (!partition-first_object) {
+   partition-first_object = talloc_steal(s, first_object);
+   } else {
+   partition-last_object-next_object = 
talloc_steal(partition-last_object,
+  
first_object);
+   }
+   for (cur = first_object; cur-next_object; cur = cur-next_object) {}
+   partition-last_object = cur;
+
+DEBUG(0,(end NC[%s] tmp_highest_usn[%llu] highest_usn[%llu]\n,
+   partition-nc.dn,
+   partition-highwatermark.tmp_highest_usn,
+   partition-highwatermark.highest_usn));
+
+   return WERR_OK;
+}
+
 static void becomeDC_drsuapi3_pull_schema_recv(struct rpc_request *req)
 {
struct libnet_BecomeDC_state *s = talloc_get_type(req-async.private,
@@ -1621,17 +1700,25 @@
struct composite_context *c = s-creq;
struct drsuapi_DsGetNCChanges *r = talloc_get_type(req-ndr.struct_ptr,
   struct drsuapi_DsGetNCChanges);
+   WERROR status;
 
c-status = dcerpc_ndr_request_recv(req);
 

svn commit: samba r20082 - in branches: SAMBA_3_0/source/nsswitch SAMBA_3_0_24/source/nsswitch

2006-12-08 Thread jra
Author: jra
Date: 2006-12-08 18:07:44 + (Fri, 08 Dec 2006)
New Revision: 20082

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=20082

Log:
When fork_domain_child is forked when we're offline
the child inherits *all* active check_online timout handlers.
This is bad when it's not our domain (ie. BUILTIN).
Jeremy.

Modified:
   branches/SAMBA_3_0/source/nsswitch/winbindd_dual.c
   branches/SAMBA_3_0_24/source/nsswitch/winbindd_dual.c


Changeset:
Modified: branches/SAMBA_3_0/source/nsswitch/winbindd_dual.c
===
--- branches/SAMBA_3_0/source/nsswitch/winbindd_dual.c  2006-12-08 18:06:38 UTC 
(rev 20081)
+++ branches/SAMBA_3_0/source/nsswitch/winbindd_dual.c  2006-12-08 18:07:44 UTC 
(rev 20082)
@@ -755,6 +755,7 @@
 {
int fdpair[2];
struct winbindd_cli_state state;
+   struct winbindd_domain *domain;
extern BOOL override_logfile;
 
if (socketpair(AF_UNIX, SOCK_STREAM, 0, fdpair) != 0) {
@@ -844,6 +845,16 @@
child-domain-startup_time = time(NULL);
}
 
+   for (domain = domain_list(); domain; domain = domain-next) {
+   if (domain != child-domain) {
+   /* Ensure we have no check_online events pending
+  that are not on this domain. */
+   if (domain-check_online_event) {
+   TALLOC_FREE(domain-check_online_event);
+   }
+   }
+   }
+
while (1) {
 
int ret;

Modified: branches/SAMBA_3_0_24/source/nsswitch/winbindd_dual.c
===
--- branches/SAMBA_3_0_24/source/nsswitch/winbindd_dual.c   2006-12-08 
18:06:38 UTC (rev 20081)
+++ branches/SAMBA_3_0_24/source/nsswitch/winbindd_dual.c   2006-12-08 
18:07:44 UTC (rev 20082)
@@ -755,6 +755,7 @@
 {
int fdpair[2];
struct winbindd_cli_state state;
+   struct winbindd_domain *domain;
extern BOOL override_logfile;
 
if (socketpair(AF_UNIX, SOCK_STREAM, 0, fdpair) != 0) {
@@ -844,6 +845,16 @@
child-domain-startup_time = time(NULL);
}
 
+   for (domain = domain_list(); domain; domain = domain-next) {
+   if (domain != child-domain) {
+   /* Ensure we have no check_online events pending
+  that are not on this domain. */
+   if (domain-check_online_event) {
+   TALLOC_FREE(domain-check_online_event);
+   }
+   }
+   }
+
while (1) {
 
int ret;



svn commit: samba r20084 - in branches/SAMBA_4_0/source/libnet: .

2006-12-08 Thread metze
Author: metze
Date: 2006-12-08 18:13:49 + (Fri, 08 Dec 2006)
New Revision: 20084

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=20084

Log:
pull the config partition

metze
Modified:
   branches/SAMBA_4_0/source/libnet/libnet_become_dc.c


Changeset:
Modified: branches/SAMBA_4_0/source/libnet/libnet_become_dc.c
===
--- branches/SAMBA_4_0/source/libnet/libnet_become_dc.c 2006-12-08 18:08:30 UTC 
(rev 20083)
+++ branches/SAMBA_4_0/source/libnet/libnet_become_dc.c 2006-12-08 18:13:49 UTC 
(rev 20084)
@@ -125,7 +125,7 @@
 
struct drsuapi_DsReplicaObjectListItemEx *first_object;
struct drsuapi_DsReplicaObjectListItemEx *last_object;
-   } schema;
+   } schema, config;
 
struct becomeDC_fsmo {
const char *dns_name;
@@ -1693,6 +1693,8 @@
 
becomeDC_drsuapi3_pull_schema_recv);
 }
 
+static void becomeDC_drsuapi3_pull_config_send(struct libnet_BecomeDC_state 
*s);
+
 static void becomeDC_drsuapi3_pull_schema_recv(struct rpc_request *req)
 {
struct libnet_BecomeDC_state *s = talloc_get_type(req-async.private,
@@ -1719,6 +1721,56 @@
return;
}
 
+   becomeDC_drsuapi3_pull_config_send(s);
+}
+
+static void becomeDC_drsuapi3_pull_config_recv(struct rpc_request *req);
+
+static void becomeDC_drsuapi3_pull_config_send(struct libnet_BecomeDC_state *s)
+{
+   s-config.nc.guid   = GUID_zero();
+   s-config.nc.sid= s-zero_sid;
+   s-config.nc.dn = s-forest.config_dn_str;
+
+   s-config.destination_dsa_guid  = s-drsuapi2.bind_guid;
+
+   s-config.replica_flags = DRSUAPI_DS_REPLICA_NEIGHBOUR_WRITEABLE
+   | DRSUAPI_DS_REPLICA_NEIGHBOUR_SYNC_ON_STARTUP
+   | 
DRSUAPI_DS_REPLICA_NEIGHBOUR_DO_SCHEDULED_SYNCS
+   | DRSUAPI_DS_REPLICA_NEIGHBOUR_FULL_IN_PROGRESS
+   | DRSUAPI_DS_REPLICA_NEIGHBOUR_NEVER_SYNCED
+   | DRSUAPI_DS_REPLICA_NEIGHBOUR_COMPRESS_CHANGES;
+
+   becomeDC_drsuapi_pull_partition_send(s, s-drsuapi2, s-drsuapi3, 
s-config,
+
becomeDC_drsuapi3_pull_config_recv);
+}
+
+static void becomeDC_drsuapi3_pull_config_recv(struct rpc_request *req)
+{
+   struct libnet_BecomeDC_state *s = talloc_get_type(req-async.private,
+ struct libnet_BecomeDC_state);
+   struct composite_context *c = s-creq;
+   struct drsuapi_DsGetNCChanges *r = talloc_get_type(req-ndr.struct_ptr,
+  struct drsuapi_DsGetNCChanges);
+   WERROR status;
+
+   c-status = dcerpc_ndr_request_recv(req);
+   if (!composite_is_ok(c)) return;
+
+   status = becomeDC_drsuapi_pull_partition_recv(s, s-config, r);
+   if (!W_ERROR_IS_OK(status)) {
+   composite_error(c, werror_to_ntstatus(status));
+   return;
+   }
+
+   talloc_free(r);
+
+   if (s-config.highwatermark.tmp_highest_usn  
s-config.highwatermark.highest_usn) {
+   becomeDC_drsuapi_pull_partition_send(s, s-drsuapi2, 
s-drsuapi3, s-config,
+
becomeDC_drsuapi3_pull_config_recv);
+   return;
+   }
+
becomeDC_connect_ldap2(s);
 }
 



svn commit: samba r20085 - in branches/SAMBA_4_0/source/libnet: .

2006-12-08 Thread metze
Author: metze
Date: 2006-12-08 18:22:26 + (Fri, 08 Dec 2006)
New Revision: 20085

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=20085

Log:
add _part to structure elements

metze
Modified:
   branches/SAMBA_4_0/source/libnet/libnet_become_dc.c


Changeset:
Modified: branches/SAMBA_4_0/source/libnet/libnet_become_dc.c
===
--- branches/SAMBA_4_0/source/libnet/libnet_become_dc.c 2006-12-08 18:13:49 UTC 
(rev 20084)
+++ branches/SAMBA_4_0/source/libnet/libnet_become_dc.c 2006-12-08 18:22:26 UTC 
(rev 20085)
@@ -125,7 +125,7 @@
 
struct drsuapi_DsReplicaObjectListItemEx *first_object;
struct drsuapi_DsReplicaObjectListItemEx *last_object;
-   } schema, config;
+   } schema_part, config_part;
 
struct becomeDC_fsmo {
const char *dns_name;
@@ -1676,20 +1676,20 @@
 
 static void becomeDC_drsuapi3_pull_schema_send(struct libnet_BecomeDC_state *s)
 {
-   s-schema.nc.guid   = GUID_zero();
-   s-schema.nc.sid= s-zero_sid;
-   s-schema.nc.dn = s-forest.schema_dn_str;
+   s-schema_part.nc.guid  = GUID_zero();
+   s-schema_part.nc.sid   = s-zero_sid;
+   s-schema_part.nc.dn= s-forest.schema_dn_str;
 
-   s-schema.destination_dsa_guid  = s-drsuapi2.bind_guid;
+   s-schema_part.destination_dsa_guid = s-drsuapi2.bind_guid;
 
-   s-schema.replica_flags = DRSUAPI_DS_REPLICA_NEIGHBOUR_WRITEABLE
-   | DRSUAPI_DS_REPLICA_NEIGHBOUR_SYNC_ON_STARTUP
-   | 
DRSUAPI_DS_REPLICA_NEIGHBOUR_DO_SCHEDULED_SYNCS
-   | DRSUAPI_DS_REPLICA_NEIGHBOUR_FULL_IN_PROGRESS
-   | DRSUAPI_DS_REPLICA_NEIGHBOUR_NEVER_SYNCED
-   | DRSUAPI_DS_REPLICA_NEIGHBOUR_COMPRESS_CHANGES;
+   s-schema_part.replica_flags= DRSUAPI_DS_REPLICA_NEIGHBOUR_WRITEABLE
+   | 
DRSUAPI_DS_REPLICA_NEIGHBOUR_SYNC_ON_STARTUP
+   | 
DRSUAPI_DS_REPLICA_NEIGHBOUR_DO_SCHEDULED_SYNCS
+   | 
DRSUAPI_DS_REPLICA_NEIGHBOUR_FULL_IN_PROGRESS
+   | 
DRSUAPI_DS_REPLICA_NEIGHBOUR_NEVER_SYNCED
+   | 
DRSUAPI_DS_REPLICA_NEIGHBOUR_COMPRESS_CHANGES;
 
-   becomeDC_drsuapi_pull_partition_send(s, s-drsuapi2, s-drsuapi3, 
s-schema,
+   becomeDC_drsuapi_pull_partition_send(s, s-drsuapi2, s-drsuapi3, 
s-schema_part,
 
becomeDC_drsuapi3_pull_schema_recv);
 }
 
@@ -1707,7 +1707,7 @@
c-status = dcerpc_ndr_request_recv(req);
if (!composite_is_ok(c)) return;
 
-   status = becomeDC_drsuapi_pull_partition_recv(s, s-schema, r);
+   status = becomeDC_drsuapi_pull_partition_recv(s, s-schema_part, r);
if (!W_ERROR_IS_OK(status)) {
composite_error(c, werror_to_ntstatus(status));
return;
@@ -1715,8 +1715,8 @@
 
talloc_free(r);
 
-   if (s-schema.highwatermark.tmp_highest_usn  
s-schema.highwatermark.highest_usn) {
-   becomeDC_drsuapi_pull_partition_send(s, s-drsuapi2, 
s-drsuapi3, s-schema,
+   if (s-schema_part.highwatermark.tmp_highest_usn  
s-schema_part.highwatermark.highest_usn) {
+   becomeDC_drsuapi_pull_partition_send(s, s-drsuapi2, 
s-drsuapi3, s-schema_part,
 
becomeDC_drsuapi3_pull_schema_recv);
return;
}
@@ -1728,20 +1728,20 @@
 
 static void becomeDC_drsuapi3_pull_config_send(struct libnet_BecomeDC_state *s)
 {
-   s-config.nc.guid   = GUID_zero();
-   s-config.nc.sid= s-zero_sid;
-   s-config.nc.dn = s-forest.config_dn_str;
+   s-config_part.nc.guid  = GUID_zero();
+   s-config_part.nc.sid   = s-zero_sid;
+   s-config_part.nc.dn= s-forest.config_dn_str;
 
-   s-config.destination_dsa_guid  = s-drsuapi2.bind_guid;
+   s-config_part.destination_dsa_guid = s-drsuapi2.bind_guid;
 
-   s-config.replica_flags = DRSUAPI_DS_REPLICA_NEIGHBOUR_WRITEABLE
-   | DRSUAPI_DS_REPLICA_NEIGHBOUR_SYNC_ON_STARTUP
-   | 
DRSUAPI_DS_REPLICA_NEIGHBOUR_DO_SCHEDULED_SYNCS
-   | DRSUAPI_DS_REPLICA_NEIGHBOUR_FULL_IN_PROGRESS
-   | DRSUAPI_DS_REPLICA_NEIGHBOUR_NEVER_SYNCED
-   | DRSUAPI_DS_REPLICA_NEIGHBOUR_COMPRESS_CHANGES;
+   s-config_part.replica_flags= DRSUAPI_DS_REPLICA_NEIGHBOUR_WRITEABLE
+   | 
DRSUAPI_DS_REPLICA_NEIGHBOUR_SYNC_ON_STARTUP
+   | 
DRSUAPI_DS_REPLICA_NEIGHBOUR_DO_SCHEDULED_SYNCS
+   | 

svn commit: samba r20086 - in branches/SAMBA_4_0/source/libnet: .

2006-12-08 Thread metze
Author: metze
Date: 2006-12-08 18:29:44 + (Fri, 08 Dec 2006)
New Revision: 20086

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=20086

Log:
pull domain partition

metze
Modified:
   branches/SAMBA_4_0/source/libnet/libnet_become_dc.c


Changeset:
Modified: branches/SAMBA_4_0/source/libnet/libnet_become_dc.c
===
--- branches/SAMBA_4_0/source/libnet/libnet_become_dc.c 2006-12-08 18:22:26 UTC 
(rev 20085)
+++ branches/SAMBA_4_0/source/libnet/libnet_become_dc.c 2006-12-08 18:29:44 UTC 
(rev 20086)
@@ -125,7 +125,7 @@
 
struct drsuapi_DsReplicaObjectListItemEx *first_object;
struct drsuapi_DsReplicaObjectListItemEx *last_object;
-   } schema_part, config_part;
+   } schema_part, config_part, domain_part;
 
struct becomeDC_fsmo {
const char *dns_name;
@@ -1774,6 +1774,56 @@
becomeDC_connect_ldap2(s);
 }
 
+static void becomeDC_drsuapi3_pull_domain_recv(struct rpc_request *req);
+
+static void becomeDC_drsuapi3_pull_domain_send(struct libnet_BecomeDC_state *s)
+{
+   s-domain_part.nc.guid  = GUID_zero();
+   s-domain_part.nc.sid   = s-zero_sid;
+   s-domain_part.nc.dn= s-domain.dn_str;
+
+   s-domain_part.destination_dsa_guid = s-drsuapi2.bind_guid;
+
+   s-domain_part.replica_flags= DRSUAPI_DS_REPLICA_NEIGHBOUR_WRITEABLE
+   | 
DRSUAPI_DS_REPLICA_NEIGHBOUR_SYNC_ON_STARTUP
+   | 
DRSUAPI_DS_REPLICA_NEIGHBOUR_DO_SCHEDULED_SYNCS
+   | 
DRSUAPI_DS_REPLICA_NEIGHBOUR_FULL_IN_PROGRESS
+   | 
DRSUAPI_DS_REPLICA_NEIGHBOUR_NEVER_SYNCED
+   | 
DRSUAPI_DS_REPLICA_NEIGHBOUR_COMPRESS_CHANGES;
+
+   becomeDC_drsuapi_pull_partition_send(s, s-drsuapi2, s-drsuapi3, 
s-domain_part,
+
becomeDC_drsuapi3_pull_domain_recv);
+}
+
+static void becomeDC_drsuapi3_pull_domain_recv(struct rpc_request *req)
+{
+   struct libnet_BecomeDC_state *s = talloc_get_type(req-async.private,
+ struct libnet_BecomeDC_state);
+   struct composite_context *c = s-creq;
+   struct drsuapi_DsGetNCChanges *r = talloc_get_type(req-ndr.struct_ptr,
+  struct drsuapi_DsGetNCChanges);
+   WERROR status;
+
+   c-status = dcerpc_ndr_request_recv(req);
+   if (!composite_is_ok(c)) return;
+
+   status = becomeDC_drsuapi_pull_partition_recv(s, s-domain_part, r);
+   if (!W_ERROR_IS_OK(status)) {
+   composite_error(c, werror_to_ntstatus(status));
+   return;
+   }
+
+   talloc_free(r);
+
+   if (s-domain_part.highwatermark.tmp_highest_usn  
s-domain_part.highwatermark.highest_usn) {
+   becomeDC_drsuapi_pull_partition_send(s, s-drsuapi2, 
s-drsuapi3, s-domain_part,
+
becomeDC_drsuapi3_pull_domain_recv);
+   return;
+   }
+
+   composite_error(c, NT_STATUS_NOT_IMPLEMENTED);
+}
+
 static NTSTATUS becomeDC_ldap2_modify_computer(struct libnet_BecomeDC_state *s)
 {
int ret;
@@ -1885,7 +1935,7 @@
c-status = becomeDC_ldap2_move_computer(s);
if (!composite_is_ok(c)) return;
 
-   composite_error(c, NT_STATUS_NOT_IMPLEMENTED);
+   becomeDC_drsuapi3_pull_domain_send(s);
 }
 
 struct composite_context *libnet_BecomeDC_send(struct libnet_context *ctx, 
TALLOC_CTX *mem_ctx, struct libnet_BecomeDC *r)



svn commit: samba r20087 - in branches: SAMBA_3_0/source/lib SAMBA_3_0/source/nsswitch SAMBA_3_0_24/source/lib SAMBA_3_0_24/source/nsswitch

2006-12-08 Thread jra
Author: jra
Date: 2006-12-08 18:40:13 + (Fri, 08 Dec 2006)
New Revision: 20087

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=20087

Log:
Ensure we clean up any random pending events we
may have inherited from our parent in the winbindd
forked child.
Jeremy.

Modified:
   branches/SAMBA_3_0/source/lib/events.c
   branches/SAMBA_3_0/source/nsswitch/winbindd_dual.c
   branches/SAMBA_3_0_24/source/lib/events.c
   branches/SAMBA_3_0_24/source/nsswitch/winbindd_dual.c


Changeset:
Modified: branches/SAMBA_3_0/source/lib/events.c
===
--- branches/SAMBA_3_0/source/lib/events.c  2006-12-08 18:29:44 UTC (rev 
20086)
+++ branches/SAMBA_3_0/source/lib/events.c  2006-12-08 18:40:13 UTC (rev 
20087)
@@ -130,3 +130,18 @@
}
return num_events;
 }
+
+/* Returns 1 if event was found and cancelled, 0 otherwise. */
+
+int cancel_named_event(const char *event_name)
+{
+   struct timed_event *te;
+
+   for (te = timed_events; te; te = te-next) {
+   if (strcmp(event_name, te-event_name) == 0) {
+   TALLOC_FREE(te);
+   return 1;
+   }
+   }
+   return 0;
+}

Modified: branches/SAMBA_3_0/source/nsswitch/winbindd_dual.c
===
--- branches/SAMBA_3_0/source/nsswitch/winbindd_dual.c  2006-12-08 18:29:44 UTC 
(rev 20086)
+++ branches/SAMBA_3_0/source/nsswitch/winbindd_dual.c  2006-12-08 18:40:13 UTC 
(rev 20087)
@@ -845,16 +845,22 @@
child-domain-startup_time = time(NULL);
}
 
+   /* Ensure we have no pending check_online events other
+  than one for this domain. */
+
for (domain = domain_list(); domain; domain = domain-next) {
if (domain != child-domain) {
-   /* Ensure we have no check_online events pending
-  that are not on this domain. */
if (domain-check_online_event) {
TALLOC_FREE(domain-check_online_event);
}
}
}
 
+   /* Ensure we're not handling an event inherited from
+  our parent. */
+
+   cancel_named_event(krb5_ticket_refresh_handler);
+
while (1) {
 
int ret;

Modified: branches/SAMBA_3_0_24/source/lib/events.c
===
--- branches/SAMBA_3_0_24/source/lib/events.c   2006-12-08 18:29:44 UTC (rev 
20086)
+++ branches/SAMBA_3_0_24/source/lib/events.c   2006-12-08 18:40:13 UTC (rev 
20087)
@@ -130,3 +130,18 @@
}
return num_events;
 }
+
+/* Returns 1 if event was found and cancelled, 0 otherwise. */
+
+int cancel_named_event(const char *event_name)
+{
+   struct timed_event *te;
+
+   for (te = timed_events; te; te = te-next) {
+   if (strcmp(event_name, te-event_name) == 0) {
+   TALLOC_FREE(te);
+   return 1;
+   }
+   }
+   return 0;
+}

Modified: branches/SAMBA_3_0_24/source/nsswitch/winbindd_dual.c
===
--- branches/SAMBA_3_0_24/source/nsswitch/winbindd_dual.c   2006-12-08 
18:29:44 UTC (rev 20086)
+++ branches/SAMBA_3_0_24/source/nsswitch/winbindd_dual.c   2006-12-08 
18:40:13 UTC (rev 20087)
@@ -845,16 +845,22 @@
child-domain-startup_time = time(NULL);
}
 
+   /* Ensure we have no pending check_online events other
+  than one for this domain. */
+
for (domain = domain_list(); domain; domain = domain-next) {
if (domain != child-domain) {
-   /* Ensure we have no check_online events pending
-  that are not on this domain. */
if (domain-check_online_event) {
TALLOC_FREE(domain-check_online_event);
}
}
}
 
+   /* Ensure we're not handling an event inherited from
+  our parent. */
+
+   cancel_named_event(krb5_ticket_refresh_handler);
+
while (1) {
 
int ret;



svn commit: samba r20088 - in branches/SAMBA_4_0/source/libnet: .

2006-12-08 Thread metze
Author: metze
Date: 2006-12-08 18:52:29 + (Fri, 08 Dec 2006)
New Revision: 20088

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=20088

Log:
implement DsReplicaUpdateRefs() calls for all partitions

metze
Modified:
   branches/SAMBA_4_0/source/libnet/libnet_become_dc.c


Changeset:
Modified: branches/SAMBA_4_0/source/libnet/libnet_become_dc.c
===
--- branches/SAMBA_4_0/source/libnet/libnet_become_dc.c 2006-12-08 18:40:13 UTC 
(rev 20087)
+++ branches/SAMBA_4_0/source/libnet/libnet_become_dc.c 2006-12-08 18:52:29 UTC 
(rev 20088)
@@ -1795,6 +1795,12 @@
 
becomeDC_drsuapi3_pull_domain_recv);
 }
 
+static void becomeDC_drsuapi_update_refs_send(struct libnet_BecomeDC_state *s,
+ struct becomeDC_drsuapi *drsuapi,
+ struct becomeDC_partition 
*partition,
+ void (*recv_fn)(struct 
rpc_request *req));
+static void becomeDC_drsuapi2_update_refs_schema_recv(struct rpc_request *req);
+
 static void becomeDC_drsuapi3_pull_domain_recv(struct rpc_request *req)
 {
struct libnet_BecomeDC_state *s = talloc_get_type(req-async.private,
@@ -1821,6 +1827,111 @@
return;
}
 
+   becomeDC_drsuapi_update_refs_send(s, s-drsuapi2, s-schema_part,
+ 
becomeDC_drsuapi2_update_refs_schema_recv);
+}
+
+static void becomeDC_drsuapi_update_refs_send(struct libnet_BecomeDC_state *s,
+ struct becomeDC_drsuapi *drsuapi,
+ struct becomeDC_partition 
*partition,
+ void (*recv_fn)(struct 
rpc_request *req))
+{
+   struct composite_context *c = s-creq;
+   struct rpc_request *req;
+   struct drsuapi_DsReplicaUpdateRefs *r;
+   const char *ntds_guid_str;
+   const char *ntds_dns_name;
+
+   r = talloc(s, struct drsuapi_DsReplicaUpdateRefs);
+   if (composite_nomem(r, c)) return;
+
+   ntds_guid_str = GUID_string(r, s-dest_dsa.ntds_guid);
+   if (composite_nomem(ntds_guid_str, c)) return;
+
+   ntds_dns_name = talloc_asprintf(r, %s._msdcs.%s,
+   ntds_guid_str,
+   s-domain.dns_name);
+   if (composite_nomem(ntds_dns_name, c)) return;
+
+   r-in.bind_handle   = drsuapi-bind_handle;
+   r-in.level = 1;
+   r-in.req.req1.naming_context   = partition-nc;
+   r-in.req.req1.dest_dsa_dns_name= ntds_dns_name;
+   r-in.req.req1.dest_dsa_guid= s-dest_dsa.ntds_guid;
+   r-in.req.req1.options  = 
DRSUAPI_DS_REPLICA_UPDATE_ADD_REFERENCE
+   | 
DRSUAPI_DS_REPLICA_UPDATE_DELETE_REFERENCE
+   | DRSUAPI_DS_REPLICA_UPDATE_0x0010;
+
+   req = dcerpc_drsuapi_DsReplicaUpdateRefs_send(drsuapi-pipe, r, r);
+   composite_continue_rpc(c, req, recv_fn, s);
+}
+
+static void becomeDC_drsuapi2_update_refs_config_recv(struct rpc_request *req);
+
+static void becomeDC_drsuapi2_update_refs_schema_recv(struct rpc_request *req)
+{
+   struct libnet_BecomeDC_state *s = talloc_get_type(req-async.private,
+ struct libnet_BecomeDC_state);
+   struct composite_context *c = s-creq;
+   struct drsuapi_DsReplicaUpdateRefs *r = 
talloc_get_type(req-ndr.struct_ptr,
+  struct drsuapi_DsReplicaUpdateRefs);
+
+   c-status = dcerpc_ndr_request_recv(req);
+   if (!composite_is_ok(c)) return;
+
+   if (!W_ERROR_IS_OK(r-out.result)) {
+   composite_error(c, werror_to_ntstatus(r-out.result));
+   return;
+   }
+
+   talloc_free(r);
+
+   becomeDC_drsuapi_update_refs_send(s, s-drsuapi2, s-config_part,
+ 
becomeDC_drsuapi2_update_refs_config_recv);
+}
+
+static void becomeDC_drsuapi2_update_refs_domain_recv(struct rpc_request *req);
+
+static void becomeDC_drsuapi2_update_refs_config_recv(struct rpc_request *req)
+{
+   struct libnet_BecomeDC_state *s = talloc_get_type(req-async.private,
+ struct libnet_BecomeDC_state);
+   struct composite_context *c = s-creq;
+   struct drsuapi_DsReplicaUpdateRefs *r = 
talloc_get_type(req-ndr.struct_ptr,
+  struct drsuapi_DsReplicaUpdateRefs);
+
+   c-status = dcerpc_ndr_request_recv(req);
+   if (!composite_is_ok(c)) return;
+
+   if (!W_ERROR_IS_OK(r-out.result)) {
+   composite_error(c, werror_to_ntstatus(r-out.result));
+   return;
+   }
+
+   talloc_free(r);
+
+   becomeDC_drsuapi_update_refs_send(s, 

svn commit: samba r20089 - in branches: SAMBA_3_0/source SAMBA_3_0/source/modules SAMBA_3_0_24/source SAMBA_3_0_24/source/modules

2006-12-08 Thread jmcd
Author: jmcd
Date: 2006-12-08 18:56:01 + (Fri, 08 Dec 2006)
New Revision: 20089

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=20089

Log:
Put gpfs acl function into vfs_gpfs module.  Thanks to Gomati Mohanan
[EMAIL PROTECTED].

Also fix fields for sec_desc differences between 3.0 and 3.0.24 in
nfs4_acls.c.

Added:
   branches/SAMBA_3_0/source/modules/README-gpfs-acl.txt
   branches/SAMBA_3_0_24/source/modules/README-gpfs-acl.txt
Modified:
   branches/SAMBA_3_0/source/Makefile.in
   branches/SAMBA_3_0/source/modules/vfs_gpfs.c
   branches/SAMBA_3_0_24/source/Makefile.in
   branches/SAMBA_3_0_24/source/modules/nfs4_acls.c
   branches/SAMBA_3_0_24/source/modules/vfs_gpfs.c


Changeset:
Sorry, the patch is too large (1457 lines) to include; please use WebSVN to see 
it!
WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=20089


Build status as of Sat Dec 9 00:00:02 2006

2006-12-08 Thread build
URL: http://build.samba.org/

--- /home/build/master/cache/broken_results.txt.old 2006-12-08 
00:00:17.0 +
+++ /home/build/master/cache/broken_results.txt 2006-12-09 00:01:16.0 
+
@@ -1,4 +1,4 @@
-Build status as of Fri Dec  8 00:00:02 2006
+Build status as of Sat Dec  9 00:00:02 2006
 
 Build counts:
 Tree Total  Broken Panic 
@@ -11,11 +11,11 @@
 libreplace   41 2  0 
 lorikeet-heimdal 36 20 0 
 ppp  18 0  0 
-rsync43 4  0 
+rsync44 4  0 
 samba0  0  0 
 samba-docs   0  0  0 
 samba4   42 32 0 
-samba_3_044 35 0 
+samba_3_044 17 0 
 smb-build41 2  0 
 talloc   44 2  0 
 tdb  43 2  0 


svn commit: samba r20090 - in branches: SAMBA_3_0/source/auth SAMBA_3_0/source/groupdb SAMBA_3_0/source/lib SAMBA_3_0/source/nsswitch SAMBA_3_0/source/passdb SAMBA_3_0/source/rpcclient SAMBA_3_0/sourc

2006-12-08 Thread jra
Author: jra
Date: 2006-12-09 02:58:18 + (Sat, 09 Dec 2006)
New Revision: 20090

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=20090

Log:
Fix a class of bugs found by James Peach. Ensure
we never mix malloc and talloc'ed contexts in the
add_XX_to_array() and add_XX_to_array_unique()
calls. Ensure that these calls always return
False on out of memory, True otherwise and always
check them. Ensure that the relevent parts of
the conn struct and the nt_user_tokens are
TALLOC_DESTROYED not SAFE_FREE'd.
James - this should fix your crash bug in both
branches.
Jeremy.

Modified:
   branches/SAMBA_3_0/source/auth/auth_util.c
   branches/SAMBA_3_0/source/groupdb/mapping.c
   branches/SAMBA_3_0/source/groupdb/mapping_ldb.c
   branches/SAMBA_3_0/source/groupdb/mapping_tdb.c
   branches/SAMBA_3_0/source/lib/privileges.c
   branches/SAMBA_3_0/source/lib/system_smbd.c
   branches/SAMBA_3_0/source/lib/util.c
   branches/SAMBA_3_0/source/lib/util_sid.c
   branches/SAMBA_3_0/source/lib/util_str.c
   branches/SAMBA_3_0/source/nsswitch/winbindd_ads.c
   branches/SAMBA_3_0/source/nsswitch/winbindd_async.c
   branches/SAMBA_3_0/source/nsswitch/winbindd_cm.c
   branches/SAMBA_3_0/source/nsswitch/winbindd_group.c
   branches/SAMBA_3_0/source/nsswitch/winbindd_rpc.c
   branches/SAMBA_3_0/source/nsswitch/winbindd_util.c
   branches/SAMBA_3_0/source/passdb/pdb_interface.c
   branches/SAMBA_3_0/source/passdb/pdb_ldap.c
   branches/SAMBA_3_0/source/rpcclient/cmd_samr.c
   branches/SAMBA_3_0/source/smbd/conn.c
   branches/SAMBA_3_0/source/smbd/service.c
   branches/SAMBA_3_0_24/source/auth/auth_util.c
   branches/SAMBA_3_0_24/source/groupdb/mapping.c
   branches/SAMBA_3_0_24/source/groupdb/mapping_ldb.c
   branches/SAMBA_3_0_24/source/groupdb/mapping_tdb.c
   branches/SAMBA_3_0_24/source/lib/privileges.c
   branches/SAMBA_3_0_24/source/lib/system_smbd.c
   branches/SAMBA_3_0_24/source/lib/util.c
   branches/SAMBA_3_0_24/source/lib/util_sid.c
   branches/SAMBA_3_0_24/source/lib/util_str.c
   branches/SAMBA_3_0_24/source/nsswitch/winbindd_ads.c
   branches/SAMBA_3_0_24/source/nsswitch/winbindd_async.c
   branches/SAMBA_3_0_24/source/nsswitch/winbindd_cm.c
   branches/SAMBA_3_0_24/source/nsswitch/winbindd_group.c
   branches/SAMBA_3_0_24/source/nsswitch/winbindd_rpc.c
   branches/SAMBA_3_0_24/source/nsswitch/winbindd_util.c
   branches/SAMBA_3_0_24/source/passdb/pdb_interface.c
   branches/SAMBA_3_0_24/source/passdb/pdb_ldap.c
   branches/SAMBA_3_0_24/source/rpcclient/cmd_samr.c
   branches/SAMBA_3_0_24/source/smbd/conn.c
   branches/SAMBA_3_0_24/source/smbd/service.c


Changeset:
Sorry, the patch is too large (2089 lines) to include; please use WebSVN to see 
it!
WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=20090


svn commit: samba r20091 - in branches/SAMBA_4_0/source/lib/util: .

2006-12-08 Thread tridge
Author: tridge
Date: 2006-12-09 03:12:33 + (Sat, 09 Dec 2006)
New Revision: 20091

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=20091

Log:

remove blank lines at the end of text lines loaded from a file

Modified:
   branches/SAMBA_4_0/source/lib/util/util_file.c


Changeset:
Modified: branches/SAMBA_4_0/source/lib/util/util_file.c
===
--- branches/SAMBA_4_0/source/lib/util/util_file.c  2006-12-09 02:58:18 UTC 
(rev 20090)
+++ branches/SAMBA_4_0/source/lib/util/util_file.c  2006-12-09 03:12:33 UTC 
(rev 20091)
@@ -263,7 +263,6 @@
talloc_steal(ret, p);

memset(ret, 0, sizeof(ret[0])*(i+2));
-   if (numlines) *numlines = i;
 
ret[0] = p;
for (s = p, i=0; s  p+size; s++) {
@@ -275,6 +274,13 @@
if (s[0] == '\r') s[0] = 0;
}
 
+   /* remove any blank lines at the end */
+   while (i  0  ret[i-1][0] == 0) {
+   i--;
+   }
+
+   if (numlines) *numlines = i;
+
return ret;
 }
 



svn commit: samba r20092 - in branches/SAMBA_4_0/source/torture: . raw

2006-12-08 Thread tridge
Author: tridge
Date: 2006-12-09 03:16:17 + (Sat, 09 Dec 2006)
New Revision: 20092

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=20092

Log:

added a locking benchmark that should be good for benchmarking
communitcation in a CIFS clustered server. It tries to keep the
connections full by setting up the next lock as each lock is done. 

The locking pattern is similar to the local filesystem ping pong test
in junkcode, forcing a communication between nodes on each request

Added:
   branches/SAMBA_4_0/source/torture/raw/lockbench.c
Modified:
   branches/SAMBA_4_0/source/torture/config.mk
   branches/SAMBA_4_0/source/torture/raw/raw.c


Changeset:
Modified: branches/SAMBA_4_0/source/torture/config.mk
===
--- branches/SAMBA_4_0/source/torture/config.mk 2006-12-09 03:12:33 UTC (rev 
20091)
+++ branches/SAMBA_4_0/source/torture/config.mk 2006-12-09 03:16:17 UTC (rev 
20092)
@@ -78,6 +78,7 @@
raw/context.o \
raw/write.o \
raw/lock.o \
+   raw/lockbench.o \
raw/rename.o \
raw/eas.o \
raw/streams.o \

Added: branches/SAMBA_4_0/source/torture/raw/lockbench.c
===
--- branches/SAMBA_4_0/source/torture/raw/lockbench.c   2006-12-09 03:12:33 UTC 
(rev 20091)
+++ branches/SAMBA_4_0/source/torture/raw/lockbench.c   2006-12-09 03:16:17 UTC 
(rev 20092)
@@ -0,0 +1,196 @@
+/* 
+   Unix SMB/CIFS implementation.
+
+   locking benchmark
+
+   Copyright (C) Andrew Tridgell 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 2 of the License, or
+   (at your option) any later version.
+   
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+   
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#include includes.h
+#include torture/torture.h
+#include libcli/raw/libcliraw.h
+#include system/time.h
+#include system/filesys.h
+#include libcli/libcli.h
+#include torture/util.h
+#include lib/events/events.h
+#include lib/cmdline/popt_common.h
+
+#define CHECK_STATUS(status, correct) do { \
+   if (!NT_STATUS_EQUAL(status, correct)) { \
+   printf((%s) Incorrect status %s - should be %s\n, \
+  __location__, nt_errstr(status), nt_errstr(correct)); \
+   goto failed; \
+   }} while (0)
+
+#define BASEDIR \\benchlock
+#define FNAME BASEDIR \\lock.dat
+
+static int nprocs;
+static int lock_failed;
+
+struct benchlock_state {
+   struct smbcli_state *cli;
+   int fnum;
+   int offset;
+   int count;
+   union smb_lock io;
+   struct smb_lock_entry lock[2];
+   struct smbcli_request *req;
+};
+
+static void lock_completion(struct smbcli_request *);
+
+/*
+  send the next lock request
+*/
+static void lock_send(struct benchlock_state *state)
+{
+   state-io.lockx.in.file.fnum = state-fnum;
+   state-io.lockx.in.ulock_cnt = 1;
+   state-lock[0].pid = state-cli-session-pid;
+   state-lock[1].pid = state-cli-session-pid;
+   state-lock[0].offset = state-offset;
+   state-lock[1].offset = (state-offset+1)%nprocs;
+   state-req = smb_raw_lock_send(state-cli-tree, state-io);
+   if (state-req == NULL) {
+   DEBUG(0,(Failed to setup lock\n));
+   lock_failed++;
+   }
+   state-req-async.private = state;
+   state-req-async.fn  = lock_completion;
+   state-offset = (state-offset+1)%nprocs;
+}
+
+/*
+  called when a lock completes
+*/
+static void lock_completion(struct smbcli_request *req)
+{
+   struct benchlock_state *state = (struct benchlock_state 
*)req-async.private;
+   NTSTATUS status = smbcli_request_simple_recv(req);
+   if (!NT_STATUS_IS_OK(status)) {
+   lock_failed++;
+   DEBUG(0,(Lock failed - %s\n, nt_errstr(status)));
+   } else {
+   state-count++;
+   lock_send(state);
+   }
+}
+
+/* 
+   benchmark locking calls
+*/
+BOOL torture_bench_lock(struct torture_context *torture)
+{
+   BOOL ret = True;
+   TALLOC_CTX *mem_ctx = talloc_new(torture);
+   int i;
+   int timelimit = torture_setting_int(torture, timelimit, 10);
+   struct timeval tv;
+   struct event_context *ev = event_context_find(mem_ctx);
+   struct benchlock_state *state;
+   int total = 0, loops=0;
+   NTSTATUS status;
+   
+   nprocs =