svn commit: samba r14904 - in branches/SAMBA_4_0/source/librpc/ndr: .

2006-04-03 Thread tridge
Author: tridge
Date: 2006-04-04 04:16:02 + (Tue, 04 Apr 2006)
New Revision: 14904

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

Log:

fixed LIBNDR_FLAG_STR_CHARLEN (thanks to Metze for noticing this)

Modified:
   branches/SAMBA_4_0/source/librpc/ndr/ndr_string.c


Changeset:
Modified: branches/SAMBA_4_0/source/librpc/ndr/ndr_string.c
===
--- branches/SAMBA_4_0/source/librpc/ndr/ndr_string.c   2006-04-04 02:02:50 UTC 
(rev 14903)
+++ branches/SAMBA_4_0/source/librpc/ndr/ndr_string.c   2006-04-04 04:16:02 UTC 
(rev 14904)
@@ -315,7 +315,7 @@
flags &= ~LIBNDR_FLAG_STR_UTF8;
}
 
-   flags &= ~(LIBNDR_FLAG_STR_CONFORMANT | LIBNDR_FLAG_STR_CHARLEN);
+   flags &= ~LIBNDR_FLAG_STR_CONFORMANT;
 
if (!(flags & LIBNDR_FLAG_STR_NOTERM)) {
s_len++;
@@ -329,6 +329,9 @@
if (flags & LIBNDR_FLAG_STR_BYTESIZE) {
c_len = d_len;
flags &= ~LIBNDR_FLAG_STR_BYTESIZE;
+   } else if (flags & LIBNDR_FLAG_STR_CHARLEN) {
+   c_len = (d_len / byte_mul)-1;
+   flags &= ~LIBNDR_FLAG_STR_CHARLEN;
} else {
c_len = d_len / byte_mul;
}



svn commit: samba r14903 - in branches/SAMBA_4_0/source/librpc/ndr: .

2006-04-03 Thread tridge
Author: tridge
Date: 2006-04-04 02:02:50 + (Tue, 04 Apr 2006)
New Revision: 14903

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

Log:

rewrote ndr_push_string() to be much simpler, and correctly handle
UTF8 strings. This should fix the german umlaut problem reported by
[EMAIL PROTECTED]

Modified:
   branches/SAMBA_4_0/source/librpc/ndr/ndr_string.c


Changeset:
Modified: branches/SAMBA_4_0/source/librpc/ndr/ndr_string.c
===
--- branches/SAMBA_4_0/source/librpc/ndr/ndr_string.c   2006-04-04 02:01:35 UTC 
(rev 14902)
+++ branches/SAMBA_4_0/source/librpc/ndr/ndr_string.c   2006-04-04 02:02:50 UTC 
(rev 14903)
@@ -288,11 +288,10 @@
 _PUBLIC_ NTSTATUS ndr_push_string(struct ndr_push *ndr, int ndr_flags, const 
char *s)
 {
ssize_t s_len, c_len, d_len;
-   int ret;
int chset = CH_UTF16;
unsigned flags = ndr->flags;
unsigned byte_mul = 2;
-   unsigned c_len_term = 1;
+   uint8_t *dest = NULL;
 
if (!(ndr_flags & NDR_SCALARS)) {
return NT_STATUS_OK;
@@ -303,7 +302,6 @@
}

s_len = s?strlen(s):0;
-   c_len = s?strlen_m(s):0;
 
if (flags & LIBNDR_FLAG_STR_ASCII) {
chset = CH_DOS;
@@ -317,148 +315,74 @@
flags &= ~LIBNDR_FLAG_STR_UTF8;
}
 
-   flags &= ~LIBNDR_FLAG_STR_CONFORMANT;
+   flags &= ~(LIBNDR_FLAG_STR_CONFORMANT | LIBNDR_FLAG_STR_CHARLEN);
 
-   if (flags & LIBNDR_FLAG_STR_CHARLEN) {
-   c_len_term = 0;
-   flags &= ~LIBNDR_FLAG_STR_CHARLEN;
+   if (!(flags & LIBNDR_FLAG_STR_NOTERM)) {
+   s_len++;
}
+   d_len = convert_string_talloc(ndr, CH_UNIX, chset, s, s_len, (void 
**)&dest);
+   if (d_len == -1) {
+   return ndr_push_error(ndr, NDR_ERR_CHARCNV, 
+ "Bad character conversion");
+   }
 
-   switch (flags & LIBNDR_STRING_FLAGS) {
+   if (flags & LIBNDR_FLAG_STR_BYTESIZE) {
+   c_len = d_len;
+   flags &= ~LIBNDR_FLAG_STR_BYTESIZE;
+   } else {
+   c_len = d_len / byte_mul;
+   }
+
+   switch ((flags & LIBNDR_STRING_FLAGS) & ~LIBNDR_FLAG_STR_NOTERM) {
case LIBNDR_FLAG_STR_LEN4|LIBNDR_FLAG_STR_SIZE4:
-   NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, c_len+c_len_term));
+   NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, c_len));
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
-   NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, c_len+c_len_term));
-   NDR_PUSH_NEED_BYTES(ndr, byte_mul*(c_len+1));
-   ret = convert_string(CH_UNIX, chset, 
-s, s_len+1,
-ndr->data+ndr->offset, 
-byte_mul*(c_len+1));
-   if (ret == -1) {
-   return ndr_push_error(ndr, NDR_ERR_CHARCNV, 
- "Bad character conversion");
-   }
-   ndr->offset += byte_mul*(c_len+1);
-   break;
-
-   case LIBNDR_FLAG_STR_LEN4|LIBNDR_FLAG_STR_SIZE4|LIBNDR_FLAG_STR_NOTERM:
-   c_len_term = 0;
-   NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, c_len+c_len_term));
-   NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, c_len));
-   NDR_PUSH_NEED_BYTES(ndr, c_len*byte_mul);
-   ret = convert_string(CH_UNIX, chset, 
-s, s_len,
-ndr->data+ndr->offset, c_len*byte_mul);
-   if (ret == -1) {
-   return ndr_push_error(ndr, NDR_ERR_CHARCNV, 
- "Bad character conversion");
-   }
-   ndr->offset += c_len*byte_mul;
+   NDR_CHECK(ndr_push_bytes(ndr, dest, d_len));
break;
 
case LIBNDR_FLAG_STR_LEN4:
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
-   NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, c_len + 
c_len_term));
-   NDR_PUSH_NEED_BYTES(ndr, byte_mul*(c_len+1));
-   ret = convert_string(CH_UNIX, chset, 
-s, s_len + 1,
-ndr->data+ndr->offset, byte_mul*(c_len+1));
-   if (ret == -1) {
-   return ndr_push_error(ndr, NDR_ERR_CHARCNV, 
- "Bad character conversion");
-   }
-   ndr->offset += byte_mul*(c_len+1);
-   break;
-
-   case LIBNDR_FLAG_STR_LEN4|LIBNDR_FLAG_STR_NOTERM:
-   NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, c_len));

svn commit: samba r14902 - in branches/SAMBA_4_0/source/lib/charset: .

2006-04-03 Thread tridge
Author: tridge
Date: 2006-04-04 02:01:35 + (Tue, 04 Apr 2006)
New Revision: 14902

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

Log:

change charcnv code to fail the conversion when it hits bad
characters, rather than silently truncating the string. This makes the
code much omre conservative, making it easier to test. It might mean
users hit problems initially, but at least we'll hear about them, and
thus can fix them.

Modified:
   branches/SAMBA_4_0/source/lib/charset/charcnv.c


Changeset:
Modified: branches/SAMBA_4_0/source/lib/charset/charcnv.c
===
--- branches/SAMBA_4_0/source/lib/charset/charcnv.c 2006-04-04 01:22:38 UTC 
(rev 14901)
+++ branches/SAMBA_4_0/source/lib/charset/charcnv.c 2006-04-04 02:01:35 UTC 
(rev 14902)
@@ -168,7 +168,7 @@
switch(errno) {
case EINVAL:
reason="Incomplete multibyte sequence";
-   break;
+   return -1;
case E2BIG:
reason="No more room"; 
if (from == CH_UNIX) {
@@ -181,10 +181,10 @@
 charset_name(from), 
charset_name(to),
 (int)srclen, (int)destlen));
}
-  break;
+  return -1;
case EILSEQ:
   reason="Illegal multibyte sequence";
-  break;
+  return -1;
}
/* smb_panic(reason); */
}



svn commit: samba r14901 - in branches/SAMBA_4_0/source/scripting/swig: .

2006-04-03 Thread tpot
Author: tpot
Date: 2006-04-04 01:22:38 + (Tue, 04 Apr 2006)
New Revision: 14901

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

Log:
More work on ldb swig interface.  Wrap some more functions.

Modified:
   branches/SAMBA_4_0/source/scripting/swig/Ldb.py
   branches/SAMBA_4_0/source/scripting/swig/ldb.i


Changeset:
Modified: branches/SAMBA_4_0/source/scripting/swig/Ldb.py
===
--- branches/SAMBA_4_0/source/scripting/swig/Ldb.py 2006-04-04 01:07:28 UTC 
(rev 14900)
+++ branches/SAMBA_4_0/source/scripting/swig/Ldb.py 2006-04-04 01:22:38 UTC 
(rev 14901)
@@ -22,7 +22,49 @@
 
 import ldb
 
