From b97e9c6454b9222493da6afe144d0a5c500784e2 Mon Sep 17 00:00:00 2001 From: cajus Date: Thu, 16 Nov 2006 05:25:21 +0000 Subject: [PATCH] Applied remove patch for trunk git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@5133 594d385d-05f5-0310-b6e9-bd551577e9d8 --- plugins/personal/generic/class_user.inc | 35 +++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/plugins/personal/generic/class_user.inc b/plugins/personal/generic/class_user.inc index a407f7936..862c4cc9a 100644 --- a/plugins/personal/generic/class_user.inc +++ b/plugins/personal/generic/class_user.inc @@ -596,6 +596,41 @@ class user extends plugin $og->save (); } + /* Kerberos server defined? */ + if (isset($this->config->data['SERVERS']['KERBEROS'])){ + $cfg= $this->config->data['SERVERS']['KERBEROS']; + } + if (isset($cfg['SERVER']) && function_exists('kadm5_init_with_password')){ + + /* Connect to the admin interface */ + $handle = kadm5_init_with_password($cfg['SERVER'], $cfg['REALM'], + $cfg['ADMIN'], $cfg['PASSWORD']); + + /* Errors? */ + if ($handle === FALSE){ + print_red (_("Kerberos database communication failed")); + return (2); + } + + /* Build user principal, get list of existsing principals */ + $principal= $this->uid."@".$cfg['REALM']; + $principals = kadm5_get_principals($handle); + + /* User exists in database? */ + if (in_array($principal, $principals)){ + + /* Ok. User exists. Remove him/her */ + $ret= kadm5_delete_principal ( $handle, $principal); + if ($ret === FALSE){ + print_red (_("Can't remove user from kerberos database.")); + } + } + + /* Free kerberos admin handle */ + kadm5_destroy($handle); + } + + /* Optionally execute a command after we're done */ $this->handle_post_events("remove",array("uid" => $this->uid)); } -- 2.30.2