[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: How to get schema ?



This is trick for me! 
thanks
Jacek Czerwinski

Wiadomość napisana przez: Dustin Sallings:
> 
> On Mon, 28 Feb 2000, jacek czerwinski wrote:
> 
>         I store my schema, attributes, and ACLs in my LDAP server.  It's a
> horrible hack, but it works like this:
> 
> objectclass spyConfig
>         requires
>                 cn,
>                 config
>         allows
>                 description
> 
> My local.oc.conf, for instance, is as follows:
> 
>         cn=Object Classes,ou=LDAP,ou=Configs,ou=Data,dc=spy,dc=net
> 
> Then, when I make changes, I stick them into the LDAP server, and go to
> each server and restart it after running a shell script that extracts the
> new configs.  Here are my scripts (again, yeah, this is a hack, and it'd
> be nice if the stuff were live in the LDAP server, but this has really
> helped me):
> 
> #!/bin/sh
> # $Id: getallconfigs,v 1.1 2000/02/27 10:44:41 dustin Exp $
> # This is the script that gets all the configs and writes them out
> 
> echo "Getting Attributes"
> ./getconfig "cn=Attributes,ou=LDAP" local.at.conf
> echo "Getting Object Classes"
> ./getconfig "cn=Object Classes,ou=LDAP" local.oc.conf
> echo "Getting ACLs"
> ./getconfig "cn=ACLs,ou=LDAP" slapd.acl.conf
> 
> #!/bin/sh
> # $Id: getconfig,v 1.2 2000/02/27 10:46:57 dustin Exp $
> # Extract a given config
> 
> if [ $# -lt 2 ]
> then
>         echo "Usage:"
>         echo "$0 ConfigDN File"
>         echo ""
>         echo "Example:"
>         echo "$0 cn=Attributes,ou=LDAP local.at.conf"
>         exit
> fi
> 
> umask 77
> 
> dn=$1
> file=$2
> 
> # what this basically does is grab the config file from the LDAP server,
> # and figure out what the name of it is.
> huh=`ldapsearch -s base -W -D uid=$LOGNAME,ou=agents,dc=spy,dc=net \
>         -B -t -b "$dn,ou=configs,ou=data,dc=spy,dc=net" objectclass=\* config \
>         | egrep config \
>         | sed s/config=//`
> 
> if [ -f $file ]
> then
>         mv $file $file.old
> fi
> 
> mv $huh $file
> 
> --
> dustin sallings                            The world is watching America,
> http://2852210114/~dustin/                 and America is watching TV.