[Pkg-openldap-devel] r913 - openldap/trunk/debian

Steve Langasek vorlon at alioth.debian.org
Sun Dec 16 10:31:44 UTC 2007


Author: vorlon
Date: 2007-12-16 10:31:44 +0000 (Sun, 16 Dec 2007)
New Revision: 913

Modified:
   openldap/trunk/debian/slapd.config
   openldap/trunk/debian/slapd.scripts-common
Log:
three more shell functions, want_manual_configuration, query_initial_config,
and validate_initial_config do debconf interaction and therefore should not
be available as part of the general shell library.



Modified: openldap/trunk/debian/slapd.config
===================================================================
--- openldap/trunk/debian/slapd.config	2007-12-16 10:10:12 UTC (rev 912)
+++ openldap/trunk/debian/slapd.config	2007-12-16 10:31:44 UTC (rev 913)
@@ -9,6 +9,95 @@
 # various helper functions and $OLD_VERSION and $SLAPD_CONF
 #SCRIPTSCOMMON#
 
+# Check if the user wants to configure slapd manually
+want_manual_configuration() {
+  db_input medium slapd/no_configuration || true
+  db_go || true
+  db_get slapd/no_configuration
+  no_configuration="$RET"
+  
+  if [ "$no_configuration" = "true" ]; then
+    return 0
+  fi
+  return 1
+}
+
+# Make sure the values entered make sense
+validate_initial_config() {
+  local invalid
+  invalid=""
+ 
+  # Make sure the domain name is valid
+  # The regexp doesn't work for UTF-8 domain names, but for that to
+  # work, we would also need to Base64 encode it in the LDIF; since
+  # we're not doing it at the moment, this should be fine for now
+  db_get slapd/domain
+  if [ -z "$RET" ] || ! echo "$RET" | grep -q '^[a-zA-Z0-9.-]*$'; then
+    db_fset slapd/domain seen false
+    invalid=true
+  fi
+ 
+  # Suffix and Organization may not be empty
+  db_get shared/organization
+  if [ -z "$RET" ]; then
+    db_fset shared/organization seen false
+    invalid=true
+  fi
+
+  # Make sure the passwords match
+  local pass1 pass2
+  db_get slapd/password1
+  pass1="$RET"
+  db_get slapd/password2
+  pass2="$RET"
+  
+  if [ "$pass1" != "$pass2" ]; then
+    db_fset slapd/password1 seen false
+    db_fset slapd/password2 seen false
+    invalid=true
+  fi
+
+  # Tell the user
+  if [ "$invalid" ]; then
+    db_fset slapd/invalid_config seen false
+    db_input critical slapd/invalid_config || true
+    db_go || true
+    db_get slapd/invalid_config
+    if [ "$RET" != "true" ]; then
+      db_set slapd/no_configuration true
+      invalid=
+    fi
+  fi
+
+  if [ "$invalid" ]; then 
+    return 1
+  else
+    return 0
+  fi
+}
+
+# Query the information we need to create an initial directory
+query_initial_config() {
+  while true; do
+    db_input medium slapd/domain || true
+    db_input medium shared/organization || true
+    db_input high slapd/password1 || true
+    db_input high slapd/password2 || true
+    db_input low slapd/backend || true
+    db_input low slapd/purge_database || true
+    # XXX - should be done more general, but for now this should do
+    # the trick
+    if [ -e "/var/lib/ldap" ] && ! is_empty_dir /var/lib/ldap; then
+      db_input low slapd/move_old_database || true
+    fi
+    db_go || true
+
+    if validate_initial_config; then
+      break
+    fi
+  done
+}
+
 configure_allow_v2_binds() {                        # {{{
 # Ask if the user would like their package to support LDAPv2..
 # This was the default in older versions but we want to ask

Modified: openldap/trunk/debian/slapd.scripts-common
===================================================================
--- openldap/trunk/debian/slapd.scripts-common	2007-12-16 10:10:12 UTC (rev 912)
+++ openldap/trunk/debian/slapd.scripts-common	2007-12-16 10:31:44 UTC (rev 913)
@@ -918,95 +918,6 @@
   fi
 }
 
-# Check if the user wants to configure slapd manually
-want_manual_configuration() {
-  db_input medium slapd/no_configuration || true
-  db_go || true
-  db_get slapd/no_configuration
-  no_configuration="$RET"
-  
-  if [ "$no_configuration" = "true" ]; then
-    return 0
-  fi
-  return 1
-}
- 
-# Query the information we need to create an initial directory
-query_initial_config() {
-  while true; do
-    db_input medium slapd/domain || true
-    db_input medium shared/organization || true
-    db_input high slapd/password1 || true
-    db_input high slapd/password2 || true
-    db_input low slapd/backend || true
-    db_input low slapd/purge_database || true
-    # XXX - should be done more general, but for now this should do
-    # the trick
-    if [ -e "/var/lib/ldap" ] && ! is_empty_dir /var/lib/ldap; then
-      db_input low slapd/move_old_database || true
-    fi
-    db_go || true
-
-    if validate_initial_config; then
-      break
-    fi
-  done
-}
- 
-# Make sure the values entered make sense
-validate_initial_config() {
-  local invalid
-  invalid=""
- 
-  # Make sure the domain name is valid
-  # The regexp doesn't work for UTF-8 domain names, but for that to
-  # work, we would also need to Base64 encode it in the LDIF; since
-  # we're not doing it at the moment, this should be fine for now
-  db_get slapd/domain
-  if [ -z "$RET" ] || ! echo "$RET" | grep -q '^[a-zA-Z0-9.-]*$'; then
-    db_fset slapd/domain seen false
-    invalid=true
-  fi
- 
-  # Suffix and Organization may not be empty
-  db_get shared/organization
-  if [ -z "$RET" ]; then
-    db_fset shared/organization seen false
-    invalid=true
-  fi
-
-  # Make sure the passwords match
-  local pass1 pass2
-  db_get slapd/password1
-  pass1="$RET"
-  db_get slapd/password2
-  pass2="$RET"
-  
-  if [ "$pass1" != "$pass2" ]; then
-    db_fset slapd/password1 seen false
-    db_fset slapd/password2 seen false
-    invalid=true
-  fi
-
-  # Tell the user
-  if [ "$invalid" ]; then
-    db_fset slapd/invalid_config seen false
-    db_input critical slapd/invalid_config || true
-    db_go || true
-    db_get slapd/invalid_config
-    if [ "$RET" != "true" ]; then
-      db_set slapd/no_configuration true
-      invalid=
-    fi
-  fi
-
-  if [ "$invalid" ]; then 
-    return 1
-  else
-    return 0
-  fi
-}
-
 crypt_admin_pass() {							# {{{
 # Store the encrypted admin password into the debconf db
 # Usage: crypt_admin_pass




More information about the Pkg-openldap-devel mailing list