X-Git-Url: https://git.adam-barratt.org.uk/?a=blobdiff_plain;f=ud-host;h=c3bf07d3acb1495ab4c10e927c333548715ef66a;hb=9851e530e67ba895a6853c3746011214116fa6e9;hp=2e72b7b41d41bf01291e0d606f392a7ed09a514e;hpb=a025eff465feb1c992bc8e3d0084a3631a81ecd9;p=mirror%2Fuserdir-ldap.git diff --git a/ud-host b/ud-host index 2e72b7b..c3bf07d 100755 --- a/ud-host +++ b/ud-host @@ -1,5 +1,25 @@ #!/usr/bin/env python # -*- mode: python -*- + +# Copyright (c) 2000-2001 Jason Gunthorpe +# Copyright (c) 2001 Ryan Murray +# Copyright (c) 2003 James Troup +# Copyright (c) 2004 Joey Schulze +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + # This script is an interactive way to manipulate fields in the LDAP directory. # When run it connects to the directory using the current users ID and fetches # all the attributes for the first machine. It then formats them nicely and @@ -174,22 +194,10 @@ for (switch, val) in options: BindUser = ""; if (BindUser != ""): - print "Accessing LDAP entry", -if (BindUser != User): - if (BindUser != ""): - print "as '" + BindUser + "'"; -else: - print; -if (BindUser != ""): - Password = getpass(BindUser + "'s password: "); - -# Connect to the ldap server -l = ldap.open(LDAPServer); -UserDn = "uid=" + BindUser + "," + BaseDn; -if (BindUser != ""): - l.simple_bind_s(UserDn,Password); + l = passwdAccessLDAP(LDAPServer, BaseDn, BindUser) else: - l.simple_bind_s("",""); + l = ldap.open(LDAPServer); + l.simple_bind_s("","") HBaseDn = "ou=hosts,dc=debian,dc=org"; HostDn = "host=" + Host + "," + HBaseDn; @@ -247,7 +255,7 @@ while(1): if NewHost == "": continue; Dn = "host=" + NewHost + "," + HBaseDn; - l.add_s(Dn,[("host",NewHost), + l.add_s(Dn,[("host", NewHost), ("hostname", NewHostName), ("objectClass", ("top", "debianServer"))]);