diff options
author | Rich Megginson <rmeggins@redhat.com> | 2009-08-11 14:37:44 -0600 |
---|---|---|
committer | Rich Megginson <rmeggins@redhat.com> | 2009-08-11 15:17:44 -0600 |
commit | 886d9b9f4fd9bfd72c2c9728f13b8db1ff2793b7 (patch) | |
tree | 7afa75c8dd680409fe7049827cf0a4f2905036a5 /ldap/servers/plugins/http | |
parent | abff3feacb218a7bb65a358dce2e9c90a2f185b1 (diff) | |
download | ds-886d9b9f4fd9bfd72c2c9728f13b8db1ff2793b7.tar.gz ds-886d9b9f4fd9bfd72c2c9728f13b8db1ff2793b7.tar.xz ds-886d9b9f4fd9bfd72c2c9728f13b8db1ff2793b7.zip |
Change default branding to 389 - remove lite code
The vendor, brand, and capbrand are set in configure - we should use those
everywhere rather than have to run some sort of script over the code to
change vendor, brand, version, etc. I've added VENDOR, BRAND, CAPBRAND
to the default defines passed to the compiler, and changed the code to use
these defines. And instead of the unintuitively named PRODUCTTEXT macro,
we should use the already defined PRODUCT_VERSION.
This allowed me to get rid of some code. The version was from a generated
file called dirver.h which we don't need anymore, and we don't need the perl
script dirver.pl which generated it.
The vendor string was coming from the dirlite header file. So I also used this
as an excuse to get rid of all references to dirlite once and for all (yay!).
For the places in plain text files which are not substituted, I just used the
generic name Dirsrv or Directory Server instead of having an explicit brand
and/or version in there.
Reviewed by: nkinder (Thanks!)
Diffstat (limited to 'ldap/servers/plugins/http')
-rw-r--r-- | ldap/servers/plugins/http/http_client.c | 6 | ||||
-rw-r--r-- | ldap/servers/plugins/http/http_impl.c | 99 |
2 files changed, 2 insertions, 103 deletions
diff --git a/ldap/servers/plugins/http/http_client.c b/ldap/servers/plugins/http/http_client.c index 814e8d1f..22033273 100644 --- a/ldap/servers/plugins/http/http_client.c +++ b/ldap/servers/plugins/http/http_client.c @@ -53,8 +53,6 @@ #include "slapi-plugin.h" #include "slapi-private.h" -#include "dirlite_strings.h" -#include "dirver.h" #include "http_client.h" #include "http_impl.h" @@ -122,8 +120,8 @@ static void *api[7]; * Plugin identifiers */ static Slapi_PluginDesc pdesc = { "http-client", - PLUGIN_MAGIC_VENDOR_STR, - PRODUCTTEXT, + VENDOR, + PACKAGE_VERSION, "HTTP Client plugin" }; static Slapi_ComponentId *plugin_id = NULL; diff --git a/ldap/servers/plugins/http/http_impl.c b/ldap/servers/plugins/http/http_impl.c index 29a91c13..c9e82be3 100644 --- a/ldap/servers/plugins/http/http_impl.c +++ b/ldap/servers/plugins/http/http_impl.c @@ -207,8 +207,6 @@ static int readConfigLDAPurl(Slapi_ComponentId *plugin_id, char *plugindn); static int parseHTTPConfigEntry(Slapi_Entry *e); static int parseConfigEntry(Slapi_Entry *e); -static int nssReinitializationRequired(); - /*SSL functions */ PRFileDesc* setupSSLSocket(PRFileDesc* fd); @@ -257,8 +255,6 @@ static int doRequest(const char *url, httpheader **httpheaderArray, char *body, char *host = NULL; char *path = NULL; - char *val = NULL; - char *defaultprefix = NULL; PRFileDesc *fd = NULL; PRNetAddr addr; PRInt32 port; @@ -315,49 +311,6 @@ static int doRequest(const char *url, httpheader **httpheaderArray, char *body, setTCPNoDelay(fd); if (sslOn) { - - /* Have to reinitialize NSS is the DS security is set to off. - This is because the HTTPS required the cert dbs to be created. - The default prefixes are used as per DS norm */ - - if (PL_strcasecmp(httpConfig->DS_sslOn, "off") == 0) { - if (!httpConfig->nssInitialized) { - if (nssReinitializationRequired()) - { - PRInt32 nssStatus; - PRUint32 nssFlags = 0; - char certDir[1024]; - char certPref[1024]; - char keyPref[1024]; - - NSS_Shutdown(); - nssFlags &= (~NSS_INIT_READONLY); - val = config_get_certdir(); - PL_strncpyz(certDir, val, sizeof(certDir)); - defaultprefix = strrchr(certDir, '/'); - if (!defaultprefix) - defaultprefix = strrchr(certDir, '\\'); - if (!defaultprefix) /* still could not find it . . . */ - goto bail; /* . . . can't do anything */ - defaultprefix++; - PR_snprintf(certPref, 1024, "%s-",defaultprefix); - PL_strncpyz(keyPref, certPref, sizeof(keyPref)); - nssStatus = NSS_Initialize(certDir, certPref, keyPref, "secmod.db", nssFlags); - slapi_ch_free((void **)&val); - - if (nssStatus != 0) { - slapi_log_error(SLAPI_LOG_FATAL, HTTP_PLUGIN_SUBSYSTEM, - "doRequest: Unable to initialize NSS Cert/Key Database\n"); - status = HTTP_CLIENT_ERROR_NSS_INITIALIZE; - goto bail; - } - } - httpConfig->nssInitialized = 1; - } - } - - NSS_SetDomesticPolicy(); - fd = setupSSLSocket(fd); if (fd == NULL) { slapi_log_error( SLAPI_LOG_FATAL, HTTP_PLUGIN_SUBSYSTEM, @@ -644,58 +597,6 @@ bail: return status; } -static int nssReinitializationRequired() -{ - int nssReinitializationRequired = 0; - int err = 0; - float version = 0; - const float DSVERSION = 6.1; - char *str = NULL; - char *value = NULL; - Slapi_Entry **entry = NULL; - Slapi_PBlock *resultpb= NULL; - - resultpb= slapi_search_internal( "", LDAP_SCOPE_BASE, "objectclass=*", NULL, NULL, 0); - slapi_pblock_get( resultpb, SLAPI_PLUGIN_INTOP_SEARCH_ENTRIES, &entry ); - slapi_pblock_get( resultpb, SLAPI_PLUGIN_INTOP_RESULT, &err); - if ( err == LDAP_SUCCESS && entry!=NULL && entry[0]!=NULL) - { - value = slapi_entry_attr_get_charptr(entry[0], "vendorVersion"); - if (value == NULL || strncmp(value, "Fedora", strlen("Fedora"))) - { - slapi_log_error( SLAPI_LOG_PLUGIN, HTTP_PLUGIN_SUBSYSTEM, - "nssReinitializationRequired: vendor is not Fedora \n"); - slapi_log_error( SLAPI_LOG_PLUGIN, HTTP_PLUGIN_SUBSYSTEM, - "or version [%s] is earlier than 6.0\n", value?value:"NULL"); - nssReinitializationRequired = 1; - slapi_free_search_results_internal(resultpb); - slapi_pblock_destroy(resultpb); - slapi_ch_free((void **)&value); - return nssReinitializationRequired; - } - - if ( (str = strstr(value,"/")) != NULL ) - { - str++; - version = atof(str); - slapi_log_error( SLAPI_LOG_PLUGIN, HTTP_PLUGIN_SUBSYSTEM, - "nssReinitializationRequired: version is %f. \n", version); - } - - - if (str == NULL || version < DSVERSION) - { - nssReinitializationRequired = 1; - } - slapi_ch_free((void **)&value); - - } - slapi_free_search_results_internal(resultpb); - slapi_pblock_destroy(resultpb); - return nssReinitializationRequired; - -} - static PRStatus sendGetReq(PRFileDesc *fd, const char *path) { PRStatus status = PR_SUCCESS; |