summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfukachan <fukachan>2005-08-23 08:52:56 +0000
committerfukachan <fukachan>2005-08-23 08:52:56 +0000
commit538ebcb7e950e1881dbd62051ea5ac7b50753740 (patch)
treed8c22ee081fd39286c904c146a3ece7d78973f23
parent0526587c9f2080f2dc3a28c9db993d19eeae3f3e (diff)
downloadfml8-538ebcb7e950e1881dbd62051ea5ac7b50753740.tar.gz
fml8-538ebcb7e950e1881dbd62051ea5ac7b50753740.tar.bz2
fml8-538ebcb7e950e1881dbd62051ea5ac7b50753740.zip
test log / memo.
-rw-r--r--regress/openldap/00_SETUP.euc-jp30
-rw-r--r--regress/openldap/elena.ldif7
-rw-r--r--regress/openldap/ldap.conf2
-rw-r--r--regress/openldap/local.schema14
-rw-r--r--regress/openldap/root.ldif6
-rwxr-xr-xregress/openldap/simple_test.pl134
-rw-r--r--regress/openldap/slapd.conf27
-rw-r--r--regress/openldap/slapd.conf~27
-rw-r--r--regress/postgresql/00_SETUP.euc-jp83
9 files changed, 330 insertions, 0 deletions
diff --git a/regress/openldap/00_SETUP.euc-jp b/regress/openldap/00_SETUP.euc-jp
new file mode 100644
index 00000000..efe899a8
--- /dev/null
+++ b/regress/openldap/00_SETUP.euc-jp
@@ -0,0 +1,30 @@
+ openldap 2.2.20 での実験例
+
+1) openldap の設定をする。
+
+1.1) local.schema
+
+1.2) slapd.conf
+
+1.3) ldap.conf
+
+
+2) デーモンさんをスタート
+
+ /etc/rc.d/slapd start
+
+
+3) データを入れてみる
+
+3.1) root.ldif と rudo.ldif を ldapadd で入れてみる
+
+3.2) ldapsearch してみる。
+
+
+4) test
+
+ ../mysql/getline.pl ldap
+
+
+------------------------------------------------------------
+$FML$
diff --git a/regress/openldap/elena.ldif b/regress/openldap/elena.ldif
new file mode 100644
index 00000000..e56bf0b1
--- /dev/null
+++ b/regress/openldap/elena.ldif
@@ -0,0 +1,7 @@
+dn: dc=elena, dc=fml, dc=org
+objectclass: top
+objectclass: dcObject
+objectclass: organizationalUnit
+objectclass: fml
+dc: elena
+ou: elena@fml.org
diff --git a/regress/openldap/ldap.conf b/regress/openldap/ldap.conf
new file mode 100644
index 00000000..5413d06d
--- /dev/null
+++ b/regress/openldap/ldap.conf
@@ -0,0 +1,2 @@
+HOST 127.0.0.1
+BASE dc=fml, dc=org
diff --git a/regress/openldap/local.schema b/regress/openldap/local.schema
new file mode 100644
index 00000000..33d19b22
--- /dev/null
+++ b/regress/openldap/local.schema
@@ -0,0 +1,14 @@
+attributetype ( 1.1.2.1.5 NAME 'fmlrecipient'
+ EQUALITY caseIgnoreMatch
+ SUBSTR caseIgnoreSubstringsMatch
+ SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )
+
+attributetype ( 1.1.2.1.6 NAME 'fmlmember'
+ EQUALITY caseIgnoreMatch
+ SUBSTR caseIgnoreSubstringsMatch
+ SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )
+
+objectClass (1.1.2.2.1 NAME 'fml'
+ DESC 'nis extras for our postifx config'
+ SUP top AUXILIARY
+ MAY (fmlrecipient $ fmlmember))
diff --git a/regress/openldap/root.ldif b/regress/openldap/root.ldif
new file mode 100644
index 00000000..ee433c1e
--- /dev/null
+++ b/regress/openldap/root.ldif
@@ -0,0 +1,6 @@
+dn: dc=fml, dc=org
+objectclass: top
+objectclass: dcObject
+objectclass: organizationalUnit
+ou: @fml.org
+dc: fml
diff --git a/regress/openldap/simple_test.pl b/regress/openldap/simple_test.pl
new file mode 100755
index 00000000..9a5f6a37
--- /dev/null
+++ b/regress/openldap/simple_test.pl
@@ -0,0 +1,134 @@
+#!/usr/bin/env perl
+#
+# $FML$
+#
+
+use strict;
+use Carp;
+use Net::LDAP;
+
+# parameters
+$| = 1;
+my $dn = "dc=fml, dc=org";
+my $x = "dc=elena, $dn";
+my $address = "fukachan\@home.fml.org";
+my $address2 = "rudo\@home.fml.org";
+
+# USAGE: new ( HOST, OPTIONS )
+my $ldap = Net::LDAP->new( 'localhost' ) or warn($@);
+
+# USAGE: bind ( DN, OPTIONS ) # bind to a directory with dn and password
+my $mesg = $ldap->bind($dn, password => 'uja');
+$mesg->code && warn($mesg->error);
+_dump();
+
+_add($ldap);
+_modify($ldap);
+_delete($ldap);
+
+# UNBIND
+$mesg = $ldap->unbind;
+$mesg->code && warn($mesg->error);
+
+exit 0;
+
+
+sub _dump
+{
+ my ($attr) = @_;
+ my $mesg = undef;
+
+ print "DUMPED {\n";
+
+ # USAGE: search ( OPTIONS )
+ # base => DN
+ # filter => FILTER
+ # attrs => [ ATTR, .. ]
+ if ($attr) {
+ $mesg = $ldap->search(base => $dn,
+ filter => "(objectclass=*)",
+ );
+ }
+ else {
+ $mesg = $ldap->search(base => $dn,
+ filter => "(objectclass=*)",
+ );
+ }
+
+ $mesg->code && warn($mesg->error);
+
+ for my $entry ($mesg->entries) {
+ if ($attr) {
+ my $r = $entry->get_value($attr, asref => 1) || [];
+ print "[ @$r ]\n";
+ }
+ else {
+ $entry->dump;
+ }
+ }
+
+ print "\n}\n\n";
+ print "=" x60;
+ print "\n";
+}
+
+
+sub _add
+{
+ my ($ldap) = @_;
+
+ print "* add (dn: $x)\n";
+ my $mesg =
+ $ldap->add($x,
+ attr => [
+ 'dc' => "elena",
+ 'ou' => "elena\@home.fml.org",
+ 'fmlmember' => $address,
+ 'fmlrecipient' => $address,
+ 'objectclass' => [
+ 'top',
+ 'dcObject',
+ 'organizationalUnit',
+ 'fml'
+ ]
+ ]
+ );
+ $mesg->code && warn($mesg->error);
+ _dump("fmlmember");
+}
+
+sub _modify
+{
+ my ($ldap) = @_;
+
+ print "* modify (dn: $x)\n";
+ my $mesg = $ldap->modify($x,
+ add => {
+ 'fmlmember' => $address2,
+ 'fmlrecipient' => $address2,
+ }
+ );
+ $mesg->code && warn($mesg->error);
+ _dump("fmlmember");
+}
+
+sub _delete
+{
+ my ($ldap) = @_;
+
+ print "* delete (dn: $x)\n";
+ my $mesg = $ldap->modify($x,
+ delete => {
+ 'fmlmember' => $address2,
+ 'fmlrecipient' => $address2,
+ }
+ );
+ $mesg->code && warn($mesg->error);
+ _dump("fmlmember");
+
+
+ return;
+ my $mesg = $ldap->delete($x);
+ $mesg->code && warn($mesg->error);
+ _dump("fmlmember");
+}
diff --git a/regress/openldap/slapd.conf b/regress/openldap/slapd.conf
new file mode 100644
index 00000000..2b7359a4
--- /dev/null
+++ b/regress/openldap/slapd.conf
@@ -0,0 +1,27 @@
+include /usr/pkg/etc/openldap/schema/core.schema
+include /usr/pkg/etc/openldap/schema/corba.schema
+include /usr/pkg/etc/openldap/schema/cosine.schema
+include /usr/pkg/etc/openldap/schema/inetorgperson.schema
+include /usr/pkg/etc/openldap/schema/java.schema
+include /usr/pkg/etc/openldap/schema/misc.schema
+include /usr/pkg/etc/openldap/schema/nis.schema
+include /usr/pkg/etc/openldap/schema/openldap.schema
+include /usr/pkg/etc/openldap/schema/local.schema
+
+# ... snip ...
+
+#######################################################################
+# BDB database definitions
+#######################################################################
+
+database bdb
+suffix "dc=fml, dc=org"
+rootdn "dc=fml, dc=org"
+
+# rootpw {SSHA}1sFZamf4ROetYHM2LpRniDFDR16ptBPW
+rootpw uja
+
+directory /var/openldap/openldap-data
+
+# Indices to maintain
+index objectClass eq
diff --git a/regress/openldap/slapd.conf~ b/regress/openldap/slapd.conf~
new file mode 100644
index 00000000..1cc3c2cc
--- /dev/null
+++ b/regress/openldap/slapd.conf~
@@ -0,0 +1,27 @@
+include /usr/pkg/etc/openldap/schema/core.schema
+include /usr/pkg/etc/openldap/schema/corba.schema
+include /usr/pkg/etc/openldap/schema/cosine.schema
+include /usr/pkg/etc/openldap/schema/inetorgperson.schema
+include /usr/pkg/etc/openldap/schema/java.schema
+include /usr/pkg/etc/openldap/schema/misc.schema
+include /usr/pkg/etc/openldap/schema/nis.schema
+include /usr/pkg/etc/openldap/schema/openldap.schema
+include /usr/pkg/etc/openldap/schema/local.schema
+
+# ... snip ...
+
+#######################################################################
+# BDB database definitions
+#######################################################################
+
+database bdb
+suffix "dc=fml, dc=org"
+rootdn "dc=fml, dc=org"
+
+# rootpw {SSHA}1sFZamf4ROetYHM2LpRniDFDR16ptBPW
+rootpw secret
+
+directory /var/openldap/openldap-data
+
+# Indices to maintain
+index objectClass eq
diff --git a/regress/postgresql/00_SETUP.euc-jp b/regress/postgresql/00_SETUP.euc-jp
new file mode 100644
index 00000000..8837630a
--- /dev/null
+++ b/regress/postgresql/00_SETUP.euc-jp
@@ -0,0 +1,83 @@
+
+ PostgreSQL 7.4.8 での実行例
+
+
+0) PostgreSQL をスタート( postmaster をスタート )させる。
+
+ /etc/rc.d/pgsql start
+
+
+1) ユーザ fml の作成
+
+ % su root
+ # su pgsql
+ > createuser --password fml
+
+
+2) データベース fml の作成
+
+ % su root
+ # su pgsql
+ > createdb fml
+
+
+3) テーブル ml を作る
+
+ % su root
+ # su pgsql
+ > psql fml
+ Welcome to psql 7.4.8, the PostgreSQL interactive terminal.
+
+ Type: \copyright for distribution terms
+ \h for help with SQL commands
+ \? for help on internal slash commands
+ \g or terminate with semicolon to execute query
+ \q to quit
+
+ fml=#
+
+もしくは一般ユーザアカウントから直接アクセスする。
+
+ % psql -h localhost -U fml --password
+ Password:
+ Welcome to psql 7.4.8, the PostgreSQL interactive terminal.
+
+ Type: \copyright for distribution terms
+ \h for help with SQL commands
+ \? for help on internal slash commands
+ \g or terminate with semicolon to execute query
+ \q to quit
+
+ fml=#
+
+
+ [INFO] mysql の見本と同じものが(当然)使えるので、それを使う。
+
+ % psql -h localhost -U fml --password < create_table.sql
+ % psql -h localhost -U fml --password < test.sql
+ % psql -h localhost -U fml --password < drop_table.sql
+
+
+4) test
+
+ ../mysql/getline.pl postgresql
+
+
+
+付録a) データベース fml の削除。
+
+ % su root
+ # su pgsql
+ > dropdb fml
+
+付録b) ユーザ&パスワードでのアクセス
+
+ % psql -h localhost -U fml --password
+
+付録z) documents
+
+ http://www.postgresql.jp/document/pg746doc/html/
+
+
+------------------------------------------------------------
+$FML$