File: config

package info (click to toggle)
libnss-ldap 265-3
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 2,608 kB
  • ctags: 2,820
  • sloc: ansic: 16,912; sh: 3,357; perl: 284; makefile: 104
file content (97 lines) | stat: -rw-r--r-- 2,858 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
#!/usr/bin/perl
# Debconf configuration script for PADL-ldap tools.
# By Sami Haahtinen <ressu@debian.org>

$conffile="/etc/libnss-ldap.conf";
$action=shift;
$from_version=shift;

use Debconf::Client::ConfModule ':all';
version('2.0');

# Not yet.. i'll prolly fix this later...
# my $capb=capb('backup');

my @ret;
my @current_config;

# The 'override' thing really ought to go, but let's see how this works
# out first.

if(-e $conffile) {
  open CONFIG, "<$conffile";
  if(<CONFIG> =~ /^###DEBCONF###$/) {
    set("libnss-ldap/override", "true");
  } else {
    my $oldval=get("libnss-ldap/override");
    set("libnss-ldap/override", "false");
    if ($oldval eq "true") {
      fset("libnss-ldap/override", "seen", "false")
    }

    # well, this was a screwy from the start.. lets make it more
    # sane. priority is critical when running reconfigure,
    # otherwise it's high..
    #           -- i hope thats enough..

    input($action =~ /reconfigure/ ? "critical" : "high",
      "libnss-ldap/override");
    $ret=go();
  };
  @current_config = <CONFIG>;
  close CONFIG;
} else {
  set("libnss-ldap/override", "true");
};

# ok, previously in Configuring LDAP services..
#  - Configuration file was tested for ###DEBCONF### and override was
#    set accordingly.
#  - Eric was dumped because of an secret affair with Karen.
# Tune in next time for the next episode of, configuring LDAP services..

if(get("libnss-ldap/override") eq "true") {
  read_and_input('shared/ldapns/ldap-server', 'uri', 'critical');
  read_and_input('shared/ldapns/base-dn', 'base', 'critical');
  read_and_input('shared/ldapns/ldap_version', 'ldap_version', 'critical');
  $ret = go();  # yeah, we don't need that.. but in case we sometime do

  # Anyone with database that requires logging in should have
  # atleast medium priority..
  input("medium", "libnss-ldap/dblogin");
  input("medium", "libnss-ldap/dbrootlogin");
  input("medium", "libnss-ldap/confperm");
  $ret = go();

  if(get("libnss-ldap/dbrootlogin") eq "true") {
    read_and_input('libnss-ldap/rootbinddn', 'rootbinddn', 'critical');
    input('critical', 'libnss-ldap/rootbindpw');
  $ret = go()
  }

  if(get("libnss-ldap/dblogin") eq "true") {
    # user wants to login..
    # we better set these at critical.. just in case
    read_and_input('libnss-ldap/binddn', 'binddn', 'critical');
    read_and_input('libnss-ldap/bindpw', 'bindpw', 'critical');
    $ret = go();
  }
}

input("critical", "libnss-ldap/nsswitch");
$ret = go();

sub read_and_input
{
  my ($debconf_name, $conffile_name, $priority) = @_;
  $priority = 'medium' unless $priority;

  my @valuelist = grep(/^$conffile_name\s/, @current_config);
  if (@valuelist) {
    my $value = pop(@valuelist);
    chomp($value);
    $value =~ s/^$conffile_name\s+//;
    set($debconf_name, $value);
  }
  input($priority, $debconf_name);
}