svn commit: samba r15116 - branches/SAMBA_3_0/source/nsswitch trunk/source/nsswitch

2006-04-17 Thread jpeach
Author: jpeach
Date: 2006-04-18 06:26:23 + (Tue, 18 Apr 2006)
New Revision: 15116

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=15116

Log:
Allow the user to set winbind nss timeouts in seconds on IRIX. Don't
convert the default timeout to milliseconds twice.

Modified:
   branches/SAMBA_3_0/source/nsswitch/winbind_nss_irix.c
   branches/SAMBA_3_0/source/nsswitch/winbind_nss_irix.h
   trunk/source/nsswitch/winbind_nss_irix.c
   trunk/source/nsswitch/winbind_nss_irix.h


Changeset:
Modified: branches/SAMBA_3_0/source/nsswitch/winbind_nss_irix.c
===
--- branches/SAMBA_3_0/source/nsswitch/winbind_nss_irix.c   2006-04-18 
03:45:09 UTC (rev 15115)
+++ branches/SAMBA_3_0/source/nsswitch/winbind_nss_irix.c   2006-04-18 
06:26:23 UTC (rev 15116)
@@ -335,11 +335,11 @@
 switch (rq->f_index) {
 case LOOKUP:
 timeout = nsd_attr_fetch_long(rq->f_attrs,
-"lookup_timeout", 10, 10 * 1000);
+"lookup_timeout", 10, 10);
 break;
 case LIST:
 timeout = nsd_attr_fetch_long(rq->f_attrs,
-"list_timeout", 10, 10 * 1000);
+"list_timeout", 10, 10);
 break;
 default:
nsd_logprintf(NSD_LOG_OPER,
@@ -366,9 +366,11 @@
/*
 * Set up callback and timeouts
 */
-   nsd_logprintf(NSD_LOG_MIN, "send_next_request (winbind) fd = 
%d\n",winbindd_fd);
-   nsd_callback_new(winbindd_fd,winbind_callback,NSD_READ);
-   nsd_timeout_new(rq,timeout,winbind_timeout,(void *)0);
+   nsd_logprintf(NSD_LOG_MIN, "send_next_request (winbind) fd = %d\n",
+   winbindd_fd);
+
+   nsd_callback_new(winbindd_fd, winbind_callback, NSD_READ);
+   nsd_timeout_new(rq, timeout * 1000, winbind_timeout, NULL);
return NSD_CONTINUE;
 }
 

Modified: branches/SAMBA_3_0/source/nsswitch/winbind_nss_irix.h
===
--- branches/SAMBA_3_0/source/nsswitch/winbind_nss_irix.h   2006-04-18 
03:45:09 UTC (rev 15115)
+++ branches/SAMBA_3_0/source/nsswitch/winbind_nss_irix.h   2006-04-18 
06:26:23 UTC (rev 15116)
@@ -41,8 +41,4 @@
   NSS_STATUS_TRYAGAIN=NS_TRYAGAIN
 } NSS_STATUS;
 
-#define NSD_MEM_STATIC 0
-#define NSD_MEM_VOLATILE 1
-#define NSD_MEM_DYNAMIC 2
-
 #endif /* _WINBIND_NSS_IRIX_H */

Modified: trunk/source/nsswitch/winbind_nss_irix.c
===
--- trunk/source/nsswitch/winbind_nss_irix.c2006-04-18 03:45:09 UTC (rev 
15115)
+++ trunk/source/nsswitch/winbind_nss_irix.c2006-04-18 06:26:23 UTC (rev 
15116)
@@ -335,11 +335,11 @@
 switch (rq->f_index) {
 case LOOKUP:
 timeout = nsd_attr_fetch_long(rq->f_attrs,
-"lookup_timeout", 10, 10 * 1000);
+"lookup_timeout", 10, 10);
 break;
 case LIST:
 timeout = nsd_attr_fetch_long(rq->f_attrs,
-"list_timeout", 10, 10 * 1000);
+"list_timeout", 10, 10);
 break;
 default:
nsd_logprintf(NSD_LOG_OPER,
@@ -366,9 +366,11 @@
/*
 * Set up callback and timeouts
 */
-   nsd_logprintf(NSD_LOG_MIN, "send_next_request (winbind) fd = 
%d\n",winbindd_fd);
-   nsd_callback_new(winbindd_fd,winbind_callback,NSD_READ);
-   nsd_timeout_new(rq,timeout,winbind_timeout,(void *)0);
+   nsd_logprintf(NSD_LOG_MIN, "send_next_request (winbind) fd = %d\n",
+   winbindd_fd);
+
+   nsd_callback_new(winbindd_fd, winbind_callback, NSD_READ);
+   nsd_timeout_new(rq, timeout * 1000, winbind_timeout, NULL);
return NSD_CONTINUE;
 }
 

Modified: trunk/source/nsswitch/winbind_nss_irix.h
===
--- trunk/source/nsswitch/winbind_nss_irix.h2006-04-18 03:45:09 UTC (rev 
15115)
+++ trunk/source/nsswitch/winbind_nss_irix.h2006-04-18 06:26:23 UTC (rev 
15116)
@@ -41,8 +41,4 @@
   NSS_STATUS_TRYAGAIN=NS_TRYAGAIN
 } NSS_STATUS;
 
-#define NSD_MEM_STATIC 0
-#define NSD_MEM_VOLATILE 1
-#define NSD_MEM_DYNAMIC 2
-
 #endif /* _WINBIND_NSS_IRIX_H */



svn commit: samba r15115 - in branches/SAMBA_3_0/source/smbd: .

2006-04-17 Thread jra
Author: jra
Date: 2006-04-18 03:45:09 + (Tue, 18 Apr 2006)
New Revision: 15115

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=15115

Log:
Fix error return on sessionsetup. Ensure no
data blob is added if the logon call failed.
Jeremy.

Modified:
   branches/SAMBA_3_0/source/smbd/sesssetup.c