+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."""
+
+def __init__(self, msg):
+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 __repr__(self):
+return '<%s(dn=%s) instance at 0x%x>' % (self.__class__.__name__,
+   `self.dn`, id(self))
+
+def __getitem__(self, key):
+return self.elements[key]
+
+def keys(self):
+return self.elements.keys()
+
 class Ldb:
+"""A class representing a binding to a ldb file."""
 
 def __init__(self):
 self.mem_ctx = ldb.talloc_init('python ldb')
@@ -35,5 +77,20 @@
 ldb.connect(self.ldb_ctx, url, flags, None)
 
 def search(self, expression):
-return ldb.search(self.ldb_ctx, None, ldb.LDB_SCOPE_DEFAULT,
-  expression, None);
+
+result = ldb.search(self.ldb_ctx, None, ldb.LDB_SCOPE_DEFAULT,
+expression, None);
+
+return [LdbMessage(ldb.ldb_message_ptr_array_getitem(result.msgs, ndx))
+for ndx in range(result.count)]
+
+def delete(self, dn):
+if ldb.delete(self.ldb_ctx, dn) != 0:
+raise IOError, ldb.errstring(self.ldb_ctx)
+
+def rename(self, olddn, newdn):
+if ldb.rename(self.ldb_ctx, olddn, newdn) != 0:
+raise IOError, ldb.errstring(self.ldb_ctx)
+
+def add(self, msg):
+ldb.add(self.ldb_ctx, msg)

Modified: branches/SAMBA_4_0/source/scripting/swig/ldb.i
===
--- branches/SAMBA_4_0/source/scripting/swig/ldb.i  2006-04-04 01:07:28 UTC 
(rev 14900)
+++ branches/SAMBA_4_0/source/scripting/swig/ldb.i  2006-04-04 01:22:38 UTC 
(rev 14901)
@@ -103,15 +103,10 @@
 }
 
 %typemap(argout) struct ldb_result ** {
-   unsigned int i;
 
-   /* XXX: Handle resultobj by throwing an exception if required */
+   /* XXX: Check result for error and throw exception if necessary */
 
-   resultobj = PyList_New((*$1)->count);
-
-   for (i = 0; i < (*$1)->count; i++) {
-   PyList_SetItem(resultobj, i, SWIG_NewPointerObj((*$1)->msgs[i], 
SWIGTYPE_p_ldb_message, 0));
-   }
+   resultobj = SWIG_NewPointerObj(*$1, SWIGTYPE_p_ldb_result, 0);
 }  
 
 %types(struct ldb_result *);
@@ -120,6 +115,17 @@
  * Wrap struct ldb_dn
  */
 
+%typemap(in) struct ldb_dn * {
+   if ($input == Py_None) {
+   $1 = NULL;
+   } else if (!PyString_Check($input)) {
+   PyErr_SetString(PyExc_TypeError, "string arg expected");
+   return NULL;
+   } else {
+   $1 = ldb_dn_explode(NULL, PyString_AsString($input));
+   }
+}
+
 %typemap(out) struct ldb_dn * {
$result = PyString_FromString(ldb_dn_linearize($1, $1));
 }
@@ -151,14 +157,39 @@
 };
 
 /*
+ * Wrap struct ldb_result
+ */
+
+%array_functions(struct ldb_message *, ldb_message_ptr_array);
+
+struct ldb_result {
+   unsigned int count;
+   struct ldb_message **msgs;
+   char **refs;
+   struct ldb_control **controls;
+};
+
+/*
  * Wrap ldb functions 
  */
 
 %rename ldb_init init;
 struct ldb_context *ldb_init(TALLOC_CTX *mem_ctx);
 
+%rename ldb_errstring errstring;
+const char *ldb_errstring(struct ldb_context *ldb);
+
 %rename ldb_connect connect;
 int ldb_connect(struct ldb_context *ldb, const char *url, unsigned int flags, 
cons

svn commit: samba r14900 - branches/SAMBA_3_0/source/utils trunk/source/utils

2006-04-03 Thread jpeach
Author: jpeach
Date: 2006-04-04 01:07:28 + (Tue, 04 Apr 2006)
New Revision: 14900

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

Log:
Separate words in error message.

Modified:
   branches/SAMBA_3_0/source/utils/smbcontrol.c
   trunk/source/utils/smbcontrol.c


Changeset:
Modified: branches/SAMBA_3_0/source/utils/smbcontrol.c
===
--- branches/SAMBA_3_0/source/utils/smbcontrol.c2006-04-04 00:59:50 UTC 
(rev 14899)
+++ branches/SAMBA_3_0/source/utils/smbcontrol.c2006-04-04 01:07:28 UTC 
(rev 14900)
@@ -143,7 +143,7 @@
}
 
 #ifndef DEVELOPER
-   fprintf(stderr, "Fault injection is only available in"
+   fprintf(stderr, "Fault injection is only available in "
"developer builds\n");
return False;
 #else /* DEVELOPER */

Modified: trunk/source/utils/smbcontrol.c
===
--- trunk/source/utils/smbcontrol.c 2006-04-04 00:59:50 UTC (rev 14899)
+++ trunk/source/utils/smbcontrol.c 2006-04-04 01:07:28 UTC (rev 14900)
@@ -143,7 +143,7 @@
}
 
 #ifndef DEVELOPER
-   fprintf(stderr, "Fault injection is only available in"
+   fprintf(stderr, "Fault injection is only available in "
"developer builds\n");
return False;
 #else /* DEVELOPER */



svn commit: samba r14899 - branches/SAMBA_3_0/source/utils trunk/source/utils

2006-04-03 Thread jpeach
Author: jpeach
Date: 2006-04-04 00:59:50 + (Tue, 04 Apr 2006)
New Revision: 14899

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

Log:
Add missing semi-colon.

Modified:
   branches/SAMBA_3_0/source/utils/smbcontrol.c
   trunk/source/utils/smbcontrol.c


Changeset:
Modified: branches/SAMBA_3_0/source/utils/smbcontrol.c
===
--- branches/SAMBA_3_0/source/utils/smbcontrol.c2006-04-04 00:27:50 UTC 
(rev 14898)
+++ branches/SAMBA_3_0/source/utils/smbcontrol.c2006-04-04 00:59:50 UTC 
(rev 14899)
@@ -144,7 +144,7 @@
 
 #ifndef DEVELOPER
fprintf(stderr, "Fault injection is only available in"
-   "developer builds\n")
+   "developer builds\n");
return False;
 #else /* DEVELOPER */
{

Modified: trunk/source/utils/smbcontrol.c
===
--- trunk/source/utils/smbcontrol.c 2006-04-04 00:27:50 UTC (rev 14898)
+++ trunk/source/utils/smbcontrol.c 2006-04-04 00:59:50 UTC (rev 14899)
@@ -144,7 +144,7 @@
 
 #ifndef DEVELOPER
fprintf(stderr, "Fault injection is only available in"
-   "developer builds\n")
+   "developer builds\n");
return False;
 #else /* DEVELOPER */
{



svn commit: samba r14898 - branches/SAMBA_3_0/source branches/SAMBA_3_0/source/include branches/SAMBA_3_0/source/lib branches/SAMBA_3_0/source/nmbd branches/SAMBA_3_0/source/nsswitch branches/SAMBA_3_

2006-04-03 Thread jpeach
Author: jpeach
Date: 2006-04-04 00:27:50 + (Tue, 04 Apr 2006)
New Revision: 14898

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

Log:
This change is an attempt to improve the quality of the information that
is produced when a process exits abnormally.

First, we coalesce the core dumping code so that we greatly improve our
odds of being able to produce a core file, even in the case of a memory
fault. I've removed duplicates of dump_core() and split it in two to
reduce the amount of work needed to actually do the dump.

Second, we refactor the exit_server code path to always log an explanation
and a stack trace. My goal is to always produce enough log information
for us to be able to explain any server exit, though there is a risk
that this could produce too much log information on a flaky network.

Finally, smbcontrol has gained a smbd fault injection operation to test
the changes above. This is only enabled for developer builds.

Modified:
   branches/SAMBA_3_0/source/configure.in
   branches/SAMBA_3_0/source/include/debug.h
   branches/SAMBA_3_0/source/include/includes.h
   branches/SAMBA_3_0/source/include/messages.h
   branches/SAMBA_3_0/source/lib/fault.c
   branches/SAMBA_3_0/source/lib/util.c
   branches/SAMBA_3_0/source/nmbd/nmbd.c
   branches/SAMBA_3_0/source/nsswitch/winbindd.c
   branches/SAMBA_3_0/source/printing/printing.c
   branches/SAMBA_3_0/source/smbd/open.c
   branches/SAMBA_3_0/source/smbd/process.c
   branches/SAMBA_3_0/source/smbd/server.c
   branches/SAMBA_3_0/source/torture/vfstest.c
   branches/SAMBA_3_0/source/utils/smbcontrol.c
   trunk/source/configure.in
   trunk/source/include/debug.h
   trunk/source/include/includes.h
   trunk/source/include/messages.h
   trunk/source/lib/fault.c
   trunk/source/lib/util.c
   trunk/source/nmbd/nmbd.c
   trunk/source/nsswitch/winbindd.c
   trunk/source/printing/printing.c
   trunk/source/smbd/open.c
   trunk/source/smbd/process.c
   trunk/source/smbd/server.c
   trunk/source/torture/vfstest.c
   trunk/source/utils/smbcontrol.c


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


Build status as of Tue Apr 4 00:00:01 2006

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

--- /home/build/master/cache/broken_results.txt.old 2006-04-03 
00:00:25.0 +
+++ /home/build/master/cache/broken_results.txt 2006-04-04 00:00:03.0 
+
@@ -1,17 +1,17 @@
-Build status as of Mon Apr  3 00:00:02 2006
+Build status as of Tue Apr  4 00:00:01 2006
 
 Build counts:
 Tree Total  Broken Panic 
 ccache   31 3  0 
 distcc   31 4  0 
-lorikeet-heimdal 25 25 0 
+lorikeet-heimdal 26 26 0 
 ppp  18 0  0 
 rsync31 2  0 
 samba3  0  0 
 samba-docs   0  0  0 
-samba4   35 28 1 
+samba4   36 28 8 
 samba_3_033 7  0 
 smb-build25 0  0 
-talloc   28 14 0 
+talloc   29 15 0 
 tdb  29 4  0 
 


svn commit: samba-web r950 - in trunk: .

2006-04-03 Thread deryck
Author: deryck
Date: 2006-04-03 23:45:56 + (Mon, 03 Apr 2006)
New Revision: 950

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

Log:
Fix bad link to current release.

deryck
Modified:
   trunk/header_columns.html


Changeset:
Modified: trunk/header_columns.html
===
--- trunk/header_columns.html   2006-04-03 15:09:23 UTC (rev 949)
+++ trunk/header_columns.html   2006-04-03 23:45:56 UTC (rev 950)
@@ -129,7 +129,7 @@
   
 Current Stable Releases
 
-Samba 3.0.22 
(gzipped)
+Samba 3.0.22 
(gzipped)
 Release Notes
 Signature
 



svn commit: samba r14897 - in branches/SAMBA_4_0/source/scripting/swig: .

2006-04-03 Thread tpot
Author: tpot
Date: 2006-04-03 22:04:33 + (Mon, 03 Apr 2006)
New Revision: 14897

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

Log:
Do more error checking of tdb function returns and raise IOError or 
KeyError exceptions as appropriate.

Add a close() function to the wrapper as we can't rely on the 
Python garbage collector destroying the object and closing the tdb file 
at any particular time.

Modified:
   branches/SAMBA_4_0/source/scripting/swig/Tdb.py


Changeset:
Modified: branches/SAMBA_4_0/source/scripting/swig/Tdb.py
===
--- branches/SAMBA_4_0/source/scripting/swig/Tdb.py 2006-04-03 19:14:12 UTC 
(rev 14896)
+++ branches/SAMBA_4_0/source/scripting/swig/Tdb.py 2006-04-03 22:04:33 UTC 
(rev 14897)
@@ -39,25 +39,33 @@
 def __init__(self, name, hash_size = 0, flags = tdb.TDB_DEFAULT,
  open_flags = os.O_RDWR | os.O_CREAT, mode = 0600):
 self.tdb = tdb.open(name, hash_size, flags, open_flags, mode)
-
+if self.tdb is None:
+raise IOError, tdb.errorstr(self.tdb)
+
 def __del__(self):
-if hasattr(self, 'tdb'):
-tdb.close(self.tdb)
+self.close()
 
+def close(self):
+if hasattr(self, 'tdb') and self.tdb is not None:
+if tdb.close(self.tdb) == -1:
+raise IOError, tdb.errorstr(self.tdb)
+self.tdb = None
+
 # Random access to keys, values
 
 def __getitem__(self, key):
 result = tdb.fetch(self.tdb, key)
 if result is None:
-raise KeyError, key
+raise KeyError, '%s: %s' % (key, tdb.errorstr(self.tdb))
 return result
 
 def __setitem__(self, key, item):
-tdb.store(self.tdb, key, item)
+if tdb.store(self.tdb, key, item) == -1:
+raise IOError, tdb.errorstr(self.tdb)
 
 def __delitem__(self, key):
 if not tdb.exists(self.tdb, key):
-raise KeyError, key
+raise KeyError, '%s: %s' % (key, tdb.errorstr(self.tdb))
 tdb.delete(self.tdb, key)
 
 def has_key(self, key):



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

2006-04-03 Thread vlendec
Author: vlendec
Date: 2006-04-03 19:14:12 + (Mon, 03 Apr 2006)
New Revision: 14896

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

Log:
Remove unused files
Removed:
   branches/SAMBA_3_0/source/nsswitch/winbindd_ldap.c
   trunk/source/nsswitch/winbindd_ldap.c


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


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

2006-04-03 Thread vlendec
Author: vlendec
Date: 2006-04-03 19:08:23 + (Mon, 03 Apr 2006)
New Revision: 14895

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

Log:
Merge the 3.0.22 change
Modified:
   branches/SAMBA_3_0/source/nsswitch/winbindd_cm.c
   trunk/source/nsswitch/winbindd_cm.c


Changeset:
Modified: branches/SAMBA_3_0/source/nsswitch/winbindd_cm.c
===
--- branches/SAMBA_3_0/source/nsswitch/winbindd_cm.c2006-04-03 15:18:12 UTC 
(rev 14894)
+++ branches/SAMBA_3_0/source/nsswitch/winbindd_cm.c2006-04-03 19:08:23 UTC 
(rev 14895)
@@ -294,7 +294,7 @@
 
DEBUG(5, ("connecting to %s from %s with username "
  "[%s]\\[%s]\n",  controller, global_myname(),
- machine_account, machine_password));
+ lp_workgroup(), machine_account));
 
ads_status = cli_session_setup_spnego(*cli,
  machine_account, 

Modified: trunk/source/nsswitch/winbindd_cm.c
===
--- trunk/source/nsswitch/winbindd_cm.c 2006-04-03 15:18:12 UTC (rev 14894)
+++ trunk/source/nsswitch/winbindd_cm.c 2006-04-03 19:08:23 UTC (rev 14895)
@@ -294,7 +294,7 @@
 
DEBUG(5, ("connecting to %s from %s with username "
  "[%s]\\[%s]\n",  controller, global_myname(),
- machine_account, machine_password));
+ lp_workgroup(), machine_account));
 
ads_status = cli_session_setup_spnego(*cli,
  machine_account, 



svn commit: samba r14894 - in branches/SAMBA_4_0/source: dsdb/samdb libcli/security

2006-04-03 Thread metze
Author: metze
Date: 2006-04-03 15:18:12 + (Mon, 03 Apr 2006)
New Revision: 14894

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

Log:
- add some 'const'
- remove sid_active_in_token() was the same as security_token_has_sid()
- rename some functions

metze
Modified:
   branches/SAMBA_4_0/source/dsdb/samdb/samdb_privilege.c
   branches/SAMBA_4_0/source/libcli/security/access_check.c
   branches/SAMBA_4_0/source/libcli/security/privilege.c
   branches/SAMBA_4_0/source/libcli/security/security_token.c


Changeset:
Modified: branches/SAMBA_4_0/source/dsdb/samdb/samdb_privilege.c
===
--- branches/SAMBA_4_0/source/dsdb/samdb/samdb_privilege.c  2006-04-03 
14:58:13 UTC (rev 14893)
+++ branches/SAMBA_4_0/source/dsdb/samdb/samdb_privilege.c  2006-04-03 
15:18:12 UTC (rev 14894)
@@ -63,7 +63,7 @@
 priv_str));
continue;
}
-   sec_privilege_set(token, privilege);
+   security_token_set_privilege(token, privilege);
}
 
return NT_STATUS_OK;

Modified: branches/SAMBA_4_0/source/libcli/security/access_check.c
===
--- branches/SAMBA_4_0/source/libcli/security/access_check.c2006-04-03 
14:58:13 UTC (rev 14893)
+++ branches/SAMBA_4_0/source/libcli/security/access_check.c2006-04-03 
15:18:12 UTC (rev 14894)
@@ -25,22 +25,6 @@
 
 
 /*
-  check if a sid is in the supplied token
-*/
-static BOOL sid_active_in_token(const struct dom_sid *sid, 
-   const struct security_token *token)
-{
-   int i;
-   for (i=0;inum_sids;i++) {
-   if (dom_sid_equal(sid, token->sids[i])) {
-   return True;
-   }
-   }
-   return False;
-}
-
-
-/*
   perform a SEC_FLAG_MAXIMUM_ALLOWED access check
 */
 static uint32_t access_check_max_allowed(const struct security_descriptor *sd, 
@@ -49,9 +33,9 @@
uint32_t denied = 0, granted = 0;
unsigned i;

-   if (sid_active_in_token(sd->owner_sid, token)) {
+   if (security_token_has_sid(token, sd->owner_sid)) {
granted |= SEC_STD_WRITE_DAC | SEC_STD_READ_CONTROL | 
SEC_STD_DELETE;
-   } else if (sec_privilege_check(token, SEC_PRIV_RESTORE)) {
+   } else if (security_token_has_privilege(token, SEC_PRIV_RESTORE)) {
granted |= SEC_STD_DELETE;
}
 
@@ -62,7 +46,7 @@
continue;
}
 
-   if (!sid_active_in_token(&ace->trustee, token)) {
+   if (!security_token_has_sid(token, &ace->trustee)) {
continue;
}
 
@@ -105,7 +89,7 @@
}
 
if (access_desired & SEC_FLAG_SYSTEM_SECURITY) {
-   if (sec_privilege_check(token, SEC_PRIV_SECURITY)) {
+   if (security_token_has_privilege(token, SEC_PRIV_SECURITY)) {
bits_remaining &= ~SEC_FLAG_SYSTEM_SECURITY;
} else {
return NT_STATUS_ACCESS_DENIED;
@@ -125,11 +109,11 @@
 
/* the owner always gets SEC_STD_WRITE_DAC, SEC_STD_READ_CONTROL and 
SEC_STD_DELETE */
if ((bits_remaining & 
(SEC_STD_WRITE_DAC|SEC_STD_READ_CONTROL|SEC_STD_DELETE)) &&
-   sid_active_in_token(sd->owner_sid, token)) {
+   security_token_has_sid(token, sd->owner_sid)) {
bits_remaining &= 
~(SEC_STD_WRITE_DAC|SEC_STD_READ_CONTROL|SEC_STD_DELETE);
}
if ((bits_remaining & SEC_STD_DELETE) &&
-   sec_privilege_check(token, SEC_PRIV_RESTORE)) {
+   security_token_has_privilege(token, SEC_PRIV_RESTORE)) {
bits_remaining &= ~SEC_STD_DELETE;
}
 
@@ -141,7 +125,7 @@
continue;
}
 
-   if (!sid_active_in_token(&ace->trustee, token)) {
+   if (!security_token_has_sid(token, &ace->trustee)) {
continue;
}
 

Modified: branches/SAMBA_4_0/source/libcli/security/privilege.c
===
--- branches/SAMBA_4_0/source/libcli/security/privilege.c   2006-04-03 
14:58:13 UTC (rev 14893)
+++ branches/SAMBA_4_0/source/libcli/security/privilege.c   2006-04-03 
15:18:12 UTC (rev 14894)
@@ -194,7 +194,7 @@
 /*
   return True if a security_token has a particular privilege bit set
 */
-BOOL sec_privilege_check(const struct security_token *token, enum 
sec_privilege privilege)
+BOOL security_token_has_privilege(const struct security_token *token, enum 
sec_privilege privilege)
 {
uint64_t mask;
 
@@ -212,7 +212,7 @@
 /*
   set a bit in the privilege mask
 */
-void sec_privilege_set(struct security_token *token, enum sec_privilege 
privilege)
+void security_token_set_privilege(struct security_token *token, enum 
se

svn commit: samba-web r949 - in trunk/news/js: .

2006-04-03 Thread deryck
Author: deryck
Date: 2006-04-03 15:09:23 + (Mon, 03 Apr 2006)
New Revision: 949

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

Log:

Allow more time for results notice on news search.
This helps slower laptops get the results count correct.

deryck

Modified:
   trunk/news/js/searchEngine.js


Changeset:
Modified: trunk/news/js/searchEngine.js
===
--- trunk/news/js/searchEngine.js   2006-04-03 13:47:18 UTC (rev 948)
+++ trunk/news/js/searchEngine.js   2006-04-03 15:09:23 UTC (rev 949)
@@ -105,7 +105,7 @@
}
}
 
-   setTimeout('checkResults("' + q + '")', 3800);
+   setTimeout('checkResults("' + q + '")', 4500);
 }
 
 function setQueryList(query)



svn commit: samba r14893 - in trunk/source: .

2006-04-03 Thread metze
Author: metze
Date: 2006-04-03 14:58:13 + (Mon, 03 Apr 2006)
New Revision: 14893

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

Log:
allow:
CC_CHECKER=mycheker make

metze
Modified:
   trunk/source/Makefile.in


Changeset:
Modified: trunk/source/Makefile.in
===
--- trunk/source/Makefile.in2006-04-03 14:57:48 UTC (rev 14892)
+++ trunk/source/Makefile.in2006-04-03 14:58:13 UTC (rev 14893)
@@ -849,9 +849,12 @@
 .c.o:
@if (: >> $@ || : > $@) >/dev/null 2>&1; then rm -f $@; else \
 dir=`echo $@ | sed 's,/[^/]*$$,,;s,^$$,.,'` $(MAKEDIR); fi
+   @if test -n "$(CC_CHECKER)"; then \
+ echo "Checking  $*.c with '$(CC_CHECKER)'";\
+ $(CC_CHECKER) -I. -I$(srcdir) $(FLAGS) @PIE_CFLAGS@ -c $< -o $@;\
+fi
@echo Compiling $*.c
-   @$(CC) -I. -I$(srcdir) $(FLAGS) @PIE_CFLAGS@ -c $< \
- -o $@ 
+   @$(CC) -I. -I$(srcdir) $(FLAGS) @PIE_CFLAGS@ -c $< -o $@ 
 @BROKEN_CC@-mv `echo $@ | sed 's%^.*/%%g'` $@
 
 # this adds support for precompiled headers. To use it, install a snapshot
@@ -899,6 +902,10 @@
 [EMAIL PROTECTED]@:
@if (: >> $@ || : > $@) >/dev/null 2>&1; then rm -f $@; else \
  dir=`echo $@ | sed 's,/[^/]*$$,,;s,^$$,.,'` $(MAKEDIR); fi
+   @if test -n "$(CC_CHECKER)"; then \
+ echo "Checking  $*.c with '$(CC_CHECKER)' and @PICFLAGS@";\
+ $(CC_CHECKER) -I. -I$(srcdir) $(FLAGS) @PICFLAGS@ -c $< -o [EMAIL 
PROTECTED]@;\
+fi
@echo Compiling $*.c with @PICFLAGS@
@$(CC) -I. -I$(srcdir) $(FLAGS) @PICFLAGS@ -c $< -o [EMAIL PROTECTED]@
 @BROKEN_CC@-mv `echo $@ | sed -e 's%^.*/%%g' -e '[EMAIL 
PROTECTED]@$$%.o%'` $@



svn commit: samba r14892 - in branches/SAMBA_3_0/source: .

2006-04-03 Thread metze
Author: metze
Date: 2006-04-03 14:57:48 + (Mon, 03 Apr 2006)
New Revision: 14892

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

Log:
allow:
CC_CHECKER=mycheker make

metze 
Modified:
   branches/SAMBA_3_0/source/Makefile.in


Changeset:
Modified: branches/SAMBA_3_0/source/Makefile.in
===
--- branches/SAMBA_3_0/source/Makefile.in   2006-04-03 14:39:46 UTC (rev 
14891)
+++ branches/SAMBA_3_0/source/Makefile.in   2006-04-03 14:57:48 UTC (rev 
14892)
@@ -833,9 +833,12 @@
 .c.o:
@if (: >> $@ || : > $@) >/dev/null 2>&1; then rm -f $@; else \
 dir=`echo $@ | sed 's,/[^/]*$$,,;s,^$$,.,'` $(MAKEDIR); fi
+   @if test -n "$(CC_CHECKER)"; then \
+ echo "Checking  $*.c with '$(CC_CHECKER)'";\
+ $(CC_CHECKER) -I. -I$(srcdir) $(FLAGS) @PIE_CFLAGS@ -c $< -o $@;\
+fi
@echo Compiling $*.c
-   @$(CC) -I. -I$(srcdir) $(FLAGS) @PIE_CFLAGS@ -c $< \
- -o $@ 
+   @$(CC) -I. -I$(srcdir) $(FLAGS) @PIE_CFLAGS@ -c $< -o $@ 
 @BROKEN_CC@-mv `echo $@ | sed 's%^.*/%%g'` $@
 
 # this adds support for precompiled headers. To use it, install a snapshot
@@ -883,6 +886,10 @@
 [EMAIL PROTECTED]@:
@if (: >> $@ || : > $@) >/dev/null 2>&1; then rm -f $@; else \
  dir=`echo $@ | sed 's,/[^/]*$$,,;s,^$$,.,'` $(MAKEDIR); fi
+   @if test -n "$(CC_CHECKER)"; then \
+ echo "Checking  $*.c with '$(CC_CHECKER)' and @PICFLAGS@";\
+ $(CC_CHECKER) -I. -I$(srcdir) $(FLAGS) @PICFLAGS@ -c $< -o [EMAIL 
PROTECTED]@;\
+fi
@echo Compiling $*.c with @PICFLAGS@
@$(CC) -I. -I$(srcdir) $(FLAGS) @PICFLAGS@ -c $< -o [EMAIL PROTECTED]@
 @BROKEN_CC@-mv `echo $@ | sed -e 's%^.*/%%g' -e '[EMAIL 
PROTECTED]@$$%.o%'` $@



svn commit: samba r14891 - in branches/SAMBA_4_0/source: dsdb/samdb libcli/security

2006-04-03 Thread metze
Author: metze
Date: 2006-04-03 14:39:46 + (Mon, 03 Apr 2006)
New Revision: 14891

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

Log:
fix a bug found by the ibm checker

the problem was that we shift with <<= (privilege-1)

and we called the function with privilege=0

add some checks to catch invalid privilege values
and hide the mask representation in privilege.c

metze
Modified:
   branches/SAMBA_4_0/source/dsdb/samdb/samdb_privilege.c
   branches/SAMBA_4_0/source/libcli/security/privilege.c
   branches/SAMBA_4_0/source/libcli/security/security_token.c


Changeset:
Modified: branches/SAMBA_4_0/source/dsdb/samdb/samdb_privilege.c
===
--- branches/SAMBA_4_0/source/dsdb/samdb/samdb_privilege.c  2006-04-03 
14:02:53 UTC (rev 14890)
+++ branches/SAMBA_4_0/source/dsdb/samdb/samdb_privilege.c  2006-04-03 
14:39:46 UTC (rev 14891)
@@ -31,16 +31,14 @@
   add privilege bits for one sid to a security_token
 */
 static NTSTATUS samdb_privilege_setup_sid(void *samctx, TALLOC_CTX *mem_ctx,
- const struct dom_sid *sid, 
- uint64_t *mask)
+ struct security_token *token,
+ const struct dom_sid *sid)
 {
const char * const attrs[] = { "privilege", NULL };
struct ldb_message **res = NULL;
struct ldb_message_element *el;
int ret, i;
char *sidstr;
-   
-   *mask = 0;
 
sidstr = ldap_encode_ndr_dom_sid(mem_ctx, sid);
NT_STATUS_HAVE_NO_MEMORY(sidstr);
@@ -59,13 +57,13 @@
 
for (i=0;inum_values;i++) {
const char *priv_str = (const char *)el->values[i].data;
-   int privilege = sec_privilege_id(priv_str);
+   enum sec_privilege privilege = sec_privilege_id(priv_str);
if (privilege == -1) {
DEBUG(1,("Unknown privilege '%s' in samdb\n",
 priv_str));
continue;
}
-   *mask |= sec_privilege_mask(privilege);
+   sec_privilege_set(token, privilege);
}
 
return NT_STATUS_OK;
@@ -103,14 +101,12 @@
token->privilege_mask = 0;

for (i=0;inum_sids;i++) {
-   uint64_t mask;
-   status = samdb_privilege_setup_sid(samctx, mem_ctx, 
-  token->sids[i], &mask);
+   status = samdb_privilege_setup_sid(samctx, mem_ctx,
+  token, token->sids[i]);
if (!NT_STATUS_IS_OK(status)) {
talloc_free(mem_ctx);
return status;
}
-   token->privilege_mask |= mask;
}
 
talloc_free(mem_ctx);

Modified: branches/SAMBA_4_0/source/libcli/security/privilege.c
===
--- branches/SAMBA_4_0/source/libcli/security/privilege.c   2006-04-03 
14:02:53 UTC (rev 14890)
+++ branches/SAMBA_4_0/source/libcli/security/privilege.c   2006-04-03 
14:39:46 UTC (rev 14891)
@@ -130,7 +130,7 @@
 /*
   map a privilege id to the wire string constant
 */
-const char *sec_privilege_name(unsigned int privilege)
+const char *sec_privilege_name(enum sec_privilege privilege)
 {
int i;
for (i=0;i 64) {
+   return NULL;
+   }
for (i=0;i 64) {
+   return 0;
+   }
+
mask <<= (privilege-1);
return mask;
 }
@@ -186,9 +194,15 @@
 /*
   return True if a security_token has a particular privilege bit set
 */
-BOOL sec_privilege_check(const struct security_token *token, unsigned int 
privilege)
+BOOL sec_privilege_check(const struct security_token *token, enum 
sec_privilege privilege)
 {
-   uint64_t mask = sec_privilege_mask(privilege);
+   uint64_t mask;
+
+   if (privilege < 1 || privilege > 64) {
+   return False;
+   }
+
+   mask = sec_privilege_mask(privilege);
if (token->privilege_mask & mask) {
return True;
}
@@ -198,7 +212,30 @@
 /*
   set a bit in the privilege mask
 */
-void sec_privilege_set(struct security_token *token, unsigned int privilege)
+void sec_privilege_set(struct security_token *token, enum sec_privilege 
privilege)
 {
+   if (privilege < 1 || privilege > 64) {
+   return;
+   }
token->privilege_mask |= sec_privilege_mask(privilege);
 }
+
+void sec_privilege_debug(int dbg_lev, const struct security_token *token)
+{
+   DEBUGADD(dbg_lev, (" Privileges (0x%16llX):\n",
+   (unsigned long long) token->privilege_mask));
+
+   if (token->privilege_mask) {
+   int i = 0;
+   uint_t privilege;
+
+   for (privile

svn commit: samba r14890 - in branches/SAMBA_4_0/source/smbd: .

2006-04-03 Thread metze
Author: metze
Date: 2006-04-03 14:02:53 + (Mon, 03 Apr 2006)
New Revision: 14890

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

Log:
fix the usage of popt...

I don't know why this causes problems on my laptop today...

anyway we have done this change in smbtorture month ago...

metze
Modified:
   branches/SAMBA_4_0/source/smbd/server.c


Changeset:
Modified: branches/SAMBA_4_0/source/smbd/server.c
===
--- branches/SAMBA_4_0/source/smbd/server.c 2006-04-03 13:53:57 UTC (rev 
14889)
+++ branches/SAMBA_4_0/source/smbd/server.c 2006-04-03 14:02:53 UTC (rev 
14890)
@@ -172,13 +172,17 @@
NTSTATUS status;
const char *model = "standard";
int max_runtime = 0;
+   enum {
+   OPT_INTERACTIVE = 1000,
+   OPT_PROCESS_MODEL
+   };
struct poptOption long_options[] = {
POPT_AUTOHELP
-   {"interactive", 'i', POPT_ARG_VAL, &interactive, True, 
+   {"interactive", 'i', POPT_ARG_NONE, NULL, OPT_INTERACTIVE,
 "Run interactive (not a daemon)", NULL},
-   {"model", 'M', POPT_ARG_STRING, &model, True, 
+   {"model", 'M', POPT_ARG_STRING, NULL, OPT_PROCESS_MODEL, 
 "Select process model", "MODEL"},
-   {"maximum-runtime", 0, POPT_ARG_INT, &max_runtime, True, 
+   {"maximum-runtime",0, POPT_ARG_INT, &max_runtime, 0, 
 "set maximum runtime of the server process, till 
autotermination", "seconds"},
POPT_COMMON_SAMBA
POPT_COMMON_VERSION
@@ -187,8 +191,16 @@
 
pc = poptGetContext(binary_name, argc, argv, long_options, 0);

-   while((opt = poptGetNextOpt(pc)) != -1) /* noop */ ;
-
+   while((opt = poptGetNextOpt(pc)) != -1) {
+   switch(opt) {
+   case OPT_INTERACTIVE:
+   interactive = True;
+   break;
+   case OPT_PROCESS_MODEL:
+   model = poptGetOptArg(pc);
+   break;
+   }
+   }
poptFreeContext(pc);
 
setup_logging(binary_name, interactive?DEBUG_STDOUT:DEBUG_FILE);



svn commit: samba r14889 - branches/SAMBA_3_0/source/smbwrapper trunk/source/smbwrapper

2006-04-03 Thread vlendec
Author: vlendec
Date: 2006-04-03 13:53:57 + (Mon, 03 Apr 2006)
New Revision: 14889

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

Log:
Fix smbwrapper compile
Modified:
   branches/SAMBA_3_0/source/smbwrapper/shared.c
   branches/SAMBA_3_0/source/smbwrapper/smbw_dir.c
   trunk/source/smbwrapper/shared.c
   trunk/source/smbwrapper/smbw_dir.c


Changeset:
Modified: branches/SAMBA_3_0/source/smbwrapper/shared.c
===
--- branches/SAMBA_3_0/source/smbwrapper/shared.c   2006-04-03 12:04:37 UTC 
(rev 14888)
+++ branches/SAMBA_3_0/source/smbwrapper/shared.c   2006-04-03 13:53:57 UTC 
(rev 14889)
@@ -111,7 +111,7 @@
if (fstat(shared_fd, &st)) goto failed;
 
if (st.st_size != shared_size) {
-   var = (char *)Realloc(variables, st.st_size);
+   var = (char *)Realloc(variables, st.st_size, True);
if (!var) goto failed;
else variables = var;
shared_size = st.st_size;
@@ -167,7 +167,7 @@
l1 = strlen(name)+1;
l2 = strlen(val)+1;
 
-   var = (char *)Realloc(variables, shared_size + l1+l2+4);
+   var = (char *)Realloc(variables, shared_size + l1+l2+4, True);
 
if (!var) {
DEBUG(0,("out of memory in smbw_setshared\n"));

Modified: branches/SAMBA_3_0/source/smbwrapper/smbw_dir.c
===
--- branches/SAMBA_3_0/source/smbwrapper/smbw_dir.c 2006-04-03 12:04:37 UTC 
(rev 14888)
+++ branches/SAMBA_3_0/source/smbwrapper/smbw_dir.c 2006-04-03 13:53:57 UTC 
(rev 14889)
@@ -85,7 +85,7 @@
if (cur_dir->malloced == cur_dir->count) {
cdl = (struct file_info *)Realloc(cur_dir->list, 

sizeof(cur_dir->list[0])*
-   
(cur_dir->count+100));
+   
(cur_dir->count+100), True);
if (!cdl) {
/* oops */
return;

Modified: trunk/source/smbwrapper/shared.c
===
--- trunk/source/smbwrapper/shared.c2006-04-03 12:04:37 UTC (rev 14888)
+++ trunk/source/smbwrapper/shared.c2006-04-03 13:53:57 UTC (rev 14889)
@@ -111,7 +111,7 @@
if (fstat(shared_fd, &st)) goto failed;
 
if (st.st_size != shared_size) {
-   var = (char *)Realloc(variables, st.st_size);
+   var = (char *)Realloc(variables, st.st_size, True);
if (!var) goto failed;
else variables = var;
shared_size = st.st_size;
@@ -167,7 +167,7 @@
l1 = strlen(name)+1;
l2 = strlen(val)+1;
 
-   var = (char *)Realloc(variables, shared_size + l1+l2+4);
+   var = (char *)Realloc(variables, shared_size + l1+l2+4, True);
 
if (!var) {
DEBUG(0,("out of memory in smbw_setshared\n"));

Modified: trunk/source/smbwrapper/smbw_dir.c
===
--- trunk/source/smbwrapper/smbw_dir.c  2006-04-03 12:04:37 UTC (rev 14888)
+++ trunk/source/smbwrapper/smbw_dir.c  2006-04-03 13:53:57 UTC (rev 14889)
@@ -85,7 +85,7 @@
if (cur_dir->malloced == cur_dir->count) {
cdl = (struct file_info *)Realloc(cur_dir->list, 

sizeof(cur_dir->list[0])*
-   
(cur_dir->count+100));
+   
(cur_dir->count+100), True);
if (!cdl) {
/* oops */
return;



svn commit: samba-web r948 - in trunk/news/advocacy: .

2006-04-03 Thread deryck
Author: deryck
Date: 2006-04-03 13:47:18 + (Mon, 03 Apr 2006)
New Revision: 948

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

Log:

Add link to Groklaw interview with FSFE's counsel Carlo Piana.

deryck

Added:
   trunk/news/advocacy/carlo_piana_groklaw_1April06.html


Changeset:
Added: trunk/news/advocacy/carlo_piana_groklaw_1April06.html
===
--- trunk/news/advocacy/carlo_piana_groklaw_1April06.html   2006-04-03 
13:30:23 UTC (rev 947)
+++ trunk/news/advocacy/carlo_piana_groklaw_1April06.html   2006-04-03 
13:47:18 UTC (rev 948)
@@ -0,0 +1,21 @@
+FSFE's Counsel Carlo Piana 
Groklaw Interview 
+
+
+  Groklaw has an 
+  http://www.groklaw.net/article.php?story=20060401001402147";>interview 
+  with the FSFE's counsel Carlo Piana.  This interview comes on the
+  heels of the Microsoft antitrust penalty hearings in Brussels last 
Friday.
+
+  But what concerns us most 
+  is that you need to control the end-user license so the end-user license 
+  shouldn't be the GNU GPL. So that's the main problem with the 
conditions. 
+  They [Microsoft] want that our implementation, the Free Software 
implementation of 
+  their information, which is a separate product developed by, 
independently 
+  by other companies, would be forced to be licensed under non-Free 
Software, 
+  non-copyleft conditions. That's plainly unacceptable, because the only 
+  real competition now is under the GNU GPL.
+
+  Thanks to Sean Daly for the link to his interview.
+
+
+   



svn commit: samba-web r947 - in trunk: .

2006-04-03 Thread deryck
Author: deryck
Date: 2006-04-03 13:30:23 + (Mon, 03 Apr 2006)
New Revision: 947

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

Log:

Remove link explaining samba.org redesign.
We've been redesigned long enough this isn't needed.

deryck

Modified:
   trunk/header_columns.html


Changeset:
Modified: trunk/header_columns.html
===
--- trunk/header_columns.html   2006-03-31 02:52:25 UTC (rev 946)
+++ trunk/header_columns.html   2006-04-03 13:30:23 UTC (rev 947)
@@ -157,7 +157,6 @@
 Commercial Support
 Samba-related Products
 Mirroring Info
-Samba-Web, version 3
 http://www.sambaxp.org/";>samba eXPerience
 
   



svn commit: samba r14888 - in branches/tmp/vl-posixacls: . examples/libsmbclient examples/pdb examples/scripts/shares/perl source source/auth source/groupdb source/include source/lib source/libads sou

2006-04-03 Thread vlendec
Author: vlendec
Date: 2006-04-03 12:04:37 + (Mon, 03 Apr 2006)
New Revision: 14888

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

Log:
svn merge -r14509:14887
Added:
   branches/tmp/vl-posixacls/source/lib/repdir.c
   branches/tmp/vl-posixacls/source/libsmb/dcerpc_err.c
   branches/tmp/vl-posixacls/source/script/tests/selftest.sh
   branches/tmp/vl-posixacls/source/script/tests/test_functions.sh
   branches/tmp/vl-posixacls/source/script/tests/test_posix_s3.sh
   branches/tmp/vl-posixacls/source/script/tests/test_smbclient_s3.sh
   branches/tmp/vl-posixacls/source/script/tests/test_smbtorture_s3.sh
   branches/tmp/vl-posixacls/source/script/tests/tests_all.sh
   branches/tmp/vl-posixacls/source/script/tests/timelimit.c
   branches/tmp/vl-posixacls/source/smbd/dmapi.c
   branches/tmp/vl-posixacls/source/tests/os2_delete.c
Removed:
   branches/tmp/vl-posixacls/examples/pdb/sambapdb.dtd
   branches/tmp/vl-posixacls/source/script/tests/functions
   branches/tmp/vl-posixacls/source/script/tests/runtests.sh
   branches/tmp/vl-posixacls/source/script/tests/t_001.sh
   branches/tmp/vl-posixacls/source/script/tests/t_002.sh
Modified:
   branches/tmp/vl-posixacls/
   branches/tmp/vl-posixacls/examples/libsmbclient/get_auth_data_fn.h
   branches/tmp/vl-posixacls/examples/libsmbclient/testbrowse.c
   branches/tmp/vl-posixacls/examples/scripts/shares/perl/modify_samba_config.pl
   branches/tmp/vl-posixacls/source/Makefile.in
   branches/tmp/vl-posixacls/source/VERSION
   branches/tmp/vl-posixacls/source/auth/auth_util.c
   branches/tmp/vl-posixacls/source/configure.in
   branches/tmp/vl-posixacls/source/groupdb/mapping.c
   branches/tmp/vl-posixacls/source/include/debug.h
   branches/tmp/vl-posixacls/source/include/includes.h
   branches/tmp/vl-posixacls/source/include/libsmb_internal.h
   branches/tmp/vl-posixacls/source/include/libsmbclient.h
   branches/tmp/vl-posixacls/source/include/local.h
   branches/tmp/vl-posixacls/source/include/rpc_dce.h
   branches/tmp/vl-posixacls/source/include/rpc_samr.h
   branches/tmp/vl-posixacls/source/include/smb.h
   branches/tmp/vl-posixacls/source/include/smb_macros.h
   branches/tmp/vl-posixacls/source/lib/debug.c
   branches/tmp/vl-posixacls/source/lib/smbrun.c
   branches/tmp/vl-posixacls/source/lib/socket_wrapper.c
   branches/tmp/vl-posixacls/source/lib/system.c
   branches/tmp/vl-posixacls/source/lib/system_smbd.c
   branches/tmp/vl-posixacls/source/lib/util.c
   branches/tmp/vl-posixacls/source/lib/util_pw.c
   branches/tmp/vl-posixacls/source/libads/kerberos.c
   branches/tmp/vl-posixacls/source/libads/kerberos_verify.c
   branches/tmp/vl-posixacls/source/libads/krb5_setpw.c
   branches/tmp/vl-posixacls/source/libsmb/cliconnect.c
   branches/tmp/vl-posixacls/source/libsmb/libsmbclient.c
   branches/tmp/vl-posixacls/source/locking/brlock.c
   branches/tmp/vl-posixacls/source/locking/locking.c
   branches/tmp/vl-posixacls/source/locking/posix.c
   branches/tmp/vl-posixacls/source/nmbd/nmbd.c
   branches/tmp/vl-posixacls/source/nsswitch/pam_winbind.h
   branches/tmp/vl-posixacls/source/nsswitch/wb_common.c
   branches/tmp/vl-posixacls/source/nsswitch/winbindd.c
   branches/tmp/vl-posixacls/source/nsswitch/winbindd_ads.c
   branches/tmp/vl-posixacls/source/nsswitch/winbindd_async.c
   branches/tmp/vl-posixacls/source/nsswitch/winbindd_cache.c
   branches/tmp/vl-posixacls/source/nsswitch/winbindd_cm.c
   branches/tmp/vl-posixacls/source/nsswitch/winbindd_cred_cache.c
   branches/tmp/vl-posixacls/source/nsswitch/winbindd_creds.c
   branches/tmp/vl-posixacls/source/nsswitch/winbindd_pam.c
   branches/tmp/vl-posixacls/source/nsswitch/winbindd_passdb.c
   branches/tmp/vl-posixacls/source/nsswitch/winbindd_util.c
   branches/tmp/vl-posixacls/source/pam_smbpass/pam_smb_acct.c
   branches/tmp/vl-posixacls/source/pam_smbpass/pam_smb_auth.c
   branches/tmp/vl-posixacls/source/pam_smbpass/pam_smb_passwd.c
   branches/tmp/vl-posixacls/source/param/loadparm.c
   branches/tmp/vl-posixacls/source/passdb/pdb_get_set.c
   branches/tmp/vl-posixacls/source/passdb/pdb_interface.c
   branches/tmp/vl-posixacls/source/passdb/pdb_ldap.c
   branches/tmp/vl-posixacls/source/passdb/pdb_tdb.c
   branches/tmp/vl-posixacls/source/registry/reg_objects.c
   branches/tmp/vl-posixacls/source/rpc_client/cli_echo.c
   branches/tmp/vl-posixacls/source/rpc_client/cli_lsarpc.c
   branches/tmp/vl-posixacls/source/rpc_client/cli_pipe.c
   branches/tmp/vl-posixacls/source/rpc_parse/parse_lsa.c
   branches/tmp/vl-posixacls/source/rpc_parse/parse_misc.c
   branches/tmp/vl-posixacls/source/rpc_parse/parse_prs.c
   branches/tmp/vl-posixacls/source/rpc_parse/parse_reg.c
   branches/tmp/vl-posixacls/source/rpc_parse/parse_rpc.c
   branches/tmp/vl-posixacls/source/rpc_parse/parse_samr.c
   branches/tmp/vl-posixacls/source/rpc_parse/parse_shutdown.c
   branches/tmp/vl-posixacls/source/rpc_parse/parse_spoolss.c
   branches/tmp/vl-posixacls/source/rpc_server/srv_pipe.c
   branches/tmp/

svn commit: samba r14887 - in trunk/source/script/tests: .

2006-04-03 Thread metze
Author: metze
Date: 2006-04-03 11:34:34 + (Mon, 03 Apr 2006)
New Revision: 14887

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

Log:
reenable BASE-DENY2 and BASE-DENY3

metze
Modified:
   trunk/source/script/tests/selftest.sh
   trunk/source/script/tests/test_posix_s3.sh


Changeset:
Modified: trunk/source/script/tests/selftest.sh
===
--- trunk/source/script/tests/selftest.sh   2006-04-03 11:34:17 UTC (rev 
14886)
+++ trunk/source/script/tests/selftest.sh   2006-04-03 11:34:34 UTC (rev 
14887)
@@ -114,6 +114,7 @@
 [tmp]
path = $PREFIX_ABS/tmp
read only = no
+   smbd:sharedelay = 10
 EOF
 
 

Modified: trunk/source/script/tests/test_posix_s3.sh
===
--- trunk/source/script/tests/test_posix_s3.sh  2006-04-03 11:34:17 UTC (rev 
14886)
+++ trunk/source/script/tests/test_posix_s3.sh  2006-04-03 11:34:34 UTC (rev 
14887)
@@ -34,7 +34,7 @@
 
 tests="$base"
 
-skipped="BASE-CHARSET BASE-DEFER_OPEN BASE-DELAYWRITE BASE-DELETE BASE-DENY1 
BASE-DENY2 BASE-DENY3 BASE-OPENATTR BASE-TCONDEV"
+skipped="BASE-CHARSET BASE-DEFER_OPEN BASE-DELAYWRITE BASE-DELETE BASE-DENY1 
BASE-OPENATTR BASE-TCONDEV"
 
 echo "WARNING: Skipping tests $skipped"
 



svn commit: samba r14886 - in branches/SAMBA_3_0/source/script/tests: .

2006-04-03 Thread metze
Author: metze
Date: 2006-04-03 11:34:17 + (Mon, 03 Apr 2006)
New Revision: 14886

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

Log:
reenable BASE-DENY2 and BASE-DENY3

metze
Modified:
   branches/SAMBA_3_0/source/script/tests/selftest.sh
   branches/SAMBA_3_0/source/script/tests/test_posix_s3.sh


Changeset:
Modified: branches/SAMBA_3_0/source/script/tests/selftest.sh
===
--- branches/SAMBA_3_0/source/script/tests/selftest.sh  2006-04-03 11:33:18 UTC 
(rev 14885)
+++ branches/SAMBA_3_0/source/script/tests/selftest.sh  2006-04-03 11:34:17 UTC 
(rev 14886)
@@ -114,6 +114,7 @@
 [tmp]
path = $PREFIX_ABS/tmp
read only = no
+   smbd:sharedelay = 10
 EOF
 
 

Modified: branches/SAMBA_3_0/source/script/tests/test_posix_s3.sh
===
--- branches/SAMBA_3_0/source/script/tests/test_posix_s3.sh 2006-04-03 
11:33:18 UTC (rev 14885)
+++ branches/SAMBA_3_0/source/script/tests/test_posix_s3.sh 2006-04-03 
11:34:17 UTC (rev 14886)
@@ -34,7 +34,7 @@
 
 tests="$base"
 
-skipped="BASE-CHARSET BASE-DEFER_OPEN BASE-DELAYWRITE BASE-DELETE BASE-DENY1 
BASE-DENY2 BASE-DENY3 BASE-OPENATTR BASE-TCONDEV"
+skipped="BASE-CHARSET BASE-DEFER_OPEN BASE-DELAYWRITE BASE-DELETE BASE-DENY1 
BASE-OPENATTR BASE-TCONDEV"
 
 echo "WARNING: Skipping tests $skipped"
 



svn commit: samba r14885 - in trunk/source/script/tests: .

2006-04-03 Thread metze
Author: metze
Date: 2006-04-03 11:33:18 + (Mon, 03 Apr 2006)
New Revision: 14885

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

Log:
this doesn't work and causes processes to be left when using ctrl-c (SIGINT)

metze
Modified:
   trunk/source/script/tests/test_functions.sh


Changeset:
Modified: trunk/source/script/tests/test_functions.sh
===
--- trunk/source/script/tests/test_functions.sh 2006-04-03 11:32:57 UTC (rev 
14884)
+++ trunk/source/script/tests/test_functions.sh 2006-04-03 11:33:18 UTC (rev 
14885)
@@ -161,10 +161,7 @@
return 1
fi

-   if [ -z "$TORTURE_MAXTIME" ];then
-   TORTURE_MAXTIME=300
-   fi
-   ( timelimit $TORTURE_MAXTIME $cmdline > $TEST_LOG 2>&1 )
+   ( $cmdline > $TEST_LOG 2>&1 )
status=$?
if [ x"$status" != x"0" ]; then
echo "TEST OUTPUT:"



svn commit: samba r14884 - in branches/SAMBA_3_0/source/script/tests: .

2006-04-03 Thread metze
Author: metze
Date: 2006-04-03 11:32:57 + (Mon, 03 Apr 2006)
New Revision: 14884

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

Log:
this doesn't work and causes processes to be left when using ctrl-c (SIGINT)

metze
Modified:
   branches/SAMBA_3_0/source/script/tests/test_functions.sh


Changeset:
Modified: branches/SAMBA_3_0/source/script/tests/test_functions.sh
===
--- branches/SAMBA_3_0/source/script/tests/test_functions.sh2006-04-03 
10:43:34 UTC (rev 14883)
+++ branches/SAMBA_3_0/source/script/tests/test_functions.sh2006-04-03 
11:32:57 UTC (rev 14884)
@@ -161,10 +161,7 @@
return 1
fi

-   if [ -z "$TORTURE_MAXTIME" ];then
-   TORTURE_MAXTIME=300
-   fi
-   ( timelimit $TORTURE_MAXTIME $cmdline > $TEST_LOG 2>&1 )
+   ( $cmdline > $TEST_LOG 2>&1 )
status=$?
if [ x"$status" != x"0" ]; then
echo "TEST OUTPUT:"



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

2006-04-03 Thread metze
Author: metze
Date: 2006-04-03 10:43:34 + (Mon, 03 Apr 2006)
New Revision: 14883

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

Log:
add 'smbd:sharedelay' option, so that we can speed up BASE-DENY2 in make test
as done in samba4

metze
Modified:
   branches/SAMBA_3_0/source/smbd/open.c


Changeset:
Modified: branches/SAMBA_3_0/source/smbd/open.c
===
--- branches/SAMBA_3_0/source/smbd/open.c   2006-04-03 10:43:10 UTC (rev 
14882)
+++ branches/SAMBA_3_0/source/smbd/open.c   2006-04-03 10:43:34 UTC (rev 
14883)
@@ -1440,7 +1440,14 @@
lp_defer_sharing_violations()) {
struct timeval timeout;
struct deferred_open_record state;
+   int timeout_usecs;
 
+   /* this is a hack to speed up torture tests
+  in 'make test' */
+   timeout_usecs = lp_parm_int(conn->service,
+   "smbd","sharedelay",
+   
SHARING_VIOLATION_USEC_WAIT);
+
/* This is a relative time, added to the 
absolute
   request_time value to get the absolute 
timeout time.
   Note that if this is the second or greater 
time we enter
@@ -1449,7 +1456,7 @@
   time this request mid was processed. This is 
what allows
   the request to eventually time out. */
 
-   timeout = timeval_set(0, 
SHARING_VIOLATION_USEC_WAIT);
+   timeout = timeval_set(0, timeout_usecs);
 
/* Nothing actually uses 
state.delayed_for_oplocks
   but it's handy to differentiate in debug 
messages



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

2006-04-03 Thread metze
Author: metze
Date: 2006-04-03 10:43:10 + (Mon, 03 Apr 2006)
New Revision: 14882

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

Log:
add 'smbd:sharedelay' option, so that we can speed up BASE-DENY2 in make test
as done in samba4

metze
Modified:
   trunk/source/smbd/open.c


Changeset:
Modified: trunk/source/smbd/open.c
===
--- trunk/source/smbd/open.c2006-04-03 09:26:38 UTC (rev 14881)
+++ trunk/source/smbd/open.c2006-04-03 10:43:10 UTC (rev 14882)
@@ -1440,7 +1440,14 @@
lp_defer_sharing_violations()) {
struct timeval timeout;
struct deferred_open_record state;
+   int timeout_usecs;
 
+   /* this is a hack to speed up torture tests
+  in 'make test' */
+   timeout_usecs = lp_parm_int(conn->service,
+   "smbd","sharedelay",
+   
SHARING_VIOLATION_USEC_WAIT);
+
/* This is a relative time, added to the 
absolute
   request_time value to get the absolute 
timeout time.
   Note that if this is the second or greater 
time we enter
@@ -1449,7 +1456,7 @@
   time this request mid was processed. This is 
what allows
   the request to eventually time out. */
 
-   timeout = timeval_set(0, 
SHARING_VIOLATION_USEC_WAIT);
+   timeout = timeval_set(0, timeout_usecs);
 
/* Nothing actually uses 
state.delayed_for_oplocks
   but it's handy to differentiate in debug 
messages



svn commit: samba-docs r935 - in trunk/manpages-3: .

2006-04-03 Thread lmuelle
Author: lmuelle
Date: 2006-04-03 10:08:54 + (Mon, 03 Apr 2006)
New Revision: 935

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

Log:
Add paragraph about how to dump a parametrical option.

Modified:
   trunk/manpages-3/testparm.1.xml


Changeset:
Modified: trunk/manpages-3/testparm.1.xml
===
--- trunk/manpages-3/testparm.1.xml 2006-03-30 14:24:55 UTC (rev 934)
+++ trunk/manpages-3/testparm.1.xml 2006-04-03 10:08:54 UTC (rev 935)
@@ -97,6 +97,10 @@

Dumps the named parameter.  If no section-name is set the view
is limited by default to the global section.
+
+   It is also possible to dump a parametrical option.  Therfore
+   the option has to be separated by a colon from the
+   parametername.


 



svn commit: samba r14881 - in branches/SAMBA_4_0/source/scripting/swig: .

2006-04-03 Thread tpot
Author: tpot
Date: 2006-04-03 09:26:38 + (Mon, 03 Apr 2006)
New Revision: 14881

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

Log:
Unpack ldb_message_element and ldb_val arrays.  Python can now access 
all parts of a ldb_result:

@BASEINFO has 2 elements
elt[0]: val[0]: sequenceNumber = 2
elt[1]: val[0]: distinguishedName = @BASEINFO
name=foo has 2 elements
elt[0]: val[0]: foo = bar
elt[1]: val[0]: distinguishedName = name=foo

Cleanup some swig junk that was only necessary when including config.h 
and function prototypes that used the PRINTF_ATTRIBUTE() macro.

Add some more comments.

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


Changeset:
Modified: branches/SAMBA_4_0/source/scripting/swig/ldb.i
===
--- branches/SAMBA_4_0/source/scripting/swig/ldb.i  2006-04-03 09:18:34 UTC 
(rev 14880)
+++ branches/SAMBA_4_0/source/scripting/swig/ldb.i  2006-04-03 09:26:38 UTC 
(rev 14881)
@@ -3,7 +3,7 @@
 
Swig interface to ldb.
 
-   Copyright (C) 2005 Tim Potter <[EMAIL PROTECTED]>
+   Copyright (C) 2005,2006 Tim Potter <[EMAIL PROTECTED]>
Copyright (C) 2006 Simo Sorce <[EMAIL PROTECTED]>
 
  ** NOTE! The following LGPL license applies to the ldb
@@ -29,53 +29,48 @@
 
 %{
 
-/* This symbol is used in both includes.h and Python.h which causes an
-   annoying compiler warning. */
+/* Some typedefs to help swig along */
 
-#ifdef HAVE_FSTAT
-#undef HAVE_FSTAT
-#endif
-
-#if (__GNUC__ >= 3)
-/** Use gcc attribute to check printf fns.  a1 is the 1-based index of
- * the parameter containing the format, and a2 the index of the first
- * argument. Note that some gcc 2.x versions don't handle this
- * properly **/
-#define PRINTF_ATTRIBUTE(a1, a2) __attribute__ ((format (__printf__, a1, a2)))
-#else
-#define PRINTF_ATTRIBUTE(a1, a2)
-#endif
-
-/* Include ldb headers */
-
-/* Treat a uint8_t as an unsigned character */
 typedef unsigned char uint8_t;
 typedef unsigned long long uint64_t;
 typedef long long int64_t;
 
+/* Include headers */
+
 #include "lib/ldb/include/ldb.h"
 #include "lib/talloc/talloc.h"
 
 %}
 
-/* The ldb functions will crash if a NULL ldb is passed */
+%include "carrays.i"
+%include "exception.i"
 
-%include exception.i
+/* 
+ * Wrap struct ldb_context
+ */
 
+/* The ldb functions will crash if a NULL ldb context is passed so
+   catch this before it happens. */
+
 %typemap(check) struct ldb_context* {
if ($1 == NULL)
SWIG_exception(SWIG_ValueError, 
"ldb context must be non-NULL");
 }
 
+/* 
+ * Wrap TALLOC_CTX
+ */
+
 /* Use talloc_init() to create a parameter to pass to ldb_init().  Don't
forget to free it using talloc_free() afterwards. */
 
 TALLOC_CTX *talloc_init(char *name);
 int talloc_free(TALLOC_CTX *ptr);
 
-/* In and out typemaps for struct ldb_val.  This is converted to and from
-   the Python string datatype. */
+/*
+ * Wrap struct ldb_val
+ */
 
 %typemap(in) struct ldb_val {
if (!PyString_Check($input)) {
@@ -99,7 +94,9 @@
LDB_SCOPE_ONELEVEL=1,
LDB_SCOPE_SUBTREE=2};
 
-/* Typemap for passing a struct ldb_result by reference */
+/*
+ * Wrap struct ldb_result
+ */
 
 %typemap(in, numinputs=0) struct ldb_result **OUT (struct ldb_result 
*temp_ldb_result) {
$1 = &temp_ldb_result;
@@ -119,10 +116,20 @@
 
 %types(struct ldb_result *);
 
+/*
+ * Wrap struct ldb_dn
+ */
+
 %typemap(out) struct ldb_dn * {
$result = PyString_FromString(ldb_dn_linearize($1, $1));
 }
 
+/*
+ * Wrap struct ldb_message_element
+ */
+
+%array_functions(struct ldb_val, ldb_val_array);
+
 struct ldb_message_element {
unsigned int flags;
const char *name;
@@ -130,6 +137,12 @@
struct ldb_val *values;
 };
 
+/*
+ * Wrap struct ldb_message
+ */
+
+%array_functions(struct ldb_message_element, ldb_message_element_array);
+
 struct ldb_message {
struct ldb_dn *dn;
unsigned int num_elements;
@@ -137,7 +150,9 @@
void *private_data; /* private to the backend */
 };
 
-/* Wrap ldb functions */
+/*
+ * Wrap ldb functions 
+ */
 
 %rename ldb_init init;
 struct ldb_context *ldb_init(TALLOC_CTX *mem_ctx);



svn commit: samba r14880 - in branches/SAMBA_4_0/source/scripting/swig: .

2006-04-03 Thread tpot
Author: tpot
Date: 2006-04-03 09:18:34 + (Mon, 03 Apr 2006)
New Revision: 14880

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

Log:
Doc.

Modified:
   branches/SAMBA_4_0/source/scripting/swig/tdb.i


Changeset:
Modified: branches/SAMBA_4_0/source/scripting/swig/tdb.i
===
--- branches/SAMBA_4_0/source/scripting/swig/tdb.i  2006-04-03 08:25:03 UTC 
(rev 14879)
+++ branches/SAMBA_4_0/source/scripting/swig/tdb.i  2006-04-03 09:18:34 UTC 
(rev 14880)
@@ -51,7 +51,7 @@
 
 %}
 
-/* The tdb functions will crash if a NULL tdb is passed */
+/* The tdb functions will crash if a NULL tdb context is passed */
 
 %include exception.i
 



svn commit: samba r14879 - in branches/SAMBA_4_0/source/scripting/swig: .

2006-04-03 Thread tpot
Author: tpot
Date: 2006-04-03 08:25:03 + (Mon, 03 Apr 2006)
New Revision: 14879

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

Log:
Fix bug unpacking ldb_messages.

Start decoding more of ldb_message and ldb_message_result.

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


Changeset:
Modified: branches/SAMBA_4_0/source/scripting/swig/ldb.i
===
--- branches/SAMBA_4_0/source/scripting/swig/ldb.i  2006-04-03 08:03:44 UTC 
(rev 14878)
+++ branches/SAMBA_4_0/source/scripting/swig/ldb.i  2006-04-03 08:25:03 UTC 
(rev 14879)
@@ -113,12 +113,23 @@
resultobj = PyList_New((*$1)->count);
 
for (i = 0; i < (*$1)->count; i++) {
-   PyList_SetItem(resultobj, i, SWIG_NewPointerObj(*$1, 
SWIGTYPE_p_ldb_message, 0));
+   PyList_SetItem(resultobj, i, SWIG_NewPointerObj((*$1)->msgs[i], 
SWIGTYPE_p_ldb_message, 0));
}
 }  
 
 %types(struct ldb_result *);
 
+%typemap(out) struct ldb_dn * {
+   $result = PyString_FromString(ldb_dn_linearize($1, $1));
+}
+
+struct ldb_message_element {
+   unsigned int flags;
+   const char *name;
+   unsigned int num_values;
+   struct ldb_val *values;
+};
+
 struct ldb_message {
struct ldb_dn *dn;
unsigned int num_elements;



svn commit: samba r14878 - in branches/SAMBA_4_0/source: script/tests scripting/swig scripting/swig/torture

2006-04-03 Thread tpot
Author: tpot
Date: 2006-04-03 08:03:44 + (Mon, 03 Apr 2006)
New Revision: 14878

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

Log:
Write swig wrappers for ldb_init() and ldb_connect().

Start wrapper for ldb_search().  Currently it returns a list of swig 
ldb_message objects.  More unpacking of results required.

Modified:
   branches/SAMBA_4_0/source/script/tests/test_swig.sh
   branches/SAMBA_4_0/source/scripting/swig/Ldb.py
   branches/SAMBA_4_0/source/scripting/swig/ldb.i
   branches/SAMBA_4_0/source/scripting/swig/torture/torture_ldb.py


Changeset:
Modified: branches/SAMBA_4_0/source/script/tests/test_swig.sh
===
--- branches/SAMBA_4_0/source/script/tests/test_swig.sh 2006-04-03 06:46:55 UTC 
(rev 14877)
+++ branches/SAMBA_4_0/source/script/tests/test_swig.sh 2006-04-03 08:03:44 UTC 
(rev 14878)
@@ -13,6 +13,7 @@
 failed=0
 
 export PYTHONPATH=scripting/swig:$PYTHONPATH
+export LD_LIBRARY_PATH=bin:$LD_LIBRARY_PATH
 
 scripting/swig/torture/torture_tdb.py || failed=`expr $failed + 1`
 scripting/swig/torture/torture_ldb.py || failed=`expr $failed + 1`

Modified: branches/SAMBA_4_0/source/scripting/swig/Ldb.py
===
--- branches/SAMBA_4_0/source/scripting/swig/Ldb.py 2006-04-03 06:46:55 UTC 
(rev 14877)
+++ branches/SAMBA_4_0/source/scripting/swig/Ldb.py 2006-04-03 08:03:44 UTC 
(rev 14878)
@@ -23,4 +23,17 @@
 import ldb
 
 class Ldb:
-pass
+
+def __init__(self):
+self.mem_ctx = ldb.talloc_init('python ldb')
+self.ldb_ctx = ldb.init(self.mem_ctx)
+
+def __del__(self):
+ldb.talloc_free(self.mem_ctx)
+
+def connect(self, url, flags = 0):
+ldb.connect(self.ldb_ctx, url, flags, None)
+
+def search(self, expression):
+return ldb.search(self.ldb_ctx, None, ldb.LDB_SCOPE_DEFAULT,
+  expression, None);

Modified: branches/SAMBA_4_0/source/scripting/swig/ldb.i
===
--- branches/SAMBA_4_0/source/scripting/swig/ldb.i  2006-04-03 06:46:55 UTC 
(rev 14877)
+++ branches/SAMBA_4_0/source/scripting/swig/ldb.i  2006-04-03 08:03:44 UTC 
(rev 14878)
@@ -54,10 +54,11 @@
 typedef long long int64_t;
 
 #include "lib/ldb/include/ldb.h"
+#include "lib/talloc/talloc.h"
 
 %}
 
-/* The ldb functions will crash if a NULL tdb is passed */
+/* The ldb functions will crash if a NULL ldb is passed */
 
 %include exception.i
 
@@ -67,22 +68,71 @@
"ldb context must be non-NULL");
 }
 
-/* Throw an IOError exception if tdb_open() or tdb_open_ex() returns NULL */
+/* Use talloc_init() to create a parameter to pass to ldb_init().  Don't
+   forget to free it using talloc_free() afterwards. */
 
-%exception {
-   $action
-   if (result == NULL) {
-   PyErr_SetFromErrno(PyExc_IOError);
-   SWIG_fail;
+TALLOC_CTX *talloc_init(char *name);
+int talloc_free(TALLOC_CTX *ptr);
+
+/* In and out typemaps for struct ldb_val.  This is converted to and from
+   the Python string datatype. */
+
+%typemap(in) struct ldb_val {
+   if (!PyString_Check($input)) {
+   PyErr_SetString(PyExc_TypeError, "string arg expected");
+   return NULL;
}
+   $1.length = PyString_Size($input);
+   $1.data = PyString_AsString($input);
 }
 
+%typemap(out) struct ldb_val {
+   if ($1.data == NULL && $1.length == 0) {
+   $result = Py_None;
+   } else {
+   $result = PyString_FromStringAndSize($1.data, $1.length);
+   }
+}
 
+enum ldb_scope {LDB_SCOPE_DEFAULT=-1, 
+   LDB_SCOPE_BASE=0, 
+   LDB_SCOPE_ONELEVEL=1,
+   LDB_SCOPE_SUBTREE=2};
+
+/* Typemap for passing a struct ldb_result by reference */
+
+%typemap(in, numinputs=0) struct ldb_result **OUT (struct ldb_result 
*temp_ldb_result) {
+   $1 = &temp_ldb_result;
+}
+
+%typemap(argout) struct ldb_result ** {
+   unsigned int i;
+
+   /* XXX: Handle resultobj by throwing an exception if required */
+
+   resultobj = PyList_New((*$1)->count);
+
+   for (i = 0; i < (*$1)->count; i++) {
+   PyList_SetItem(resultobj, i, SWIG_NewPointerObj(*$1, 
SWIGTYPE_p_ldb_message, 0));
+   }
+}  
+
+%types(struct ldb_result *);
+
+struct ldb_message {
+   struct ldb_dn *dn;
+   unsigned int num_elements;
+   struct ldb_message_element *elements;
+   void *private_data; /* private to the backend */
+};
+
+/* Wrap ldb functions */
+
 %rename ldb_init init;
-struct ldb_context *ldb_init(void *mem_ctx);
+struct ldb_context *ldb_init(TALLOC_CTX *mem_ctx);
 
 %rename ldb_connect connect;
 int ldb_connect(struct ldb_context *ldb, const char *url, unsigned int flags, 
const char *options[]);
 
-%rename ldb_request request;
-int ldb_request(struct ldb_context *ldb, struct ldb_request *requ