Re: Fixes for LDAP client support.

2004-10-14 Thread Patrick J. LoPresti
Andrew Bartlett [EMAIL PROTECTED] writes:

 The LDAP support in current release unattended is broken, because there
 is no /etc/protocols file.

Thank you!  Shad has added /etc/protocols to the boot disk for our
next release.

 I added this to my config.pl, because I didn't feel like rebuilding
 the images, and putting it in linuxaux/etc/protocols didn't work...

Yeah, the boot disk image uses symlinks into /z/linuxaux for all the
stuff which lives on the network.  Some of those links point to whole
directory trees (like /opt and /usr/local), but mostly they just point
to individual files.

 The unattended system just saved me a lot of work last night - I
 rebuilt a whole lab of computers, with most of the time taken by
 teaching them to boot of the network and entering passwords (which I
 don't trust in an anonymous share...).

 Thanks!

Glad we could help.  Although as a Samba developer, you deserve more
thanks than you owe :-).

 - Pat


---
This SF.net email is sponsored by: IT Product Guide on ITManagersJournal
Use IT products in your business? Tell us what you think of them. Give us
Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
http://productguide.itmanagersjournal.com/guidepromo.tmpl
___
unattended-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/unattended-devel


Fixes for LDAP client support.

2004-10-13 Thread Andrew Bartlett
The LDAP support in current release unattended is broken, because there
is no /etc/protocols file.  I added this to my config.pl, because I
didn't feel like rebuilding the images, and putting it in
linuxaux/etc/protocols didn't work...
 
open(PROTO,  /etc/protocols);
 
print PROTO ip 0 IP\n;
print PROTO icmp 1 ICMP\n;
print PROTO tcp 6 TCP\n;
print PROTO udp 17 UDP\n;
close PROTO;
 
I'm sure the correct fix is nice and simple however :-)

With this, I can do a lookup in LDAP for the macAddress, and find the
registered name for the machine.  I intend to use if for OS selection
and other things shortly.  We should develop a common 'unattended'
schema, to save each site inventing their own.  

$u-{'UserData'}-{'ComputerName'} =
 sub {
 my $macaddr = $u-{'_meta'}-{'macaddr'};
 my $ds= Net::LDAP-new('ldap.internal.hawkerc.net.') or die $@;

 my $basedn = dc=hawkerc,dc=net;

 $ds-bind() || die bind failed!;

 my $attrs = [ 'cn', 'macAddress' ];

 my $splitmac = join(':',split(/(..)/, lc($macaddr)));
 $splitmac =~ /\:(.*)/;
 $splitmac = $1;
 $splitmac =~ s/\:\:/\:/g;

 my $mesg = $ds-search(
base = $basedn,
filter =
(((objectClass=ieee802device)(macAddress=$splitmac))(cn=*)),
attrs = $attrs,
);

 if ($mesg-count != 1) {
 die Could not find computer in LDAP! (found mac address .
$splitmac. .$mesg-count. times in ldap);
 }
 return $mesg-entry(0)-get_value('cn');
 };


The unattended system just saved me a lot of work last night - I rebuilt
a whole lab of computers, with most of the time taken by teaching them
to boot of the network and entering passwords (which I don't trust in an
anonymous share...).  

Thanks!

Andrew Bartlett
-- 
Andrew Bartlett [EMAIL PROTECTED]
Authentication Developer, Samba Teamhttp://samba.org
Student Network Administrator, Hawker College   [EMAIL PROTECTED]


signature.asc
Description: This is a digitally signed message part