Changeset:
Modified: branches/SAMBA_3_0/source/smbd/sesssetup.c
===
--- branches/SAMBA_3_0/source/smbd/sesssetup.c  2006-04-18 03:44:55 UTC (rev 
15114)
+++ branches/SAMBA_3_0/source/smbd/sesssetup.c  2006-04-18 03:45:09 UTC (rev 
15115)
@@ -95,21 +95,25 @@
 {
char *p;
 
-   set_message(outbuf,4,0,True);
+   if (!NT_STATUS_IS_OK(nt_status) && !NT_STATUS_EQUAL(nt_status, 
NT_STATUS_MORE_PROCESSING_REQUIRED)) {
+   ERROR_NT(nt_status);
+   } else {
+   set_message(outbuf,4,0,True);
 
-   nt_status = nt_status_squash(nt_status);
-   SIVAL(outbuf, smb_rcls, NT_STATUS_V(nt_status));
-   SSVAL(outbuf, smb_vwv0, 0xFF); /* no chaining possible */
-   SSVAL(outbuf, smb_vwv3, blob.length);
-   p = smb_buf(outbuf);
+   nt_status = nt_status_squash(nt_status);
+   SIVAL(outbuf, smb_rcls, NT_STATUS_V(nt_status));
+   SSVAL(outbuf, smb_vwv0, 0xFF); /* no chaining possible */
+   SSVAL(outbuf, smb_vwv3, blob.length);
+   p = smb_buf(outbuf);
 
-   /* should we cap this? */
-   memcpy(p, blob.data, blob.length);
-   p += blob.length;
+   /* should we cap this? */
+   memcpy(p, blob.data, blob.length);
+   p += blob.length;
 
-   p += add_signature( outbuf, p );
+   p += add_signature( outbuf, p );
 
-   set_message_end(outbuf,p);
+   set_message_end(outbuf,p);
+   }
 
show_msg(outbuf);
return send_smb(smbd_server_fd(),outbuf);



svn commit: samba r15114 - in trunk/source/smbd: .

2006-04-17 Thread jra
Author: jra
Date: 2006-04-18 03:44:55 + (Tue, 18 Apr 2006)
New Revision: 15114

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=15114

Log:
Fix error return on sessionsetup. Ensure no
data blob is added if the logon call failed.
Jeremy.

Modified:
   trunk/source/smbd/sesssetup.c


Changeset:
Modified: trunk/source/smbd/sesssetup.c
===
--- trunk/source/smbd/sesssetup.c   2006-04-17 23:25:25 UTC (rev 15113)
+++ trunk/source/smbd/sesssetup.c   2006-04-18 03:44:55 UTC (rev 15114)
@@ -95,21 +95,25 @@
 {
char *p;
 
-   set_message(outbuf,4,0,True);
+   if (!NT_STATUS_IS_OK(nt_status) && !NT_STATUS_EQUAL(nt_status, 
NT_STATUS_MORE_PROCESSING_REQUIRED)) {
+   ERROR_NT(nt_status);
+   } else {
+   set_message(outbuf,4,0,True);
 
-   nt_status = nt_status_squash(nt_status);
-   SIVAL(outbuf, smb_rcls, NT_STATUS_V(nt_status));
-   SSVAL(outbuf, smb_vwv0, 0xFF); /* no chaining possible */
-   SSVAL(outbuf, smb_vwv3, blob.length);
-   p = smb_buf(outbuf);
+   nt_status = nt_status_squash(nt_status);
+   SIVAL(outbuf, smb_rcls, NT_STATUS_V(nt_status));
+   SSVAL(outbuf, smb_vwv0, 0xFF); /* no chaining possible */
+   SSVAL(outbuf, smb_vwv3, blob.length);
+   p = smb_buf(outbuf);
 
-   /* should we cap this? */
-   memcpy(p, blob.data, blob.length);
-   p += blob.length;
+   /* should we cap this? */
+   memcpy(p, blob.data, blob.length);
+   p += blob.length;
 
-   p += add_signature( outbuf, p );
+   p += add_signature( outbuf, p );
 
-   set_message_end(outbuf,p);
+   set_message_end(outbuf,p);
+   }
 
show_msg(outbuf);
return send_smb(smbd_server_fd(),outbuf);



Build status as of Tue Apr 18 00:00:02 2006

2006-04-17 Thread build
URL: http://build.samba.org/

--- /home/build/master/cache/broken_results.txt.old 2006-04-17 
00:00:04.0 +
+++ /home/build/master/cache/broken_results.txt 2006-04-18 00:00:08.0 
+
@@ -1,17 +1,17 @@
-Build status as of Mon Apr 17 00:00:02 2006
+Build status as of Tue Apr 18 00:00:02 2006
 
 Build counts:
 Tree Total  Broken Panic 
-ccache   35 5  0 
-distcc   34 4  0 
-lorikeet-heimdal 32 32 0 
-ppp  19 0  0 
-rsync35 2  0 
+ccache   7  0  0 
+distcc   8  1  0 
+lorikeet-heimdal 20 20 0 
+ppp  17 0  0 
+rsync33 9  0 
 samba2  0  0 
 samba-docs   0  0  0 
-samba4   40 29 2 
-samba_3_037 7  0 
-smb-build28 0  0 
-talloc   33 18 0 
-tdb  33 3  0 
+samba4   38 23 2 
+samba_3_035 7  0 
+smb-build27 0  0 
+talloc   10 7  0 
+tdb  31 3  0 
 


svn commit: samba r15113 - in branches/SAMBA_4_0/source/lib/ldb: common include

2006-04-17 Thread tpot
Author: tpot
Date: 2006-04-17 23:25:25 + (Mon, 17 Apr 2006)
New Revision: 15113

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=15113

Log:
Add a ldb_strerror() function.

Modified:
   branches/SAMBA_4_0/source/lib/ldb/common/ldb.c
   branches/SAMBA_4_0/source/lib/ldb/include/ldb.h


Changeset:
Modified: branches/SAMBA_4_0/source/lib/ldb/common/ldb.c
===
--- branches/SAMBA_4_0/source/lib/ldb/common/ldb.c  2006-04-17 22:32:38 UTC 
(rev 15112)
+++ branches/SAMBA_4_0/source/lib/ldb/common/ldb.c  2006-04-17 23:25:25 UTC 
(rev 15113)
@@ -474,7 +474,102 @@
return NULL;
 }
 
+/*
+  return a string explaining what a ldb error constant meancs
+*/
+const char *ldb_strerror(int ldb_err)
+{
+   switch (ldb_err) {
+   case LDB_SUCCESS:
+   return "Success";
+   case LDB_ERR_OPERATIONS_ERROR:
+   return "Operations error";
+   case LDB_ERR_PROTOCOL_ERROR:
+   return "Protocol error";
+   case LDB_ERR_TIME_LIMIT_EXCEEDED:
+   return "Time limit exceeded";
+   case LDB_ERR_SIZE_LIMIT_EXCEEDED:
+   return "Size limit exceeded";
+   case LDB_ERR_COMPARE_FALSE:
+   return "Compare false";
+   case LDB_ERR_COMPARE_TRUE:
+   return "Compare true";
+   case LDB_ERR_AUTH_METHOD_NOT_SUPPORTED:
+   return "Auth method not supported";
+   case LDB_ERR_STRONG_AUTH_REQUIRED:
+   return "Strong auth required";
+/* 9 RESERVED */
+   case LDB_ERR_REFERRAL:
+   return "Referral error";
+   case LDB_ERR_ADMIN_LIMIT_EXCEEDED:
+   return "Admin limit exceeded";
+   case LDB_ERR_UNSUPPORTED_CRITICAL_EXTENSION:
+   return "Unsupported critical extension";
+   case LDB_ERR_CONFIDENTIALITY_REQUIRED:
+   return "Confidentiality required";
+   case LDB_ERR_SASL_BIND_IN_PROGRESS:
+   return "SASL bind in progress";
+   case LDB_ERR_NO_SUCH_ATTRIBUTE:
+   return "No such attribute";
+   case LDB_ERR_UNDEFINED_ATTRIBUTE_TYPE:
+   return "Undefined attribute type";
+   case LDB_ERR_INAPPROPRIATE_MATCHING:
+   return "Inappropriate matching";
+   case LDB_ERR_CONSTRAINT_VIOLATION:
+   return "Constraint violation";
+   case LDB_ERR_ATTRIBUTE_OR_VALUE_EXISTS:
+   return "Attribute or value exists";
+   case LDB_ERR_INVALID_ATTRIBUTE_SYNTAX:
+   return "Invalid attribute syntax";
+/* 22-31 unused */
+   case LDB_ERR_NO_SUCH_OBJECT:
+   return "No such object";
+   case LDB_ERR_ALIAS_PROBLEM:
+   return "Alias problem";
+   case LDB_ERR_INVALID_DN_SYNTAX:
+   return "Invalid DN syntax";
+/* 53 RESERVED */
+   case LDB_ERR_ALIAS_DEREFERENCING_PROBLEM:
+   return "Alias dereferencing problem";
+/* 37-47 unused */
+   case LDB_ERR_INAPPROPRIATE_AUTHENTICATION:
+   return "Inappropriate authentication";
+   case LDB_ERR_INVALID_CREDENTIALS:
+   return "Invalid credentials";
+   case LDB_ERR_INSUFFICIENT_ACCESS_RIGHTS:
+   return "insufficient access rights";
+   case LDB_ERR_BUSY:
+   return "Busy";
+   case LDB_ERR_UNAVAILABLE:
+   return "Unavailable";
+   case LDB_ERR_UNWILLING_TO_PERFORM:
+   return "Unwilling to perform";
+   case LDB_ERR_LOOP_DETECT:
+   return "Loop detect";
+/* 55-63 unused */
+   case LDB_ERR_NAMING_VIOLATION:
+   return "Naming violation";
+   case LDB_ERR_OBJECT_CLASS_VIOLATION:
+   return "Object class violation";
+   case LDB_ERR_NOT_ALLOWED_ON_NON_LEAF:
+   return "Not allowed on non-leaf";
+   case LDB_ERR_NOT_ALLOWED_ON_RDN:
+   return "Not allowed on RDN";
+   case LDB_ERR_ENTRY_ALREADY_EXISTS:
+   return "Entry already exists";
+   case LDB_ERR_OBJECT_CLASS_MODS_PROHIBITED:
+   return "Object class mods prohibited";
+/* 70 RESERVED FOR CLDAP */
+   case LDB_ERR_AFFECTS_MULTIPLE_DSAS:
+   return "Affects multiple DSAs";
+/* 72-79 unused */
+   case LDB_ERR_OTHER:
+   return "Other";
+   }
 
+   return "Unknown error";
+}
+
 /*
   set backend specific opaque parameters
 */

Modified: branches/SAMBA_4_0/source/lib/ldb/include/ldb.h
===
--- branches/SAMBA_4_0/source/lib/ldb/include/ldb.h 2006-04-17 22:32:38 UTC 
(rev 15112)
+++ branches/SAMBA_4_0/source/lib/ldb/include/ldb.h 2006-04-17 23:25:25 UTC 
(rev 15113)
@@ -827,6 +827,11 @@
 const char *ldb_errstring(struct ldb_context *ldb);
 
 /**
+  return a string explaining what a ldb error constant meancs
+*/
+const char *ldb_strerror(int ldb_err);
+
+/**
   setup the defaul

svn commit: samba-docs r936 - in trunk/smbdotconf/locking: .

2006-04-17 Thread jra
Author: jra
Date: 2006-04-17 22:35:57 + (Mon, 17 Apr 2006)
New Revision: 936

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba-docs&rev=936

Log:
Document default change from "yes" to "auto".
Jeremy.

Modified:
   trunk/smbdotconf/locking/strictlocking.xml


Changeset:
Modified: trunk/smbdotconf/locking/strictlocking.xml
===
--- trunk/smbdotconf/locking/strictlocking.xml  2006-04-03 10:08:54 UTC (rev 
935)
+++ trunk/smbdotconf/locking/strictlocking.xml  2006-04-17 22:35:57 UTC (rev 
936)
@@ -1,22 +1,29 @@
 http://www.samba.org/samba/DTD/samba-doc";>
 

-   This is a boolean that controls the handling of file locking in the 
server. When this is set to yes,
+   This is an enumberated type that controls the handling of file locking 
in the server. When this is set to yes,
the server will check every read and write access for file locks, and 
deny access if locks exist. This can be slow on 
some systems.

 

+   When strict locking is set to Auto (the default), the server performs 
file lock checks only on non-oplocked files.
+   As most Windows redirectors perform file locking checks locally on 
oplocked files this is a good trade off for
+   inproved performance.
+   
+
+   
When strict locking is disabled, the server performs file lock checks 
only when the client explicitly asks for them.

 

Well-behaved clients always ask for lock checks when it is important.  
So in the vast majority of cases, 
+   strict locking = Auto or
strict locking = no is acceptable.

 
-yes
+Auto
 



svn commit: samba r15112 - in branches/SAMBA_3_0/source: param smbd

2006-04-17 Thread jra
Author: jra
Date: 2006-04-17 22:32:38 + (Mon, 17 Apr 2006)
New Revision: 15112

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=15112

Log:
Move strict locking default to auto. Fix up the error
return for one of the Samba4 torture tests.
Jeremy.

Modified:
   branches/SAMBA_3_0/source/param/loadparm.c
   branches/SAMBA_3_0/source/smbd/reply.c


Changeset:
Modified: branches/SAMBA_3_0/source/param/loadparm.c
===
--- branches/SAMBA_3_0/source/param/loadparm.c  2006-04-17 22:32:35 UTC (rev 
15111)
+++ branches/SAMBA_3_0/source/param/loadparm.c  2006-04-17 22:32:38 UTC (rev 
15112)
@@ -551,7 +551,7 @@
False,  /* bStoreDosAttributes */
False,  /* bDmapiSupport */
True,   /* bLocking */
-   True,   /* iStrictLocking */
+   Auto,   /* iStrictLocking */
True,   /* bPosixLocking */
True,   /* bShareModes */
True,   /* bOpLocks */

Modified: branches/SAMBA_3_0/source/smbd/reply.c
===
--- branches/SAMBA_3_0/source/smbd/reply.c  2006-04-17 22:32:35 UTC (rev 
15111)
+++ branches/SAMBA_3_0/source/smbd/reply.c  2006-04-17 22:32:38 UTC (rev 
15112)
@@ -5221,7 +5221,7 @@
/* we don't support these - and CANCEL_LOCK makes w2k
   and XP reboot so I don't really want to be
   compatible! (tridge) */
-   return ERROR_DOS(ERRDOS, ERRnoatomiclocks);
+   return ERROR_FORCE_DOS(ERRDOS, ERRnoatomiclocks);
}

