public inbox for cluster-cvs@sourceware.org help / color / mirror / Atom feed
From: ccaulfield@sourceware.org To: cluster-cvs@sources.redhat.com, cluster-devel@redhat.com Subject: Cluster Project branch, master, updated. cluster-2.99.05-29-gad87670 Date: Fri, 27 Jun 2008 12:55:00 -0000 [thread overview] Message-ID: <20080627125500.19820.qmail@sourceware.org> (raw) This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project". http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=ad8767058241f405583b446ee9f86a61fa1be273 The branch, master has been updated via ad8767058241f405583b446ee9f86a61fa1be273 (commit) from 3dc7fc16ed36088e3fc33db82dd485f2c27c4bf2 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit ad8767058241f405583b446ee9f86a61fa1be273 Author: Christine Caulfield <ccaulfie@redhat.com> Date: Fri Jun 27 13:54:14 2008 +0100 [CONFIG] Improve LDAP error reporting and tidy up the include list too. Signed-off-by: Christine Caulfield <ccaulfie@redhat.com> ----------------------------------------------------------------------- Summary of changes: config/plugins/ldap/configldap.c | 45 +++++++++++++++++-------------------- 1 files changed, 21 insertions(+), 24 deletions(-) diff --git a/config/plugins/ldap/configldap.c b/config/plugins/ldap/configldap.c index 91edab8..d378fbf 100644 --- a/config/plugins/ldap/configldap.c +++ b/config/plugins/ldap/configldap.c @@ -9,13 +9,10 @@ ** ******************************************************************************* ******************************************************************************/ -#include <stdio.h> +#include <sys/types.h> #include <stdlib.h> -#include <stdint.h> #include <string.h> #include <errno.h> -#include <netinet/in.h> -#include <stdio.h> // CC: temp until I tame SASL ... is this necessary? #define LDAP_DEPRECATED 1 @@ -23,21 +20,20 @@ /* openais headers */ #include <openais/service/objdb.h> -#include <openais/service/swab.h> -#include <openais/totem/totemip.h> -#include <openais/totem/totempg.h> -#include <openais/totem/aispoll.h> -#include <openais/service/service.h> #include <openais/service/config.h> #include <openais/lcr/lcr_comp.h> -#include <openais/service/swab.h> +/* These are defaults. they can be overridden with environment variables + * LDAP_URL & LDAP_BASEDN + */ #define DEFAULT_LDAP_URL "ldap:///" #define DEFAULT_LDAP_BASEDN "dc=chrissie,dc=net" static int ldap_readconfig(struct objdb_iface_ver0 *objdb, char **error_string); -static int init_config(struct objdb_iface_ver0 *objdb, char *error_string); +static int init_config(struct objdb_iface_ver0 *objdb); static char error_reason[1024]; +static char *ldap_url = DEFAULT_LDAP_URL; +static char *ldap_basedn = DEFAULT_LDAP_BASEDN; /* * Exports the interface for the service @@ -78,7 +74,7 @@ static int ldap_readconfig(struct objdb_iface_ver0 *objdb, char **error_string) int ret; /* Read config tree from LDAP */ - if (!(ret = init_config(objdb, error_reason))) + if (!(ret = init_config(objdb))) sprintf(error_reason, "%s", "Successfully read config from LDAP\n"); *error_string = error_reason; @@ -86,10 +82,6 @@ static int ldap_readconfig(struct objdb_iface_ver0 *objdb, char **error_string) return ret; } -/* Specify the search criteria here. */ -static char *ldap_url = DEFAULT_LDAP_URL; -static char *ldap_basedn = DEFAULT_LDAP_BASEDN; - /* * Convert hyphens to underscores in all attribute names */ @@ -176,8 +168,11 @@ static int read_config_for(LDAP *ld, struct objdb_iface_ver0 *objdb, unsigned in rc = ldap_search_ext_s(ld, search_dn, LDAP_SCOPE_SUBTREE, "(objectClass=*)", NULL, 0, NULL, NULL, NULL, 0, &result); if (rc != LDAP_SUCCESS) { - fprintf(stderr, "ldap_search_ext_s: %s\n", ldap_err2string(rc)); - return 1; + sprintf(error_reason, "ldap_search_ext_s: %s\n", ldap_err2string(rc)); + if (rc == LDAP_NO_SUCH_OBJECT) + return 0; + else + return -1; } for (e = ldap_first_entry(ld, result); e != NULL; e = ldap_next_entry(ld, e)) { @@ -188,7 +183,7 @@ static int read_config_for(LDAP *ld, struct objdb_iface_ver0 *objdb, unsigned in /* Make it parsable so we can discern the hierarchy */ if (ldap_str2dn(dn, &parsed_dn, LDAP_DN_PEDANTIC)) { - strcpy(error_reason, strerror(errno)); + sprintf(error_reason, "ldap_str2dn failed: %s\n", ldap_err2string(rc)); return -1; } @@ -265,7 +260,7 @@ static int read_config_for(LDAP *ld, struct objdb_iface_ver0 *objdb, unsigned in } /* The real work starts here */ -static int init_config(struct objdb_iface_ver0 *objdb, char *error_string) +static int init_config(struct objdb_iface_ver0 *objdb) { LDAP *ld; int version, rc; @@ -277,7 +272,7 @@ static int init_config(struct objdb_iface_ver0 *objdb, char *error_string) /* Connect to the LDAP server */ if (ldap_initialize(&ld, ldap_url)) { - perror("ldap_initialize"); + sprintf(error_reason, "ldap_simple_bind failed: %s\n", strerror(errno)); return -1; } version = LDAP_VERSION3; @@ -288,13 +283,15 @@ static int init_config(struct objdb_iface_ver0 *objdb, char *error_string) */ rc = ldap_simple_bind_s(ld, getenv("LDAP_BINDDN"), getenv("LDAP_BINDPWD")); if (rc != LDAP_SUCCESS) { - fprintf(stderr, "ldap_simple_bind_s: %s\n", ldap_err2string(rc)); + sprintf(error_reason, "ldap_simple_bind failed: %s\n", ldap_err2string(rc)); return -1; } rc = read_config_for(ld, objdb, OBJECT_PARENT_HANDLE, "cluster", "cn=cluster", 1); - rc = read_config_for(ld, objdb, OBJECT_PARENT_HANDLE, "totem", "cn=totem,cn=cluster", 1); - rc = read_config_for(ld, objdb, OBJECT_PARENT_HANDLE, "logging", "cn=logging,cn=cluster", 1); + if (!rc) + rc = read_config_for(ld, objdb, OBJECT_PARENT_HANDLE, "totem", "cn=totem,cn=cluster", 1); + if (!rc) + rc = read_config_for(ld, objdb, OBJECT_PARENT_HANDLE, "logging", "cn=logging,cn=cluster", 1); ldap_unbind(ld); return 0; hooks/post-receive -- Cluster Project
reply other threads:[~2008-06-27 12:55 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20080627125500.19820.qmail@sourceware.org \ --to=ccaulfield@sourceware.org \ --cc=cluster-cvs@sources.redhat.com \ --cc=cluster-devel@redhat.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).