[SCM] Samba Shared Repository - branch master updated
Nadezhda Ivanova
nivanova at samba.org
Tue Sep 24 07:44:02 CEST 2013
The branch, master has been updated
via 5426e57 Fix DN RDN case in partition names
via fefdb27 Fix entryCSN format
via 7570577 s4-openldap: Remove use of talloc_reference in ldb_map_outbound.c
via 5805b7a s4-openldap: Added an -H option to delegation script
via aea5b5c Drop paged-search from OpenLDAP stack
via 93f3aba Add LDB_MAP_RENDROP option
via bc1503a Return a couple more attrs by default
via 2a452f2 Cleanup start/stop code
from 167e2f2 pidl: Generate wireshark that conforms to the rules of Wireshark project
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 5426e57898b2b60b7def1af24050df10b1394c9e
Author: Howard Chu <hyc at symas.com>
Date: Thu Sep 19 10:41:16 2013 -0700
Fix DN RDN case in partition names
Move fix_dn from extended_dn_out.c to util.c
Signed-off-by: Howard Chu <hyc at symas.com>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Nadezhda Ivanova <nivanova at symas.com>
Autobuild-User(master): Nadezhda Ivanova <nivanova at samba.org>
Autobuild-Date(master): Tue Sep 24 07:43:39 CEST 2013 on sn-devel-104
commit fefdb27f51ee4b8807314106674f7a3be1941610
Author: Howard Chu <hyc at symas.com>
Date: Thu Sep 19 10:41:02 2013 -0700
Fix entryCSN format
Signed-off-by: Howard Chu <hyc at symas.com>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Nadezhda Ivanova <nivanova at symas.com>
commit 75705776929d87f1a694582261c07d1724574370
Author: Nadezhda Ivanova <nivanova at symas.com>
Date: Wed Sep 18 15:31:24 2013 -0700
s4-openldap: Remove use of talloc_reference in ldb_map_outbound.c
Instead of referencing the values array of the element to the new element, copy them, to
avoid use of talloc_reference and remove a warning of talloc_steal with reference.
The issue is only relevant when openldap backend is used.
Signed-off-by: Nadezhda Ivanova <nivanova at symas.com>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit 5805b7abc88d9f16bc927ae5d51c2807e4a939ee
Author: Nadezhda Ivanova <nivanova at symas.com>
Date: Sun Sep 22 11:24:57 2013 -0700
s4-openldap: Added an -H option to delegation script
Also calling delegation locally without credentials, as this is not really
necessary and causes selftest errors against the openldap backend.
Signed-off-by: Nadezhda Ivanova <nivanova at symas.com>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
commit aea5b5ce338e0d84d93231171c172ec259151a33
Author: Howard Chu <hyc at symas.com>
Date: Mon Sep 16 14:12:42 2013 -0700
Drop paged-search from OpenLDAP stack
Unnecessary, waste of time
Signed-off-by: Howard Chu <hyc at symas.com>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Nadezhda Ivanova <nivanova at symas.com>
commit 93f3aba5e083976a791b982b2064b619800ce110
Author: Howard Chu <hyc at symas.com>
Date: Wed Sep 18 16:50:34 2013 -0700
Add LDB_MAP_RENDROP option
Like LDB_MAP_RENAME, but drop the attribute if it occurs in an Add request.
Used for distinguishedName attribute, is read-only and generated but for
some bizarre reason AD allows it in an Add request.
Signed-off-by: Howard Chu <hyc at symas.com>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Nadezhda Ivanova <nivanova at symas.com>
commit bc1503a96656f1274aa93ac7cab88401c96cac60
Author: Howard Chu <hyc at symas.com>
Date: Wed Sep 18 17:10:07 2013 -0700
Return a couple more attrs by default
Seems to want name and distinguishedName to always be returned.
Signed-off-by: Howard Chu <hyc at symas.com>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Nadezhda Ivanova <nivanova at symas.com>
commit 2a452f2374d5723c43c5547708e253a1adfaabc4
Author: Howard Chu <hyc at symas.com>
Date: Thu Sep 19 05:52:59 2013 -0700
Cleanup start/stop code
teardown was bailing out before stopping slapd.
Use fork/exec to start slapd, just like samba.
Signed-off-by: Howard Chu <hyc at symas.com>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Nadezhda Ivanova <nivanova at symas.com>
-----------------------------------------------------------------------
Summary of changes:
lib/ldb/ldb_map/ldb_map.c | 4 +
lib/ldb/ldb_map/ldb_map.h | 3 +-
lib/ldb/ldb_map/ldb_map_inbound.c | 17 ++++--
lib/ldb/ldb_map/ldb_map_outbound.c | 29 +++++---
python/samba/netcmd/delegation.py | 74 ++++++++++++++++++---
selftest/target/Samba4.pm | 76 ++++++++++++----------
source4/dsdb/samdb/ldb_modules/extended_dn_out.c | 33 +---------
source4/dsdb/samdb/ldb_modules/partition_init.c | 7 ++
source4/dsdb/samdb/ldb_modules/samba_dsdb.c | 2 +-
source4/dsdb/samdb/ldb_modules/simple_ldap_map.c | 12 +++-
source4/dsdb/samdb/ldb_modules/util.c | 26 ++++++++
11 files changed, 187 insertions(+), 96 deletions(-)
Changeset truncated at 500 lines:
diff --git a/lib/ldb/ldb_map/ldb_map.c b/lib/ldb/ldb_map/ldb_map.c
index ce2d660..52b483b 100644
--- a/lib/ldb/ldb_map/ldb_map.c
+++ b/lib/ldb/ldb_map/ldb_map.c
@@ -332,6 +332,7 @@ const struct ldb_map_attribute *map_attr_find_remote(const struct ldb_map_contex
break;
case LDB_MAP_RENAME:
+ case LDB_MAP_RENDROP:
case LDB_MAP_CONVERT:
if (ldb_attr_cmp(map->u.rename.remote_name, name) == 0) {
return map;
@@ -383,6 +384,7 @@ const char *map_attr_map_local(void *mem_ctx, const struct ldb_map_attribute *ma
return talloc_strdup(mem_ctx, attr);
case LDB_MAP_RENAME:
+ case LDB_MAP_RENDROP:
case LDB_MAP_CONVERT:
return talloc_strdup(mem_ctx, map->u.rename.remote_name);
@@ -524,6 +526,7 @@ struct ldb_dn *ldb_dn_map_local(struct ldb_module *module, void *mem_ctx, struct
/* fall through */
case LDB_MAP_KEEP:
case LDB_MAP_RENAME:
+ case LDB_MAP_RENDROP:
name = map_attr_map_local(newdn, map, ldb_dn_get_component_name(dn, i));
if (name == NULL) goto failed;
@@ -599,6 +602,7 @@ struct ldb_dn *ldb_dn_map_remote(struct ldb_module *module, void *mem_ctx, struc
/* fall through */
case LDB_MAP_KEEP:
case LDB_MAP_RENAME:
+ case LDB_MAP_RENDROP:
name = map_attr_map_remote(newdn, map, ldb_dn_get_component_name(dn, i));
if (name == NULL) goto failed;
diff --git a/lib/ldb/ldb_map/ldb_map.h b/lib/ldb/ldb_map/ldb_map.h
index 5db3e02..46ef3cc 100644
--- a/lib/ldb/ldb_map/ldb_map.h
+++ b/lib/ldb/ldb_map/ldb_map.h
@@ -63,9 +63,10 @@ struct ldb_map_attribute {
LDB_MAP_KEEP, /* Keep as is. Same name locally and remotely. */
LDB_MAP_RENAME, /* Simply rename the attribute. Name changes, data is the same */
LDB_MAP_CONVERT, /* Rename + convert data */
- LDB_MAP_GENERATE /* Use generate function for generating new name/data.
+ LDB_MAP_GENERATE, /* Use generate function for generating new name/data.
Used for generating attributes based on
multiple remote attributes. */
+ LDB_MAP_RENDROP /* Rename the attribute. Strip from Add requests. */
} type;
/* if set, will be called for search expressions that contain this attribute */
diff --git a/lib/ldb/ldb_map/ldb_map_inbound.c b/lib/ldb/ldb_map/ldb_map_inbound.c
index 38dd5ac..06d52aa 100644
--- a/lib/ldb/ldb_map/ldb_map_inbound.c
+++ b/lib/ldb/ldb_map/ldb_map_inbound.c
@@ -65,7 +65,7 @@ static struct ldb_message_element *ldb_msg_el_map_local(struct ldb_module *modul
/* Add a message element either to a local or to a remote message,
* depending on whether it goes into the local or remote partition. */
-static int ldb_msg_el_partition(struct ldb_module *module, struct ldb_message *local, struct ldb_message *remote, const struct ldb_message *msg, const char *attr_name, /* const char * const names[], */ const struct ldb_message_element *old)
+static int ldb_msg_el_partition(struct ldb_module *module, enum ldb_request_type optype, struct ldb_message *local, struct ldb_message *remote, const struct ldb_message *msg, const char *attr_name, /* const char * const names[], */ const struct ldb_message_element *old)
{
const struct ldb_map_context *data = map_get_context(module);
const struct ldb_map_attribute *map = map_attr_find_local(data, attr_name);
@@ -81,6 +81,13 @@ static int ldb_msg_el_partition(struct ldb_module *module, struct ldb_message *l
}
switch (map->type) {
+ case LDB_MAP_RENDROP:
+ if (optype != LDB_ADD) {
+ /* do the same as LDB_MAP_RENAME */
+ el = ldb_msg_el_map_local(module, remote, map, old);
+ break;
+ }
+ /* fall through */
case LDB_MAP_IGNORE:
goto local;
@@ -157,7 +164,7 @@ static bool ldb_msg_check_remote(struct ldb_module *module, const struct ldb_mes
/* Split message elements that stay in the local partition from those
* that are mapped into the remote partition. */
-static int ldb_msg_partition(struct ldb_module *module, struct ldb_message *local, struct ldb_message *remote, const struct ldb_message *msg)
+static int ldb_msg_partition(struct ldb_module *module, enum ldb_request_type optype, struct ldb_message *local, struct ldb_message *remote, const struct ldb_message *msg)
{
/* const char * const names[]; */
struct ldb_context *ldb;
@@ -175,7 +182,7 @@ static int ldb_msg_partition(struct ldb_module *module, struct ldb_message *loca
continue;
}
- ret = ldb_msg_el_partition(module, local, remote, msg, msg->elements[i].name, &msg->elements[i]);
+ ret = ldb_msg_el_partition(module, optype, local, remote, msg, msg->elements[i].name, &msg->elements[i]);
if (ret) {
return ret;
}
@@ -408,7 +415,7 @@ int ldb_map_add(struct ldb_module *module, struct ldb_request *req)
remote_msg->dn = ldb_dn_map_local(ac->module, remote_msg, msg->dn);
/* Split local from remote message */
- ldb_msg_partition(module, ac->local_msg, remote_msg, msg);
+ ldb_msg_partition(module, req->operation, ac->local_msg, remote_msg, msg);
/* Prepare the remote operation */
ret = ldb_build_add_req(&ac->remote_req, ldb,
@@ -518,7 +525,7 @@ int ldb_map_modify(struct ldb_module *module, struct ldb_request *req)
remote_msg->dn = ldb_dn_map_local(ac->module, remote_msg, msg->dn);
/* Split local from remote message */
- ldb_msg_partition(module, ac->local_msg, remote_msg, msg);
+ ldb_msg_partition(module, req->operation, ac->local_msg, remote_msg, msg);
/* Prepare the remote operation */
ret = ldb_build_mod_req(&ac->remote_req, ldb,
diff --git a/lib/ldb/ldb_map/ldb_map_outbound.c b/lib/ldb/ldb_map/ldb_map_outbound.c
index 5be5e76..1ee2dfe 100644
--- a/lib/ldb/ldb_map/ldb_map_outbound.c
+++ b/lib/ldb/ldb_map/ldb_map_outbound.c
@@ -134,6 +134,7 @@ static const char **map_attrs_collect_remote(struct ldb_module *module, void *me
goto named;
case LDB_MAP_RENAME:
+ case LDB_MAP_RENDROP:
case LDB_MAP_CONVERT:
name = map->u.rename.remote_name;
goto named;
@@ -189,7 +190,7 @@ static int map_attrs_partition(struct ldb_module *module, void *mem_ctx, const c
static int ldb_msg_replace(struct ldb_message *msg, const struct ldb_message_element *el)
{
struct ldb_message_element *old;
-
+ int j;
old = ldb_msg_find_element(msg, el->name);
/* no local result, add as new element */
@@ -197,18 +198,22 @@ static int ldb_msg_replace(struct ldb_message *msg, const struct ldb_message_ele
if (ldb_msg_add_empty(msg, el->name, 0, &old) != 0) {
return LDB_ERR_OPERATIONS_ERROR;
}
- talloc_free(discard_const_p(char, old->name));
+ }
+ else {
+ talloc_free(old->values);
}
- /* copy new element */
- *old = *el;
-
- /* and make sure we reference the contents */
- if (!talloc_reference(msg->elements, el->name)) {
+ old->values = talloc_array(msg->elements, struct ldb_val, el->num_values);
+ old->num_values = el->num_values;
+ if (old->values == NULL) {
return LDB_ERR_OPERATIONS_ERROR;
}
- if (!talloc_reference(msg->elements, el->values)) {
- return LDB_ERR_OPERATIONS_ERROR;
+ /* copy the values into the element */
+ for (j=0;j<el->num_values;j++) {
+ old->values[j] = ldb_val_dup(old->values, &el->values[j]);
+ if (old->values[j].data == NULL && el->values[j].length != 0) {
+ return LDB_ERR_OPERATIONS_ERROR;
+ }
}
return 0;
@@ -241,7 +246,7 @@ static struct ldb_message_element *ldb_msg_el_map_remote(struct ldb_module *modu
for (i = 0; data->attribute_maps[i].local_name; i++) {
struct ldb_map_attribute *am = &data->attribute_maps[i];
- if ((am->type == LDB_MAP_RENAME &&
+ if (((am->type == LDB_MAP_RENAME || am->type == LDB_MAP_RENDROP) &&
!strcmp(am->u.rename.remote_name, attr_name))
|| (am->type == LDB_MAP_CONVERT &&
!strcmp(am->u.convert.remote_name, attr_name))) {
@@ -306,6 +311,7 @@ static int ldb_msg_el_merge(struct ldb_module *module, struct ldb_message *local
remote_name = attr_name;
break;
case LDB_MAP_RENAME:
+ case LDB_MAP_RENDROP:
remote_name = map->u.rename.remote_name;
break;
case LDB_MAP_GENERATE:
@@ -327,6 +333,7 @@ static int ldb_msg_el_merge(struct ldb_module *module, struct ldb_message *local
/* fall through */
case LDB_MAP_KEEP:
case LDB_MAP_RENAME:
+ case LDB_MAP_RENDROP:
old = ldb_msg_find_element(remote, remote_name);
if (old) {
el = ldb_msg_el_map_remote(module, local, map, attr_name, old);
@@ -834,7 +841,7 @@ int map_subtree_collect_remote_simple(struct ldb_module *module, void *mem_ctx,
return 0;
}
- if (map->type == LDB_MAP_RENAME) {
+ if (map->type == LDB_MAP_RENAME || map->type == LDB_MAP_RENDROP) {
/* Nothing more to do here, the attribute has been renamed */
return 0;
}
diff --git a/python/samba/netcmd/delegation.py b/python/samba/netcmd/delegation.py
index 47dffb0..39397bb 100644
--- a/python/samba/netcmd/delegation.py
+++ b/python/samba/netcmd/delegation.py
@@ -44,13 +44,24 @@ class cmd_delegation_show(Command):
"versionopts": options.VersionOptions,
}
+ takes_options = [
+ Option("-H", "--URL", help="LDB URL for database or target server", type=str,
+ metavar="URL", dest="H"),
+ ]
+
takes_args = ["accountname"]
- def run(self, accountname, credopts=None, sambaopts=None, versionopts=None):
+ def run(self, accountname, H=None, credopts=None, sambaopts=None, versionopts=None):
lp = sambaopts.get_loadparm()
creds = credopts.get_credentials(lp)
paths = provision.provision_paths_from_lp(lp, lp.get("realm"))
- sam = SamDB(paths.samdb, session_info=system_session(),
+
+ if H == None:
+ path = paths.samdb
+ else:
+ path = H
+
+ sam = SamDB(path, session_info=system_session(),
credentials=creds, lp=lp)
# TODO once I understand how, use the domain info to naildown
# to the correct domain
@@ -89,9 +100,14 @@ class cmd_delegation_for_any_service(Command):
"versionopts": options.VersionOptions,
}
+ takes_options = [
+ Option("-H", "--URL", help="LDB URL for database or target server", type=str,
+ metavar="URL", dest="H"),
+ ]
+
takes_args = ["accountname", "onoff"]
- def run(self, accountname, onoff, credopts=None, sambaopts=None,
+ def run(self, accountname, onoff, H=None, credopts=None, sambaopts=None,
versionopts=None):
on = False
@@ -105,7 +121,12 @@ class cmd_delegation_for_any_service(Command):
lp = sambaopts.get_loadparm()
creds = credopts.get_credentials(lp)
paths = provision.provision_paths_from_lp(lp, lp.get("realm"))
- sam = SamDB(paths.samdb, session_info=system_session(),
+ if H == None:
+ path = paths.samdb
+ else:
+ path = H
+
+ sam = SamDB(path, session_info=system_session(),
credentials=creds, lp=lp)
# TODO once I understand how, use the domain info to naildown
# to the correct domain
@@ -132,9 +153,15 @@ class cmd_delegation_for_any_protocol(Command):
"versionopts": options.VersionOptions,
}
+ takes_options = [
+ Option("-H", "--URL", help="LDB URL for database or target server", type=str,
+ metavar="URL", dest="H"),
+ ]
+
+
takes_args = ["accountname", "onoff"]
- def run(self, accountname, onoff, credopts=None, sambaopts=None,
+ def run(self, accountname, onoff, H=None, credopts=None, sambaopts=None,
versionopts=None):
on = False
@@ -146,9 +173,14 @@ class cmd_delegation_for_any_protocol(Command):
raise CommandError("invalid argument: '%s' (choose from 'on', 'off')" % onoff)
lp = sambaopts.get_loadparm()
- creds = credopts.get_credentials(lp)
+ creds = credopts.get_credentials(lp, fallback_machine=True)
paths = provision.provision_paths_from_lp(lp, lp.get("realm"))
- sam = SamDB(paths.samdb, session_info=system_session(),
+ if H == None:
+ path = paths.samdb
+ else:
+ path = H
+
+ sam = SamDB(path, session_info=system_session(),
credentials=creds, lp=lp)
# TODO once I understand how, use the domain info to naildown
# to the correct domain
@@ -175,15 +207,25 @@ class cmd_delegation_add_service(Command):
"versionopts": options.VersionOptions,
}
+ takes_options = [
+ Option("-H", "--URL", help="LDB URL for database or target server", type=str,
+ metavar="URL", dest="H"),
+ ]
+
takes_args = ["accountname", "principal"]
- def run(self, accountname, principal, credopts=None, sambaopts=None,
+ def run(self, accountname, principal, H=None, credopts=None, sambaopts=None,
versionopts=None):
lp = sambaopts.get_loadparm()
creds = credopts.get_credentials(lp)
paths = provision.provision_paths_from_lp(lp, lp.get("realm"))
- sam = SamDB(paths.samdb, session_info=system_session(),
+ if H == None:
+ path = paths.samdb
+ else:
+ path = H
+
+ sam = SamDB(path, session_info=system_session(),
credentials=creds, lp=lp)
# TODO once I understand how, use the domain info to naildown
# to the correct domain
@@ -219,15 +261,25 @@ class cmd_delegation_del_service(Command):
"versionopts": options.VersionOptions,
}
+ takes_options = [
+ Option("-H", "--URL", help="LDB URL for database or target server", type=str,
+ metavar="URL", dest="H"),
+ ]
+
takes_args = ["accountname", "principal"]
- def run(self, accountname, principal, credopts=None, sambaopts=None,
+ def run(self, accountname, principal, H=None, credopts=None, sambaopts=None,
versionopts=None):
lp = sambaopts.get_loadparm()
creds = credopts.get_credentials(lp)
paths = provision.provision_paths_from_lp(lp, lp.get("realm"))
- sam = SamDB(paths.samdb, session_info=system_session(),
+ if H == None:
+ path = paths.samdb
+ else:
+ path = H
+
+ sam = SamDB(path, session_info=system_session(),
credentials=creds, lp=lp)
# TODO once I understand how, use the domain info to naildown
# to the correct domain
diff --git a/selftest/target/Samba4.pm b/selftest/target/Samba4.pm
index 37f7102..d7aa9c5 100644
--- a/selftest/target/Samba4.pm
+++ b/selftest/target/Samba4.pm
@@ -40,7 +40,7 @@ sub openldap_start($$$) {
sub slapd_start($$)
{
my $count = 0;
- my ($self, $env_vars) = @_;
+ my ($self, $env_vars, $STDIN_READER) = @_;
my $ldbsearch = Samba::bindir_path($self, "ldbsearch");
my $uri = $env_vars->{LDAP_URI};
@@ -51,11 +51,22 @@ sub slapd_start($$)
}
# running slapd in the background means it stays in the same process group, so it can be
# killed by timelimit
- if ($self->{ldap} eq "fedora-ds") {
- system("$ENV{FEDORA_DS_ROOT}/sbin/ns-slapd -D $env_vars->{FEDORA_DS_DIR} -d0 -i $env_vars->{FEDORA_DS_PIDFILE}> $env_vars->{LDAPDIR}/logs 2>&1 &");
- } elsif ($self->{ldap} eq "openldap") {
- system("$ENV{OPENLDAP_SLAPD} -d0 -F $env_vars->{SLAPD_CONF_D} -h $uri > $env_vars->{LDAPDIR}/logs 2>&1 &");
+ my $pid = fork();
+ if ($pid == 0) {
+ open STDOUT, ">$env_vars->{LDAPDIR}/logs";
+ open STDERR, '>&STDOUT';
+ close($env_vars->{STDIN_PIPE});
+ open STDIN, ">&", $STDIN_READER or die "can't dup STDIN_READER to STDIN: $!";
+
+ if ($self->{ldap} eq "fedora-ds") {
+ exec("$ENV{FEDORA_DS_ROOT}/sbin/ns-slapd", "-D", $env_vars->{FEDORA_DS_DIR}, "-d0", "-i", $env_vars->{FEDORA_DS_PIDFILE});
+ } elsif ($self->{ldap} eq "openldap") {
+ exec($ENV{OPENLDAP_SLAPD}, "-dnone", "-F", $env_vars->{SLAPD_CONF_D}, "-h", $uri);
+ }
+ die("Unable to start slapd: $!");
}
+ $env_vars->{SLAPD_PID} = $pid;
+ sleep(1);
while (system("$ldbsearch -H $uri -s base -b \"\" supportedLDAPVersion > /dev/null") != 0) {
$count++;
if ($count > 40) {
@@ -70,29 +81,29 @@ sub slapd_start($$)
sub slapd_stop($$)
{
my ($self, $envvars) = @_;
- if ($self->{ldap} eq "fedora-ds") {
- system("$envvars->{LDAPDIR}/slapd-$envvars->{LDAP_INSTANCE}/stop-slapd");
- } elsif ($self->{ldap} eq "openldap") {
- unless (open(IN, "<$envvars->{OPENLDAP_PIDFILE}")) {
- warn("unable to open slapd pid file: $envvars->{OPENLDAP_PIDFILE}");
- return 0;
- }
- kill 9, <IN>;
- close(IN);
- }
+ kill 9, $envvars->{SLAPD_PID};
return 1;
}
sub check_or_start($$$)
{
my ($self, $env_vars, $process_model) = @_;
+ my $STDIN_READER;
return 0 if $self->check_env($env_vars);
# use a pipe for stdin in the child processes. This allows
# those processes to monitor the pipe for EOF to ensure they
# exit when the test script exits
- pipe(STDIN_READER, $env_vars->{STDIN_PIPE});
+ pipe($STDIN_READER, $env_vars->{STDIN_PIPE});
+
+ # Start slapd before samba, but with the fifo on stdin
+ if (defined($self->{ldap})) {
+ unless($self->slapd_start($env_vars, $STDIN_READER)) {
+ warn("couldn't start slapd (main run)");
+ return undef;
+ }
+ }
print "STARTING SAMBA...";
my $pid = fork();
@@ -126,14 +137,14 @@ sub check_or_start($$$)
}
close($env_vars->{STDIN_PIPE});
- open STDIN, ">&", \*STDIN_READER or die "can't dup STDIN_READER to STDIN: $!";
+ open STDIN, ">&", $STDIN_READER or die "can't dup STDIN_READER to STDIN: $!";
exec(@preargs, Samba::bindir_path($self, "samba"), "-M", $process_model, "-i", "--maximum-runtime=$self->{server_maxtime}", $env_vars->{CONFIGURATION}, @optargs) or die("Unable to start samba: $!");
}
$env_vars->{SAMBA_PID} = $pid;
print "DONE\n";
- close(STDIN_READER);
+ close($STDIN_READER);
return $pid;
}
@@ -169,6 +180,7 @@ sub wait_for_start($$)
my $count = 0;
my $base_dn = "DC=".join(",DC=", split(/\./, $testenv_vars->{REALM}));
my $rid_set_dn = "cn=RID Set,cn=$testenv_vars->{NETBIOSNAME},ou=domain controllers,$base_dn";
+ sleep(1);
while (system("$ldbsearch -H ldap://$testenv_vars->{SERVER} -U$testenv_vars->{USERNAME}%$testenv_vars->{PASSWORD} -s base -b \"$rid_set_dn\" rIDAllocationPool > /dev/null") != 0) {
$count++;
if ($count > 40) {
@@ -981,7 +993,8 @@ sub provision_rpc_proxy($$$)
$cmd .= "SOCKET_WRAPPER_DEFAULT_IFACE=\"$dcvars->{SOCKET_WRAPPER_DEFAULT_IFACE}\" ";
$cmd .= "KRB5_CONFIG=\"$dcvars->{KRB5_CONFIG}\" ";
$cmd .= "$samba_tool delegation for-any-protocol '$ret->{NETBIOSNAME}\$' on";
- $cmd .= " -U$dcvars->{DC_USERNAME}\%$dcvars->{DC_PASSWORD} $dcvars->{CONFIGURATION}";
+ $cmd .= " $dcvars->{CONFIGURATION}";
+ print $cmd;
unless (system($cmd) == 0) {
warn("Delegation failed\n$cmd");
@@ -993,7 +1006,7 @@ sub provision_rpc_proxy($$$)
$cmd .= "SOCKET_WRAPPER_DEFAULT_IFACE=\"$dcvars->{SOCKET_WRAPPER_DEFAULT_IFACE}\" ";
$cmd .= "KRB5_CONFIG=\"$dcvars->{KRB5_CONFIG}\" ";
$cmd .= "$samba_tool delegation add-service '$ret->{NETBIOSNAME}\$' cifs/$dcvars->{SERVER}";
- $cmd .= " -U$dcvars->{DC_USERNAME}\%$dcvars->{DC_PASSWORD} $dcvars->{CONFIGURATION}";
+ $cmd .= " $dcvars->{CONFIGURATION}";
unless (system($cmd) == 0) {
warn("Delegation failed\n$cmd");
@@ -1566,22 +1579,17 @@ sub teardown_env($$)
$count++;
}
- if ($count <= 20 && kill(0, $pid) == 0) {
- return;
- }
-
- kill "TERM", $pid;
+ if ($count > 30 || kill(0, $pid)) {
+ kill "TERM", $pid;
- until ($count > 20) {
- if (Samba::cleanup_child($pid, "samba") == -1) {
- last;
+ until ($count > 40) {
+ if (Samba::cleanup_child($pid, "samba") == -1) {
+ last;
+ }
+ sleep(1);
+ $count++;
}
- sleep(1);
--
Samba Shared Repository
More information about the samba-cvs
mailing list