if (locktype & LOCKING_ANDX_CANCEL_LOCK) {



svn commit: samba r15111 - in trunk/source: param smbd

2006-04-17 Thread jra
Author: jra
Date: 2006-04-17 22:32:35 + (Mon, 17 Apr 2006)
New Revision: 15111

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=15111

Log:
Move strict locking default to auto. Fix up the error
return for one of the Samba4 torture tests.
Jeremy.

Modified:
   trunk/source/param/loadparm.c
   trunk/source/smbd/reply.c


Changeset:
Modified: trunk/source/param/loadparm.c
===
--- trunk/source/param/loadparm.c   2006-04-17 22:00:30 UTC (rev 15110)
+++ trunk/source/param/loadparm.c   2006-04-17 22:32:35 UTC (rev 15111)
@@ -551,7 +551,7 @@
False,  /* bStoreDosAttributes */
False,  /* bDmapiSupport */
True,   /* bLocking */
-   True,   /* iStrictLocking */
+   Auto,   /* iStrictLocking */
True,   /* bPosixLocking */
True,   /* bShareModes */
True,   /* bOpLocks */

Modified: trunk/source/smbd/reply.c
===
--- trunk/source/smbd/reply.c   2006-04-17 22:00:30 UTC (rev 15110)
+++ trunk/source/smbd/reply.c   2006-04-17 22:32:35 UTC (rev 15111)
@@ -5221,7 +5221,7 @@
/* we don't support these - and CANCEL_LOCK makes w2k
   and XP reboot so I don't really want to be
   compatible! (tridge) */
-   return ERROR_DOS(ERRDOS, ERRnoatomiclocks);
+   return ERROR_FORCE_DOS(ERRDOS, ERRnoatomiclocks);
}

