[SCM] Samba Shared Repository - branch v3-2-test updated - initial-v3-2-unstable-713-g7a911b3

2007-12-18 Thread Volker Lendecke
The branch, v3-2-test has been updated
   via  7a911b35713538d82001a3c9f34152e293fe1943 (commit)
  from  6a7f2a59fc370e226ddacb195059155f28c6c157 (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-2-test


- Log -
commit 7a911b35713538d82001a3c9f34152e293fe1943
Author: Volker Lendecke [EMAIL PROTECTED]
Date:   Tue Dec 18 09:41:03 2007 +0100

Add a in-memory cache

This is a more general API that caches data with a LRU scheme. See
include/cache.h. No comments yet, I'm still working on it. But Jeremy has 
given
me a hint in one of his checkins that he would like to make use of this now.

The idea is that we get rid of all our silly little caches and merge them 
all
into one cache that we can then very easily trim, for example even with a
smbcontrol message if someone decides memory is tight. The main user is the
stat cache, this patch also converts the getwd cache. More caches to come.

---

Summary of changes:
 source/Makefile.in |2 +-
 source/include/includes.h  |1 +
 source/lib/cache.c |  298 
 source/param/loadparm.c|7 +-
 source/smbd/mangle_hash2.c |   67 +++---
 source/smbd/server.c   |   13 ++
 source/smbd/statcache.c|   64 --
 source/smbd/vfs.c  |  168 +
 source/torture/torture.c   |   76 +++
 source/torture/vfstest.c   |   13 ++
 10 files changed, 505 insertions(+), 204 deletions(-)
 create mode 100644 source/lib/cache.c


Changeset truncated at 500 lines:

diff --git a/source/Makefile.in b/source/Makefile.in
index eda3297..81c8330 100644
--- a/source/Makefile.in
+++ b/source/Makefile.in
@@ -284,7 +284,7 @@ TALLOC_OBJ = lib/talloc/talloc.o
 LIB_WITHOUT_PROTO_OBJ = $(LIBREPLACE_OBJ) $(SOCKET_WRAPPER_OBJ) 
$(NSS_WRAPPER_OBJ) $(TALLOC_OBJ) \
lib/messages.o librpc/gen_ndr/ndr_messaging.o lib/messages_local.o \
lib/messages_ctdbd.o lib/packet.o lib/ctdbd_conn.o lib/talloc_stack.o \
-   lib/interfaces.o lib/rbtree.o
+   lib/interfaces.o lib/rbtree.o lib/cache.o
 
 LIB_WITH_PROTO_OBJ = $(VERSION_OBJ) lib/charcnv.o lib/debug.o lib/fault.o \
  lib/interface.o lib/md4.o \
diff --git a/source/include/includes.h b/source/include/includes.h
index 2245174..a45176a 100644
--- a/source/include/includes.h
+++ b/source/include/includes.h
@@ -719,6 +719,7 @@ typedef char fstring[FSTRING_LEN];
 #include packet.h
 #include ctdbd_conn.h
 #include talloc_stack.h
+#include cache.h
 
 /* used in net.c */
 struct functable {
diff --git a/source/lib/cache.c b/source/lib/cache.c
new file mode 100644
index 000..baf2fe3
--- /dev/null
+++ b/source/lib/cache.c
@@ -0,0 +1,298 @@
+/*
+   Unix SMB/CIFS implementation.
+   In-memory cache
+   Copyright (C) Volker Lendecke 2007
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see http://www.gnu.org/licenses/.
+*/
+
+#include cache.h
+#include rbtree.h
+
+struct memcache_element {
+   struct rb_node rb_node;
+   struct memcache_element *prev, *next;
+   size_t keylength, valuelength;
+   uint8 n;/* This is really an enum, but save memory */
+   char data[1];   /* placeholder for offsetof */
+};
+
+struct memcache {
+   struct memcache_element *mru, *lru;
+   struct rb_root tree;
+   size_t size;
+   size_t max_size;
+};
+
+static int memcache_destructor(struct memcache *cache) {
+   struct memcache_element *e, *next;
+
+   for (e = cache-mru; e != NULL; e = next) {
+   next = e-next;
+   SAFE_FREE(e);
+   }
+   return 0;
+}
+
+struct memcache *memcache_init(TALLOC_CTX *mem_ctx, size_t max_size)
+{
+   struct memcache *result;
+
+   result = TALLOC_ZERO_P(mem_ctx, struct memcache);
+   if (result == NULL) {
+   return NULL;
+   }
+   result-max_size = max_size;
+   talloc_set_destructor(result, memcache_destructor);
+   return result;
+}
+
+static struct memcache_element *memcache_node2elem(struct rb_node *node)
+{
+   return (struct memcache_element *)
+   ((char *)node - offsetof(struct memcache_element, rb_node));
+}
+
+static void memcache_element_parse(struct memcache_element *e,
+

[SCM] Samba Shared Repository - branch v3-2-test updated - initial-v3-2-unstable-714-g0dc4d6a

2007-12-18 Thread Volker Lendecke
The branch, v3-2-test has been updated
   via  0dc4d6a8de84c191e339ee08c7f06ca63f83e6f3 (commit)
  from  7a911b35713538d82001a3c9f34152e293fe1943 (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-2-test


- Log -
commit 0dc4d6a8de84c191e339ee08c7f06ca63f83e6f3
Author: Volker Lendecke [EMAIL PROTECTED]
Date:   Tue Dec 18 10:07:08 2007 +0100

Add forgotten cache.h

---

Summary of changes:
 source/include/cache.h |   51 
 1 files changed, 51 insertions(+), 0 deletions(-)
 create mode 100644 source/include/cache.h


Changeset truncated at 500 lines:

diff --git a/source/include/cache.h b/source/include/cache.h
new file mode 100644
index 000..460a33b
--- /dev/null
+++ b/source/include/cache.h
@@ -0,0 +1,51 @@
+/*
+   Unix SMB/CIFS implementation.
+   In-memory cache
+   Copyright (C) Volker Lendecke 2005-2007
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see http://www.gnu.org/licenses/.
+*/
+
+#ifndef __CACHE_H__
+#define __CACHE_H__
+
+#include includes.h
+
+struct memcache;
+
+enum memcache_number {
+   STAT_CACHE,
+   UID_SID_CACHE,
+   SID_UID_CACHE,
+   GID_SID_CACHE,
+   SID_GID_CACHE,
+   GETWD_CACHE,
+   GETPWNAM_CACHE,
+   MANGLE_HASH2_CACHE
+};
+
+struct memcache *memcache_init(TALLOC_CTX *mem_ctx, size_t max_size);
+
+void memcache_add(struct memcache *cache, enum memcache_number n,
+ DATA_BLOB key, DATA_BLOB value);
+
+void memcache_delete(struct memcache *cache, enum memcache_number n,
+DATA_BLOB key);
+
+bool memcache_lookup(struct memcache *cache, enum memcache_number n,
+DATA_BLOB key, DATA_BLOB *value);
+
+void memcache_flush(struct memcache *cache, enum memcache_number n);
+
+#endif


-- 
Samba Shared Repository


Re: [SCM] Samba Shared Repository - branch v3-2-test updated - initial-v3-2-unstable-713-g7a911b3

2007-12-18 Thread Rafal Szczesniak
 commit 7a911b35713538d82001a3c9f34152e293fe1943
 Author: Volker Lendecke [EMAIL PROTECTED]
 Date:   Tue Dec 18 09:41:03 2007 +0100
 
 Add a in-memory cache
 
 This is a more general API that caches data with a LRU scheme. See
 include/cache.h. No comments yet, I'm still working on it. But Jeremy has 
 given
 me a hint in one of his checkins that he would like to make use of this 
 now.
 
 The idea is that we get rid of all our silly little caches and merge them 
 all
 into one cache

I thought gencache was originally implemented for this reason :-)

 that we can then very easily trim, for example even with a
 smbcontrol message if someone decides memory is tight. The main user is 
 the
 stat cache, this patch also converts the getwd cache. More caches to come.


cheers,
-- 
Rafal Szczesniak
Samba Team member  http://www.samba.org


signature.asc
Description: Digital signature


[SCM] Samba Shared Repository - branch v3-2-test updated - initial-v3-2-unstable-715-g2a0585d

2007-12-18 Thread Michael Adam
The branch, v3-2-test has been updated
   via  2a0585d3093265a499c9fef60d500059f79b4112 (commit)
  from  0dc4d6a8de84c191e339ee08c7f06ca63f83e6f3 (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-2-test


- Log -
commit 2a0585d3093265a499c9fef60d500059f79b4112
Author: Michael Adam [EMAIL PROTECTED]
Date:   Tue Dec 18 16:32:57 2007 +0100

Fix an error when accessing unallocated sid in error path.

Michael

---

Summary of changes:
 source/rpcclient/cmd_samr.c |6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source/rpcclient/cmd_samr.c b/source/rpcclient/cmd_samr.c
index dae6c42..601e62f 100644
--- a/source/rpcclient/cmd_samr.c
+++ b/source/rpcclient/cmd_samr.c
@@ -2114,11 +2114,11 @@ static NTSTATUS cmd_samr_lookup_domain(struct 
rpc_pipe_client *cli,
result = rpccli_samr_lookup_domain(
cli, mem_ctx, connect_pol, domain_name, sid);
 
-   sid_to_fstring(sid_string,sid);
- 
-   if (NT_STATUS_IS_OK(result)) 
+   if (NT_STATUS_IS_OK(result)) {
+   sid_to_fstring(sid_string,sid);
printf(SAMR_LOOKUP_DOMAIN: Domain Name: %s Domain SID: %s\n,
   domain_name,sid_string);
+   }
 
rpccli_samr_close(cli, mem_ctx, domain_pol);
rpccli_samr_close(cli, mem_ctx, connect_pol);


-- 
Samba Shared Repository


svn commit: samba r26523 - in branches/SAMBA_4_0: . source/scripting/python/samba source/setup

2007-12-18 Thread jelmer
Author: jelmer
Date: 2007-12-18 17:21:13 + (Tue, 18 Dec 2007)
New Revision: 26523

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

Log:
Refactor provisioning code.
Modified:
   branches/SAMBA_4_0/
   branches/SAMBA_4_0/source/scripting/python/samba/__init__.py
   branches/SAMBA_4_0/source/scripting/python/samba/provision.py
   branches/SAMBA_4_0/source/scripting/python/samba/samdb.py
   branches/SAMBA_4_0/source/setup/provision.py


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


svn commit: samba r26524 - in branches/SAMBA_4_0: . source/scripting/python/samba

2007-12-18 Thread jelmer
Author: jelmer
Date: 2007-12-18 17:21:20 + (Tue, 18 Dec 2007)
New Revision: 26524

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

Log:
Import self join.
Modified:
   branches/SAMBA_4_0/
   branches/SAMBA_4_0/source/scripting/python/samba/provision.py


Changeset:

Property changes on: branches/SAMBA_4_0
___
Name: bzr:revision-info
...skipped...
Name: bzr:revision-id:v3-trunk0
...skipped...

Modified: branches/SAMBA_4_0/source/scripting/python/samba/provision.py
===
--- branches/SAMBA_4_0/source/scripting/python/samba/provision.py   
2007-12-18 17:21:13 UTC (rev 26523)
+++ branches/SAMBA_4_0/source/scripting/python/samba/provision.py   
2007-12-18 17:21:20 UTC (rev 26524)
@@ -54,15 +54,7 @@
 self.schemedn_ldb = None
 self.s4_ldapi_path = None
 self.policyguid = None
-self.serverrole = None
 
-def subst_vars(self):
-return {
-SERVERROLE: self.serverrole,
-DOMAIN_CONF: self.domain,
-REALM_CONF: self.realm,
-}
-
 def fix(self, paths):
 self.realm   = self.realm.upper()
 self.hostname= self.hostname.lower()
@@ -75,13 +67,6 @@
 rdns = self.domaindn.split(,)
 self.rdn_dc = rdns[0][len(DC=):]
 
-self.sam_ldb= paths.samdb
-self.secrets_ldb= paths.secrets
-self.secrets_keytab= paths.keytab
-
-self.s4_ldapi_path = paths.s4_ldapi_path
-self.serverrole = domain controller
-
 def validate(self, lp):
 if not valid_netbios_name(self.domain):
 raise InvalidNetbiosName(self.domain)
@@ -111,12 +96,12 @@
 self.samdb = None
 self.secrets = None
 self.keytab = None
+self.dns_keytab = None
 self.dns = None
 self.winsdb = None
 self.ldap_basedn_ldif = None
 self.ldap_config_basedn_ldif = None
 self.ldap_schema_basedn_ldif = None
-self.s4_ldapi_path = None
 
 
 def install_ok(lp, session_info, credentials):
@@ -184,6 +169,8 @@
 if subst_vars is not None:
 data = substitute_var(data, subst_vars)
 
+assert ${ not in data
+
 for msg in ldb.parse_ldif(data):
 ldb.add(msg[1])
 
@@ -195,6 +182,8 @@
 if substvars is not None:
 data = substitute_var(data, substvars)
 
+assert ${ not in data
+
 for (changetype, msg) in ldb.parse_ldif(data):
 ldb.modify(msg)
 
@@ -231,7 +220,8 @@
 os.unlink(f)
 
 data = open(src, 'r').read()
-data = substitute_var(data, substvars)
+if substvars:
+data = substitute_var(data, substvars)
 assert not ${ in data
 
 open(f, 'w').write(data)
@@ -250,6 +240,7 @@
 paths.secrets = os.path.join(private_dir, lp.get(secrets database) or 
secrets.ldb)
 paths.templates = os.path.join(private_dir, templates.ldb)
 paths.keytab = os.path.join(private_dir, secrets.keytab)
+paths.dns_keytab = os.path.join(private_dir, dns.keytab)
 paths.dns = os.path.join(private_dir, subobj.dnsdomain + .zone)
 paths.winsdb = os.path.join(private_dir, wins.ldb)
 paths.ldap_basedn_ldif = os.path.join(private_dir, 
@@ -262,6 +253,14 @@
 paths.phpldapadminconfig = os.path.join(private_dir, 
 phpldapadmin-config.php)
 paths.hklm = os.path.join(private_dir, hklm.ldb)
+paths.sysvol = lp.get(sysvol, path)
+if paths.sysvol is None:
+paths.sysvol = os.path.join(lp.get(lock dir), sysvol)
+
+paths.netlogon = lp.get(netlogon, path)
+if paths.netlogon is None:
+paths.netlogon = os.path.join(os.path.join(paths.sysvol, scripts))
+
 return paths
 
 
@@ -412,11 +411,6 @@
 
 subobj.fix(paths)
 
-if subobj.host_guid is not None:
-subobj.hostguid_add = objectGUID: %s % subobj.host_guid
-else:
-subobj.hostguid_add = 
-
 assert paths.smbconf is not None
 
 # only install a new smb.conf if there isn't one there already
@@ -440,10 +434,11 @@
 setup_ldb(share_ldb, setup_dir, share.ldif, None)
 
 message(Setting up %s % paths.secrets)
-setup_secretsdb(paths.secrets, setup_dir, session_info=session_info, 
+secrets_ldb = setup_secretsdb(paths.secrets, setup_dir, 
session_info=session_info, 
 credentials=credentials, lp=lp)
 
 message(Setting up registry)
+# FIXME: Still fails for some reason
 #setup_registry(paths.hklm, setup_dir, session_info, 
 #   credentials=credentials, lp=lp)
 
@@ -582,16 +577,8 @@
 CONFIGDN: subobj.configdn,
 })
 
-if blank:
-message(Setting up sam.ldb index)
-setup_add_ldif(samdb, setup_dir, provision_index.ldif)
+if not blank:
 
-message(Setting up sam.ldb rootDSE marking as 

svn commit: samba r26525 - in branches/SAMBA_4_0: . source/scripting/python/samba

2007-12-18 Thread jelmer
Author: jelmer
Date: 2007-12-18 17:21:24 + (Tue, 18 Dec 2007)
New Revision: 26525

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

Log:
Consistency in the API.
Modified:
   branches/SAMBA_4_0/
   branches/SAMBA_4_0/source/scripting/python/samba/provision.py


Changeset:

Property changes on: branches/SAMBA_4_0
___
Name: bzr:revision-info
...skipped...
Name: bzr:revision-id:v3-trunk0
...skipped...

Modified: branches/SAMBA_4_0/source/scripting/python/samba/provision.py
===
--- branches/SAMBA_4_0/source/scripting/python/samba/provision.py   
2007-12-18 17:21:20 UTC (rev 26524)
+++ branches/SAMBA_4_0/source/scripting/python/samba/provision.py   
2007-12-18 17:21:24 UTC (rev 26525)
@@ -199,12 +199,13 @@
 ldb.transaction_commit()
 
 
-def setup_ldb_modify(setup_dir, ldif, substvars, ldb):
+def setup_ldb_modify(ldb, setup_dir, ldif, substvars=None):
 Modify a ldb in the private dir.
 src = os.path.join(setup_dir, ldif)
 
 data = open(src, 'r').read()
-data = substitute_var(data, substvars)
+if substvars is not None:
+data = substitute_var(data, substvars)
 assert not ${ in data
 
 for (changetype, msg) in ldb.parse_ldif(data):
@@ -312,7 +313,8 @@
 samdb.erase()
 
 message(Setting up %s partitions % paths.samdb)
-setup_samdb_partitions(samdb, setup_dir, subobj)
+setup_samdb_partitions(samdb, setup_dir, subobj.schemadn, 
+   subobj.configdn, subobj.domaindn)
 
 samdb = SamDB(paths.samdb, credentials=credentials, 
   session_info=session_info, lp=lp)
@@ -382,23 +384,52 @@
 })
 
 
-def setup_samdb_partitions(samdb, setup_dir, subobj):
+def setup_samdb_partitions(samdb, setup_dir, schemadn, configdn, domaindn):
+#Add modules to the list to activate them by default
+#beware often order is important
+#
+# Some Known ordering constraints:
+# - rootdse must be first, as it makes redirects from  - cn=rootdse
+# - objectclass must be before password_hash, because password_hash checks
+#   that the objectclass is of type person (filled in by objectclass
+#   module when expanding the objectclass list)
+# - partition must be last
+# - each partition has its own module list then
+modules_list = [rootdse,
+paged_results,
+ranged_results,
+anr,
+server_sort,
+extended_dn,
+asq,
+samldb,
+rdn_name,
+objectclass,
+kludge_acl,
+operational]
+tdb_modules_list = [
+subtree_rename,
+subtree_delete,
+linked_attributes]
+modules_list2 = [show_deleted,
+partition]
+ 
 setup_ldb(samdb, setup_dir, provision_partitions.ldif, {
-SCHEMADN: subobj.schemadn, 
+SCHEMADN: schemadn, 
 SCHEMADN_LDB: schema.ldb,
 SCHEMADN_MOD2: ,objectguid,
-CONFIGDN: subobj.configdn,
+CONFIGDN: configdn,
 CONFIGDN_LDB: configuration.ldb,
-DOMAINDN: subobj.domaindn,
+DOMAINDN: domaindn,
 DOMAINDN_LDB: users.ldb,
 SCHEMADN_MOD: schema_fsmo,
 CONFIGDN_MOD: naming_fsmo,
 CONFIGDN_MOD2: ,objectguid,
 DOMAINDN_MOD: pdc_fsmo,password_hash,
 DOMAINDN_MOD2: ,objectguid,
-MODULES_LIST: ,.join(subobj.modules_list),
-TDB_MODULES_LIST: ,+,.join(subobj.tdb_modules_list),
-MODULES_LIST2: ,.join(subobj.modules_list2),
+MODULES_LIST: ,.join(modules_list),
+TDB_MODULES_LIST: ,+,.join(tdb_modules_list),
+MODULES_LIST2: ,.join(modules_list2),
 })
 
 
@@ -451,7 +482,8 @@
 samdb.erase()
 
 message(Setting up sam.ldb partitions)
-setup_samdb_partitions(samdb, setup_dir, subobj)
+setup_samdb_partitions(samdb, setup_dir, subobj.schemadn,
+   subobj.configdn, subobj.domaindn)
 
 samdb = SamDB(paths.samdb, session_info=session_info, 
   credentials=credentials, lp=lp)
@@ -495,7 +527,7 @@
 else:
 domainguid_mod = 
 
-setup_ldb_modify(setup_dir, provision_basedn_modify.ldif, {
+setup_ldb_modify(samdb, setup_dir, provision_basedn_modify.ldif, {
 RDN_DC: subobj.rdn_dc,
 LDAPTIME: timestring(int(time.time())),
 DOMAINSID: str(subobj.domainsid),
@@ -506,7 +538,7 @@
 POLICYGUID: subobj.policyguid,
 DOMAINDN: subobj.domaindn,
 DOMAINGUID_MOD: domainguid_mod,
-}, samdb)
+})
 
 message(Adding configuration container (permitted to fail))
 setup_add_ldif(samdb, setup_dir, 

svn commit: samba r26526 - in branches/SAMBA_4_0: . source/setup

2007-12-18 Thread jelmer
Author: jelmer
Date: 2007-12-18 17:29:08 + (Tue, 18 Dec 2007)
New Revision: 26526

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

Log:
Fix argument value.
Modified:
   branches/SAMBA_4_0/
   branches/SAMBA_4_0/source/setup/provision.py


Changeset:

Property changes on: branches/SAMBA_4_0
___
Name: bzr:revision-info
...skipped...
Name: bzr:revision-id:v3-trunk0
...skipped...

Modified: branches/SAMBA_4_0/source/setup/provision.py
===
--- branches/SAMBA_4_0/source/setup/provision.py2007-12-18 17:21:24 UTC 
(rev 26525)
+++ branches/SAMBA_4_0/source/setup/provision.py2007-12-18 17:29:08 UTC 
(rev 26526)
@@ -90,7 +90,7 @@
 parser.add_option(--aci, type=string, metavar=ACI, 
help=An arbitary LDIF fragment, particularly useful to loading 
a backend ACI value into a target LDAP server. You must provide at least a 
realm and domain)
 parser.add_option(--server-role, type=choice, metavar=ROLE,
- choices=[domain controller, domain server],
+ choices=[domain controller, member server],
help=Set server role to provision for (default standalone))
 parser.add_option(--partitions-only, 
help=Configure Samba's partitions, but do not modify them (ie, 
join a BDC), action=store_true)



svn commit: samba r26527 - in branches/SAMBA_4_0: . source/scripting/python/samba source/scripting/python/samba/tests source/selftest

2007-12-18 Thread jelmer
Author: jelmer
Date: 2007-12-18 18:54:19 + (Tue, 18 Dec 2007)
New Revision: 26527

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

Log:
Start on tests for provision.
Added:
   branches/SAMBA_4_0/source/scripting/python/samba/tests/provision.py
Modified:
   branches/SAMBA_4_0/
   branches/SAMBA_4_0/source/scripting/python/samba/__init__.py
   branches/SAMBA_4_0/source/scripting/python/samba/provision.py
   branches/SAMBA_4_0/source/scripting/python/samba/tests/__init__.py
   branches/SAMBA_4_0/source/selftest/samba4_tests.sh


Changeset:

Property changes on: branches/SAMBA_4_0
___
Name: bzr:revision-info
...skipped...
Name: bzr:file-ids
...skipped...
Name: bzr:revision-id:v3-trunk0
...skipped...

Modified: branches/SAMBA_4_0/source/scripting/python/samba/__init__.py
===
--- branches/SAMBA_4_0/source/scripting/python/samba/__init__.py
2007-12-18 17:29:08 UTC (rev 26526)
+++ branches/SAMBA_4_0/source/scripting/python/samba/__init__.py
2007-12-18 18:54:19 UTC (rev 26527)
@@ -129,8 +129,6 @@
 assert isinstance(value, str), Value %r for %s is not a string % 
(value, name)
 text = text.replace(${%s} % name, value)
 
-assert ${ not in text, text
-
 return text
 
 

Modified: branches/SAMBA_4_0/source/scripting/python/samba/provision.py
===
--- branches/SAMBA_4_0/source/scripting/python/samba/provision.py   
2007-12-18 17:29:08 UTC (rev 26526)
+++ branches/SAMBA_4_0/source/scripting/python/samba/provision.py   
2007-12-18 18:54:19 UTC (rev 26527)
@@ -135,18 +135,6 @@
 return gethostname().split(.)[0]
 
 
-def ldb_delete(ldb):
-Delete a LDB file.
-
-This may be necessary if the ldb is in bad shape, possibly due to being 
-built from an incompatible previous version of the code, so delete it
-completely.
-
-print Deleting %s\n % ldb.filename
-os.unlink(ldb.filename)
-ldb.connect(ldb.filename)
-
-
 def open_ldb(session_info, credentials, lp, dbname):
 assert session_info is not None
 try:
@@ -176,6 +164,13 @@
 
 
 def setup_modify_ldif(ldb, setup_dir, ldif, substvars=None):
+Modify a ldb in the private dir.
+
+:param ldb: LDB object.
+:param setup_dir: Setup directory.
+:param ldif: LDIF file path.
+:param substvars: Optional dictionary with substitution variables.
+
 src = os.path.join(setup_dir, ldif)
 
 data = open(src, 'r').read()
@@ -199,19 +194,6 @@
 ldb.transaction_commit()
 
 
-def setup_ldb_modify(ldb, setup_dir, ldif, substvars=None):
-Modify a ldb in the private dir.
-src = os.path.join(setup_dir, ldif)
-
-data = open(src, 'r').read()
-if substvars is not None:
-data = substitute_var(data, substvars)
-assert not ${ in data
-
-for (changetype, msg) in ldb.parse_ldif(data):
-ldb.modify(msg)
-
-
 def setup_file(setup_dir, template, fname, substvars):
 Setup a file in the private dir.
 f = fname
@@ -328,7 +310,7 @@
 setup_samdb_rootdse(samdb, setup_dir, subobj)
 
 message(Erasing data from partitions)
-ldb_erase_partitions(subobj, message, samdb, None)
+ldb_erase_partitions(subobj.domaindn, message, samdb, None)
 
 message(Setting up %s indexes % paths.samdb)
 setup_add_ldif(samdb, setup_dir, provision_index.ldif)
@@ -453,8 +435,7 @@
 smbconfsuffix = member
 else:
 assert Invalid server role setting: %s % lp.get(server role)
-setup_file(setup_dir, provision.smb.conf.%s % smbconfsuffix, 
paths.smbconf, 
-None)
+setup_file(setup_dir, provision.smb.conf.%s % smbconfsuffix, 
paths.smbconf)
 lp.reload()
 
 # only install a new shares config db if there is none
@@ -462,7 +443,7 @@
 message(Setting up share.ldb)
 share_ldb = Ldb(paths.shareconf, session_info=session_info, 
 credentials=credentials, lp=lp)
-setup_ldb(share_ldb, setup_dir, share.ldif, None)
+setup_ldb(share_ldb, setup_dir, share.ldif)
 
 message(Setting up %s % paths.secrets)
 secrets_ldb = setup_secretsdb(paths.secrets, setup_dir, 
session_info=session_info, 
@@ -497,7 +478,7 @@
 setup_samdb_rootdse(samdb, setup_dir, subobj)
 
 message(Erasing data from partitions)
-ldb_erase_partitions(subobj, message, samdb, ldapbackend)
+ldb_erase_partitions(subobj.domaindn, message, samdb, ldapbackend)
 except:
 samdb.transaction_cancel()
 raise
@@ -527,7 +508,7 @@
 else:
 domainguid_mod = 
 
-setup_ldb_modify(samdb, setup_dir, provision_basedn_modify.ldif, {
+setup_modify_ldif(samdb, setup_dir, provision_basedn_modify.ldif, {
 RDN_DC: subobj.rdn_dc,
 LDAPTIME: 

svn commit: samba r26528 - in branches/SAMBA_4_0/source/dsdb/schema: .

2007-12-18 Thread kai
Author: kai
Date: 2007-12-18 22:50:49 + (Tue, 18 Dec 2007)
New Revision: 26528

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

Log:
dsdb: Fix a warning.

Modified:
   branches/SAMBA_4_0/source/dsdb/schema/schema_init.c


Changeset:
Modified: branches/SAMBA_4_0/source/dsdb/schema/schema_init.c
===
--- branches/SAMBA_4_0/source/dsdb/schema/schema_init.c 2007-12-18 18:54:19 UTC 
(rev 26527)
+++ branches/SAMBA_4_0/source/dsdb/schema/schema_init.c 2007-12-18 22:50:49 UTC 
(rev 26528)
@@ -1085,10 +1085,10 @@
  * Find the schema object for this ldb
  */
 
-const struct dsdb_schema *dsdb_get_schema(struct ldb_context *ldb)
+struct dsdb_schema *dsdb_get_schema(struct ldb_context *ldb)
 {
const void *p;
-   const struct dsdb_schema *schema;
+   struct dsdb_schema *schema;
 
/* see if we have a cached copy */
p = ldb_get_opaque(ldb, dsdb_schema);
@@ -1110,8 +1110,7 @@
 
 void dsdb_make_schema_global(struct ldb_context *ldb)
 {
-   const void *p;
-   const struct dsdb_schema *schema = dsdb_get_schema(ldb);
+   struct dsdb_schema *schema = dsdb_get_schema(ldb);
if (!schema) {
return;
}



Build status as of Wed Dec 19 00:00:02 2007

2007-12-18 Thread build
URL: http://build.samba.org/

--- /home/build/master/cache/broken_results.txt.old 2007-12-18 
00:00:56.0 +
+++ /home/build/master/cache/broken_results.txt 2007-12-19 00:01:08.0 
+
@@ -1,4 +1,4 @@
-Build status as of Tue Dec 18 00:00:02 2007
+Build status as of Wed Dec 19 00:00:02 2007
 
 Build counts:
 Tree Total  Broken Panic 
@@ -13,13 +13,13 @@
 pidl 18 5  0 
 ppp  10 8  0 
 python   0  0  0 
-rsync29 12 0 
+rsync29 11 0 
 samba-docs   0  0  0 
 samba-gtk4  4  0 
 samba4   26 20 2 
 samba_3_21  0  0 
-samba_3_2_test 27 16 0 
+samba_3_2_test 27 17 0 
 smb-build27 26 0 
-talloc   29 13 0 
+talloc   29 14 0 
 tdb  29 9  0 
 


[SCM] Samba Shared Repository - branch v3-2-test updated - initial-v3-2-unstable-716-g12cce3b

2007-12-18 Thread Jeremy Allison
The branch, v3-2-test has been updated
   via  12cce3be2a24fd72106d747890caf6c7f29db43d (commit)
  from  2a0585d3093265a499c9fef60d500059f79b4112 (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-2-test


- Log -
commit 12cce3be2a24fd72106d747890caf6c7f29db43d
Author: Jeremy Allison [EMAIL PROTECTED]
Date:   Tue Dec 18 16:03:57 2007 -0800

Fix valgrind error in dbwrap_rbt where rec_priv-node was
being accessed after free. VALOKER PLEASE CHECK THIS VERY
CAREFULLY  This is a correct fix in that it fixes the
valgrind error, but it looks inelegant to me. I think if
I understood this code better I could craft a more subtle
fix. Still looking at it
Jeremy.

---

Summary of changes:
 source/lib/dbwrap_rbt.c |   11 ++-
 1 files changed, 10 insertions(+), 1 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source/lib/dbwrap_rbt.c b/source/lib/dbwrap_rbt.c
index df568a0..15d9b67 100644
--- a/source/lib/dbwrap_rbt.c
+++ b/source/lib/dbwrap_rbt.c
@@ -68,6 +68,8 @@ static NTSTATUS db_rbt_store(struct db_record *rec, TDB_DATA 
data, int flag)
 
TDB_DATA this_key, this_val;
 
+   bool del_old_keyval = false;
+
if (rec_priv-node != NULL) {
 
/*
@@ -95,7 +97,7 @@ static NTSTATUS db_rbt_store(struct db_record *rec, TDB_DATA 
data, int flag)
 */
 
rb_erase(rec_priv-node-rb_node, rec_priv-db_ctx-tree);
-   SAFE_FREE(rec_priv-node);
+   del_old_keyval = true;
}
 
node = (struct db_rbt_node *)SMB_MALLOC(
@@ -103,6 +105,9 @@ static NTSTATUS db_rbt_store(struct db_record *rec, 
TDB_DATA data, int flag)
+ data.dsize);
 
if (node == NULL) {
+   if (del_old_keyval) {
+   SAFE_FREE(rec_priv-node);
+   }
return NT_STATUS_NO_MEMORY;
}
 
@@ -152,6 +157,10 @@ static NTSTATUS db_rbt_store(struct db_record *rec, 
TDB_DATA data, int flag)
rb_link_node(node-rb_node, parent, p);
rb_insert_color(node-rb_node, rec_priv-db_ctx-tree);
 
+   if (del_old_keyval) {
+   SAFE_FREE(rec_priv-node);
+   }
+
return NT_STATUS_OK;
 }
 


-- 
Samba Shared Repository


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

2007-12-18 Thread mimir
Author: mimir
Date: 2007-12-19 00:44:01 + (Wed, 19 Dec 2007)
New Revision: 26530

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

Log:
Add NET-API-GROUPLIST test.


Modified:
   branches/SAMBA_4_0/source/torture/libnet/libnet.c
   branches/SAMBA_4_0/source/torture/libnet/libnet_group.c


Changeset:
Modified: branches/SAMBA_4_0/source/torture/libnet/libnet.c
===
--- branches/SAMBA_4_0/source/torture/libnet/libnet.c   2007-12-19 00:39:27 UTC 
(rev 26529)
+++ branches/SAMBA_4_0/source/torture/libnet/libnet.c   2007-12-19 00:44:01 UTC 
(rev 26530)
@@ -42,6 +42,7 @@
torture_suite_add_simple_test(suite, API-USERINFO, 
torture_userinfo_api);
torture_suite_add_simple_test(suite, API-USERLIST, torture_userlist);
torture_suite_add_simple_test(suite, API-GROUPINFO, 
torture_groupinfo_api);
+   torture_suite_add_simple_test(suite, API-GROUPLIST, 
torture_grouplist);
torture_suite_add_simple_test(suite, API-RPCCONN-BIND, 
torture_rpc_connect_binding);
torture_suite_add_simple_test(suite, API-RPCCONN-SRV, 
torture_rpc_connect_srv);
torture_suite_add_simple_test(suite, API-RPCCONN-PDC, 
torture_rpc_connect_pdc);

Modified: branches/SAMBA_4_0/source/torture/libnet/libnet_group.c
===
--- branches/SAMBA_4_0/source/torture/libnet/libnet_group.c 2007-12-19 
00:39:27 UTC (rev 26529)
+++ branches/SAMBA_4_0/source/torture/libnet/libnet_group.c 2007-12-19 
00:44:01 UTC (rev 26530)
@@ -202,6 +202,25 @@
 }
 
 
+static bool test_lsa_close(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
+  struct policy_handle *domain_handle)
+{
+   NTSTATUS status;
+   struct lsa_Close r;
+
+   r.in.handle = domain_handle;
+   r.out.handle = domain_handle;
+   
+   status = dcerpc_lsa_Close(p, mem_ctx, r);
+   if (!NT_STATUS_IS_OK(status)) {
+   printf(Close lsa domain failed - %s\n, nt_errstr(status));
+   return false;
+   }
+
+   return true;
+}
+
+
 bool torture_groupinfo_api(struct torture_context *torture)
 {
const char *name = TEST_GROUPNAME;
@@ -269,3 +288,64 @@
talloc_free(mem_ctx);
return ret;
 }
+
+
+bool torture_grouplist(struct torture_context *torture)
+{
+   bool ret = true;
+   NTSTATUS status;
+   TALLOC_CTX *mem_ctx = NULL;
+   struct libnet_context *ctx;
+   struct lsa_String domain_name;
+   struct libnet_GroupList req;
+   int i;
+
+   ctx = libnet_context_init(NULL, torture-lp_ctx);
+   ctx-cred = cmdline_credentials;
+
+   domain_name.string = lp_workgroup(torture-lp_ctx);
+   mem_ctx = talloc_init(torture group list);
+
+   ZERO_STRUCT(req);
+
+   printf(listing group accounts:\n);
+   
+   do {
+   req.in.domain_name  = domain_name.string;
+   req.in.page_size= 128;
+   req.in.resume_index = req.out.resume_index;
+
+   status = libnet_GroupList(ctx, mem_ctx, req);
+   if (!NT_STATUS_IS_OK(status) 
+   !NT_STATUS_EQUAL(status, STATUS_MORE_ENTRIES)) break;
+
+   for (i = 0; i  req.out.count; i++) {
+   printf(\tgroup: %s, sid=%s\n,
+  req.out.groups[i].groupname, 
req.out.groups[i].sid);
+   }
+
+   } while (NT_STATUS_EQUAL(status, STATUS_MORE_ENTRIES));
+
+   if (!(NT_STATUS_IS_OK(status) ||
+ NT_STATUS_EQUAL(status, NT_STATUS_NO_MORE_ENTRIES))) {
+   printf(libnet_GroupList call failed: %s\n, nt_errstr(status));
+   ret = false;
+   goto done;
+   }
+
+   if (!test_samr_close(ctx-samr.pipe, mem_ctx, ctx-samr.handle)) {
+   printf(domain close failed\n);
+   ret = false;
+   }
+
+   if (!test_lsa_close(ctx-lsa.pipe, mem_ctx, ctx-lsa.handle)) {
+   printf(lsa domain close failed\n);
+   ret = false;
+   }
+
+   talloc_free(ctx);
+
+done:
+   talloc_free(mem_ctx);
+   return ret;
+}



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

2007-12-18 Thread mimir
Author: mimir
Date: 2007-12-19 00:46:43 + (Wed, 19 Dec 2007)
New Revision: 26532

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

Log:
Fix mistake in assignment.


Modified:
   branches/SAMBA_4_0/source/libnet/libnet_group.c


Changeset:
Modified: branches/SAMBA_4_0/source/libnet/libnet_group.c
===
--- branches/SAMBA_4_0/source/libnet/libnet_group.c 2007-12-19 00:45:07 UTC 
(rev 26531)
+++ branches/SAMBA_4_0/source/libnet/libnet_group.c 2007-12-19 00:46:43 UTC 
(rev 26532)
@@ -414,7 +414,7 @@
group_sid = dom_sid_add_rid(c, domain_sid, entry-idx);
if (composite_nomem(group_sid, c)) return;
 
-   s-groups[i].groupname = dom_sid_string(c, group_sid);
+   s-groups[i].groupname = talloc_strdup(c, 
entry-name.string);
if (composite_nomem(s-groups[i].groupname, c)) return;
 
s-groups[i].sid = dom_sid_string(c, group_sid);



svn commit: samba r26529 - in branches/SAMBA_4_0/source/lib/ldb/common: .

2007-12-18 Thread abartlet
Author: abartlet
Date: 2007-12-19 00:39:27 + (Wed, 19 Dec 2007)
New Revision: 26529

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

Log:
Indeed, this belongs in the schema module.  Ranged results need to use
an attribute with ';' in the name.

Andrew Bartlett

Modified:
   branches/SAMBA_4_0/source/lib/ldb/common/ldb_msg.c


Changeset:
Modified: branches/SAMBA_4_0/source/lib/ldb/common/ldb_msg.c
===
--- branches/SAMBA_4_0/source/lib/ldb/common/ldb_msg.c  2007-12-18 22:50:49 UTC 
(rev 26528)
+++ branches/SAMBA_4_0/source/lib/ldb/common/ldb_msg.c  2007-12-19 00:39:27 UTC 
(rev 26529)
@@ -124,11 +124,6 @@
 {
struct ldb_message_element *els;
 
-   /* FIXME: we should probably leave this to the schema module to check */
-   if (! ldb_valid_attr_name(attr_name)) {
-   return LDB_ERR_OPERATIONS_ERROR;
-   }
-
els = talloc_realloc(msg, msg-elements, 
 struct ldb_message_element, msg-num_elements+1);
if (!els) {



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

2007-12-18 Thread mimir
Author: mimir
Date: 2007-12-19 00:45:07 + (Wed, 19 Dec 2007)
New Revision: 26531

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

Log:
Prevent from displaying the results if the function
call has failed.


Modified:
   branches/SAMBA_4_0/source/torture/libnet/libnet_user.c


Changeset:
Modified: branches/SAMBA_4_0/source/torture/libnet/libnet_user.c
===
--- branches/SAMBA_4_0/source/torture/libnet/libnet_user.c  2007-12-19 
00:44:01 UTC (rev 26530)
+++ branches/SAMBA_4_0/source/torture/libnet/libnet_user.c  2007-12-19 
00:45:07 UTC (rev 26531)
@@ -691,6 +691,8 @@
req.in.resume_index = req.out.resume_index;
 
status = libnet_UserList(ctx, mem_ctx, req);
+   if (!NT_STATUS_IS_OK(status) 
+   !NT_STATUS_EQUAL(status, STATUS_MORE_ENTRIES)) break;
 
for (i = 0; i  req.out.count; i++) {
printf(\tuser: %s, sid=%s\n,



[SCM] Samba Shared Repository - branch v3-2-test updated - initial-v3-2-unstable-717-g39f3efb

2007-12-18 Thread Jeremy Allison
The branch, v3-2-test has been updated
   via  39f3efbcc5fbdff1db1b12e5fc7368968f240993 (commit)
  from  12cce3be2a24fd72106d747890caf6c7f29db43d (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-2-test


- Log -
commit 39f3efbcc5fbdff1db1b12e5fc7368968f240993
Author: Jeremy Allison [EMAIL PROTECTED]
Date:   Tue Dec 18 17:30:02 2007 -0800

We've finished with the old node once we've copied the
keyval.
Jeremy.

---

Summary of changes:
 source/lib/dbwrap_rbt.c |8 
 1 files changed, 4 insertions(+), 4 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source/lib/dbwrap_rbt.c b/source/lib/dbwrap_rbt.c
index 15d9b67..468b940 100644
--- a/source/lib/dbwrap_rbt.c
+++ b/source/lib/dbwrap_rbt.c
@@ -121,6 +121,10 @@ static NTSTATUS db_rbt_store(struct db_record *rec, 
TDB_DATA data, int flag)
memcpy(this_key.dptr, rec-key.dptr, node-keysize);
memcpy(this_val.dptr, data.dptr, node-valuesize);
 
+   if (del_old_keyval) {
+   SAFE_FREE(rec_priv-node);
+   }
+
parent = NULL;
p = rec_priv-db_ctx-tree.rb_node;
 
@@ -157,10 +161,6 @@ static NTSTATUS db_rbt_store(struct db_record *rec, 
TDB_DATA data, int flag)
rb_link_node(node-rb_node, parent, p);
rb_insert_color(node-rb_node, rec_priv-db_ctx-tree);
 
-   if (del_old_keyval) {
-   SAFE_FREE(rec_priv-node);
-   }
-
return NT_STATUS_OK;
 }
 


-- 
Samba Shared Repository


[SCM] Samba Shared Repository - branch v3-2-test updated - initial-v3-2-unstable-718-gf9182bb

2007-12-18 Thread Jeremy Allison
The branch, v3-2-test has been updated
   via  f9182bbe628cb5f5395a08b2e09d4a282a99d7dc (commit)
  from  39f3efbcc5fbdff1db1b12e5fc7368968f240993 (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-2-test


- Log -
commit f9182bbe628cb5f5395a08b2e09d4a282a99d7dc
Author: Jeremy Allison [EMAIL PROTECTED]
Date:   Tue Dec 18 18:01:34 2007 -0800

Remove another static fstring.
Jeremy.

---

Summary of changes:
 source/printing/lpq_parse.c |   11 ---
 1 files changed, 8 insertions(+), 3 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source/printing/lpq_parse.c b/source/printing/lpq_parse.c
index 56e228f..6dcddb6 100644
--- a/source/printing/lpq_parse.c
+++ b/source/printing/lpq_parse.c
@@ -444,7 +444,7 @@ static bool parse_lpq_hpux(char *line, print_queue_struct 
*buf, bool first)
 {
/* must read two lines to process, therefore keep some values static */
static bool header_line_ok=False, base_prio_reset=False;
-   static fstring jobuser;
+   static char *jobuser;
static int jobid;
static int jobprio;
static time_t jobtime;
@@ -511,7 +511,11 @@ static bool parse_lpq_hpux(char *line, print_queue_struct 
*buf, bool first)
buf-job = jobid;
buf-status = jobstat;
buf-priority = jobprio;
-   fstrcpy(buf-fs_user,jobuser);
+   if (jobuser) {
+   fstrcpy(buf-fs_user,jobuser);
+   } else {
+   buf-fs_user[0] = '\0';
+   }
 
TALLOC_FREE(frame);
return True;
@@ -548,7 +552,8 @@ static bool parse_lpq_hpux(char *line, print_queue_struct 
*buf, bool first)
return False;
}
jobid = atoi(tok[1]);
-   fstrcpy(jobuser,tok[2]);
+   SAFE_FREE(jobuser);
+   jobuser = SMB_STRDUP(tok[2]);
jobprio = atoi(tok[4]);
 
/* process time */


-- 
Samba Shared Repository


[SCM] Samba Shared Repository - branch v3-0-test updated - release-3-0-28-48-g0b98572

2007-12-18 Thread Jeremy Allison
The branch, v3-0-test has been updated
   via  0b98572fa3e7854be8dcb709b85c78c1aea26111 (commit)
  from  9d93ec1cdd7ef3a6a02a8095bb1c487fd6310863 (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-0-test


- Log -
commit 0b98572fa3e7854be8dcb709b85c78c1aea26111
Author: Jeremy Allison [EMAIL PROTECTED]
Date:   Tue Dec 18 18:08:18 2007 -0800

Ensure we can't pass -1 to smb_fn_name(). Fixes bug #4612.
This is not used in 3.2 code.
Jeremy.

---

Summary of changes:
 source/smbd/server.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source/smbd/server.c b/source/smbd/server.c
index 89cceae..c90d5e7 100644
--- a/source/smbd/server.c
+++ b/source/smbd/server.c
@@ -30,7 +30,7 @@ static int am_parent = 1;
 int last_message = -1;
 
 /* a useful macro to debug the last message processed */
-#define LAST_MESSAGE() smb_fn_name(last_message)
+#define LAST_MESSAGE() (last_message != -1 ? smb_fn_name(last_message) : )
 
 extern struct auth_context *negprot_global_auth_context;
 extern pstring user_socket_options;


-- 
Samba Shared Repository


[SCM] Samba Shared Repository - branch v3-2-test updated - initial-v3-2-unstable-719-gc378c3e

2007-12-18 Thread Jeremy Allison
The branch, v3-2-test has been updated
   via  c378c3edc1197d46c5d6eb2bcabbf9e774c03ffc (commit)
  from  f9182bbe628cb5f5395a08b2e09d4a282a99d7dc (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-2-test


- Log -
commit c378c3edc1197d46c5d6eb2bcabbf9e774c03ffc
Author: Jeremy Allison [EMAIL PROTECTED]
Date:   Tue Dec 18 18:10:09 2007 -0800

Remove last_message completely as it's no longer used.
Jeremy.

---

Summary of changes:
 source/smbd/process.c |3 ---
 source/smbd/server.c  |6 --
 2 files changed, 0 insertions(+), 9 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source/smbd/process.c b/source/smbd/process.c
index ffc9e10..ee76f90 100644
--- a/source/smbd/process.c
+++ b/source/smbd/process.c
@@ -38,7 +38,6 @@ int max_send = BUFFER_SIZE;
  */
 int max_recv = BUFFER_SIZE;
 
-extern int last_message;
 SIG_ATOMIC_T reload_after_sighup = 0;
 SIG_ATOMIC_T got_sig_term = 0;
 extern bool global_machine_password_needs_changing;
@@ -1308,8 +1307,6 @@ static void switch_message(uint8 type, struct smb_request 
*req, int size)
 
errno = 0;
 
-   last_message = type;
-
/* Make sure this is an SMB packet. smb_size contains NetBIOS header
 * so subtract 4 from it. */
if ((strncmp(smb_base(req-inbuf),\377SMB,4) != 0)
diff --git a/source/smbd/server.c b/source/smbd/server.c
index 574197d..4003707 100644
--- a/source/smbd/server.c
+++ b/source/smbd/server.c
@@ -27,12 +27,6 @@ static_decl_rpc;
 
 static int am_parent = 1;
 
-/* the last message the was processed */
-int last_message = -1;
-
-/* a useful macro to debug the last message processed */
-#define LAST_MESSAGE() smb_fn_name(last_message)
-
 extern struct auth_context *negprot_global_auth_context;
 extern SIG_ATOMIC_T got_sig_term;
 extern SIG_ATOMIC_T reload_after_sighup;


-- 
Samba Shared Repository


[SCM] Samba Shared Repository - branch v3-2-test updated - initial-v3-2-unstable-720-g4056bb8

2007-12-18 Thread Jeremy Allison
The branch, v3-2-test has been updated
   via  4056bb8645821fba95d6e9ca4d82e2d5084c1e5c (commit)
  from  c378c3edc1197d46c5d6eb2bcabbf9e774c03ffc (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-2-test


- Log -
commit 4056bb8645821fba95d6e9ca4d82e2d5084c1e5c
Author: Jeremy Allison [EMAIL PROTECTED]
Date:   Tue Dec 18 18:16:40 2007 -0800

Two more static fstrings gone.
Jeremy.

---

Summary of changes:
 source/printing/nt_printing.c |   55 -
 1 files changed, 43 insertions(+), 12 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source/printing/nt_printing.c b/source/printing/nt_printing.c
index ec4e8c5..f83f898 100644
--- a/source/printing/nt_printing.c
+++ b/source/printing/nt_printing.c
@@ -3849,10 +3849,46 @@ static int unpack_values(NT_PRINTER_DATA *printer_data, 
const uint8 *buf, int bu
 /
  ***/
 
+static char *last_from;
+static char *last_to;
+
+static const char *get_last_from(void)
+{
+   if (!last_from) {
+   return ;
+   }
+   return last_from;
+}
+
+static const char *get_last_to(void)
+{
+   if (!last_to) {
+   return ;
+   }
+   return last_to;
+}
+
+static bool set_last_from_to(const char *from, const char *to)
+{
+   char *orig_from = last_from;
+   char *orig_to = last_to;
+
+   last_from = SMB_STRDUP(from);
+   last_to = SMB_STRDUP(to);
+
+   SAFE_FREE(orig_from);
+   SAFE_FREE(orig_to);
+
+   if (!last_from || !last_to) {
+   SAFE_FREE(last_from);
+   SAFE_FREE(last_to);
+   return false;
+   }
+   return true;
+}
+
 static void map_to_os2_driver(fstring drivername)
 {
-   static bool initialised=False;
-   static fstring last_from,last_to;
char *mapfile = lp_os2_driver_map();
char **lines = NULL;
int numlines = 0;
@@ -3864,14 +3900,10 @@ static void map_to_os2_driver(fstring drivername)
if (!*mapfile)
return;
 
-   if (!initialised) {
-   *last_from = *last_to = 0;
-   initialised = True;
-   }
-
-   if (strequal(drivername,last_from)) {
-   DEBUG(3,(Mapped Windows driver %s to OS/2 driver 
%s\n,drivername,last_to));
-   fstrcpy(drivername,last_to);
+   if (strequal(drivername,get_last_from())) {
+   DEBUG(3,(Mapped Windows driver %s to OS/2 driver %s\n,
+   drivername,get_last_to()));
+   fstrcpy(drivername,get_last_to());
return;
}
 
@@ -3920,8 +3952,7 @@ static void map_to_os2_driver(fstring drivername)
 
if (strequal(nt_name,drivername)) {
DEBUG(3,(Mapped windows driver %s to os2 
driver%s\n,drivername,os2_name));
-   fstrcpy(last_from,drivername);
-   fstrcpy(last_to,os2_name);
+   set_last_from_to(drivername,os2_name);
fstrcpy(drivername,os2_name);
file_lines_free(lines);
return;


-- 
Samba Shared Repository


Re: svn commit: samba r26529 - in branches/SAMBA_4_0/source/lib/ldb/common: .

2007-12-18 Thread simo

On Wed, 2007-12-19 at 00:39 +, [EMAIL PROTECTED] wrote:
 Author: abartlet
 Date: 2007-12-19 00:39:27 + (Wed, 19 Dec 2007)
 New Revision: 26529
 
 WebSVN: 
 http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=26529
 
 Log:
 Indeed, this belongs in the schema module.  Ranged results need to use
 an attribute with ';' in the name.

The ';' most probably is not part of the attribute name.
You should rather correctly handle the case imo, instead of just
removing the check altogether.
I haven't seen corresponding code in the schema module to check
attribute names nor calls to it, but maybe, I have overlooked it ?

Simo.

-- 
Simo Sorce
Samba Team GPL Compliance Officer [EMAIL PROTECTED]
Senior Software Engineer at Red Hat Inc. [EMAIL PROTECTED]