summaryrefslogtreecommitdiffstats
path: root/ldap_wizard
diff options
context:
space:
mode:
Diffstat (limited to 'ldap_wizard')
-rw-r--r--ldap_wizard/ldapdef.pm18
1 files changed, 17 insertions, 1 deletions
diff --git a/ldap_wizard/ldapdef.pm b/ldap_wizard/ldapdef.pm
index 10b0b00e..3d44005b 100644
--- a/ldap_wizard/ldapdef.pm
+++ b/ldap_wizard/ldapdef.pm
@@ -16,7 +16,7 @@ require Exporter;
use vars qw(@ISA @EXPORT %cfg %cfgfile $congfile $msg $attrs %ldap $ldap);
@ISA=qw(Exporter);
-@EXPORT=qw( %cfg %cfgfile $congfile load_config ldap_connect root_bind $msg anonymous_bind ldap_search get_dn $attrs get_dse %ldap add_user);
+@EXPORT=qw( %cfg %cfgfile $congfile load_config ldap_connect root_bind $msg anonymous_bind ldap_search get_dn $attrs get_dse %ldap add_user modif_krb5);
require Exporter;
@@ -181,3 +181,19 @@ sub add_user {
#print ldap_error_text($result->code);
return $result->code;
}
+
+sub modif_krb5 {
+ my ($u) = @_;
+ my $ldap = ldap_connect();
+ root_bind($ldap);
+ my $result = $ldap->modify(
+ "uid=$u->{var}{uid},$u->{var}{defou},$u->{var}{suffix}",
+ changes => [
+ replace => [objectClass => ['inetOrgPerson', 'posixAccount', 'shadowAccount','krb5Principal']],
+ replace => [ userPassword => 'EROS '],
+ add => [krb5PrincipalName => $u->{var}{uid}],
+ ]
+ );
+ $result->code && die "failed to add entry: ", $result->error ;
+ return 1;
+}