if (locktype & LOCKING_ANDX_CANCEL_LOCK) {



svn commit: samba r15110 - in branches/SAMBA_4_0/source/lib/ldb/swig: .

2006-04-17 Thread tpot
Author: tpot
Date: 2006-04-17 22:00:30 + (Mon, 17 Apr 2006)
New Revision: 15110

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=15110

Log:
Start rewriting higher level ldb wrapper.

Modified:
   branches/SAMBA_4_0/source/lib/ldb/swig/Ldb.py


Changeset:
Modified: branches/SAMBA_4_0/source/lib/ldb/swig/Ldb.py
===
--- branches/SAMBA_4_0/source/lib/ldb/swig/Ldb.py   2006-04-17 21:59:44 UTC 
(rev 15109)
+++ branches/SAMBA_4_0/source/lib/ldb/swig/Ldb.py   2006-04-17 22:00:30 UTC 
(rev 15110)
@@ -20,73 +20,71 @@
 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 #
 
-import ldb
+from ldb import *
 
+ldb_global_init()
+
 class LdbError(Exception):
 """An exception raised when a ldb error occurs."""
 pass
 
-class LdbElement:
-"""A class representing a ldb element as an array of values."""
-
-def __init__(self, elt):
-self.name = elt.name
-self.flags = elt.flags
-self.values = [ldb.ldb_val_array_getitem(elt.values, x)
-   for x in range(elt.num_values)]
-
-def __repr__(self):
-return '<%s(name=%s) instance at 0x%x' % (self.__class__.__name__,
-  `self.name`, id(self))
-
-def __len__(self):
-return self.values.len()
-
-def __getitem__(self, key):
-return self.values[key]
-
 class LdbMessage:
-"""A class representing a ldb message as a dict of ldb elements."""
+"""A class representing a ldb message as a Python dictionary."""
 
 def __init__(self, msg = None):
 
-self.dn = None
-self.private_data = None
-self.elements = []
+self._msg = msg
+if self._msg is None:
+self._msg = ldb_msg_new(None)
 
-if msg is not None:
-self.dn = msg.dn
-self.private_data = msg.private_data
-eltlist = \
-[LdbElement(ldb.ldb_message_element_array_getitem(
-msg.elements, x))
- for x in range(msg.num_elements)]
-self.elements = dict([(x.name, x) for x in eltlist])
+def __del__(self):
+talloc_free(self._msg)
 
-def __repr__(self):
-return '<%s(dn=%s) instance at 0x%x>' % (self.__class__.__name__,
-   `self.dn`, id(self))
+def len(self):
+return self._msg.num_elements
 
 def __getitem__(self, key):
-return self.elements[key]
+elt = ldb_msg_find_element(self._msg, key)
+if elt is None:
+raise KeyError, "No such attribute '%s'" % key
+return [ldb_val_array_getitem(elt.values, i)
+for i in range(elt.num_values)]
 
-def keys(self):
-return self.elements.keys()
-
+def __setitem__(self, key, value):
+result = ldb_msg_add_value(self._msg, key, str(value))
+if result != LDB_SUCCESS:
+raise LdbError, (result, ldb.strerror(result))
+
 class Ldb:
 """A class representing a binding to a ldb file."""
 
-def __init__(self):
-self.mem_ctx = ldb.talloc_init('python ldb')
-self.ldb_ctx = ldb.init(self.mem_ctx)
+def __init__(self, url, flags = 0):
+"""Initialise underlying ldb."""
+
+self.mem_ctx = talloc_init('mem_ctx for ldb 0x%x' % id(self))
+self.ldb_ctx = ldb_init(self.mem_ctx)
+
+result =  ldb_connect(self.ldb_ctx, url, flags, None)
+
+if result != LDB_SUCCESS:
+raise ldbError, (result, ldb.strerror(result))
 
 def __del__(self):
 ldb.talloc_free(self.mem_ctx)
+self.mem_ctx = None
+self.ldb_ctx = None
 
-def connect(self, url, flags = 0):
-ldb.connect(self.ldb_ctx, url, flags, None)
+def _ldb_call(self, fn, *args):
+"""Call a ldb function with args.  Raise a LdbError exception
+if the function returns a non-zero return value."""
+
+result = fn(*args)
 
+if result != ldb.LDB_SUCCESS:
+raise LdbError, (result, ldb.strerror(result))
+
 def search(self, expression):
+"""Search a ldb for a given expression."""
 
 self._ldb_call(ldb.search, self.ldb_ctx, None, ldb.LDB_SCOPE_DEFAULT,
expression, None);
@@ -94,16 +92,20 @@
 return [LdbMessage(ldb.ldb_message_ptr_array_getitem(result.msgs, ndx))
 for ndx in range(result.count)]
 
-def _ldb_call(self, fn, *args):
-result = fn(*args)
-if result != ldb.LDB_SUCCESS:
-raise LdbError, (result, ldb.strerror(result))
-
 def delete(self, dn):
-self._ldb_call(ldb.delete, self.ldb_ctx, dn)
+"""Delete a dn."""
 
+_dn = ldb_dn_explode(self.ldb_ctx, dn)
+
+self._ldb_call(ldb.delete, self.ldb_ctx, _dn)
+
 def rename(self, olddn, newdn):
-self._ldb_call(ldb.rename, self

svn commit: samba r15109 - in branches/SAMBA_4_0/source/lib/ldb/swig: .

2006-04-17 Thread tpot
Author: tpot
Date: 2006-04-17 21:59:44 + (Mon, 17 Apr 2006)
New Revision: 15109

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=15109

Log:
Wrap ldb_global_init()

Modified:
   branches/SAMBA_4_0/source/lib/ldb/swig/ldb.i


Changeset:
Modified: branches/SAMBA_4_0/source/lib/ldb/swig/ldb.i
===
--- branches/SAMBA_4_0/source/lib/ldb/swig/ldb.i2006-04-17 17:56:57 UTC 
(rev 15108)
+++ branches/SAMBA_4_0/source/lib/ldb/swig/ldb.i2006-04-17 21:59:44 UTC 
(rev 15109)
@@ -199,6 +199,8 @@
  * Wrap ldb functions 
  */
 
+int ldb_global_init(void);
+
 struct ldb_context *ldb_init(TALLOC_CTX *mem_ctx);
 
 const char *ldb_errstring(struct ldb_context *ldb);



svn commit: samba r15108 - in trunk/source: passdb tdb

2006-04-17 Thread vlendec
Author: vlendec
Date: 2006-04-17 17:56:57 + (Mon, 17 Apr 2006)
New Revision: 15108

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=15108

Log:
Implement tdb_trans_store() and use it in secrets_store().

Tridge, did I use the transaction stuff right in tdb_trans_store?

Thanks,

Volker

Modified:
   trunk/source/passdb/secrets.c
   trunk/source/tdb/tdbutil.c


Changeset:
Modified: trunk/source/passdb/secrets.c
===
--- trunk/source/passdb/secrets.c   2006-04-17 17:16:46 UTC (rev 15107)
+++ trunk/source/passdb/secrets.c   2006-04-17 17:56:57 UTC (rev 15108)
@@ -104,8 +104,8 @@
secrets_init();
if (!tdb)
return False;
-   return tdb_store(tdb, string_tdb_data(key), make_tdb_data(data, size),
-TDB_REPLACE) == 0;
+   return tdb_trans_store(tdb, string_tdb_data(key),
+  make_tdb_data(data, size), TDB_REPLACE) == 0;
 }
 
 

Modified: trunk/source/tdb/tdbutil.c
===
--- trunk/source/tdb/tdbutil.c  2006-04-17 17:16:46 UTC (rev 15107)
+++ trunk/source/tdb/tdbutil.c  2006-04-17 17:56:57 UTC (rev 15108)
@@ -907,3 +907,32 @@
return tdb->flags;
 }
 
+/
+ tdb_store, wrapped in a transaction. This way we make sure that a process
+ that dies within writing does not leave a corrupt tdb behind.
+/
+
+int tdb_trans_store(struct tdb_context *tdb, TDB_DATA key, TDB_DATA dbuf,
+   int flag)
+{
+   int res;
+
+   if ((res = tdb_transaction_start(tdb)) != 0) {
+   DEBUG(5, ("tdb_transaction_start failed\n"));
+   return res;
+   }
+
+   if ((res = tdb_store(tdb, key, dbuf, flag)) != 0) {
+   DEBUG(10, ("tdb_store failed\n"));
+   if (tdb_transaction_cancel(tdb) != 0) {
+   smb_panic("Cancelling transaction failed\n");
+   }
+   return res;
+   }
+
+   if ((res = tdb_transaction_commit(tdb)) != 0) {
+   DEBUG(5, ("tdb_transaction_commit failed\n"));
+   }
+
+   return res;
+}



svn commit: samba r15107 - in branches/SAMBA_3_0/source/nsswitch: .

2006-04-17 Thread jra
Author: jra
Date: 2006-04-17 17:16:46 + (Mon, 17 Apr 2006)
New Revision: 15107

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=15107

Log:
64 bit fixes. size_t on a 64-bit box is not uint32.
Jeremy.

