#!/usr/bin/perl # modhosts.cgi # ... Services with Tarantella. # STTA Rev. 1.3 Copyright (c) 2001-2004 Jesús Pérez Lorenzo --- license GNU GPL # stta: (@#) 1.31051043346- [2004_01_29_102036] require './stta-lib.pl'; &ReadParse(); if ( $config{'is_ldapcache'} eq "true" && $in{tta3tier_login} ) { do "ldap-lib.pl"; } &headerstta($text{'index_modhosts'}, "", "modhosts",undef,1,0,"$text{'headpage_right'}"."$text{'head_logout'}",undef,undef,"$text{head_below}" ); print "

\n"; &foreign_require("proc", "proc-lib.pl"); $type_cmd = $in{ttacmd}; print "\n"; print "\n"; print "
$text{'titidx_modhosts'}
\n"; print "
\n"; $hostname=$in{hostname}; $location=$in{location}; $descrip=$in{descrip}; $ntdomain=$in{ntdomain}; $ipaddress=$in{ipaddress}; $maxsess=$in{maxsess}; $portalive=$in{portalive}; $aliashosts=$in{aliashosts}; $usergrphosts=$in{usergrphosts}; if (!$hostname) { &footHere; exit; } $alias=$aliashosts; %h_hosts=&list_hosts(); if ( $h_hosts{$aliashosts}->{'alias'} ne $aliashosts ) { $err_msg=$text{'list_errno'}; &footHere; exit; } $grp_name=""; $dn_host=""; $ens_host=""; $dn_host=$h_hosts{$aliashosts}->{'obj'}; $ens_host=$h_hosts{$aliashosts}->{'ens'}; %h_grphosts=&list_grphosts(); $grp_name=$h_grphosts{$usergrphosts}->{'name'}; if ( $dn_host eq "" ) { $dn_org = "ou=$hostname"; $ens_org = "cn=$hostname"; } else { $dn_org = $dn_host; $ens_org = $ens_host; } $ens_obj = "--name \"".$config{tta_base}."/$ens_org\""; $| = 1; $temp = &tempname(); open(TEMP, ">$temp"); print TEMP "#!/bin/sh\n"; print TEMP $env; print TEMP "export $export\n" if ($export); print TEMP "$str\n"; close(TEMP); $temp_f = &tempname(); open(TEMPF, ">$temp_f"); print TEMPF "$ens_obj \\\n"; if ( $ntdomain ne "" ) {print TEMPF " --ntdomain \"$ntdomain\"\\\n"; } if ( $location ne "" ) {print TEMPF " --location \"$location\"\\\n"; } if ( $descrip ne "" ) {print TEMPF " --description \"$descrip\"\\\n"; } print TEMPF " --address \"$ipaddress\"\n"; close(TEMPF); if (&run_tta_cmd($type_cmd,$ens_obj,$temp_f)) { print "
\n"; } else { &html_errshow("tta")}; # Default object para LDAP cache ... if ( $config{'is_ldapcache'} eq "true" && $in{tta3tier_login} ) { $obj_descrip=$in{descrip}; $dnldap = "default"; $dn_cache=$dn_org; $task="mod"; $ldapcache_server=1; &connect_cache (); $default_obj="cn=$config{ldapcache_defaultobj}"; $dn_wk=$default_obj.",".$dn_cache.",".$config{ldapcache_base}; $cur_entry=&sel_cache_obj($dn_wk,"cn=*"); if ( !defined($cur_entry) || $cur_entry->dn ne $dn_wk) { $task="add"; }; @tta3tier=&set_tta3tier($default_obj,$dn_cache,$dnldap,$task,"host"); if ( &cache_obj(\%tta3tier) eq 0 ) { if ( $config{ldapcache2_server}.length gt 0 ) { $ldapcache_server=2; &connect_cache (); if ( &cache_obj(\%tta3tier) ne 0 ) { &err_replication() } } } else { &html_errshow("ldap")}; } $lin_hosts=$aliashosts."::".$hostname."::".$usergrphosts."::"."$dn_org"."::"."$ens_org"."::".$ipaddress."::".$maxsess."::".$portalive."::".$descrip."::"; &out_objslist( "modify", "modhosts.cgi", "hosts", "hosts_list", $aliashosts, $lin_hosts, \%h_hosts ); print "

".$text{'user_update'}.$hostname." -> ".$grp_name."

\n"; print "\n"; # print "\n"; # print " \n"; # print " \n"; # print " \n"; # print " \n"; # print " \n"; # print "
$text{'user_update'}... Tarantella
\n"; # print "         \n"; # print " \n"; if ( $debug lt 2 ) { unlink($temp_f); } print "


\n"; &footer($config{'back_return'},$text{'index'}); print "

\n"; do "footer.pl"; exit;