summaryrefslogtreecommitdiffstats
path: root/ldap_wizard
diff options
context:
space:
mode:
authorVicent Guardiola <vguardiola@mandriva.com>2004-08-10 15:51:31 +0000
committerVicent Guardiola <vguardiola@mandriva.com>2004-08-10 15:51:31 +0000
commite6ecd636bcf1fa46660f2048399653253d25425d (patch)
tree5f36b2b8f8ff8b95b67370d988ddca8fbc26a17c /ldap_wizard
parente80991974645e1cb325ec89c4db5d7c003e5e292 (diff)
downloaddrakwizard-e6ecd636bcf1fa46660f2048399653253d25425d.tar
drakwizard-e6ecd636bcf1fa46660f2048399653253d25425d.tar.gz
drakwizard-e6ecd636bcf1fa46660f2048399653253d25425d.tar.bz2
drakwizard-e6ecd636bcf1fa46660f2048399653253d25425d.tar.xz
drakwizard-e6ecd636bcf1fa46660f2048399653253d25425d.zip
Add modif_krb5 for add krb5 objectclass in posixuseraccount
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;
+}