Modified:
   branches/SAMBA_3_0/source/nsswitch/winbindd_group.c


Changeset:
Modified: branches/SAMBA_3_0/source/nsswitch/winbindd_group.c
===
--- branches/SAMBA_3_0/source/nsswitch/winbindd_group.c 2006-04-17 17:16:35 UTC 
(rev 15106)
+++ branches/SAMBA_3_0/source/nsswitch/winbindd_group.c 2006-04-17 17:16:46 UTC 
(rev 15107)
@@ -208,6 +208,7 @@
fstring name_domain, name_group;
char *tmp, *gr_mem;
size_t gr_mem_len;
+   size_t num_gr_mem;
gid_t gid;
union unid_t id;
NTSTATUS status;
@@ -311,12 +312,14 @@
if (!fill_grent(&state->response.data.gr, name_domain,
name_group, gid) ||
!fill_grent_mem(domain, &group_sid, name_type,
-   &state->response.data.gr.num_gr_mem,
+   &num_gr_mem,
&gr_mem, &gr_mem_len)) {
request_error(state);
return;
}
 
+   state->response.data.gr.num_gr_mem = (uint32)num_gr_mem;
+
/* Group membership lives at start of extra data */
 
state->response.data.gr.gr_mem_ofs = 0;
@@ -336,6 +339,7 @@
fstring dom_name;
fstring group_name;
size_t gr_mem_len;
+   size_t num_gr_mem;
char *gr_mem;
NTSTATUS status;
 
@@ -405,12 +409,14 @@
if (!fill_grent(&state->response.data.gr, dom_name, group_name, 
state->request.data.gid) ||
!fill_grent_mem(domain, &group_sid, name_type,
-   &state->response.data.gr.num_gr_mem,
+   &num_gr_mem,
&gr_mem, &gr_mem_len)) {
request_error(state);
return;
}
 
+   state->response.data.gr.num_gr_mem = (uint32)num_gr_mem;
+
/* Group membership lives at start of extra data */
 
state->response.data.gr.gr_mem_ofs = 0;
@@ -756,6 +762,7 @@
/* Fill in group membership entry */
 
if (result) {
+   size_t num_gr_mem = 0;
DOM_SID member_sid;
group_list[group_list_ndx].num_gr_mem = 0;
gr_mem = NULL;
@@ -771,8 +778,10 @@
domain,
&member_sid,
SID_NAME_DOM_GRP,
-   &group_list[group_list_ndx].num_gr_mem, 
+   &num_gr_mem,
&gr_mem, &gr_mem_len);
+
+   group_list[group_list_ndx].num_gr_mem = 
(uint32)num_gr_mem;
}
}
 



svn commit: samba r15106 - in trunk/source/nsswitch: .

2006-04-17 Thread jra
Author: jra
Date: 2006-04-17 17:16:35 + (Mon, 17 Apr 2006)
New Revision: 15106

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=15106

Log:
64 bit fixes. size_t on a 64-bit box is not uint32.
Jeremy.

Modified:
   trunk/source/nsswitch/winbindd_group.c


Changeset:
Modified: trunk/source/nsswitch/winbindd_group.c
===
--- trunk/source/nsswitch/winbindd_group.c  2006-04-17 15:07:23 UTC (rev 
15105)
+++ trunk/source/nsswitch/winbindd_group.c  2006-04-17 17:16:35 UTC (rev 
15106)
@@ -208,6 +208,7 @@
fstring name_domain, name_group;
char *tmp, *gr_mem;
size_t gr_mem_len;
+   size_t num_gr_mem;
gid_t gid;
union unid_t id;
NTSTATUS status;
@@ -311,12 +312,14 @@
if (!fill_grent(&state->response.data.gr, name_domain,
name_group, gid) ||
!fill_grent_mem(domain, &group_sid, name_type,
-   &state->response.data.gr.num_gr_mem,
+   &num_gr_mem,
&gr_mem, &gr_mem_len)) {
request_error(state);
return;
}
 
+   state->response.data.gr.num_gr_mem = (uint32)num_gr_mem;
+
/* Group membership lives at start of extra data */
 
state->response.data.gr.gr_mem_ofs = 0;
@@ -336,6 +339,7 @@
fstring dom_name;
fstring group_name;
size_t gr_mem_len;
+   size_t num_gr_mem;
char *gr_mem;
NTSTATUS status;
 
@@ -405,12 +409,14 @@
if (!fill_grent(&state->response.data.gr, dom_name, group_name, 
state->request.data.gid) ||
!fill_grent_mem(domain, &group_sid, name_type,
-   &state->response.data.gr.num_gr_mem,
+   &num_gr_mem,
&gr_mem, &gr_mem_len)) {
request_error(state);
return;
}
 
+   state->response.data.gr.num_gr_mem = (uint32)num_gr_mem;
+
/* Group membership lives at start of extra data */
 
state->response.data.gr.gr_mem_ofs = 0;
@@ -756,6 +762,7 @@
/* Fill in group membership entry */
 
if (result) {
+   size_t num_gr_mem = 0;
DOM_SID member_sid;
group_list[group_list_ndx].num_gr_mem = 0;
gr_mem = NULL;
@@ -771,8 +778,10 @@
domain,
&member_sid,
SID_NAME_DOM_GRP,
-   &group_list[group_list_ndx].num_gr_mem, 
+   &num_gr_mem,
&gr_mem, &gr_mem_len);
+
+   group_list[group_list_ndx].num_gr_mem = 
(uint32)num_gr_mem;
}
}
 



svn commit: samba r15105 - in trunk/source: . include nsswitch smbd tdb utils

2006-04-17 Thread vlendec
Author: vlendec
Date: 2006-04-17 15:07:23 + (Mon, 17 Apr 2006)
New Revision: 15105

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=15105

Log:
This is a backport of the samba4 tdb implementation to samba3. I did one
change to samba4's tdb: Samba4's TDB_DATA has an 'unsigned char *' as buffer
pointer, Samba3 has 'char *'. While 'unsigned char' is probably more correct,
this creates a ton of warnings in Samba3. So I changed that. We might go
through that later.

I did some basic tests, 'make test' works.

Lets see how Coverity likes this :-)

Volker

Added:
   trunk/source/tdb/dump.c
   trunk/source/tdb/error.c
   trunk/source/tdb/freelist.c
   trunk/source/tdb/io.c
   trunk/source/tdb/lock.c
   trunk/source/tdb/open.c
   trunk/source/tdb/tdb_private.h
   trunk/source/tdb/transaction.c
   trunk/source/tdb/traverse.c
Removed:
   trunk/source/tdb/spinlock.c
   trunk/source/tdb/spinlock.h
Modified:
   trunk/source/Makefile.in
   trunk/source/include/includes.h
   trunk/source/include/smb.h
   trunk/source/nsswitch/winbindd_cache.c
   trunk/source/nsswitch/winbindd_util.c
   trunk/source/smbd/mangle_hash2.c
   trunk/source/smbd/statcache.c
   trunk/source/tdb/tdb.c
   trunk/source/tdb/tdb.h
   trunk/source/tdb/tdbback.c
   trunk/source/tdb/tdbutil.c
   trunk/source/tdb/tdbutil.h
   trunk/source/utils/smbcontrol.c


Changeset:
Sorry, the patch is too large (6657 lines) to include; please use WebSVN to see 
it!
WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=15105


svn commit: samba r15104 - branches/SAMBA_3_0/source/registry branches/SAMBA_3_0/source/tdb trunk/source/registry trunk/source/tdb

2006-04-17 Thread vlendec
Author: vlendec
Date: 2006-04-17 13:06:57 + (Mon, 17 Apr 2006)
New Revision: 15104

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=15104

Log:
Implement Samba4's tdb_name().

Volker


Modified:
   branches/SAMBA_3_0/source/registry/reg_perfcount.c
   branches/SAMBA_3_0/source/tdb/tdbutil.c
   trunk/source/registry/reg_perfcount.c
   trunk/source/tdb/tdbutil.c


