Arthur de Jong

Open Source / Free Software developer

summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArthur de Jong <arthur@arthurdejong.org>2008-06-06 20:22:08 +0200
committerArthur de Jong <arthur@arthurdejong.org>2008-06-06 20:22:08 +0200
commitc2c4f641e91c8a0f84948b9eabd70d3d97ee25a8 (patch)
treeef502bb12291c5e3a12a7702d2697a648f67acf4
parentcfc61ef54410e3729a29201957c0fab98cc46faa (diff)
check that all URLs start with https:// if "ssl on" is specified
git-svn-id: http://arthurdejong.org/svn/nss-pam-ldapd/nss-ldapd@750 ef36b2f9-881f-0410-afb5-c4e39611909c
-rw-r--r--nslcd/cfg.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/nslcd/cfg.c b/nslcd/cfg.c
index 1b0b198..ecfba06 100644
--- a/nslcd/cfg.c
+++ b/nslcd/cfg.c
@@ -878,6 +878,7 @@ static void cfg_read(const char *filename,struct ldap_config *cfg)
void cfg_init(const char *fname)
{
+ int i;
/* check if we were called before */
if (nslcd_cfg!=NULL)
{
@@ -901,4 +902,15 @@ void cfg_init(const char *fname)
log_log(LOG_ERR,"no URIs defined in config");
exit(EXIT_FAILURE);
}
+ /* if ssl is on each URI should start with https */
+ if (nslcd_cfg->ldc_ssl_on==SSL_LDAPS)
+ {
+ for (i=0;nslcd_cfg->ldc_uris[i].uri!=NULL;i++)
+ {
+ if (strncasecmp(nslcd_cfg->ldc_uris[i].uri,"https://",8)!=0)
+ log_log(LOG_WARNING,"%s doesn't start with https:// and \"ssl on\" is specified",
+ nslcd_cfg->ldc_uris[i].uri);
+ }
+ }
+ /* TODO: check that if some tls options are set the ssl option should be set to on (just warn) */
}