Changeset:
Modified: branches/SAMBA_3_0/source/registry/reg_perfcount.c
===
--- branches/SAMBA_3_0/source/registry/reg_perfcount.c  2006-04-17 12:27:35 UTC 
(rev 15103)
+++ branches/SAMBA_3_0/source/registry/reg_perfcount.c  2006-04-17 13:06:57 UTC 
(rev 15104)
@@ -172,7 +172,7 @@
/* If a key isn't there, just bypass it -- this really 
shouldn't 
   happen unless someone's mucking around with the tdb */
DEBUG(3, ("_reg_perfcount_multi_sz_from_tdb: failed to find key 
[%s] in [%s].\n",
- temp, tdb->name));
+ temp, tdb_name(tdb)));
return buffer_size;
}
/* First encode the name_index */

Modified: branches/SAMBA_3_0/source/tdb/tdbutil.c
===
--- branches/SAMBA_3_0/source/tdb/tdbutil.c 2006-04-17 12:27:35 UTC (rev 
15103)
+++ branches/SAMBA_3_0/source/tdb/tdbutil.c 2006-04-17 13:06:57 UTC (rev 
15104)
@@ -805,6 +805,14 @@
return tdb;
 }
 
+/
+  return the name of the current tdb file useful for external logging
+  functions
+/
+const char *tdb_name(struct tdb_context *tdb)
+{
+   return tdb->name;
+}
 
 /
  Allow tdb_delete to be used as a tdb_traversal_fn.

Modified: trunk/source/registry/reg_perfcount.c
===
--- trunk/source/registry/reg_perfcount.c   2006-04-17 12:27:35 UTC (rev 
15103)
+++ trunk/source/registry/reg_perfcount.c   2006-04-17 13:06:57 UTC (rev 
15104)
@@ -172,7 +172,7 @@
/* If a key isn't there, just bypass it -- this really 
shouldn't 
   happen unless someone's mucking around with the tdb */
DEBUG(3, ("_reg_perfcount_multi_sz_from_tdb: failed to find key 
[%s] in [%s].\n",
- temp, tdb->name));
+ temp, tdb_name(tdb)));
return buffer_size;
}
/* First encode the name_index */

Modified: trunk/source/tdb/tdbutil.c
===
--- trunk/source/tdb/tdbutil.c  2006-04-17 12:27:35 UTC (rev 15103)
+++ trunk/source/tdb/tdbutil.c  2006-04-17 13:06:57 UTC (rev 15104)
@@ -805,6 +805,14 @@
return tdb;
 }
 
+/
+  return the name of the current tdb file useful for external logging
+  functions
+/
+const char *tdb_name(struct tdb_context *tdb)
+{
+   return tdb->name;
+}
 
 /
  Allow tdb_delete to be used as a tdb_traversal_fn.



svn commit: samba r15103 - branches/SAMBA_3_0/source/smbd trunk/source/smbd

2006-04-17 Thread vlendec
Author: vlendec
Date: 2006-04-17 12:27:35 + (Mon, 17 Apr 2006)
New Revision: 15103

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=15103

Log:
Okay, looking closer: Samba4 tdb not exporting u32 is a bug in samba4's
tdb. tdb_open_ex needs it. Can someone from samba4 tell me how this should be
handled?

Thanks,

Volker


Modified:
   branches/SAMBA_3_0/source/smbd/mangle_hash2.c
   branches/SAMBA_3_0/source/smbd/statcache.c
   trunk/source/smbd/mangle_hash2.c
   trunk/source/smbd/statcache.c


Changeset:
Modified: branches/SAMBA_3_0/source/smbd/mangle_hash2.c
===
--- branches/SAMBA_3_0/source/smbd/mangle_hash2.c   2006-04-17 12:23:38 UTC 
(rev 15102)
+++ branches/SAMBA_3_0/source/smbd/mangle_hash2.c   2006-04-17 12:27:35 UTC 
(rev 15103)
@@ -101,7 +101,7 @@
hashing the resulting cache entry to match the known hash
 */
 static char **prefix_cache;
-static uint32 *prefix_cache_hashes;
+static u32 *prefix_cache_hashes;
 
 /* these are the characters we use in the 8.3 hash. Must be 36 chars long */
 static const char *basechars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
@@ -119,10 +119,10 @@
 
this hash needs to be fast with a low collision rate (what hash doesn't?)
 */
-static uint32 mangle_hash(const char *key, unsigned int length)
+static u32 mangle_hash(const char *key, unsigned int length)
 {
-   uint32 value;
-   uint32   i;
+   u32 value;
+   u32   i;
fstring str;
 
/* we have to uppercase here to ensure that the mangled name
@@ -139,8 +139,8 @@
 
/* Set the initial value from the key size. */
for (value = FNV1_INIT, i=0; i < length; i++) {
-value *= (uint32)FNV1_PRIME;
-value ^= (uint32)(str[i]);
+value *= (u32)FNV1_PRIME;
+value ^= (u32)(str[i]);
 }
 
/* note that we force it to a 31 bit hash, to keep within the limits
@@ -162,7 +162,7 @@
return False;
}
 
-   prefix_cache_hashes = SMB_CALLOC_ARRAY(uint32, MANGLE_CACHE_SIZE);
+   prefix_cache_hashes = SMB_CALLOC_ARRAY(u32, MANGLE_CACHE_SIZE);
if (!prefix_cache_hashes) {
return False;
}
@@ -173,7 +173,7 @@
 /*
   insert an entry into the prefix cache. The string might not be null
   terminated */
-static void cache_insert(const char *prefix, int length, uint32 hash)
+static void cache_insert(const char *prefix, int length, u32 hash)
 {
int i = hash % MANGLE_CACHE_SIZE;
 
@@ -188,7 +188,7 @@
 /*
   lookup an entry in the prefix cache. Return NULL if not found.
 */
-static const char *cache_lookup(uint32 hash)
+static const char *cache_lookup(u32 hash)
 {
int i = hash % MANGLE_CACHE_SIZE;
 
@@ -372,7 +372,7 @@
 */
 static BOOL check_cache(char *name, size_t maxlen, int snum)
 {
-   uint32 hash, multiplier;
+   u32 hash, multiplier;
unsigned int i;
const char *prefix;
char extension[4];
@@ -386,7 +386,7 @@
/* we need to extract the hash from the 8.3 name */
hash = base_reverse[(unsigned char)name[7]];
for (multiplier=36, i=5;i>=mangle_prefix;i--) {
-   uint32 v = base_reverse[(unsigned char)name[i]];
+   u32 v = base_reverse[(unsigned char)name[i]];
hash += multiplier * v;
multiplier *= 36;
}
@@ -517,7 +517,7 @@
char extension[4];
unsigned int extension_length, i;
unsigned int prefix_len;
-   uint32 hash, v;
+   u32 hash, v;
char new_name[13];
 
/* reserved names are handled specially */

Modified: branches/SAMBA_3_0/source/smbd/statcache.c
===
--- branches/SAMBA_3_0/source/smbd/statcache.c  2006-04-17 12:23:38 UTC (rev 
15102)
+++ branches/SAMBA_3_0/source/smbd/statcache.c  2006-04-17 12:27:35 UTC (rev 
15103)
@@ -291,12 +291,12 @@
  JRA. Use a djb-algorithm hash for speed.
 ***/

  
-uint32 fast_string_hash(TDB_DATA *key)
+u32 fast_string_hash(TDB_DATA *key)
 {
-uint32 n = 0;
+u32 n = 0;
 const char *p;
 for (p = key->dptr; *p != '\0'; p++) {
-n = ((n << 5) + n) ^ (uint32)(*p);
+n = ((n << 5) + n) ^ (u32)(*p);
 }
 return n;
 }

Modified: trunk/source/smbd/mangle_hash2.c
===
--- trunk/source/smbd/mangle_hash2.c2006-04-17 12:23:38 UTC (rev 15102)
+++ trunk/source/smbd/mangle_hash2.c2006-04-17 12:27:35 UTC (rev 15103)
@@ -101,7 +101,7 @@
hashing the resulting cache entry to match the known hash
 */
 static char **prefix_cache;
-static uint32 *prefix_cache_hashes;
+static u32 *prefix_cache_hashes;
 
 /* the

svn commit: samba r15102 - branches/SAMBA_3_0/source/smbd trunk/source/smbd

2006-04-17 Thread vlendec
Author: vlendec
Date: 2006-04-17 12:23:38 + (Mon, 17 Apr 2006)
New Revision: 15102

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=15102

Log:
u32 is a tdb-only thing that's not exported by samba4 tdb. Replace by uint32.

Volker


Modified:
   branches/SAMBA_3_0/source/smbd/mangle_hash2.c
   branches/SAMBA_3_0/source/smbd/statcache.c
   trunk/source/smbd/mangle_hash2.c
   trunk/source/smbd/statcache.c


Changeset:
Modified: branches/SAMBA_3_0/source/smbd/mangle_hash2.c
===
--- branches/SAMBA_3_0/source/smbd/mangle_hash2.c   2006-04-17 11:49:06 UTC 
(rev 15101)
+++ branches/SAMBA_3_0/source/smbd/mangle_hash2.c   2006-04-17 12:23:38 UTC 
(rev 15102)
@@ -101,7 +101,7 @@
hashing the resulting cache entry to match the known hash
 */
 static char **prefix_cache;
-static u32 *prefix_cache_hashes;
+static uint32 *prefix_cache_hashes;
 
 /* these are the characters we use in the 8.3 hash. Must be 36 chars long */
 static const char *basechars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
@@ -119,10 +119,10 @@
 
this hash needs to be fast with a low collision rate (what hash doesn't?)
 */
-static u32 mangle_hash(const char *key, unsigned int length)
+static uint32 mangle_hash(const char *key, unsigned int length)
 {
-   u32 value;
-   u32   i;
+   uint32 value;
+   uint32   i;
fstring str;
 
/* we have to uppercase here to ensure that the mangled name
@@ -139,8 +139,8 @@
 
/* Set the initial value from the key size. */
for (value = FNV1_INIT, i=0; i < length; i++) {
-value *= (u32)FNV1_PRIME;
-value ^= (u32)(str[i]);
+value *= (uint32)FNV1_PRIME;
+value ^= (uint32)(str[i]);
 }
 
/* note that we force it to a 31 bit hash, to keep within the limits
@@ -162,7 +162,7 @@
return False;
}
 
-   prefix_cache_hashes = SMB_CALLOC_ARRAY(u32, MANGLE_CACHE_SIZE);
+   prefix_cache_hashes = SMB_CALLOC_ARRAY(uint32, MANGLE_CACHE_SIZE);
if (!prefix_cache_hashes) {
return False;
}
@@ -173,7 +173,7 @@
 /*
   insert an entry into the prefix cache. The string might not be null
   terminated */
-static void cache_insert(const char *prefix, int length, u32 hash)
+static void cache_insert(const char *prefix, int length, uint32 hash)
 {
int i = hash % MANGLE_CACHE_SIZE;
 
@@ -188,7 +188,7 @@
 /*
   lookup an entry in the prefix cache. Return NULL if not found.
 */
-static const char *cache_lookup(u32 hash)
+static const char *cache_lookup(uint32 hash)
 {
int i = hash % MANGLE_CACHE_SIZE;
 
@@ -372,7 +372,7 @@
 */
 static BOOL check_cache(char *name, size_t maxlen, int snum)
 {
-   u32 hash, multiplier;
+   uint32 hash, multiplier;
unsigned int i;
const char *prefix;
char extension[4];
@@ -386,7 +386,7 @@
/* we need to extract the hash from the 8.3 name */
hash = base_reverse[(unsigned char)name[7]];
for (multiplier=36, i=5;i>=mangle_prefix;i--) {
-   u32 v = base_reverse[(unsigned char)name[i]];
+   uint32 v = base_reverse[(unsigned char)name[i]];
hash += multiplier * v;
multiplier *= 36;
}
@@ -517,7 +517,7 @@
char extension[4];
unsigned int extension_length, i;
unsigned int prefix_len;
-   u32 hash, v;
+   uint32 hash, v;
char new_name[13];
 
/* reserved names are handled specially */

Modified: branches/SAMBA_3_0/source/smbd/statcache.c
===
--- branches/SAMBA_3_0/source/smbd/statcache.c  2006-04-17 11:49:06 UTC (rev 
15101)
+++ branches/SAMBA_3_0/source/smbd/statcache.c  2006-04-17 12:23:38 UTC (rev 
15102)
@@ -291,12 +291,12 @@
  JRA. Use a djb-algorithm hash for speed.
 ***/

  
-u32 fast_string_hash(TDB_DATA *key)
+uint32 fast_string_hash(TDB_DATA *key)
 {
-u32 n = 0;
+uint32 n = 0;
 const char *p;
 for (p = key->dptr; *p != '\0'; p++) {
-n = ((n << 5) + n) ^ (u32)(*p);
+n = ((n << 5) + n) ^ (uint32)(*p);
 }
 return n;
 }

Modified: trunk/source/smbd/mangle_hash2.c
===
--- trunk/source/smbd/mangle_hash2.c2006-04-17 11:49:06 UTC (rev 15101)
+++ trunk/source/smbd/mangle_hash2.c2006-04-17 12:23:38 UTC (rev 15102)
@@ -101,7 +101,7 @@
hashing the resulting cache entry to match the known hash
 */
 static char **prefix_cache;
-static u32 *prefix_cache_hashes;
+static uint32 *prefix_cache_hashes;
 
 /* these are the characters we use in the 8.3 hash. Must be 36 chars long */
 static const char 

svn commit: samba r15101 - branches/SAMBA_3_0/source/groupdb branches/SAMBA_3_0/source/lib branches/SAMBA_3_0/source/passdb branches/SAMBA_3_0/source/printing branches/SAMBA_3_0/source/rpc_server bran

2006-04-17 Thread vlendec
Author: vlendec
Date: 2006-04-17 11:49:06 + (Mon, 17 Apr 2006)
New Revision: 15101

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=15101

Log:
Little step towards getting Samba4 tdb into 3: tdb_lock_bystring does not
have the timeout argument in Samba4. Add a new routine
tdb_lock_bystring_with_timeout.

Volker


Modified:
   branches/SAMBA_3_0/source/groupdb/mapping.c
   branches/SAMBA_3_0/source/lib/account_pol.c
   branches/SAMBA_3_0/source/lib/gencache.c
   branches/SAMBA_3_0/source/lib/sharesec.c
   branches/SAMBA_3_0/source/passdb/pdb_tdb.c
   branches/SAMBA_3_0/source/passdb/secrets.c
   branches/SAMBA_3_0/source/printing/notify.c
   branches/SAMBA_3_0/source/printing/nt_printing.c
   branches/SAMBA_3_0/source/printing/printing.c
   branches/SAMBA_3_0/source/rpc_server/srv_eventlog_lib.c
   branches/SAMBA_3_0/source/rpc_server/srv_eventlog_nt.c
   branches/SAMBA_3_0/source/tdb/tdbutil.c
   trunk/source/groupdb/mapping.c
   trunk/source/lib/account_pol.c
   trunk/source/lib/gencache.c
   trunk/source/lib/sharesec.c
   trunk/source/passdb/pdb_tdb.c
   trunk/source/passdb/secrets.c
   trunk/source/printing/notify.c
   trunk/source/printing/nt_printing.c
   trunk/source/printing/printing.c
   trunk/source/rpc_server/srv_eventlog_lib.c
   trunk/source/rpc_server/srv_eventlog_nt.c
   trunk/source/tdb/tdbutil.c


Changeset:
Sorry, the patch is too large (563 lines) to include; please use WebSVN to see 
it!
WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=15101


svn commit: samba r15100 - in branches/SAMBA_4_0/source: lib/tdb/common lib/tdb/include lib/tdb/tools smbd

2006-04-17 Thread vlendec
Author: vlendec
Date: 2006-04-17 11:42:59 + (Mon, 17 Apr 2006)
New Revision: 15100

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=15100

Log:
Port the bugfix for #3569 to Samba4
Modified:
   branches/SAMBA_4_0/source/lib/tdb/common/open.c
   branches/SAMBA_4_0/source/lib/tdb/include/tdb.h
   branches/SAMBA_4_0/source/lib/tdb/tools/tdbtorture.c
   branches/SAMBA_4_0/source/smbd/process_standard.c


Changeset:
Modified: branches/SAMBA_4_0/source/lib/tdb/common/open.c
===
--- branches/SAMBA_4_0/source/lib/tdb/common/open.c 2006-04-17 07:04:56 UTC 
(rev 15099)
+++ branches/SAMBA_4_0/source/lib/tdb/common/open.c 2006-04-17 11:42:59 UTC 
(rev 15100)
@@ -424,11 +424,27 @@
 }
 
 /* reopen all tdb's */
-int tdb_reopen_all(void)
+int tdb_reopen_all(int parent_longlived)
 {
struct tdb_context *tdb;
 
for (tdb=tdbs; tdb; tdb = tdb->next) {
+   /*
+* If the parent is longlived (ie. a
+* parent daemon architecture), we know
+* it will keep it's active lock on a
+* tdb opened with CLEAR_IF_FIRST. Thus
+* for child processes we don't have to
+* add an active lock. This is essential
+* to improve performance on systems that
+* keep POSIX locks as a non-scalable data
+* structure in the kernel.
+*/
+   if (parent_longlived) {
+   /* Ensure no clear-if-first. */
+   tdb->flags &= ~TDB_CLEAR_IF_FIRST;
+   }
+
if (tdb_reopen(tdb) != 0)
return -1;
}

Modified: branches/SAMBA_4_0/source/lib/tdb/include/tdb.h
===
--- branches/SAMBA_4_0/source/lib/tdb/include/tdb.h 2006-04-17 07:04:56 UTC 
(rev 15099)
+++ branches/SAMBA_4_0/source/lib/tdb/include/tdb.h 2006-04-17 11:42:59 UTC 
(rev 15100)
@@ -87,7 +87,7 @@
 tdb_hash_func hash_fn);
 
 int tdb_reopen(struct tdb_context *tdb);
-int tdb_reopen_all(void);
+int tdb_reopen_all(int parent_longlived);
 void tdb_logging_function(struct tdb_context *tdb, tdb_log_func);
 enum TDB_ERROR tdb_error(struct tdb_context *tdb);
 const char *tdb_errorstr(struct tdb_context *tdb);

Modified: branches/SAMBA_4_0/source/lib/tdb/tools/tdbtorture.c
===
--- branches/SAMBA_4_0/source/lib/tdb/tools/tdbtorture.c2006-04-17 
07:04:56 UTC (rev 15099)
+++ branches/SAMBA_4_0/source/lib/tdb/tools/tdbtorture.c2006-04-17 
11:42:59 UTC (rev 15100)
@@ -149,7 +149,7 @@
 
 #if REOPEN_PROB
if (in_transaction == 0 && random() % REOPEN_PROB == 0) {
-   tdb_reopen_all();
+   tdb_reopen_all(0);
goto next;
} 
 #endif

Modified: branches/SAMBA_4_0/source/smbd/process_standard.c
===
--- branches/SAMBA_4_0/source/smbd/process_standard.c   2006-04-17 07:04:56 UTC 
(rev 15099)
+++ branches/SAMBA_4_0/source/smbd/process_standard.c   2006-04-17 11:42:59 UTC 
(rev 15100)
@@ -105,7 +105,7 @@
socket_dup(sock2);

/* tdb needs special fork handling */
-   if (tdb_reopen_all() == -1) {
+   if (tdb_reopen_all(1) == -1) {
DEBUG(0,("standard_accept_connection: tdb_reopen_all 
failed.\n"));
}
 
@@ -169,7 +169,7 @@
talloc_free(ev);
 
/* tdb needs special fork handling */
-   if (tdb_reopen_all() == -1) {
+   if (tdb_reopen_all(1) == -1) {
DEBUG(0,("standard_accept_connection: tdb_reopen_all 
failed.\n"));
}
 



svn commit: samba r15099 - in branches/SAMBA_4_0/source: heimdal_build lib/registry script

2006-04-17 Thread ab
Author: ab
Date: 2006-04-17 07:04:56 + (Mon, 17 Apr 2006)
New Revision: 15099

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=15099

Log:
An attempt to fix BSD make portability issues. With these changes Samba 4 
builds successfully on NetBSD 3.0
Modified:
   branches/SAMBA_4_0/source/heimdal_build/config.mk
   branches/SAMBA_4_0/source/lib/registry/config.mk
   branches/SAMBA_4_0/source/script/buildtree.pl
   branches/SAMBA_4_0/source/script/cflags.pl


Changeset:
Modified: branches/SAMBA_4_0/source/heimdal_build/config.mk
===
--- branches/SAMBA_4_0/source/heimdal_build/config.mk   2006-04-16 11:47:26 UTC 
(rev 15098)
+++ branches/SAMBA_4_0/source/heimdal_build/config.mk   2006-04-17 07:04:56 UTC 
(rev 15099)
@@ -436,6 +436,9 @@
 .hin.h:
@cp $< $@
 
+heimdal/lib/roken/vis.h: heimdal/lib/roken/vis.hin
+heimdal/lib/roken/err.h: heimdal/lib/roken/err.hin
+
 $(patsubst heimdal/lib/des/%.h,heimdal/lib/des/hcrypto/%.h,$(wildcard 
heimdal/lib/des/*.h)): heimdal/lib/des/hcrypto
 
 heimdal/lib/des/hcrypto: 

Modified: branches/SAMBA_4_0/source/lib/registry/config.mk
===
--- branches/SAMBA_4_0/source/lib/registry/config.mk2006-04-16 11:47:26 UTC 
(rev 15098)
+++ branches/SAMBA_4_0/source/lib/registry/config.mk2006-04-17 07:04:56 UTC 
(rev 15099)
@@ -22,7 +22,7 @@
 lib/registry/tdr_regf.c: $(srcdir)/lib/registry/regf.idl
@CPP="$(CPP)" $(PERL) $(srcdir)/pidl/pidl $(PIDL_ARGS) \
--header --outputdir=lib/registry \
-   --tdr-parser -- $^
+   --tdr-parser -- $(srcdir)/lib/registry/regf.idl
 
 clean::
@-rm -f lib/registry/regf.h lib/registry/tdr_regf*

Modified: branches/SAMBA_4_0/source/script/buildtree.pl
===
--- branches/SAMBA_4_0/source/script/buildtree.pl   2006-04-16 11:47:26 UTC 
(rev 15098)
+++ branches/SAMBA_4_0/source/script/buildtree.pl   2006-04-17 07:04:56 UTC 
(rev 15099)
@@ -1,5 +1,5 @@
-#! /usr/bin/perl -w
-eval 'exec /usr/bin/perl -S $0 ${1+"$@"}'
+#! /usr/bin/env perl -w
+eval 'exec /usr/bin/env perl -S $0 ${1+"$@"}'
 if 0; #$running_under_some_shell
 
 use strict;

Modified: branches/SAMBA_4_0/source/script/cflags.pl
===
--- branches/SAMBA_4_0/source/script/cflags.pl  2006-04-16 11:47:26 UTC (rev 
15098)
+++ branches/SAMBA_4_0/source/script/cflags.pl  2006-04-17 07:04:56 UTC (rev 
15099)
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
 
 # This is a hack to allow per target cflags. It isn't very elegant, but it
 # is the most portable idea we have come up with yet